 
 	int numFlBcRigid = 2 + numRigidBodies;
 	int totalNumberOfFlexNodes = ANCF_ReferenceArrayNodesOnBeamsD[ANCF_ReferenceArrayNodesOnBeamsD.size() - 1].y;
-
-	thrust::device_vector<real3> flexNodesForces1(totalNumberOfFlexNodes);//(totalNumberOfFlexNodes); Size:sum(numNodesOfEachBeam*numSPH_MarkersOfEachBeam)
+	int totalNumberOfFlexMultNodes = flexMapEachMarkerOnAllBeamNodesD.size();
+
+	thrust::device_vector<real3> flexNodesForces1(totalNumberOfFlexNodes);
 	thrust::device_vector<real3> flexNodesForces2(totalNumberOfFlexNodes);
 
-	thrust::device_vector<real3> flexNodesForcesAllMarkers1();//(totalNumberOfFlexNodes * totalNumberOfFlexMarkers); Size:sum(numNodesOfEachBeam*numSPH_MarkersOfEachBeam)
-	thrust::device_vector<real3> flexNodesForcesAllMarkers2();//(totalNumberOfFlexNodes * totalNumberOfFlexMarkers);
+	thrust::device_vector<real3> flexNodesForcesAllMarkers1(totalNumberOfFlexMultNodes);
+	thrust::device_vector<real3> flexNodesForcesAllMarkers2(totalNumberOfFlexMultNodes);
 
 	uint nBlocks_numFlex_SphMarkers;
 	uint nThreads_SphMarkers;

		thrust::device_vector<real3> & ANCF_SlopesVelD,
		thrust::device_vector<int2> & ANCF_ReferenceArrayNodesOnBeamsD,
		thrust::device_vector<int> & ANCF_NumMarkers_Per_BeamD,
//		thrust::device_vector<int> & ANCF_NumNodesMultMarkers_Per_BeamD,
		thrust::device_vector<int> & ANCF_NumNodesMultMarkers_Per_Beam_CumulD,

		const thrust::device_vector<int> & flexIdentifierD,
		const thrust::device_vector<int2> & flexMapEachMarkerOnAllBeamNodes,
		const thrust::device_vector<real3> & flexSPH_MeshPos_LRF_D,
		const thrust::device_vector<real_> & flexParametricDistD,
		const thrust::device_vector<real_> & ANCF_Beam_LengthD,

	Calc_NumNodesMultMarkers_Per_Beam(ANCF_NumNodesMultMarkers_Per_BeamD, ANCF_NumMarkers_Per_BeamD, ANCF_ReferenceArrayNodesOnBeams, numFlexBodies);
	thrust::exclusive_scan(ANCF_NumNodesMultMarkers_Per_BeamD.begin(), ANCF_NumNodesMultMarkers_Per_BeamD.end(), ANCF_NumNodesMultMarkers_Per_Beam_CumulD());

	Calc_mapEachMarkerOnAllBeamNodes_IdentifierD(flexMapEachMarkerOnAllBeamNodesD, ANCF_NumNodesMultMarkers_Per_Beam_CumulD, ANCF_NumMarkers_Per_BeamD, ANCF_ReferenceArrayNodesOnBeams, numFlexBodies);

	//*******************

