# | Line 22 | Line 22 | |
---|---|---|
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 | > | #define NPTxyz_ENS 4 |
26 | ||
27 | + | |
28 | #define FF_DUFF 0 | |
29 | #define FF_LJ 1 | |
30 | #define FF_EAM 2 | |
# | Line 92 | Line 92 | void SimSetup::createSim(void){ | |
92 | #endif // is_mpi | |
93 | ||
94 | void SimSetup::createSim(void){ | |
95 | – | int i, j, k, globalAtomIndex; |
95 | ||
96 | // gather all of the information from the Bass file | |
97 | ||
# | Line 110 | Line 109 | void SimSetup::createSim(void){ | |
109 | ||
110 | if (!isInfoArray){ | |
111 | initSystemCoords(); | |
112 | + | |
113 | + | if( !(globals->getUseInitTime()) ) |
114 | + | info[0].currentTime = 0.0; |
115 | } | |
116 | ||
117 | // make the output filenames | |
# | Line 131 | Line 133 | void SimSetup::makeMolecules(void){ | |
133 | ||
134 | ||
135 | void SimSetup::makeMolecules(void){ | |
136 | < | int k, l; |
136 | > | int k; |
137 | int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset; | |
138 | molInit molInfo; | |
139 | DirectionalAtom* dAtom; | |
# | Line 553 | Line 555 | void SimSetup::gatherInfo(void){ | |
555 | ||
556 | ||
557 | void SimSetup::gatherInfo(void){ | |
558 | < | int i, j, k; |
558 | > | int i; |
559 | ||
560 | ensembleCase = -1; | |
561 | ffCase = -1; | |
# | Line 604 | Line 606 | void SimSetup::gatherInfo(void){ | |
606 | else if (!strcasecmp(ensemble, "NPTf")){ | |
607 | ensembleCase = NPTf_ENS; | |
608 | } | |
609 | < | else if (!strcasecmp(ensemble, "NPTim")){ |
610 | < | ensembleCase = NPTim_ENS; |
609 | > | else if (!strcasecmp(ensemble, "NPTxyz")){ |
610 | > | ensembleCase = NPTxyz_ENS; |
611 | } | |
610 | – | else if (!strcasecmp(ensemble, "NPTfm")){ |
611 | – | ensembleCase = NPTfm_ENS; |
612 | – | } |
612 | else{ | |
613 | sprintf(painCave.errMsg, | |
614 | "SimSetup Warning. Unrecognized Ensemble -> %s, " | |
# | Line 688 | Line 687 | void SimSetup::gatherInfo(void){ | |
687 | info[i].thermalTime = globals->getThermalTime(); | |
688 | } | |
689 | ||
690 | + | info[i].resetIntegrator = 0; |
691 | + | if( globals->haveResetTime() ){ |
692 | + | info[i].resetTime = globals->getResetTime(); |
693 | + | info[i].resetIntegrator = 1; |
694 | + | } |
695 | + | |
696 | // check for the temperature set flag | |
697 | ||
698 | if (globals->haveTempSet()) | |
# | Line 916 | Line 921 | void SimSetup::initSystemCoords(void){ | |
921 | if (worldRank == 0){ | |
922 | #endif //is_mpi | |
923 | inName = globals->getInitialConfig(); | |
919 | – | double* tempDouble = new double[1000000]; |
924 | fileInit = new InitializeFromFile(inName); | |
925 | #ifdef IS_MPI | |
926 | } | |
# | Line 934 | Line 938 | void SimSetup::initSystemCoords(void){ | |
938 | ||
939 | sprintf(painCave.errMsg, | |
940 | "Cannot intialize a parallel simulation without an initial configuration file.\n"); | |
941 | < | painCave.isFatal; |
941 | > | painCave.isFatal = 1;; |
942 | simError(); | |
943 | ||
944 | #else | |
# | Line 1160 | Line 1164 | void SimSetup::calcSysValues(void){ | |
1164 | } | |
1165 | ||
1166 | void SimSetup::calcSysValues(void){ | |
1167 | < | int i, j, k; |
1167 | > | int i; |
1168 | ||
1169 | int* molMembershipArray; | |
1170 | ||
# | Line 1259 | Line 1263 | void SimSetup::makeSysArrays(void){ | |
1263 | ||
1264 | ||
1265 | void SimSetup::makeSysArrays(void){ | |
1266 | < | int i, j, k, l; |
1266 | > | |
1267 | > | #ifndef IS_MPI |
1268 | > | int k, j; |
1269 | > | #endif // is_mpi |
1270 | > | int i, l; |
1271 | ||
1272 | Atom** the_atoms; | |
1273 | Molecule* the_molecules; | |
# | Line 1342 | Line 1350 | void SimSetup::makeIntegrator(void){ | |
1350 | void SimSetup::makeIntegrator(void){ | |
1351 | int k; | |
1352 | ||
1353 | + | NVE<RealIntegrator>* myNVE = NULL; |
1354 | NVT<RealIntegrator>* myNVT = NULL; | |
1355 | < | NPTi<RealIntegrator>* myNPTi = NULL; |
1356 | < | NPTf<RealIntegrator>* myNPTf = NULL; |
1357 | < | NPTim<RealIntegrator>* myNPTim = NULL; |
1358 | < | NPTfm<RealIntegrator>* myNPTfm = NULL; |
1350 | < | |
1355 | > | NPTi<NPT<RealIntegrator> >* myNPTi = NULL; |
1356 | > | NPTf<NPT<RealIntegrator> >* myNPTf = NULL; |
1357 | > | NPTxyz<NPT<RealIntegrator> >* myNPTxyz = NULL; |
1358 | > | |
1359 | for (k = 0; k < nInfo; k++){ | |
1360 | switch (ensembleCase){ | |
1361 | case NVE_ENS: | |
1362 | if (globals->haveZconstraints()){ | |
1363 | setupZConstraint(info[k]); | |
1364 | < | new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1364 | > | myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1365 | } | |
1366 | < | else |
1367 | < | new NVE<RealIntegrator>(&(info[k]), the_ff); |
1366 | > | else{ |
1367 | > | myNVE = new NVE<RealIntegrator>(&(info[k]), the_ff); |
1368 | > | } |
1369 | > | |
1370 | > | info->the_integrator = myNVE; |
1371 | break; | |
1372 | ||
1373 | case NVT_ENS: | |
# | Line 1378 | Line 1389 | void SimSetup::makeIntegrator(void){ | |
1389 | painCave.isFatal = 1; | |
1390 | simError(); | |
1391 | } | |
1392 | + | |
1393 | + | info->the_integrator = myNVT; |
1394 | break; | |
1395 | ||
1396 | case NPTi_ENS: | |
1397 | if (globals->haveZconstraints()){ | |
1398 | setupZConstraint(info[k]); | |
1399 | < | myNPTi = new ZConstraint<NPTi<RealIntegrator> >(&(info[k]), the_ff); |
1399 | > | myNPTi = new ZConstraint<NPTi<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1400 | } | |
1401 | else | |
1402 | < | myNPTi = new NPTi<RealIntegrator>(&(info[k]), the_ff); |
1402 | > | myNPTi = new NPTi<NPT<RealIntegrator> >(&(info[k]), the_ff); |
1403 | ||
1404 | myNPTi->setTargetTemp(globals->getTargetTemp()); | |
1405 | ||
# | Line 1419 | Line 1432 | void SimSetup::makeIntegrator(void){ | |
1432 | painCave.isFatal = 1; | |
1433 | simError(); | |
1434 | } | |
1435 | + | |
1436 | + | info->the_integrator = myNPTi; |
1437 | break; | |
1438 | ||
1439 | case NPTf_ENS: | |
1440 | if (globals->haveZconstraints()){ | |
1441 | setupZConstraint(info[k]); | |
1442 | < | myNPTf = new ZConstraint<NPTf<RealIntegrator> >(&(info[k]), the_ff); |
1442 | > | myNPTf = new ZConstraint<NPTf<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1443 | } | |
1444 | else | |
1445 | < | myNPTf = new NPTf<RealIntegrator>(&(info[k]), the_ff); |
1445 | > | myNPTf = new NPTf<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1446 | ||
1447 | myNPTf->setTargetTemp(globals->getTargetTemp()); | |
1448 | ||
# | Line 1457 | Line 1472 | void SimSetup::makeIntegrator(void){ | |
1472 | sprintf(painCave.errMsg, | |
1473 | "SimSetup error: If you use an NPT\n" | |
1474 | " ensemble, you must set tauBarostat.\n"); | |
1460 | – | painCave.isFatal = 1; |
1461 | – | simError(); |
1462 | – | } |
1463 | – | break; |
1464 | – | |
1465 | – | case NPTim_ENS: |
1466 | – | if (globals->haveZconstraints()){ |
1467 | – | setupZConstraint(info[k]); |
1468 | – | myNPTim = new ZConstraint<NPTim<RealIntegrator> >(&(info[k]), the_ff); |
1469 | – | } |
1470 | – | else |
1471 | – | myNPTim = new NPTim<RealIntegrator>(&(info[k]), the_ff); |
1472 | – | |
1473 | – | myNPTim->setTargetTemp(globals->getTargetTemp()); |
1474 | – | |
1475 | – | if (globals->haveTargetPressure()) |
1476 | – | myNPTim->setTargetPressure(globals->getTargetPressure()); |
1477 | – | else{ |
1478 | – | sprintf(painCave.errMsg, |
1479 | – | "SimSetup error: If you use a constant pressure\n" |
1480 | – | " ensemble, you must set targetPressure in the BASS file.\n"); |
1475 | painCave.isFatal = 1; | |
1476 | simError(); | |
1477 | } | |
1478 | ||
1479 | < | if (globals->haveTauThermostat()) |
1486 | < | myNPTim->setTauThermostat(globals->getTauThermostat()); |
1487 | < | else{ |
1488 | < | sprintf(painCave.errMsg, |
1489 | < | "SimSetup error: If you use an NPT\n" |
1490 | < | " ensemble, you must set tauThermostat.\n"); |
1491 | < | painCave.isFatal = 1; |
1492 | < | simError(); |
1493 | < | } |
1494 | < | |
1495 | < | if (globals->haveTauBarostat()) |
1496 | < | myNPTim->setTauBarostat(globals->getTauBarostat()); |
1497 | < | else{ |
1498 | < | sprintf(painCave.errMsg, |
1499 | < | "SimSetup error: If you use an NPT\n" |
1500 | < | " ensemble, you must set tauBarostat.\n"); |
1501 | < | painCave.isFatal = 1; |
1502 | < | simError(); |
1503 | < | } |
1479 | > | info->the_integrator = myNPTf; |
1480 | break; | |
1481 | ||
1482 | < | case NPTfm_ENS: |
1482 | > | case NPTxyz_ENS: |
1483 | if (globals->haveZconstraints()){ | |
1484 | setupZConstraint(info[k]); | |
1485 | < | myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >(&(info[k]), the_ff); |
1485 | > | myNPTxyz = new ZConstraint<NPTxyz<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1486 | } | |
1487 | else | |
1488 | < | myNPTfm = new NPTfm<RealIntegrator>(&(info[k]), the_ff); |
1488 | > | myNPTxyz = new NPTxyz<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1489 | ||
1490 | < | myNPTfm->setTargetTemp(globals->getTargetTemp()); |
1490 | > | myNPTxyz->setTargetTemp(globals->getTargetTemp()); |
1491 | ||
1492 | if (globals->haveTargetPressure()) | |
1493 | < | myNPTfm->setTargetPressure(globals->getTargetPressure()); |
1493 | > | myNPTxyz->setTargetPressure(globals->getTargetPressure()); |
1494 | else{ | |
1495 | sprintf(painCave.errMsg, | |
1496 | "SimSetup error: If you use a constant pressure\n" | |
1497 | " ensemble, you must set targetPressure in the BASS file.\n"); | |
1498 | painCave.isFatal = 1; | |
1499 | simError(); | |
1500 | < | } |
1500 | > | } |
1501 | ||
1502 | if (globals->haveTauThermostat()) | |
1503 | < | myNPTfm->setTauThermostat(globals->getTauThermostat()); |
1503 | > | myNPTxyz->setTauThermostat(globals->getTauThermostat()); |
1504 | else{ | |
1505 | sprintf(painCave.errMsg, | |
1506 | "SimSetup error: If you use an NPT\n" | |
# | Line 1534 | Line 1510 | void SimSetup::makeIntegrator(void){ | |
1510 | } | |
1511 | ||
1512 | if (globals->haveTauBarostat()) | |
1513 | < | myNPTfm->setTauBarostat(globals->getTauBarostat()); |
1513 | > | myNPTxyz->setTauBarostat(globals->getTauBarostat()); |
1514 | else{ | |
1515 | sprintf(painCave.errMsg, | |
1516 | "SimSetup error: If you use an NPT\n" | |
# | Line 1542 | Line 1518 | void SimSetup::makeIntegrator(void){ | |
1518 | painCave.isFatal = 1; | |
1519 | simError(); | |
1520 | } | |
1521 | + | |
1522 | + | info->the_integrator = myNPTxyz; |
1523 | break; | |
1524 | ||
1525 | default: | |
# | Line 1615 | Line 1593 | void SimSetup::setupZConstraint(SimInfo& theInfo){ | |
1593 | } | |
1594 | theInfo.addProperty(zconsTol); | |
1595 | ||
1596 | < | //set Force Substraction Policy |
1596 | > | //set Force Subtraction Policy |
1597 | StringData* zconsForcePolicy = new StringData(); | |
1598 | zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID); | |
1599 | ||
# | Line 1624 | Line 1602 | void SimSetup::setupZConstraint(SimInfo& theInfo){ | |
1602 | } | |
1603 | else{ | |
1604 | sprintf(painCave.errMsg, | |
1605 | < | "ZConstraint Warning: User does not set force substraction policy, " |
1606 | < | "average force substraction policy is used\n"); |
1605 | > | "ZConstraint Warning: User does not set force Subtraction policy, " |
1606 | > | "PolicyByMass is used\n"); |
1607 | painCave.isFatal = 0; | |
1608 | simError(); | |
1609 | < | zconsForcePolicy->setData("BYNUMBER"); |
1609 | > | zconsForcePolicy->setData("BYMASS"); |
1610 | } | |
1611 | ||
1612 | theInfo.addProperty(zconsForcePolicy); | |
# | Line 1666 | Line 1644 | void SimSetup::setupZConstraint(SimInfo& theInfo){ | |
1644 | zconsParaData->addItem(tempParaItem); | |
1645 | } | |
1646 | ||
1647 | + | //check the uniqueness of index |
1648 | + | if(!zconsParaData->isIndexUnique()){ |
1649 | + | sprintf(painCave.errMsg, |
1650 | + | "ZConstraint Error: molIndex is not unique\n"); |
1651 | + | painCave.isFatal = 1; |
1652 | + | simError(); |
1653 | + | } |
1654 | + | |
1655 | //sort the parameters by index of molecules | |
1656 | zconsParaData->sortByIndex(); | |
1657 | < | |
1657 | > | |
1658 | //push data into siminfo, therefore, we can retrieve later | |
1659 | theInfo.addProperty(zconsParaData); | |
1660 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |