--- trunk/OOPSE/libmdtools/SimSetup.cpp 2004/04/12 20:32:20 1097 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2004/04/14 15:37:41 1108 @@ -167,7 +167,7 @@ void SimSetup::makeMolecules(void){ void SimSetup::makeMolecules(void){ int i, j, k; - int exI, exJ, exK, exL, slI; + int exI, exJ, exK, exL, slI, slJ; int tempI, tempJ, tempK, tempL; int molI; int stampID, atomOffset, rbOffset; @@ -190,6 +190,8 @@ void SimSetup::makeMolecules(void){ set skipList; double phi, theta, psi; + char* molName; + char rbName[100]; //init the forceField paramters @@ -206,6 +208,7 @@ void SimSetup::makeMolecules(void){ for (i = 0; i < info[k].n_mol; i++){ stampID = info[k].molecules[i].getStampID(); + molName = comp_stamps[stampID]->getID(); molInfo.nAtoms = comp_stamps[stampID]->getNAtoms(); molInfo.nBonds = comp_stamps[stampID]->getNBonds(); @@ -265,7 +268,7 @@ void SimSetup::makeMolecules(void){ #ifdef IS_MPI - molInfo.myAtoms[j]->setGlobalIndex(globalIndex[j + atomOffset]); + molInfo.myAtoms[j]->setGlobalIndex(globalAtomIndex[j + atomOffset]); #endif // is_mpi } @@ -414,6 +417,9 @@ void SimSetup::makeMolecules(void){ // Create the Rigid Body: myRB = new RigidBody(); + + sprintf(rbName,"%s_RB_%s", molName, j); + myRB->setType(rbName); for (rb1 = 0; rb1 < nMembers; rb1++) { @@ -464,8 +470,41 @@ void SimSetup::makeMolecules(void){ info[k].excludes->addPair(exI, exJ); } + } + + molInfo.myRigidBodies.push_back(myRB); + info[k].rigidBodies.push_back(myRB); + } + + + // After this is all set up, scan through the atoms to + // see if they can be added to the integrableObjects: + + for (j = 0; j < molInfo.nAtoms; j++){ + +#ifdef IS_MPI + slJ = molInfo.myAtoms[j]->getGlobalIndex(); +#else + slJ = j+atomOffset; +#endif + + // if they aren't on the skip list, then they can be integrated + + if (skipList.find(slJ) == skipList.end()) { + mySD = (StuntDouble *) molInfo.myAtoms[j]; + info[k].integrableObjects.push_back(mySD); + molInfo.myIntegrableObjects.push_back(mySD); } + } + + // all rigid bodies are integrated: + + for (j = 0; j < molInfo.nRigidBodies; j++) { + mySD = (StuntDouble *) molInfo.myRigidBodies[j]; + info[k].integrableObjects.push_back(mySD); + molInfo.myIntegrableObjects.push_back(mySD); } + // send the arrays off to the forceField for init. @@ -482,28 +521,7 @@ void SimSetup::makeMolecules(void){ delete[] theBonds; delete[] theBends; delete[] theTorsions; - } - - // build up the integrableObjects vector: - - for (i = 0; i < info[k].n_atoms; i++) { - -#ifdef IS_MPI - slI = info[k].atoms[i]->getGlobalIndex(); -#else - slI = i; -#endif - - if (skipList.find(slI) == skipList.end()) { - mySD = (StuntDouble *) info[k].atoms[i]; - info[k].integrableObjects.push_back(mySD); - } - } - for (i = 0; i < info[k].rigidBodies.size(); i++) { - mySD = (StuntDouble *) info[k].rigidBodies[i]; - info[k].integrableObjects.push_back(mySD); - } - + } } #ifdef IS_MPI @@ -1334,10 +1352,14 @@ void SimSetup::mpiMolDivide(void){ int localMol, allMol; int local_atoms, local_bonds, local_bends, local_torsions, local_SRI; int local_rigid; + vector globalAtomIndex; + vector globalMolIndex; mpiSim = new mpiSimulation(info); - globalIndex = mpiSim->divideLabor(); + mpiSim->divideLabor(); + globalAtomIndex = mpiSim->getGlobalAtomIndex(); + globalMolIndex = mpiSim->getGlobalMolIndex(); // set up the local variables @@ -1351,7 +1373,7 @@ void SimSetup::mpiMolDivide(void){ local_bends = 0; local_torsions = 0; local_rigid = 0; - globalAtomIndex = 0; + globalAtomCounter = 0; for (i = 0; i < n_components; i++){ for (j = 0; j < components_nmol[i]; j++){ @@ -1364,8 +1386,8 @@ void SimSetup::mpiMolDivide(void){ localMol++; } for (k = 0; k < comp_stamps[i]->getNAtoms(); k++){ - info[0].molMembershipArray[globalAtomIndex] = allMol; - globalAtomIndex++; + info[0].molMembershipArray[globalAtomCounter] = allMol; + globalAtomCounter++; } allMol++; @@ -1433,15 +1455,15 @@ void SimSetup::makeSysArrays(void){ #else // is_mpi molIndex = 0; - globalAtomIndex = 0; + globalAtomCounter = 0; for (i = 0; i < n_components; i++){ for (j = 0; j < components_nmol[i]; j++){ the_molecules[molIndex].setStampID(i); the_molecules[molIndex].setMyIndex(molIndex); the_molecules[molIndex].setGlobalIndex(molIndex); for (k = 0; k < comp_stamps[i]->getNAtoms(); k++){ - info[l].molMembershipArray[globalAtomIndex] = molIndex; - globalAtomIndex++; + info[l].molMembershipArray[globalAtomCounter] = molIndex; + globalAtomCounter++; } molIndex++; }