     unsigned int pidx = d_pgroup_idx[group_idx];
     unsigned int idx_body = d_particle_body[pidx];
     unsigned int particle_offset = d_particle_offset[pidx];
-    float4 orientation = d_rigid_orientation[idx_body];
+    float4 body_orientation = d_rigid_orientation[idx_body];
+    
     com = d_rigid_com[idx_body];
     vel = d_rigid_vel[idx_body];
     angvel = d_rigid_angvel[idx_body];

        image.z += (int)z_shift;

        // update particle orientation
        quatquat(d_rigid_orientation[idx_body],
                 d_rigid_particle_orientation[localidx],
                 porientation);
        }
    

        body_imagez = d_rigid_imagez[idx_body];
        }
    
    exyzFromQuaternion(body_orientation, ex_space, ey_space, ez_space);
    
    int localidx = idx_body * nmax + particle_offset;
    float4 particle_pos = d_rigid_particle_dis[localidx];
    float4 constituent_orientation = d_rigid_particle_orientation[localidx];
    
    // compute ri with new orientation
    float4 ri;
