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 |
|
#include "SimSetup.hpp" |
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 |
|
|
103 |
|
|
104 |
|
sysObjectsCreation(); |
105 |
|
|
103 |
– |
// check on the post processing info |
104 |
– |
|
105 |
– |
finalInfoCheck(); |
106 |
– |
|
106 |
|
// initialize the system coordinates |
107 |
|
|
108 |
< |
if (!isInfoArray){ |
108 |
> |
if ( !initSuspend ){ |
109 |
|
initSystemCoords(); |
110 |
|
|
111 |
|
if( !(globals->getUseInitTime()) ) |
112 |
|
info[0].currentTime = 0.0; |
113 |
|
} |
114 |
+ |
|
115 |
+ |
// check on the post processing info |
116 |
+ |
|
117 |
+ |
finalInfoCheck(); |
118 |
|
|
119 |
|
// make the output filenames |
120 |
|
|
696 |
|
} |
697 |
|
|
698 |
|
// check for the temperature set flag |
699 |
< |
|
699 |
> |
|
700 |
|
if (globals->haveTempSet()) |
701 |
|
info[i].setTemp = globals->getTempSet(); |
702 |
< |
|
700 |
< |
// get some of the tricky things that may still be in the globals |
701 |
< |
|
702 |
< |
double boxVector[3]; |
703 |
< |
if (globals->haveBox()){ |
704 |
< |
boxVector[0] = globals->getBox(); |
705 |
< |
boxVector[1] = globals->getBox(); |
706 |
< |
boxVector[2] = globals->getBox(); |
707 |
< |
|
708 |
< |
info[i].setBox(boxVector); |
709 |
< |
} |
710 |
< |
else if (globals->haveDensity()){ |
711 |
< |
double vol; |
712 |
< |
vol = (double) tot_nmol / globals->getDensity(); |
713 |
< |
boxVector[0] = pow(vol, (1.0 / 3.0)); |
714 |
< |
boxVector[1] = boxVector[0]; |
715 |
< |
boxVector[2] = boxVector[0]; |
716 |
< |
|
717 |
< |
info[i].setBox(boxVector); |
718 |
< |
} |
719 |
< |
else{ |
720 |
< |
if (!globals->haveBoxX()){ |
721 |
< |
sprintf(painCave.errMsg, |
722 |
< |
"SimSetup error, no periodic BoxX size given.\n"); |
723 |
< |
painCave.isFatal = 1; |
724 |
< |
simError(); |
725 |
< |
} |
726 |
< |
boxVector[0] = globals->getBoxX(); |
727 |
< |
|
728 |
< |
if (!globals->haveBoxY()){ |
729 |
< |
sprintf(painCave.errMsg, |
730 |
< |
"SimSetup error, no periodic BoxY size given.\n"); |
731 |
< |
painCave.isFatal = 1; |
732 |
< |
simError(); |
733 |
< |
} |
734 |
< |
boxVector[1] = globals->getBoxY(); |
735 |
< |
|
736 |
< |
if (!globals->haveBoxZ()){ |
737 |
< |
sprintf(painCave.errMsg, |
738 |
< |
"SimSetup error, no periodic BoxZ size given.\n"); |
739 |
< |
painCave.isFatal = 1; |
740 |
< |
simError(); |
741 |
< |
} |
742 |
< |
boxVector[2] = globals->getBoxZ(); |
743 |
< |
|
744 |
< |
info[i].setBox(boxVector); |
745 |
< |
} |
702 |
> |
|
703 |
|
} |
704 |
< |
|
704 |
> |
|
705 |
|
//setup seed for random number generator |
706 |
|
int seedValue; |
707 |
|
|
805 |
|
theEst = globals->getEST(); |
806 |
|
} |
807 |
|
|
808 |
< |
info[i].setEcr(theEcr, theEst); |
808 |
> |
info[i].setDefaultEcr(theEcr, theEst); |
809 |
|
|
810 |
|
if (!globals->haveDielectric()){ |
811 |
|
sprintf(painCave.errMsg, |
850 |
|
theEst = globals->getEST(); |
851 |
|
} |
852 |
|
|
853 |
< |
info[i].setEcr(theEcr, theEst); |
853 |
> |
info[i].setDefaultEcr(theEcr, theEst); |
854 |
|
} |
855 |
|
} |
856 |
+ |
info[i].checkCutOffs(); |
857 |
|
} |
858 |
|
|
859 |
|
#ifdef IS_MPI |
1307 |
|
void SimSetup::makeIntegrator(void){ |
1308 |
|
int k; |
1309 |
|
|
1310 |
< |
NVE<RealIntegrator>* myNVE = NULL; |
1311 |
< |
NVT<RealIntegrator>* myNVT = NULL; |
1312 |
< |
NPTi<NPT<RealIntegrator> >* myNPTi = NULL; |
1313 |
< |
NPTf<NPT<RealIntegrator> >* myNPTf = NULL; |
1314 |
< |
NPTxyz<NPT<RealIntegrator> >* myNPTxyz = NULL; |
1310 |
> |
NVE* myNVE = NULL; |
1311 |
> |
NVT* myNVT = NULL; |
1312 |
> |
NPTi* myNPTi = NULL; |
1313 |
> |
NPTf* myNPTf = NULL; |
1314 |
> |
NPTxyz* myNPTxyz = NULL; |
1315 |
|
|
1316 |
|
for (k = 0; k < nInfo; k++){ |
1317 |
|
switch (ensembleCase){ |
1318 |
< |
case NVE_ENS: |
1319 |
< |
if (globals->haveZconstraints()){ |
1362 |
< |
setupZConstraint(info[k]); |
1363 |
< |
myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1364 |
< |
} |
1365 |
< |
else{ |
1366 |
< |
myNVE = new NVE<RealIntegrator>(&(info[k]), the_ff); |
1367 |
< |
} |
1318 |
> |
case NVE_ENS: |
1319 |
> |
if (globals->haveZconstraints()){ |
1320 |
|
|
1321 |
+ |
std::cerr << "ZConstraint is temporarily disabled\n"; |
1322 |
+ |
|
1323 |
+ |
// setupZConstraint(info[k]); |
1324 |
+ |
// myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1325 |
+ |
} |
1326 |
+ |
|
1327 |
+ |
// else{ |
1328 |
+ |
myNVE = new NVE<RealIntegrator>(&(info[k]), the_ff); |
1329 |
+ |
// } |
1330 |
+ |
|
1331 |
|
info->the_integrator = myNVE; |
1332 |
|
break; |
1333 |
+ |
|
1334 |
+ |
case NVT_ENS: |
1335 |
+ |
if (globals->haveZconstraints()){ |
1336 |
|
|
1337 |
< |
case NVT_ENS: |
1338 |
< |
if (globals->haveZconstraints()){ |
1339 |
< |
setupZConstraint(info[k]); |
1340 |
< |
myNVT = new ZConstraint<NVT<RealIntegrator> >(&(info[k]), the_ff); |
1341 |
< |
} |
1337 |
> |
std::cerr << "ZConstraint is temporarily disabled\n"; |
1338 |
> |
|
1339 |
> |
// setupZConstraint(info[k]); |
1340 |
> |
// myNVT = new ZConstraint<NVT<RealIntegrator> >(&(info[k]), the_ff); |
1341 |
> |
} |
1342 |
|
else |
1343 |
|
myNVT = new NVT<RealIntegrator>(&(info[k]), the_ff); |
1344 |
|
|
1422 |
|
|
1423 |
|
if (globals->haveTauThermostat()) |
1424 |
|
myNPTf->setTauThermostat(globals->getTauThermostat()); |
1425 |
+ |
|
1426 |
|
else{ |
1427 |
|
sprintf(painCave.errMsg, |
1428 |
|
"SimSetup error: If you use an NPT\n" |
1433 |
|
|
1434 |
|
if (globals->haveTauBarostat()) |
1435 |
|
myNPTf->setTauBarostat(globals->getTauBarostat()); |
1436 |
+ |
|
1437 |
|
else{ |
1438 |
|
sprintf(painCave.errMsg, |
1439 |
|
"SimSetup error: If you use an NPT\n" |