 		body_torque[threadIdx.x].x = torquei.x;
 		body_torque[threadIdx.x].y = torquei.y;
 		body_torque[threadIdx.x].z = torquei.z;
-		body_torque[threadIdx.x].w = torquei.w;
-		
-	
+		body_torque[threadIdx.x].w = torquei.w;		
 		}
 	
 	__syncthreads();

	unsigned int idx_particle_index = tex1Dfetch(rigid_data_particle_indices_tex, idx_particle);
	// Since we use nmax for all rigid bodies, there might be some empty slot for particles in a rigid body
	// the particle index of these empty slots is set to be 0xffffffff.
	float4 particle_accel = make_float4(0.0f, 0.0f, 0.0f, 0.0f);	
	float4 ex_space = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
	float4 ey_space = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
	float4 ez_space = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
	float4 particle_pos = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
	float4 ri = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
	
	if (idx_body < rigid_data.n_bodies)
		{
		ex_space = tex1Dfetch(rigid_data_exspace_tex, idx_body);

		ri.x = ex_space.x * particle_pos.x + ey_space.x * particle_pos.y + ez_space.x * particle_pos.z;
		ri.y = ex_space.y * particle_pos.x + ey_space.y * particle_pos.y + ez_space.y * particle_pos.z;
		ri.z = ex_space.z * particle_pos.x + ey_space.z * particle_pos.y + ez_space.z * particle_pos.z;
		
		body_mass = tex1Dfetch(rigid_data_body_mass_tex, idx_body);
		moment_inertia = tex1Dfetch(rigid_data_moment_inertia_tex, idx_body);
		angmom = tex1Dfetch(rigid_data_angmom_tex, idx_body);
		vel = tex1Dfetch(rigid_data_vel_tex, idx_body);
		angvel = tex1Dfetch(rigid_data_angvel_tex, idx_body);

		}
		
	particle_accel = gpu_integrator_sum_forces_inline(idx_particle_index, pdata.local_num, force_data_ptrs, num_forces);		
	if (idx_body < rigid_data.n_bodies && idx_particle_index != INVALID_INDEX)
		{
		// calculate body force and torques
		float particle_mass = tex1Dfetch(pdata_mass_tex, idx_particle_index);
