# | Line 167 | Line 167 | void SimSetup::makeMolecules(void){ | |
---|---|---|
167 | ||
168 | void SimSetup::makeMolecules(void){ | |
169 | int i, j, k; | |
170 | < | int exI, exJ, exK, exL, slI; |
170 | > | int exI, exJ, exK, exL, slI, slJ; |
171 | int tempI, tempJ, tempK, tempL; | |
172 | int molI; | |
173 | int stampID, atomOffset, rbOffset; | |
# | Line 190 | Line 190 | void SimSetup::makeMolecules(void){ | |
190 | set<int> skipList; | |
191 | ||
192 | double phi, theta, psi; | |
193 | + | char* molName; |
194 | + | char rbName[100]; |
195 | ||
196 | //init the forceField paramters | |
197 | ||
# | Line 206 | Line 208 | void SimSetup::makeMolecules(void){ | |
208 | ||
209 | for (i = 0; i < info[k].n_mol; i++){ | |
210 | stampID = info[k].molecules[i].getStampID(); | |
211 | + | molName = comp_stamps[stampID]->getID(); |
212 | ||
213 | molInfo.nAtoms = comp_stamps[stampID]->getNAtoms(); | |
214 | molInfo.nBonds = comp_stamps[stampID]->getNBonds(); | |
# | Line 265 | Line 268 | void SimSetup::makeMolecules(void){ | |
268 | ||
269 | #ifdef IS_MPI | |
270 | ||
271 | < | molInfo.myAtoms[j]->setGlobalIndex(globalIndex[j + atomOffset]); |
271 | > | molInfo.myAtoms[j]->setGlobalIndex(globalAtomIndex[j + atomOffset]); |
272 | ||
273 | #endif // is_mpi | |
274 | } | |
# | Line 414 | Line 417 | void SimSetup::makeMolecules(void){ | |
417 | // Create the Rigid Body: | |
418 | ||
419 | myRB = new RigidBody(); | |
420 | + | |
421 | + | sprintf(rbName,"%s_RB_%s", molName, j); |
422 | + | myRB->setType(rbName); |
423 | ||
424 | for (rb1 = 0; rb1 < nMembers; rb1++) { | |
425 | ||
# | Line 464 | Line 470 | void SimSetup::makeMolecules(void){ | |
470 | info[k].excludes->addPair(exI, exJ); | |
471 | ||
472 | } | |
473 | + | } |
474 | + | |
475 | + | molInfo.myRigidBodies.push_back(myRB); |
476 | + | info[k].rigidBodies.push_back(myRB); |
477 | + | } |
478 | + | |
479 | + | |
480 | + | // After this is all set up, scan through the atoms to |
481 | + | // see if they can be added to the integrableObjects: |
482 | + | |
483 | + | for (j = 0; j < molInfo.nAtoms; j++){ |
484 | + | |
485 | + | #ifdef IS_MPI |
486 | + | slJ = molInfo.myAtoms[j]->getGlobalIndex(); |
487 | + | #else |
488 | + | slJ = j+atomOffset; |
489 | + | #endif |
490 | + | |
491 | + | // if they aren't on the skip list, then they can be integrated |
492 | + | |
493 | + | if (skipList.find(slJ) == skipList.end()) { |
494 | + | mySD = (StuntDouble *) molInfo.myAtoms[j]; |
495 | + | info[k].integrableObjects.push_back(mySD); |
496 | + | molInfo.myIntegrableObjects.push_back(mySD); |
497 | } | |
498 | + | } |
499 | + | |
500 | + | // all rigid bodies are integrated: |
501 | + | |
502 | + | for (j = 0; j < molInfo.nRigidBodies; j++) { |
503 | + | mySD = (StuntDouble *) molInfo.myRigidBodies[j]; |
504 | + | info[k].integrableObjects.push_back(mySD); |
505 | + | molInfo.myIntegrableObjects.push_back(mySD); |
506 | } | |
507 | + | |
508 | ||
509 | // send the arrays off to the forceField for init. | |
510 | ||
# | Line 482 | Line 521 | void SimSetup::makeMolecules(void){ | |
521 | delete[] theBonds; | |
522 | delete[] theBends; | |
523 | delete[] theTorsions; | |
524 | < | } |
486 | < | |
487 | < | // build up the integrableObjects vector: |
488 | < | |
489 | < | for (i = 0; i < info[k].n_atoms; i++) { |
490 | < | |
491 | < | #ifdef IS_MPI |
492 | < | slI = info[k].atoms[i]->getGlobalIndex(); |
493 | < | #else |
494 | < | slI = i; |
495 | < | #endif |
496 | < | |
497 | < | if (skipList.find(slI) == skipList.end()) { |
498 | < | mySD = (StuntDouble *) info[k].atoms[i]; |
499 | < | info[k].integrableObjects.push_back(mySD); |
500 | < | } |
501 | < | } |
502 | < | for (i = 0; i < info[k].rigidBodies.size(); i++) { |
503 | < | mySD = (StuntDouble *) info[k].rigidBodies[i]; |
504 | < | info[k].integrableObjects.push_back(mySD); |
505 | < | } |
506 | < | |
524 | > | } |
525 | } | |
526 | ||
527 | #ifdef IS_MPI | |
# | Line 1334 | Line 1352 | void SimSetup::mpiMolDivide(void){ | |
1352 | int localMol, allMol; | |
1353 | int local_atoms, local_bonds, local_bends, local_torsions, local_SRI; | |
1354 | int local_rigid; | |
1355 | + | vector<int> globalAtomIndex; |
1356 | + | vector<int> globalMolIndex; |
1357 | ||
1358 | mpiSim = new mpiSimulation(info); | |
1359 | ||
1360 | < | globalIndex = mpiSim->divideLabor(); |
1360 | > | mpiSim->divideLabor(); |
1361 | > | globalAtomIndex = mpiSim->getGlobalAtomIndex(); |
1362 | > | globalMolIndex = mpiSim->getGlobalMolIndex(); |
1363 | ||
1364 | // set up the local variables | |
1365 | ||
# | Line 1351 | Line 1373 | void SimSetup::mpiMolDivide(void){ | |
1373 | local_bends = 0; | |
1374 | local_torsions = 0; | |
1375 | local_rigid = 0; | |
1376 | < | globalAtomIndex = 0; |
1376 | > | globalAtomCounter = 0; |
1377 | ||
1378 | for (i = 0; i < n_components; i++){ | |
1379 | for (j = 0; j < components_nmol[i]; j++){ | |
# | Line 1364 | Line 1386 | void SimSetup::mpiMolDivide(void){ | |
1386 | localMol++; | |
1387 | } | |
1388 | for (k = 0; k < comp_stamps[i]->getNAtoms(); k++){ | |
1389 | < | info[0].molMembershipArray[globalAtomIndex] = allMol; |
1390 | < | globalAtomIndex++; |
1389 | > | info[0].molMembershipArray[globalAtomCounter] = allMol; |
1390 | > | globalAtomCounter++; |
1391 | } | |
1392 | ||
1393 | allMol++; | |
# | Line 1433 | Line 1455 | void SimSetup::makeSysArrays(void){ | |
1455 | #else // is_mpi | |
1456 | ||
1457 | molIndex = 0; | |
1458 | < | globalAtomIndex = 0; |
1458 | > | globalAtomCounter = 0; |
1459 | for (i = 0; i < n_components; i++){ | |
1460 | for (j = 0; j < components_nmol[i]; j++){ | |
1461 | the_molecules[molIndex].setStampID(i); | |
1462 | the_molecules[molIndex].setMyIndex(molIndex); | |
1463 | the_molecules[molIndex].setGlobalIndex(molIndex); | |
1464 | for (k = 0; k < comp_stamps[i]->getNAtoms(); k++){ | |
1465 | < | info[l].molMembershipArray[globalAtomIndex] = molIndex; |
1466 | < | globalAtomIndex++; |
1465 | > | info[l].molMembershipArray[globalAtomCounter] = molIndex; |
1466 | > | globalAtomCounter++; |
1467 | } | |
1468 | molIndex++; | |
1469 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |