 
 	LF_totalTorque3.clear();
 	//################################################### update rigid body things
-	UpdateRigidParticlesPosition<<<nBlocks_numRigid_SphMarkers, nThreads_SphMarkers>>>(R3CAST(posRadD), R4CAST(velMasD), R3CAST(rigidSPH_MeshPos_LRF_D), I1CAST(rigidIdentifierD), R3CAST(posRigidD), R4CAST(velMassRigidD), R3CAST(omegaLRF_D), R3CAST(AD1), R3CAST(AD2), R3CAST(AD3));
+	UpdateRigidMarkersPosition<<<nBlocks_numRigid_SphMarkers, nThreads_SphMarkers>>>(R3CAST(posRadD), R4CAST(velMasD), R3CAST(rigidSPH_MeshPos_LRF_D), I1CAST(rigidIdentifierD), R3CAST(posRigidD), R4CAST(velMassRigidD), R3CAST(omegaLRF_D), R3CAST(AD1), R3CAST(AD2), R3CAST(AD3));
 	cudaThreadSynchronize();
 	CUT_CHECK_ERROR("Kernel execution failed: UpdateKernelRigid");
 }

}
//--------------------------------------------------------------------------------------------------------------------------------
//updates the rigid body particles
__global__ void UpdateRigidParticlesPosition(
		real3 * posRadD,
		real4 * velMasD,
		const real3 * rigidSPH_MeshPos_LRF_D,

	velMasD[rigidParticleIndex] = R4(R3(vM_Rigid) + R3(dot(a1, omegaCrossS), dot(a2, omegaCrossS), dot(a3, omegaCrossS)), vM.w);
}
//--------------------------------------------------------------------------------------------------------------------------------
//updates the flex body markers
__global__ void UpdateFlexMarkersPosition(
		real3 * posRadD,
		real4 * velMasD,
		int* flexIdentifierD,
		real_* parametricDist,
		real_* ANCF_Beam_Length,
		int* ANCF_NumNodes_Per_Beam,
		real3 * ANCF_Nodes,
		real3 * ANCF_Slopes,
		real3 * ANCF_VelNodes,
		real3 * ANCF_VelSlopes,
		int numFlex_SphMarkers) {

	uint index = blockIdx.x * blockDim.x + threadIdx.x;
	uint rigidParticleIndex = index + startRigidParticleD; // updatePortionD = [start, end] index of the update portion
	if (index >= numRigid_SphParticlesD) {
		return;
	}
	real_ t = parametricDist[index];
	int rigidBodyIndex = flexIdentifierD[index];
	real_ l = ANCF_Beam_Length[rigidBodyIndex];
	int nNodes = ANCF_NumNodes_Per_Beam[rigidBodyIndex];

	int indexOfClosestNode = int(t / l) * nNodes;
	if (indexOfClosestNode == nNodes) indexOfClosestNode--;







		const real3 * rigidSPH_MeshPos_LRF_D,
		const int * rigidIdentifierD,
		real3 * posRigidD,
