147 |
|
// make the output filenames |
148 |
|
|
149 |
|
makeOutNames(); |
150 |
– |
|
151 |
– |
if (globals->haveMinimizer()) |
152 |
– |
// make minimizer |
153 |
– |
makeMinimizer(); |
154 |
– |
else |
155 |
– |
// make the integrator |
156 |
– |
makeIntegrator(); |
150 |
|
|
151 |
|
#ifdef IS_MPI |
152 |
|
mpiSim->mpiRefresh(); |
155 |
|
// initialize the Fortran |
156 |
|
|
157 |
|
initFortran(); |
158 |
+ |
|
159 |
+ |
if (globals->haveMinimizer()) |
160 |
+ |
// make minimizer |
161 |
+ |
makeMinimizer(); |
162 |
+ |
else |
163 |
+ |
// make the integrator |
164 |
+ |
makeIntegrator(); |
165 |
+ |
|
166 |
|
} |
167 |
|
|
168 |
|
|
169 |
|
void SimSetup::makeMolecules(void){ |
170 |
|
int i, j, k; |
171 |
< |
int exI, exJ, exK, exL, slI; |
171 |
> |
int exI, exJ, exK, exL, slI, slJ; |
172 |
|
int tempI, tempJ, tempK, tempL; |
173 |
|
int molI; |
174 |
|
int stampID, atomOffset, rbOffset; |
191 |
|
set<int> skipList; |
192 |
|
|
193 |
|
double phi, theta, psi; |
194 |
+ |
char* molName; |
195 |
+ |
char rbName[100]; |
196 |
|
|
197 |
|
//init the forceField paramters |
198 |
|
|
209 |
|
|
210 |
|
for (i = 0; i < info[k].n_mol; i++){ |
211 |
|
stampID = info[k].molecules[i].getStampID(); |
212 |
+ |
molName = comp_stamps[stampID]->getID(); |
213 |
|
|
214 |
|
molInfo.nAtoms = comp_stamps[stampID]->getNAtoms(); |
215 |
|
molInfo.nBonds = comp_stamps[stampID]->getNBonds(); |
263 |
|
else{ |
264 |
|
|
265 |
|
molInfo.myAtoms[j] = new Atom((j + atomOffset), info[k].getConfiguration()); |
266 |
+ |
|
267 |
|
} |
268 |
|
|
269 |
|
molInfo.myAtoms[j]->setType(currentAtom->getType()); |
265 |
– |
|
270 |
|
#ifdef IS_MPI |
271 |
|
|
272 |
< |
molInfo.myAtoms[j]->setGlobalIndex(globalIndex[j + atomOffset]); |
272 |
> |
molInfo.myAtoms[j]->setGlobalIndex(globalAtomIndex[j + atomOffset]); |
273 |
|
|
274 |
|
#endif // is_mpi |
275 |
|
} |
410 |
|
info[k].excludes->addPair(exK, exL); |
411 |
|
} |
412 |
|
|
413 |
+ |
|
414 |
+ |
molInfo.myRigidBodies.clear(); |
415 |
+ |
|
416 |
|
for (j = 0; j < molInfo.nRigidBodies; j++){ |
417 |
|
|
418 |
|
currentRigidBody = comp_stamps[stampID]->getRigidBody(j); |
421 |
|
// Create the Rigid Body: |
422 |
|
|
423 |
|
myRB = new RigidBody(); |
424 |
+ |
|
425 |
+ |
sprintf(rbName,"%s_RB_%d", molName, j); |
426 |
+ |
myRB->setType(rbName); |
427 |
|
|
428 |
|
for (rb1 = 0; rb1 < nMembers; rb1++) { |
429 |
|
|
464 |
|
// used for the exclude list: |
465 |
|
|
466 |
|
#ifdef IS_MPI |
467 |
< |
exI = info[k].atoms[tempI]->getGlobalIndex() + 1; |
468 |
< |
exJ = info[k].atoms[tempJ]->getGlobalIndex() + 1; |
467 |
> |
exI = molInfo.myAtoms[tempI]->getGlobalIndex() + 1; |
468 |
> |
exJ = molInfo.myAtoms[tempJ]->getGlobalIndex() + 1; |
469 |
|
#else |
470 |
< |
exI = tempI + 1; |
471 |
< |
exJ = tempJ + 1; |
470 |
> |
exI = molInfo.myAtoms[tempI]->getIndex() + 1; |
471 |
> |
exJ = molInfo.myAtoms[tempJ]->getIndex() + 1; |
472 |
|
#endif |
473 |
|
|
474 |
|
info[k].excludes->addPair(exI, exJ); |
475 |
|
|
476 |
|
} |
477 |
|
} |
478 |
+ |
|
479 |
+ |
molInfo.myRigidBodies.push_back(myRB); |
480 |
+ |
info[k].rigidBodies.push_back(myRB); |
481 |
|
} |
482 |
|
|
483 |
+ |
|
484 |
+ |
// After this is all set up, scan through the atoms to |
485 |
+ |
// see if they can be added to the integrableObjects: |
486 |
+ |
|
487 |
+ |
molInfo.myIntegrableObjects.clear(); |
488 |
+ |
|
489 |
+ |
|
490 |
+ |
for (j = 0; j < molInfo.nAtoms; j++){ |
491 |
+ |
|
492 |
+ |
#ifdef IS_MPI |
493 |
+ |
slJ = molInfo.myAtoms[j]->getGlobalIndex(); |
494 |
+ |
#else |
495 |
+ |
slJ = j+atomOffset; |
496 |
+ |
#endif |
497 |
+ |
|
498 |
+ |
// if they aren't on the skip list, then they can be integrated |
499 |
+ |
|
500 |
+ |
if (skipList.find(slJ) == skipList.end()) { |
501 |
+ |
mySD = (StuntDouble *) molInfo.myAtoms[j]; |
502 |
+ |
info[k].integrableObjects.push_back(mySD); |
503 |
+ |
molInfo.myIntegrableObjects.push_back(mySD); |
504 |
+ |
} |
505 |
+ |
} |
506 |
+ |
|
507 |
+ |
// all rigid bodies are integrated: |
508 |
+ |
|
509 |
+ |
for (j = 0; j < molInfo.nRigidBodies; j++) { |
510 |
+ |
mySD = (StuntDouble *) molInfo.myRigidBodies[j]; |
511 |
+ |
info[k].integrableObjects.push_back(mySD); |
512 |
+ |
molInfo.myIntegrableObjects.push_back(mySD); |
513 |
+ |
} |
514 |
+ |
|
515 |
+ |
|
516 |
|
// send the arrays off to the forceField for init. |
517 |
|
|
518 |
|
the_ff->initializeAtoms(molInfo.nAtoms, molInfo.myAtoms); |
528 |
|
delete[] theBonds; |
529 |
|
delete[] theBends; |
530 |
|
delete[] theTorsions; |
531 |
< |
} |
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 |
< |
|
531 |
> |
} |
532 |
|
} |
533 |
|
|
534 |
|
#ifdef IS_MPI |
964 |
|
void SimSetup::finalInfoCheck(void){ |
965 |
|
int index; |
966 |
|
int usesDipoles; |
967 |
+ |
int usesCharges; |
968 |
|
int i; |
969 |
|
|
970 |
|
for (i = 0; i < nInfo; i++){ |
976 |
|
usesDipoles = (info[i].atoms[index])->hasDipole(); |
977 |
|
index++; |
978 |
|
} |
979 |
< |
|
979 |
> |
index = 0; |
980 |
> |
usesCharges = 0; |
981 |
> |
while ((index < info[i].n_atoms) && !usesCharges){ |
982 |
> |
usesCharges= (info[i].atoms[index])->hasCharge(); |
983 |
> |
index++; |
984 |
> |
} |
985 |
|
#ifdef IS_MPI |
986 |
|
int myUse = usesDipoles; |
987 |
|
MPI_Allreduce(&myUse, &usesDipoles, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
1032 |
|
info[i].dielectric = globals->getDielectric(); |
1033 |
|
} |
1034 |
|
else{ |
1035 |
< |
if (usesDipoles){ |
1035 |
> |
if (usesDipoles || usesCharges){ |
1036 |
|
if (!globals->haveECR()){ |
1037 |
|
sprintf(painCave.errMsg, |
1038 |
|
"SimSetup Warning: No value was set for electrostaticCutoffRadius.\n" |
1365 |
|
int localMol, allMol; |
1366 |
|
int local_atoms, local_bonds, local_bends, local_torsions, local_SRI; |
1367 |
|
int local_rigid; |
1368 |
+ |
vector<int> globalAtomIndex; |
1369 |
+ |
vector<int> globalMolIndex; |
1370 |
|
|
1371 |
|
mpiSim = new mpiSimulation(info); |
1372 |
|
|
1373 |
< |
globalIndex = mpiSim->divideLabor(); |
1373 |
> |
mpiSim->divideLabor(); |
1374 |
> |
globalAtomIndex = mpiSim->getGlobalAtomIndex(); |
1375 |
> |
globalMolIndex = mpiSim->getGlobalMolIndex(); |
1376 |
|
|
1377 |
|
// set up the local variables |
1378 |
|
|
1386 |
|
local_bends = 0; |
1387 |
|
local_torsions = 0; |
1388 |
|
local_rigid = 0; |
1389 |
< |
globalAtomIndex = 0; |
1389 |
> |
globalAtomCounter = 0; |
1390 |
|
|
1391 |
|
for (i = 0; i < n_components; i++){ |
1392 |
|
for (j = 0; j < components_nmol[i]; j++){ |
1399 |
|
localMol++; |
1400 |
|
} |
1401 |
|
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++){ |
1402 |
< |
info[0].molMembershipArray[globalAtomIndex] = allMol; |
1403 |
< |
globalAtomIndex++; |
1402 |
> |
info[0].molMembershipArray[globalAtomCounter] = allMol; |
1403 |
> |
globalAtomCounter++; |
1404 |
|
} |
1405 |
|
|
1406 |
|
allMol++; |
1468 |
|
#else // is_mpi |
1469 |
|
|
1470 |
|
molIndex = 0; |
1471 |
< |
globalAtomIndex = 0; |
1471 |
> |
globalAtomCounter = 0; |
1472 |
|
for (i = 0; i < n_components; i++){ |
1473 |
|
for (j = 0; j < components_nmol[i]; j++){ |
1474 |
|
the_molecules[molIndex].setStampID(i); |
1475 |
|
the_molecules[molIndex].setMyIndex(molIndex); |
1476 |
|
the_molecules[molIndex].setGlobalIndex(molIndex); |
1477 |
|
for (k = 0; k < comp_stamps[i]->getNAtoms(); k++){ |
1478 |
< |
info[l].molMembershipArray[globalAtomIndex] = molIndex; |
1479 |
< |
globalAtomIndex++; |
1478 |
> |
info[l].molMembershipArray[globalAtomCounter] = molIndex; |
1479 |
> |
globalAtomCounter++; |
1480 |
|
} |
1481 |
|
molIndex++; |
1482 |
|
} |