22 |
|
#define NVT_ENS 1 |
23 |
|
#define NPTi_ENS 2 |
24 |
|
#define NPTf_ENS 3 |
25 |
– |
#define NPTim_ENS 4 |
26 |
– |
#define NPTfm_ENS 5 |
25 |
|
|
26 |
|
#define FF_DUFF 0 |
27 |
|
#define FF_LJ 1 |
90 |
|
#endif // is_mpi |
91 |
|
|
92 |
|
void SimSetup::createSim(void){ |
95 |
– |
int i, j, k, globalAtomIndex; |
93 |
|
|
94 |
|
// gather all of the information from the Bass file |
95 |
|
|
128 |
|
|
129 |
|
|
130 |
|
void SimSetup::makeMolecules(void){ |
131 |
< |
int k, l; |
131 |
> |
int k; |
132 |
|
int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset; |
133 |
|
molInit molInfo; |
134 |
|
DirectionalAtom* dAtom; |
550 |
|
|
551 |
|
|
552 |
|
void SimSetup::gatherInfo(void){ |
553 |
< |
int i, j, k; |
553 |
> |
int i; |
554 |
|
|
555 |
|
ensembleCase = -1; |
556 |
|
ffCase = -1; |
600 |
|
} |
601 |
|
else if (!strcasecmp(ensemble, "NPTf")){ |
602 |
|
ensembleCase = NPTf_ENS; |
606 |
– |
} |
607 |
– |
else if (!strcasecmp(ensemble, "NPTim")){ |
608 |
– |
ensembleCase = NPTim_ENS; |
603 |
|
} |
610 |
– |
else if (!strcasecmp(ensemble, "NPTfm")){ |
611 |
– |
ensembleCase = NPTfm_ENS; |
612 |
– |
} |
604 |
|
else{ |
605 |
|
sprintf(painCave.errMsg, |
606 |
|
"SimSetup Warning. Unrecognized Ensemble -> %s, " |
913 |
|
if (worldRank == 0){ |
914 |
|
#endif //is_mpi |
915 |
|
inName = globals->getInitialConfig(); |
925 |
– |
double* tempDouble = new double[1000000]; |
916 |
|
fileInit = new InitializeFromFile(inName); |
917 |
|
#ifdef IS_MPI |
918 |
|
} |
930 |
|
|
931 |
|
sprintf(painCave.errMsg, |
932 |
|
"Cannot intialize a parallel simulation without an initial configuration file.\n"); |
933 |
< |
painCave.isFatal; |
933 |
> |
painCave.isFatal = 1;; |
934 |
|
simError(); |
935 |
|
|
936 |
|
#else |
1156 |
|
} |
1157 |
|
|
1158 |
|
void SimSetup::calcSysValues(void){ |
1159 |
< |
int i, j, k; |
1159 |
> |
int i; |
1160 |
|
|
1161 |
|
int* molMembershipArray; |
1162 |
|
|
1255 |
|
|
1256 |
|
|
1257 |
|
void SimSetup::makeSysArrays(void){ |
1258 |
< |
int i, j, k, l; |
1258 |
> |
|
1259 |
> |
#ifndef IS_MPI |
1260 |
> |
int k, j; |
1261 |
> |
#endif // is_mpi |
1262 |
> |
int i, l; |
1263 |
|
|
1264 |
|
Atom** the_atoms; |
1265 |
|
Molecule* the_molecules; |
1342 |
|
void SimSetup::makeIntegrator(void){ |
1343 |
|
int k; |
1344 |
|
|
1345 |
+ |
NVE<RealIntegrator>* myNVE = NULL; |
1346 |
|
NVT<RealIntegrator>* myNVT = NULL; |
1347 |
< |
NPTi<RealIntegrator>* myNPTi = NULL; |
1348 |
< |
NPTf<RealIntegrator>* myNPTf = NULL; |
1354 |
< |
NPTim<RealIntegrator>* myNPTim = NULL; |
1355 |
< |
NPTfm<RealIntegrator>* myNPTfm = NULL; |
1347 |
> |
NPTi<NPT<RealIntegrator> >* myNPTi = NULL; |
1348 |
> |
NPTf<NPT<RealIntegrator> >* myNPTf = NULL; |
1349 |
|
|
1350 |
|
for (k = 0; k < nInfo; k++){ |
1351 |
|
switch (ensembleCase){ |
1352 |
|
case NVE_ENS: |
1353 |
|
if (globals->haveZconstraints()){ |
1354 |
|
setupZConstraint(info[k]); |
1355 |
< |
new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1355 |
> |
myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1356 |
|
} |
1357 |
< |
else |
1358 |
< |
new NVE<RealIntegrator>(&(info[k]), the_ff); |
1357 |
> |
else{ |
1358 |
> |
myNVE = new NVE<RealIntegrator>(&(info[k]), the_ff); |
1359 |
> |
} |
1360 |
> |
|
1361 |
> |
info->the_integrator = myNVE; |
1362 |
|
break; |
1363 |
|
|
1364 |
|
case NVT_ENS: |
1380 |
|
painCave.isFatal = 1; |
1381 |
|
simError(); |
1382 |
|
} |
1383 |
+ |
|
1384 |
+ |
info->the_integrator = myNVT; |
1385 |
|
break; |
1386 |
|
|
1387 |
|
case NPTi_ENS: |
1388 |
|
if (globals->haveZconstraints()){ |
1389 |
|
setupZConstraint(info[k]); |
1390 |
< |
myNPTi = new ZConstraint<NPTi<RealIntegrator> >(&(info[k]), the_ff); |
1390 |
> |
myNPTi = new ZConstraint<NPTi<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1391 |
|
} |
1392 |
|
else |
1393 |
< |
myNPTi = new NPTi<RealIntegrator>(&(info[k]), the_ff); |
1393 |
> |
myNPTi = new NPTi<NPT<RealIntegrator> >(&(info[k]), the_ff); |
1394 |
|
|
1395 |
|
myNPTi->setTargetTemp(globals->getTargetTemp()); |
1396 |
|
|
1423 |
|
painCave.isFatal = 1; |
1424 |
|
simError(); |
1425 |
|
} |
1426 |
+ |
|
1427 |
+ |
info->the_integrator = myNPTi; |
1428 |
|
break; |
1429 |
|
|
1430 |
|
case NPTf_ENS: |
1431 |
|
if (globals->haveZconstraints()){ |
1432 |
|
setupZConstraint(info[k]); |
1433 |
< |
myNPTf = new ZConstraint<NPTf<RealIntegrator> >(&(info[k]), the_ff); |
1433 |
> |
myNPTf = new ZConstraint<NPTf<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1434 |
|
} |
1435 |
|
else |
1436 |
< |
myNPTf = new NPTf<RealIntegrator>(&(info[k]), the_ff); |
1436 |
> |
myNPTf = new NPTf<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1437 |
|
|
1438 |
|
myNPTf->setTargetTemp(globals->getTargetTemp()); |
1439 |
|
|
1459 |
|
|
1460 |
|
if (globals->haveTauBarostat()) |
1461 |
|
myNPTf->setTauBarostat(globals->getTauBarostat()); |
1462 |
– |
else{ |
1463 |
– |
sprintf(painCave.errMsg, |
1464 |
– |
"SimSetup error: If you use an NPT\n" |
1465 |
– |
" ensemble, you must set tauBarostat.\n"); |
1466 |
– |
painCave.isFatal = 1; |
1467 |
– |
simError(); |
1468 |
– |
} |
1469 |
– |
break; |
1470 |
– |
|
1471 |
– |
case NPTim_ENS: |
1472 |
– |
if (globals->haveZconstraints()){ |
1473 |
– |
setupZConstraint(info[k]); |
1474 |
– |
myNPTim = new ZConstraint<NPTim<RealIntegrator> >(&(info[k]), the_ff); |
1475 |
– |
} |
1476 |
– |
else |
1477 |
– |
myNPTim = new NPTim<RealIntegrator>(&(info[k]), the_ff); |
1478 |
– |
|
1479 |
– |
myNPTim->setTargetTemp(globals->getTargetTemp()); |
1480 |
– |
|
1481 |
– |
if (globals->haveTargetPressure()) |
1482 |
– |
myNPTim->setTargetPressure(globals->getTargetPressure()); |
1462 |
|
else{ |
1463 |
|
sprintf(painCave.errMsg, |
1485 |
– |
"SimSetup error: If you use a constant pressure\n" |
1486 |
– |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1487 |
– |
painCave.isFatal = 1; |
1488 |
– |
simError(); |
1489 |
– |
} |
1490 |
– |
|
1491 |
– |
if (globals->haveTauThermostat()) |
1492 |
– |
myNPTim->setTauThermostat(globals->getTauThermostat()); |
1493 |
– |
else{ |
1494 |
– |
sprintf(painCave.errMsg, |
1464 |
|
"SimSetup error: If you use an NPT\n" |
1496 |
– |
" ensemble, you must set tauThermostat.\n"); |
1497 |
– |
painCave.isFatal = 1; |
1498 |
– |
simError(); |
1499 |
– |
} |
1500 |
– |
|
1501 |
– |
if (globals->haveTauBarostat()) |
1502 |
– |
myNPTim->setTauBarostat(globals->getTauBarostat()); |
1503 |
– |
else{ |
1504 |
– |
sprintf(painCave.errMsg, |
1505 |
– |
"SimSetup error: If you use an NPT\n" |
1465 |
|
" ensemble, you must set tauBarostat.\n"); |
1466 |
|
painCave.isFatal = 1; |
1467 |
|
simError(); |
1468 |
|
} |
1510 |
– |
break; |
1469 |
|
|
1470 |
< |
case NPTfm_ENS: |
1513 |
< |
if (globals->haveZconstraints()){ |
1514 |
< |
setupZConstraint(info[k]); |
1515 |
< |
myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >(&(info[k]), the_ff); |
1516 |
< |
} |
1517 |
< |
else |
1518 |
< |
myNPTfm = new NPTfm<RealIntegrator>(&(info[k]), the_ff); |
1519 |
< |
|
1520 |
< |
myNPTfm->setTargetTemp(globals->getTargetTemp()); |
1521 |
< |
|
1522 |
< |
if (globals->haveTargetPressure()) |
1523 |
< |
myNPTfm->setTargetPressure(globals->getTargetPressure()); |
1524 |
< |
else{ |
1525 |
< |
sprintf(painCave.errMsg, |
1526 |
< |
"SimSetup error: If you use a constant pressure\n" |
1527 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1528 |
< |
painCave.isFatal = 1; |
1529 |
< |
simError(); |
1530 |
< |
} |
1531 |
< |
|
1532 |
< |
if (globals->haveTauThermostat()) |
1533 |
< |
myNPTfm->setTauThermostat(globals->getTauThermostat()); |
1534 |
< |
else{ |
1535 |
< |
sprintf(painCave.errMsg, |
1536 |
< |
"SimSetup error: If you use an NPT\n" |
1537 |
< |
" ensemble, you must set tauThermostat.\n"); |
1538 |
< |
painCave.isFatal = 1; |
1539 |
< |
simError(); |
1540 |
< |
} |
1541 |
< |
|
1542 |
< |
if (globals->haveTauBarostat()) |
1543 |
< |
myNPTfm->setTauBarostat(globals->getTauBarostat()); |
1544 |
< |
else{ |
1545 |
< |
sprintf(painCave.errMsg, |
1546 |
< |
"SimSetup error: If you use an NPT\n" |
1547 |
< |
" ensemble, you must set tauBarostat.\n"); |
1548 |
< |
painCave.isFatal = 1; |
1549 |
< |
simError(); |
1550 |
< |
} |
1470 |
> |
info->the_integrator = myNPTf; |
1471 |
|
break; |
1472 |
|
|
1473 |
|
default: |