1 |
< |
#include <algorithm> |
2 |
< |
#include <cstdlib> |
1 |
> |
#include <stdlib.h> |
2 |
|
#include <iostream> |
3 |
< |
#include <cmath> |
4 |
< |
#include <string> |
3 |
> |
#include <math.h> |
4 |
> |
#include <string.h> |
5 |
|
#include <sprng.h> |
6 |
|
|
7 |
|
#include "SimSetup.hpp" |
21 |
|
#define NVT_ENS 1 |
22 |
|
#define NPTi_ENS 2 |
23 |
|
#define NPTf_ENS 3 |
24 |
< |
#define NPTim_ENS 4 |
26 |
< |
#define NPTfm_ENS 5 |
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 |
|
|
94 |
|
#endif // is_mpi |
95 |
|
|
96 |
|
void SimSetup::createSim(void){ |
95 |
– |
int i, j, k, globalAtomIndex; |
97 |
|
|
98 |
|
// gather all of the information from the Bass file |
99 |
|
|
103 |
|
|
104 |
|
sysObjectsCreation(); |
105 |
|
|
105 |
– |
// check on the post processing info |
106 |
– |
|
107 |
– |
finalInfoCheck(); |
108 |
– |
|
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 |
|
|
121 |
|
makeOutNames(); |
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; |
557 |
|
|
558 |
|
|
559 |
|
void SimSetup::gatherInfo(void){ |
560 |
< |
int i, j, k; |
560 |
> |
int i; |
561 |
|
|
562 |
|
ensembleCase = -1; |
563 |
|
ffCase = -1; |
608 |
|
else if (!strcasecmp(ensemble, "NPTf")){ |
609 |
|
ensembleCase = NPTf_ENS; |
610 |
|
} |
611 |
< |
else if (!strcasecmp(ensemble, "NPTim")){ |
612 |
< |
ensembleCase = NPTim_ENS; |
611 |
> |
else if (!strcasecmp(ensemble, "NPTxyz")){ |
612 |
> |
ensembleCase = NPTxyz_ENS; |
613 |
|
} |
610 |
– |
else if (!strcasecmp(ensemble, "NPTfm")){ |
611 |
– |
ensembleCase = NPTfm_ENS; |
612 |
– |
} |
614 |
|
else{ |
615 |
|
sprintf(painCave.errMsg, |
616 |
|
"SimSetup Warning. Unrecognized Ensemble -> %s, " |
689 |
|
info[i].thermalTime = globals->getThermalTime(); |
690 |
|
} |
691 |
|
|
692 |
< |
// check for the temperature set flag |
692 |
> |
info[i].resetIntegrator = 0; |
693 |
> |
if( globals->haveResetTime() ){ |
694 |
> |
info[i].resetTime = globals->getResetTime(); |
695 |
> |
info[i].resetIntegrator = 1; |
696 |
> |
} |
697 |
|
|
698 |
+ |
// check for the temperature set flag |
699 |
+ |
|
700 |
|
if (globals->haveTempSet()) |
701 |
|
info[i].setTemp = globals->getTempSet(); |
702 |
< |
|
696 |
< |
// get some of the tricky things that may still be in the globals |
697 |
< |
|
698 |
< |
double boxVector[3]; |
699 |
< |
if (globals->haveBox()){ |
700 |
< |
boxVector[0] = globals->getBox(); |
701 |
< |
boxVector[1] = globals->getBox(); |
702 |
< |
boxVector[2] = globals->getBox(); |
703 |
< |
|
704 |
< |
info[i].setBox(boxVector); |
705 |
< |
} |
706 |
< |
else if (globals->haveDensity()){ |
707 |
< |
double vol; |
708 |
< |
vol = (double) tot_nmol / globals->getDensity(); |
709 |
< |
boxVector[0] = pow(vol, (1.0 / 3.0)); |
710 |
< |
boxVector[1] = boxVector[0]; |
711 |
< |
boxVector[2] = boxVector[0]; |
712 |
< |
|
713 |
< |
info[i].setBox(boxVector); |
714 |
< |
} |
715 |
< |
else{ |
716 |
< |
if (!globals->haveBoxX()){ |
717 |
< |
sprintf(painCave.errMsg, |
718 |
< |
"SimSetup error, no periodic BoxX size given.\n"); |
719 |
< |
painCave.isFatal = 1; |
720 |
< |
simError(); |
721 |
< |
} |
722 |
< |
boxVector[0] = globals->getBoxX(); |
723 |
< |
|
724 |
< |
if (!globals->haveBoxY()){ |
725 |
< |
sprintf(painCave.errMsg, |
726 |
< |
"SimSetup error, no periodic BoxY size given.\n"); |
727 |
< |
painCave.isFatal = 1; |
728 |
< |
simError(); |
729 |
< |
} |
730 |
< |
boxVector[1] = globals->getBoxY(); |
731 |
< |
|
732 |
< |
if (!globals->haveBoxZ()){ |
733 |
< |
sprintf(painCave.errMsg, |
734 |
< |
"SimSetup error, no periodic BoxZ size given.\n"); |
735 |
< |
painCave.isFatal = 1; |
736 |
< |
simError(); |
737 |
< |
} |
738 |
< |
boxVector[2] = globals->getBoxZ(); |
739 |
< |
|
740 |
< |
info[i].setBox(boxVector); |
741 |
< |
} |
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 |
878 |
|
if (worldRank == 0){ |
879 |
|
#endif //is_mpi |
880 |
|
inName = globals->getInitialConfig(); |
919 |
– |
double* tempDouble = new double[1000000]; |
881 |
|
fileInit = new InitializeFromFile(inName); |
882 |
|
#ifdef IS_MPI |
883 |
|
} |
895 |
|
|
896 |
|
sprintf(painCave.errMsg, |
897 |
|
"Cannot intialize a parallel simulation without an initial configuration file.\n"); |
898 |
< |
painCave.isFatal; |
898 |
> |
painCave.isFatal = 1;; |
899 |
|
simError(); |
900 |
|
|
901 |
|
#else |
1121 |
|
} |
1122 |
|
|
1123 |
|
void SimSetup::calcSysValues(void){ |
1124 |
< |
int i, j, k; |
1124 |
> |
int i; |
1125 |
|
|
1126 |
|
int* molMembershipArray; |
1127 |
|
|
1220 |
|
|
1221 |
|
|
1222 |
|
void SimSetup::makeSysArrays(void){ |
1223 |
< |
int i, j, k, l; |
1223 |
> |
|
1224 |
> |
#ifndef IS_MPI |
1225 |
> |
int k, j; |
1226 |
> |
#endif // is_mpi |
1227 |
> |
int i, l; |
1228 |
|
|
1229 |
|
Atom** the_atoms; |
1230 |
|
Molecule* the_molecules; |
1307 |
|
void SimSetup::makeIntegrator(void){ |
1308 |
|
int k; |
1309 |
|
|
1310 |
< |
NVT<RealIntegrator>* myNVT = NULL; |
1311 |
< |
NPTi<RealIntegrator>* myNPTi = NULL; |
1312 |
< |
NPTf<RealIntegrator>* myNPTf = NULL; |
1313 |
< |
NPTim<RealIntegrator>* myNPTim = NULL; |
1314 |
< |
NPTfm<RealIntegrator>* myNPTfm = 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()){ |
1320 |
< |
setupZConstraint(info[k]); |
1321 |
< |
new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1322 |
< |
} |
1323 |
< |
else |
1324 |
< |
new NVE<RealIntegrator>(&(info[k]), the_ff); |
1325 |
< |
break; |
1326 |
< |
|
1327 |
< |
case NVT_ENS: |
1328 |
< |
if (globals->haveZconstraints()){ |
1329 |
< |
setupZConstraint(info[k]); |
1330 |
< |
myNVT = new ZConstraint<NVT<RealIntegrator> >(&(info[k]), the_ff); |
1331 |
< |
} |
1332 |
< |
else |
1333 |
< |
myNVT = new NVT<RealIntegrator>(&(info[k]), the_ff); |
1334 |
< |
|
1335 |
< |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1336 |
< |
|
1337 |
< |
if (globals->haveTauThermostat()) |
1338 |
< |
myNVT->setTauThermostat(globals->getTauThermostat()); |
1339 |
< |
else{ |
1340 |
< |
sprintf(painCave.errMsg, |
1341 |
< |
"SimSetup error: If you use the NVT\n" |
1342 |
< |
" ensemble, you must set tauThermostat.\n"); |
1343 |
< |
painCave.isFatal = 1; |
1344 |
< |
simError(); |
1345 |
< |
} |
1346 |
< |
break; |
1347 |
< |
|
1348 |
< |
case NPTi_ENS: |
1349 |
< |
if (globals->haveZconstraints()){ |
1350 |
< |
setupZConstraint(info[k]); |
1351 |
< |
myNPTi = new ZConstraint<NPTi<RealIntegrator> >(&(info[k]), the_ff); |
1352 |
< |
} |
1353 |
< |
else |
1354 |
< |
myNPTi = new NPTi<RealIntegrator>(&(info[k]), the_ff); |
1355 |
< |
|
1356 |
< |
myNPTi->setTargetTemp(globals->getTargetTemp()); |
1357 |
< |
|
1358 |
< |
if (globals->haveTargetPressure()) |
1359 |
< |
myNPTi->setTargetPressure(globals->getTargetPressure()); |
1360 |
< |
else{ |
1361 |
< |
sprintf(painCave.errMsg, |
1362 |
< |
"SimSetup error: If you use a constant pressure\n" |
1363 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1364 |
< |
painCave.isFatal = 1; |
1365 |
< |
simError(); |
1366 |
< |
} |
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(&(info[k]), the_ff); |
1329 |
> |
// } |
1330 |
> |
|
1331 |
> |
info->the_integrator = myNVE; |
1332 |
> |
break; |
1333 |
> |
|
1334 |
> |
case NVT_ENS: |
1335 |
> |
if (globals->haveZconstraints()){ |
1336 |
> |
|
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(&(info[k]), the_ff); |
1344 |
> |
|
1345 |
> |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1346 |
> |
|
1347 |
> |
if (globals->haveTauThermostat()) |
1348 |
> |
myNVT->setTauThermostat(globals->getTauThermostat()); |
1349 |
> |
else{ |
1350 |
> |
sprintf(painCave.errMsg, |
1351 |
> |
"SimSetup error: If you use the NVT\n" |
1352 |
> |
" ensemble, you must set tauThermostat.\n"); |
1353 |
> |
painCave.isFatal = 1; |
1354 |
> |
simError(); |
1355 |
> |
} |
1356 |
> |
|
1357 |
> |
info->the_integrator = myNVT; |
1358 |
> |
break; |
1359 |
> |
|
1360 |
> |
case NPTi_ENS: |
1361 |
> |
if (globals->haveZconstraints()){ |
1362 |
> |
|
1363 |
> |
std::cerr << "ZConstraint is temporarily disabled\n"; |
1364 |
> |
|
1365 |
> |
// setupZConstraint(info[k]); |
1366 |
> |
// myNPTi = new ZConstraint<NPTi<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1367 |
> |
} |
1368 |
> |
// else |
1369 |
> |
myNPTi = new NPTi(&(info[k]), the_ff); |
1370 |
> |
|
1371 |
> |
myNPTi->setTargetTemp(globals->getTargetTemp()); |
1372 |
> |
|
1373 |
> |
if (globals->haveTargetPressure()) |
1374 |
> |
myNPTi->setTargetPressure(globals->getTargetPressure()); |
1375 |
> |
else{ |
1376 |
> |
sprintf(painCave.errMsg, |
1377 |
> |
"SimSetup error: If you use a constant pressure\n" |
1378 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1379 |
> |
painCave.isFatal = 1; |
1380 |
> |
simError(); |
1381 |
> |
} |
1382 |
> |
|
1383 |
> |
if (globals->haveTauThermostat()) |
1384 |
> |
myNPTi->setTauThermostat(globals->getTauThermostat()); |
1385 |
> |
else{ |
1386 |
> |
sprintf(painCave.errMsg, |
1387 |
> |
"SimSetup error: If you use an NPT\n" |
1388 |
> |
" ensemble, you must set tauThermostat.\n"); |
1389 |
> |
painCave.isFatal = 1; |
1390 |
> |
simError(); |
1391 |
> |
} |
1392 |
> |
|
1393 |
> |
if (globals->haveTauBarostat()) |
1394 |
> |
myNPTi->setTauBarostat(globals->getTauBarostat()); |
1395 |
> |
else{ |
1396 |
> |
sprintf(painCave.errMsg, |
1397 |
> |
"SimSetup error: If you use an NPT\n" |
1398 |
> |
" ensemble, you must set tauBarostat.\n"); |
1399 |
> |
painCave.isFatal = 1; |
1400 |
> |
simError(); |
1401 |
> |
} |
1402 |
> |
|
1403 |
> |
info->the_integrator = myNPTi; |
1404 |
> |
break; |
1405 |
> |
|
1406 |
> |
case NPTf_ENS: |
1407 |
> |
if (globals->haveZconstraints()){ |
1408 |
|
|
1409 |
< |
if (globals->haveTauThermostat()) |
1404 |
< |
myNPTi->setTauThermostat(globals->getTauThermostat()); |
1405 |
< |
else{ |
1406 |
< |
sprintf(painCave.errMsg, |
1407 |
< |
"SimSetup error: If you use an NPT\n" |
1408 |
< |
" ensemble, you must set tauThermostat.\n"); |
1409 |
< |
painCave.isFatal = 1; |
1410 |
< |
simError(); |
1411 |
< |
} |
1409 |
> |
std::cerr << "ZConstraint is temporarily disabled\n"; |
1410 |
|
|
1411 |
< |
if (globals->haveTauBarostat()) |
1412 |
< |
myNPTi->setTauBarostat(globals->getTauBarostat()); |
1413 |
< |
else{ |
1414 |
< |
sprintf(painCave.errMsg, |
1415 |
< |
"SimSetup error: If you use an NPT\n" |
1416 |
< |
" ensemble, you must set tauBarostat.\n"); |
1417 |
< |
painCave.isFatal = 1; |
1418 |
< |
simError(); |
1419 |
< |
} |
1420 |
< |
break; |
1421 |
< |
|
1422 |
< |
case NPTf_ENS: |
1423 |
< |
if (globals->haveZconstraints()){ |
1424 |
< |
setupZConstraint(info[k]); |
1425 |
< |
myNPTf = new ZConstraint<NPTf<RealIntegrator> >(&(info[k]), the_ff); |
1426 |
< |
} |
1427 |
< |
else |
1428 |
< |
myNPTf = new NPTf<RealIntegrator>(&(info[k]), the_ff); |
1429 |
< |
|
1430 |
< |
myNPTf->setTargetTemp(globals->getTargetTemp()); |
1431 |
< |
|
1432 |
< |
if (globals->haveTargetPressure()) |
1433 |
< |
myNPTf->setTargetPressure(globals->getTargetPressure()); |
1434 |
< |
else{ |
1435 |
< |
sprintf(painCave.errMsg, |
1436 |
< |
"SimSetup error: If you use a constant pressure\n" |
1437 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1438 |
< |
painCave.isFatal = 1; |
1439 |
< |
simError(); |
1440 |
< |
} |
1441 |
< |
|
1442 |
< |
if (globals->haveTauThermostat()) |
1443 |
< |
myNPTf->setTauThermostat(globals->getTauThermostat()); |
1444 |
< |
else{ |
1445 |
< |
sprintf(painCave.errMsg, |
1446 |
< |
"SimSetup error: If you use an NPT\n" |
1447 |
< |
" ensemble, you must set tauThermostat.\n"); |
1448 |
< |
painCave.isFatal = 1; |
1449 |
< |
simError(); |
1450 |
< |
} |
1451 |
< |
|
1452 |
< |
if (globals->haveTauBarostat()) |
1453 |
< |
myNPTf->setTauBarostat(globals->getTauBarostat()); |
1454 |
< |
else{ |
1455 |
< |
sprintf(painCave.errMsg, |
1456 |
< |
"SimSetup error: If you use an NPT\n" |
1457 |
< |
" ensemble, you must set tauBarostat.\n"); |
1458 |
< |
painCave.isFatal = 1; |
1459 |
< |
simError(); |
1460 |
< |
} |
1461 |
< |
break; |
1462 |
< |
|
1463 |
< |
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"); |
1481 |
< |
painCave.isFatal = 1; |
1482 |
< |
simError(); |
1483 |
< |
} |
1484 |
< |
|
1485 |
< |
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 |
< |
} |
1411 |
> |
// setupZConstraint(info[k]); |
1412 |
> |
// myNPTf = new ZConstraint<NPTf<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1413 |
> |
} |
1414 |
> |
// else |
1415 |
> |
myNPTf = new NPTf(&(info[k]), the_ff); |
1416 |
> |
|
1417 |
> |
myNPTf->setTargetTemp(globals->getTargetTemp()); |
1418 |
> |
|
1419 |
> |
if (globals->haveTargetPressure()) |
1420 |
> |
myNPTf->setTargetPressure(globals->getTargetPressure()); |
1421 |
> |
else{ |
1422 |
> |
sprintf(painCave.errMsg, |
1423 |
> |
"SimSetup error: If you use a constant pressure\n" |
1424 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1425 |
> |
painCave.isFatal = 1; |
1426 |
> |
simError(); |
1427 |
> |
} |
1428 |
> |
|
1429 |
> |
if (globals->haveTauThermostat()) |
1430 |
> |
myNPTf->setTauThermostat(globals->getTauThermostat()); |
1431 |
> |
|
1432 |
> |
else{ |
1433 |
> |
sprintf(painCave.errMsg, |
1434 |
> |
"SimSetup error: If you use an NPT\n" |
1435 |
> |
" ensemble, you must set tauThermostat.\n"); |
1436 |
> |
painCave.isFatal = 1; |
1437 |
> |
simError(); |
1438 |
> |
} |
1439 |
> |
|
1440 |
> |
if (globals->haveTauBarostat()) |
1441 |
> |
myNPTf->setTauBarostat(globals->getTauBarostat()); |
1442 |
> |
|
1443 |
> |
else{ |
1444 |
> |
sprintf(painCave.errMsg, |
1445 |
> |
"SimSetup error: If you use an NPT\n" |
1446 |
> |
" ensemble, you must set tauBarostat.\n"); |
1447 |
> |
painCave.isFatal = 1; |
1448 |
> |
simError(); |
1449 |
> |
} |
1450 |
> |
|
1451 |
> |
info->the_integrator = myNPTf; |
1452 |
> |
break; |
1453 |
> |
|
1454 |
> |
case NPTxyz_ENS: |
1455 |
> |
if (globals->haveZconstraints()){ |
1456 |
> |
|
1457 |
> |
std::cerr << "ZConstraint is temporarily disabled\n"; |
1458 |
> |
|
1459 |
> |
// setupZConstraint(info[k]); |
1460 |
> |
// myNPTxyz = new ZConstraint<NPTxyz<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1461 |
> |
} |
1462 |
> |
// else |
1463 |
> |
myNPTxyz = new NPTxyz(&(info[k]), the_ff); |
1464 |
|
|
1465 |
< |
if (globals->haveTauBarostat()) |
1466 |
< |
myNPTim->setTauBarostat(globals->getTauBarostat()); |
1467 |
< |
else{ |
1468 |
< |
sprintf(painCave.errMsg, |
1469 |
< |
"SimSetup error: If you use an NPT\n" |
1470 |
< |
" ensemble, you must set tauBarostat.\n"); |
1471 |
< |
painCave.isFatal = 1; |
1472 |
< |
simError(); |
1473 |
< |
} |
1474 |
< |
break; |
1475 |
< |
|
1476 |
< |
case NPTfm_ENS: |
1477 |
< |
if (globals->haveZconstraints()){ |
1478 |
< |
setupZConstraint(info[k]); |
1479 |
< |
myNPTfm = new ZConstraint<NPTfm<RealIntegrator> >(&(info[k]), the_ff); |
1480 |
< |
} |
1481 |
< |
else |
1482 |
< |
myNPTfm = new NPTfm<RealIntegrator>(&(info[k]), the_ff); |
1483 |
< |
|
1484 |
< |
myNPTfm->setTargetTemp(globals->getTargetTemp()); |
1485 |
< |
|
1486 |
< |
if (globals->haveTargetPressure()) |
1487 |
< |
myNPTfm->setTargetPressure(globals->getTargetPressure()); |
1488 |
< |
else{ |
1489 |
< |
sprintf(painCave.errMsg, |
1490 |
< |
"SimSetup error: If you use a constant pressure\n" |
1491 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1492 |
< |
painCave.isFatal = 1; |
1493 |
< |
simError(); |
1494 |
< |
} |
1495 |
< |
|
1496 |
< |
if (globals->haveTauThermostat()) |
1497 |
< |
myNPTfm->setTauThermostat(globals->getTauThermostat()); |
1498 |
< |
else{ |
1499 |
< |
sprintf(painCave.errMsg, |
1500 |
< |
"SimSetup error: If you use an NPT\n" |
1501 |
< |
" ensemble, you must set tauThermostat.\n"); |
1502 |
< |
painCave.isFatal = 1; |
1503 |
< |
simError(); |
1504 |
< |
} |
1535 |
< |
|
1536 |
< |
if (globals->haveTauBarostat()) |
1537 |
< |
myNPTfm->setTauBarostat(globals->getTauBarostat()); |
1538 |
< |
else{ |
1539 |
< |
sprintf(painCave.errMsg, |
1540 |
< |
"SimSetup error: If you use an NPT\n" |
1541 |
< |
" ensemble, you must set tauBarostat.\n"); |
1542 |
< |
painCave.isFatal = 1; |
1543 |
< |
simError(); |
1544 |
< |
} |
1545 |
< |
break; |
1546 |
< |
|
1547 |
< |
default: |
1548 |
< |
sprintf(painCave.errMsg, |
1549 |
< |
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1550 |
< |
painCave.isFatal = 1; |
1551 |
< |
simError(); |
1465 |
> |
myNPTxyz->setTargetTemp(globals->getTargetTemp()); |
1466 |
> |
|
1467 |
> |
if (globals->haveTargetPressure()) |
1468 |
> |
myNPTxyz->setTargetPressure(globals->getTargetPressure()); |
1469 |
> |
else{ |
1470 |
> |
sprintf(painCave.errMsg, |
1471 |
> |
"SimSetup error: If you use a constant pressure\n" |
1472 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1473 |
> |
painCave.isFatal = 1; |
1474 |
> |
simError(); |
1475 |
> |
} |
1476 |
> |
|
1477 |
> |
if (globals->haveTauThermostat()) |
1478 |
> |
myNPTxyz->setTauThermostat(globals->getTauThermostat()); |
1479 |
> |
else{ |
1480 |
> |
sprintf(painCave.errMsg, |
1481 |
> |
"SimSetup error: If you use an NPT\n" |
1482 |
> |
" ensemble, you must set tauThermostat.\n"); |
1483 |
> |
painCave.isFatal = 1; |
1484 |
> |
simError(); |
1485 |
> |
} |
1486 |
> |
|
1487 |
> |
if (globals->haveTauBarostat()) |
1488 |
> |
myNPTxyz->setTauBarostat(globals->getTauBarostat()); |
1489 |
> |
else{ |
1490 |
> |
sprintf(painCave.errMsg, |
1491 |
> |
"SimSetup error: If you use an NPT\n" |
1492 |
> |
" ensemble, you must set tauBarostat.\n"); |
1493 |
> |
painCave.isFatal = 1; |
1494 |
> |
simError(); |
1495 |
> |
} |
1496 |
> |
|
1497 |
> |
info->the_integrator = myNPTxyz; |
1498 |
> |
break; |
1499 |
> |
|
1500 |
> |
default: |
1501 |
> |
sprintf(painCave.errMsg, |
1502 |
> |
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1503 |
> |
painCave.isFatal = 1; |
1504 |
> |
simError(); |
1505 |
|
} |
1506 |
|
} |
1507 |
|
} |
1529 |
|
#endif // is_mpi |
1530 |
|
} |
1531 |
|
|
1532 |
< |
void SimSetup::setupZConstraint(SimInfo& theInfo){ |
1533 |
< |
int nZConstraints; |
1534 |
< |
ZconStamp** zconStamp; |
1532 |
> |
// void SimSetup::setupZConstraint(SimInfo& theInfo){ |
1533 |
> |
// int nZConstraints; |
1534 |
> |
// ZconStamp** zconStamp; |
1535 |
|
|
1536 |
< |
if (globals->haveZconstraintTime()){ |
1537 |
< |
//add sample time of z-constraint into SimInfo's property list |
1538 |
< |
DoubleData* zconsTimeProp = new DoubleData(); |
1539 |
< |
zconsTimeProp->setID(ZCONSTIME_ID); |
1540 |
< |
zconsTimeProp->setData(globals->getZconsTime()); |
1541 |
< |
theInfo.addProperty(zconsTimeProp); |
1542 |
< |
} |
1543 |
< |
else{ |
1544 |
< |
sprintf(painCave.errMsg, |
1545 |
< |
"ZConstraint error: If you use an ZConstraint\n" |
1546 |
< |
" , you must set sample time.\n"); |
1547 |
< |
painCave.isFatal = 1; |
1548 |
< |
simError(); |
1549 |
< |
} |
1536 |
> |
// if (globals->haveZconstraintTime()){ |
1537 |
> |
// //add sample time of z-constraint into SimInfo's property list |
1538 |
> |
// DoubleData* zconsTimeProp = new DoubleData(); |
1539 |
> |
// zconsTimeProp->setID(ZCONSTIME_ID); |
1540 |
> |
// zconsTimeProp->setData(globals->getZconsTime()); |
1541 |
> |
// theInfo.addProperty(zconsTimeProp); |
1542 |
> |
// } |
1543 |
> |
// else{ |
1544 |
> |
// sprintf(painCave.errMsg, |
1545 |
> |
// "ZConstraint error: If you use an ZConstraint\n" |
1546 |
> |
// " , you must set sample time.\n"); |
1547 |
> |
// painCave.isFatal = 1; |
1548 |
> |
// simError(); |
1549 |
> |
// } |
1550 |
|
|
1551 |
< |
//push zconsTol into siminfo, if user does not specify |
1552 |
< |
//value for zconsTol, a default value will be used |
1553 |
< |
DoubleData* zconsTol = new DoubleData(); |
1554 |
< |
zconsTol->setID(ZCONSTOL_ID); |
1555 |
< |
if (globals->haveZconsTol()){ |
1556 |
< |
zconsTol->setData(globals->getZconsTol()); |
1557 |
< |
} |
1558 |
< |
else{ |
1559 |
< |
double defaultZConsTol = 0.01; |
1560 |
< |
sprintf(painCave.errMsg, |
1561 |
< |
"ZConstraint Waring: Tolerance for z-constraint methodl is not specified\n" |
1562 |
< |
" , default value %f is used.\n", |
1563 |
< |
defaultZConsTol); |
1564 |
< |
painCave.isFatal = 0; |
1565 |
< |
simError(); |
1551 |
> |
// //push zconsTol into siminfo, if user does not specify |
1552 |
> |
// //value for zconsTol, a default value will be used |
1553 |
> |
// DoubleData* zconsTol = new DoubleData(); |
1554 |
> |
// zconsTol->setID(ZCONSTOL_ID); |
1555 |
> |
// if (globals->haveZconsTol()){ |
1556 |
> |
// zconsTol->setData(globals->getZconsTol()); |
1557 |
> |
// } |
1558 |
> |
// else{ |
1559 |
> |
// double defaultZConsTol = 0.01; |
1560 |
> |
// sprintf(painCave.errMsg, |
1561 |
> |
// "ZConstraint Waring: Tolerance for z-constraint methodl is not specified\n" |
1562 |
> |
// " , default value %f is used.\n", |
1563 |
> |
// defaultZConsTol); |
1564 |
> |
// painCave.isFatal = 0; |
1565 |
> |
// simError(); |
1566 |
|
|
1567 |
< |
zconsTol->setData(defaultZConsTol); |
1568 |
< |
} |
1569 |
< |
theInfo.addProperty(zconsTol); |
1567 |
> |
// zconsTol->setData(defaultZConsTol); |
1568 |
> |
// } |
1569 |
> |
// theInfo.addProperty(zconsTol); |
1570 |
|
|
1571 |
< |
//set Force Substraction Policy |
1572 |
< |
StringData* zconsForcePolicy = new StringData(); |
1573 |
< |
zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID); |
1571 |
> |
// //set Force Subtraction Policy |
1572 |
> |
// StringData* zconsForcePolicy = new StringData(); |
1573 |
> |
// zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID); |
1574 |
|
|
1575 |
< |
if (globals->haveZconsForcePolicy()){ |
1576 |
< |
zconsForcePolicy->setData(globals->getZconsForcePolicy()); |
1577 |
< |
} |
1578 |
< |
else{ |
1579 |
< |
sprintf(painCave.errMsg, |
1580 |
< |
"ZConstraint Warning: User does not set force substraction policy, " |
1581 |
< |
"PolicyByMass is used\n"); |
1582 |
< |
painCave.isFatal = 0; |
1583 |
< |
simError(); |
1584 |
< |
zconsForcePolicy->setData("BYMASS"); |
1585 |
< |
} |
1575 |
> |
// if (globals->haveZconsForcePolicy()){ |
1576 |
> |
// zconsForcePolicy->setData(globals->getZconsForcePolicy()); |
1577 |
> |
// } |
1578 |
> |
// else{ |
1579 |
> |
// sprintf(painCave.errMsg, |
1580 |
> |
// "ZConstraint Warning: User does not set force Subtraction policy, " |
1581 |
> |
// "PolicyByMass is used\n"); |
1582 |
> |
// painCave.isFatal = 0; |
1583 |
> |
// simError(); |
1584 |
> |
// zconsForcePolicy->setData("BYMASS"); |
1585 |
> |
// } |
1586 |
|
|
1587 |
< |
theInfo.addProperty(zconsForcePolicy); |
1587 |
> |
// theInfo.addProperty(zconsForcePolicy); |
1588 |
|
|
1589 |
< |
//Determine the name of ouput file and add it into SimInfo's property list |
1590 |
< |
//Be careful, do not use inFileName, since it is a pointer which |
1591 |
< |
//point to a string at master node, and slave nodes do not contain that string |
1589 |
> |
// //Determine the name of ouput file and add it into SimInfo's property list |
1590 |
> |
// //Be careful, do not use inFileName, since it is a pointer which |
1591 |
> |
// //point to a string at master node, and slave nodes do not contain that string |
1592 |
|
|
1593 |
< |
string zconsOutput(theInfo.finalName); |
1593 |
> |
// string zconsOutput(theInfo.finalName); |
1594 |
|
|
1595 |
< |
zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1595 |
> |
// zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1596 |
|
|
1597 |
< |
StringData* zconsFilename = new StringData(); |
1598 |
< |
zconsFilename->setID(ZCONSFILENAME_ID); |
1599 |
< |
zconsFilename->setData(zconsOutput); |
1597 |
> |
// StringData* zconsFilename = new StringData(); |
1598 |
> |
// zconsFilename->setID(ZCONSFILENAME_ID); |
1599 |
> |
// zconsFilename->setData(zconsOutput); |
1600 |
|
|
1601 |
< |
theInfo.addProperty(zconsFilename); |
1601 |
> |
// theInfo.addProperty(zconsFilename); |
1602 |
|
|
1603 |
< |
//setup index, pos and other parameters of z-constraint molecules |
1604 |
< |
nZConstraints = globals->getNzConstraints(); |
1605 |
< |
theInfo.nZconstraints = nZConstraints; |
1603 |
> |
// //setup index, pos and other parameters of z-constraint molecules |
1604 |
> |
// nZConstraints = globals->getNzConstraints(); |
1605 |
> |
// theInfo.nZconstraints = nZConstraints; |
1606 |
|
|
1607 |
< |
zconStamp = globals->getZconStamp(); |
1608 |
< |
ZConsParaItem tempParaItem; |
1607 |
> |
// zconStamp = globals->getZconStamp(); |
1608 |
> |
// ZConsParaItem tempParaItem; |
1609 |
|
|
1610 |
< |
ZConsParaData* zconsParaData = new ZConsParaData(); |
1611 |
< |
zconsParaData->setID(ZCONSPARADATA_ID); |
1610 |
> |
// ZConsParaData* zconsParaData = new ZConsParaData(); |
1611 |
> |
// zconsParaData->setID(ZCONSPARADATA_ID); |
1612 |
|
|
1613 |
< |
for (int i = 0; i < nZConstraints; i++){ |
1614 |
< |
tempParaItem.havingZPos = zconStamp[i]->haveZpos(); |
1615 |
< |
tempParaItem.zPos = zconStamp[i]->getZpos(); |
1616 |
< |
tempParaItem.zconsIndex = zconStamp[i]->getMolIndex(); |
1617 |
< |
tempParaItem.kRatio = zconStamp[i]->getKratio(); |
1613 |
> |
// for (int i = 0; i < nZConstraints; i++){ |
1614 |
> |
// tempParaItem.havingZPos = zconStamp[i]->haveZpos(); |
1615 |
> |
// tempParaItem.zPos = zconStamp[i]->getZpos(); |
1616 |
> |
// tempParaItem.zconsIndex = zconStamp[i]->getMolIndex(); |
1617 |
> |
// tempParaItem.kRatio = zconStamp[i]->getKratio(); |
1618 |
|
|
1619 |
< |
zconsParaData->addItem(tempParaItem); |
1620 |
< |
} |
1619 |
> |
// zconsParaData->addItem(tempParaItem); |
1620 |
> |
// } |
1621 |
|
|
1622 |
< |
//check the uniqueness of index |
1623 |
< |
if(!zconsParaData->isIndexUnique()){ |
1624 |
< |
sprintf(painCave.errMsg, |
1625 |
< |
"ZConstraint Error: molIndex is not unique\n"); |
1626 |
< |
painCave.isFatal = 1; |
1627 |
< |
simError(); |
1628 |
< |
} |
1622 |
> |
// //check the uniqueness of index |
1623 |
> |
// if(!zconsParaData->isIndexUnique()){ |
1624 |
> |
// sprintf(painCave.errMsg, |
1625 |
> |
// "ZConstraint Error: molIndex is not unique\n"); |
1626 |
> |
// painCave.isFatal = 1; |
1627 |
> |
// simError(); |
1628 |
> |
// } |
1629 |
|
|
1630 |
< |
//sort the parameters by index of molecules |
1631 |
< |
zconsParaData->sortByIndex(); |
1630 |
> |
// //sort the parameters by index of molecules |
1631 |
> |
// zconsParaData->sortByIndex(); |
1632 |
|
|
1633 |
< |
//push data into siminfo, therefore, we can retrieve later |
1634 |
< |
theInfo.addProperty(zconsParaData); |
1635 |
< |
} |
1633 |
> |
// //push data into siminfo, therefore, we can retrieve later |
1634 |
> |
// theInfo.addProperty(zconsParaData); |
1635 |
> |
// } |