# | Line 4 | Line 4 | |
---|---|---|
4 | #include <cmath> | |
5 | #include <string> | |
6 | #include <sprng.h> | |
7 | – | |
7 | #include "SimSetup.hpp" | |
8 | #include "ReadWrite.hpp" | |
9 | #include "parse_me.h" | |
# | Line 22 | Line 21 | |
21 | #define NVT_ENS 1 | |
22 | #define NPTi_ENS 2 | |
23 | #define NPTf_ENS 3 | |
24 | + | #define NPTxyz_ENS 4 |
25 | ||
26 | + | |
27 | #define FF_DUFF 0 | |
28 | #define FF_LJ 1 | |
29 | #define FF_EAM 2 | |
# | Line 30 | Line 31 | SimSetup::SimSetup(){ | |
31 | using namespace std; | |
32 | ||
33 | SimSetup::SimSetup(){ | |
34 | + | |
35 | + | initSuspend = false; |
36 | isInfoArray = 0; | |
37 | nInfo = 1; | |
38 | ||
# | Line 52 | Line 55 | void SimSetup::setSimInfo(SimInfo* the_info, int theNi | |
55 | info = the_info; | |
56 | nInfo = theNinfo; | |
57 | isInfoArray = 1; | |
58 | + | initSuspend = true; |
59 | } | |
60 | ||
61 | ||
# | Line 90 | Line 94 | void SimSetup::createSim(void){ | |
94 | #endif // is_mpi | |
95 | ||
96 | void SimSetup::createSim(void){ | |
93 | – | int i, j, k, globalAtomIndex; |
97 | ||
98 | // gather all of the information from the Bass file | |
99 | ||
# | Line 106 | Line 109 | void SimSetup::createSim(void){ | |
109 | ||
110 | // initialize the system coordinates | |
111 | ||
112 | < | if (!isInfoArray){ |
112 | > | if ( !initSuspend ){ |
113 | initSystemCoords(); | |
114 | + | |
115 | + | if( !(globals->getUseInitTime()) ) |
116 | + | info[0].currentTime = 0.0; |
117 | } | |
118 | ||
119 | // make the output filenames | |
# | Line 129 | Line 135 | void SimSetup::makeMolecules(void){ | |
135 | ||
136 | ||
137 | void SimSetup::makeMolecules(void){ | |
138 | < | int k, l; |
138 | > | int k; |
139 | int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset; | |
140 | molInit molInfo; | |
141 | DirectionalAtom* dAtom; | |
# | Line 551 | Line 557 | void SimSetup::gatherInfo(void){ | |
557 | ||
558 | ||
559 | void SimSetup::gatherInfo(void){ | |
560 | < | int i, j, k; |
560 | > | int i; |
561 | ||
562 | ensembleCase = -1; | |
563 | ffCase = -1; | |
# | Line 602 | Line 608 | void SimSetup::gatherInfo(void){ | |
608 | else if (!strcasecmp(ensemble, "NPTf")){ | |
609 | ensembleCase = NPTf_ENS; | |
610 | } | |
611 | + | else if (!strcasecmp(ensemble, "NPTxyz")){ |
612 | + | ensembleCase = NPTxyz_ENS; |
613 | + | } |
614 | else{ | |
615 | sprintf(painCave.errMsg, | |
616 | "SimSetup Warning. Unrecognized Ensemble -> %s, " | |
# | Line 914 | Line 923 | void SimSetup::initSystemCoords(void){ | |
923 | if (worldRank == 0){ | |
924 | #endif //is_mpi | |
925 | inName = globals->getInitialConfig(); | |
917 | – | double* tempDouble = new double[1000000]; |
926 | fileInit = new InitializeFromFile(inName); | |
927 | #ifdef IS_MPI | |
928 | } | |
# | Line 932 | Line 940 | void SimSetup::initSystemCoords(void){ | |
940 | ||
941 | sprintf(painCave.errMsg, | |
942 | "Cannot intialize a parallel simulation without an initial configuration file.\n"); | |
943 | < | painCave.isFatal; |
943 | > | painCave.isFatal = 1;; |
944 | simError(); | |
945 | ||
946 | #else | |
# | Line 1158 | Line 1166 | void SimSetup::calcSysValues(void){ | |
1166 | } | |
1167 | ||
1168 | void SimSetup::calcSysValues(void){ | |
1169 | < | int i, j, k; |
1169 | > | int i; |
1170 | ||
1171 | int* molMembershipArray; | |
1172 | ||
# | Line 1257 | Line 1265 | void SimSetup::makeSysArrays(void){ | |
1265 | ||
1266 | ||
1267 | void SimSetup::makeSysArrays(void){ | |
1268 | < | int i, j, k, l; |
1268 | > | |
1269 | > | #ifndef IS_MPI |
1270 | > | int k, j; |
1271 | > | #endif // is_mpi |
1272 | > | int i, l; |
1273 | ||
1274 | Atom** the_atoms; | |
1275 | Molecule* the_molecules; | |
# | Line 1344 | Line 1356 | void SimSetup::makeIntegrator(void){ | |
1356 | NVT<RealIntegrator>* myNVT = NULL; | |
1357 | NPTi<NPT<RealIntegrator> >* myNPTi = NULL; | |
1358 | NPTf<NPT<RealIntegrator> >* myNPTf = NULL; | |
1359 | + | NPTxyz<NPT<RealIntegrator> >* myNPTxyz = NULL; |
1360 | ||
1361 | for (k = 0; k < nInfo; k++){ | |
1362 | switch (ensembleCase){ | |
# | Line 1466 | Line 1479 | void SimSetup::makeIntegrator(void){ | |
1479 | } | |
1480 | ||
1481 | info->the_integrator = myNPTf; | |
1482 | + | break; |
1483 | + | |
1484 | + | case NPTxyz_ENS: |
1485 | + | if (globals->haveZconstraints()){ |
1486 | + | setupZConstraint(info[k]); |
1487 | + | myNPTxyz = new ZConstraint<NPTxyz<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1488 | + | } |
1489 | + | else |
1490 | + | myNPTxyz = new NPTxyz<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1491 | + | |
1492 | + | myNPTxyz->setTargetTemp(globals->getTargetTemp()); |
1493 | + | |
1494 | + | if (globals->haveTargetPressure()) |
1495 | + | myNPTxyz->setTargetPressure(globals->getTargetPressure()); |
1496 | + | else{ |
1497 | + | sprintf(painCave.errMsg, |
1498 | + | "SimSetup error: If you use a constant pressure\n" |
1499 | + | " ensemble, you must set targetPressure in the BASS file.\n"); |
1500 | + | painCave.isFatal = 1; |
1501 | + | simError(); |
1502 | + | } |
1503 | + | |
1504 | + | if (globals->haveTauThermostat()) |
1505 | + | myNPTxyz->setTauThermostat(globals->getTauThermostat()); |
1506 | + | else{ |
1507 | + | sprintf(painCave.errMsg, |
1508 | + | "SimSetup error: If you use an NPT\n" |
1509 | + | " ensemble, you must set tauThermostat.\n"); |
1510 | + | painCave.isFatal = 1; |
1511 | + | simError(); |
1512 | + | } |
1513 | + | |
1514 | + | if (globals->haveTauBarostat()) |
1515 | + | myNPTxyz->setTauBarostat(globals->getTauBarostat()); |
1516 | + | else{ |
1517 | + | sprintf(painCave.errMsg, |
1518 | + | "SimSetup error: If you use an NPT\n" |
1519 | + | " ensemble, you must set tauBarostat.\n"); |
1520 | + | painCave.isFatal = 1; |
1521 | + | simError(); |
1522 | + | } |
1523 | + | |
1524 | + | info->the_integrator = myNPTxyz; |
1525 | break; | |
1526 | ||
1527 | default: |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |