| 1 |
|
#include <algorithm> |
| 2 |
< |
#include <cstdlib> |
| 2 |
> |
#include <stdlib.h> |
| 3 |
|
#include <iostream> |
| 4 |
< |
#include <cmath> |
| 4 |
> |
#include <math.h> |
| 5 |
|
#include <string> |
| 6 |
|
#include <sprng.h> |
| 7 |
– |
|
| 7 |
|
#include "SimSetup.hpp" |
| 8 |
|
#include "ReadWrite.hpp" |
| 9 |
|
#include "parse_me.h" |
| 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 |
| 31 |
|
using namespace std; |
| 32 |
|
|
| 33 |
|
SimSetup::SimSetup(){ |
| 34 |
+ |
|
| 35 |
+ |
initSuspend = false; |
| 36 |
|
isInfoArray = 0; |
| 37 |
|
nInfo = 1; |
| 38 |
|
|
| 55 |
|
info = the_info; |
| 56 |
|
nInfo = theNinfo; |
| 57 |
|
isInfoArray = 1; |
| 58 |
+ |
initSuspend = true; |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
|
| 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 |
| 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, " |
| 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){ |
| 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: |