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 |
|
|
22 |
|
#define NVT_ENS 1 |
23 |
|
#define NPTi_ENS 2 |
24 |
|
#define NPTf_ENS 3 |
25 |
+ |
#define NPTxyz_ENS 4 |
26 |
|
|
27 |
+ |
|
28 |
|
#define FF_DUFF 0 |
29 |
|
#define FF_LJ 1 |
30 |
|
#define FF_EAM 2 |
32 |
|
using namespace std; |
33 |
|
|
34 |
|
SimSetup::SimSetup(){ |
35 |
+ |
|
36 |
+ |
initSuspend = false; |
37 |
|
isInfoArray = 0; |
38 |
|
nInfo = 1; |
39 |
|
|
56 |
|
info = the_info; |
57 |
|
nInfo = theNinfo; |
58 |
|
isInfoArray = 1; |
59 |
+ |
initSuspend = true; |
60 |
|
} |
61 |
|
|
62 |
|
|
104 |
|
|
105 |
|
sysObjectsCreation(); |
106 |
|
|
102 |
– |
// check on the post processing info |
103 |
– |
|
104 |
– |
finalInfoCheck(); |
105 |
– |
|
107 |
|
// initialize the system coordinates |
108 |
|
|
109 |
< |
if (!isInfoArray){ |
109 |
> |
if ( !initSuspend ){ |
110 |
|
initSystemCoords(); |
111 |
|
|
112 |
|
if( !(globals->getUseInitTime()) ) |
113 |
|
info[0].currentTime = 0.0; |
114 |
|
} |
115 |
|
|
116 |
+ |
// check on the post processing info |
117 |
+ |
|
118 |
+ |
finalInfoCheck(); |
119 |
+ |
|
120 |
|
// make the output filenames |
121 |
|
|
122 |
|
makeOutNames(); |
609 |
|
else if (!strcasecmp(ensemble, "NPTf")){ |
610 |
|
ensembleCase = NPTf_ENS; |
611 |
|
} |
612 |
+ |
else if (!strcasecmp(ensemble, "NPTxyz")){ |
613 |
+ |
ensembleCase = NPTxyz_ENS; |
614 |
+ |
} |
615 |
|
else{ |
616 |
|
sprintf(painCave.errMsg, |
617 |
|
"SimSetup Warning. Unrecognized Ensemble -> %s, " |
697 |
|
} |
698 |
|
|
699 |
|
// check for the temperature set flag |
700 |
< |
|
700 |
> |
|
701 |
|
if (globals->haveTempSet()) |
702 |
|
info[i].setTemp = globals->getTempSet(); |
703 |
< |
|
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 |
< |
} |
703 |
> |
|
704 |
|
} |
705 |
< |
|
705 |
> |
|
706 |
|
//setup seed for random number generator |
707 |
|
int seedValue; |
708 |
|
|
806 |
|
theEst = globals->getEST(); |
807 |
|
} |
808 |
|
|
809 |
< |
info[i].setEcr(theEcr, theEst); |
809 |
> |
info[i].setDefaultEcr(theEcr, theEst); |
810 |
|
|
811 |
|
if (!globals->haveDielectric()){ |
812 |
|
sprintf(painCave.errMsg, |
851 |
|
theEst = globals->getEST(); |
852 |
|
} |
853 |
|
|
854 |
< |
info[i].setEcr(theEcr, theEst); |
854 |
> |
info[i].setDefaultEcr(theEcr, theEst); |
855 |
|
} |
856 |
|
} |
857 |
+ |
info[i].checkCutOffs(); |
858 |
|
} |
859 |
|
|
860 |
|
#ifdef IS_MPI |
1308 |
|
void SimSetup::makeIntegrator(void){ |
1309 |
|
int k; |
1310 |
|
|
1311 |
< |
NVE<RealIntegrator>* myNVE = NULL; |
1312 |
< |
NVT<RealIntegrator>* myNVT = NULL; |
1313 |
< |
NPTi<NPT<RealIntegrator> >* myNPTi = NULL; |
1314 |
< |
NPTf<NPT<RealIntegrator> >* myNPTf = NULL; |
1311 |
> |
NVE* myNVE = NULL; |
1312 |
> |
NVT* myNVT = NULL; |
1313 |
> |
NPTi* myNPTi = NULL; |
1314 |
> |
NPTf* myNPTf = NULL; |
1315 |
> |
NPTxyz* myNPTxyz = NULL; |
1316 |
|
|
1317 |
|
for (k = 0; k < nInfo; k++){ |
1318 |
|
switch (ensembleCase){ |
1319 |
< |
case NVE_ENS: |
1320 |
< |
if (globals->haveZconstraints()){ |
1357 |
< |
setupZConstraint(info[k]); |
1358 |
< |
myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1359 |
< |
} |
1360 |
< |
else{ |
1361 |
< |
myNVE = new NVE<RealIntegrator>(&(info[k]), the_ff); |
1362 |
< |
} |
1319 |
> |
case NVE_ENS: |
1320 |
> |
if (globals->haveZconstraints()){ |
1321 |
|
|
1322 |
< |
info->the_integrator = myNVE; |
1323 |
< |
break; |
1324 |
< |
|
1325 |
< |
case NVT_ENS: |
1326 |
< |
if (globals->haveZconstraints()){ |
1327 |
< |
setupZConstraint(info[k]); |
1328 |
< |
myNVT = new ZConstraint<NVT<RealIntegrator> >(&(info[k]), the_ff); |
1329 |
< |
} |
1330 |
< |
else |
1331 |
< |
myNVT = new NVT<RealIntegrator>(&(info[k]), the_ff); |
1332 |
< |
|
1333 |
< |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1334 |
< |
|
1335 |
< |
if (globals->haveTauThermostat()) |
1336 |
< |
myNVT->setTauThermostat(globals->getTauThermostat()); |
1337 |
< |
else{ |
1338 |
< |
sprintf(painCave.errMsg, |
1339 |
< |
"SimSetup error: If you use the NVT\n" |
1340 |
< |
" ensemble, you must set tauThermostat.\n"); |
1341 |
< |
painCave.isFatal = 1; |
1342 |
< |
simError(); |
1343 |
< |
} |
1344 |
< |
|
1345 |
< |
info->the_integrator = myNVT; |
1346 |
< |
break; |
1347 |
< |
|
1348 |
< |
case NPTi_ENS: |
1349 |
< |
if (globals->haveZconstraints()){ |
1350 |
< |
setupZConstraint(info[k]); |
1351 |
< |
myNPTi = new ZConstraint<NPTi<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1352 |
< |
} |
1353 |
< |
else |
1354 |
< |
myNPTi = new NPTi<NPT<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 |
< |
} |
1322 |
> |
std::cerr << "ZConstraint is temporarily disabled\n"; |
1323 |
> |
|
1324 |
> |
// setupZConstraint(info[k]); |
1325 |
> |
// myNVE = new ZConstraint<NVE<RealIntegrator> >(&(info[k]), the_ff); |
1326 |
> |
} |
1327 |
> |
|
1328 |
> |
// else{ |
1329 |
> |
myNVE = new NVE(&(info[k]), the_ff); |
1330 |
> |
// } |
1331 |
> |
|
1332 |
> |
info->the_integrator = myNVE; |
1333 |
> |
break; |
1334 |
> |
|
1335 |
> |
case NVT_ENS: |
1336 |
> |
if (globals->haveZconstraints()){ |
1337 |
> |
|
1338 |
> |
std::cerr << "ZConstraint is temporarily disabled\n"; |
1339 |
> |
|
1340 |
> |
// setupZConstraint(info[k]); |
1341 |
> |
// myNVT = new ZConstraint<NVT<RealIntegrator> >(&(info[k]), the_ff); |
1342 |
> |
} |
1343 |
> |
// else |
1344 |
> |
myNVT = new NVT(&(info[k]), the_ff); |
1345 |
> |
|
1346 |
> |
myNVT->setTargetTemp(globals->getTargetTemp()); |
1347 |
> |
|
1348 |
> |
if (globals->haveTauThermostat()) |
1349 |
> |
myNVT->setTauThermostat(globals->getTauThermostat()); |
1350 |
> |
else{ |
1351 |
> |
sprintf(painCave.errMsg, |
1352 |
> |
"SimSetup error: If you use the NVT\n" |
1353 |
> |
" ensemble, you must set tauThermostat.\n"); |
1354 |
> |
painCave.isFatal = 1; |
1355 |
> |
simError(); |
1356 |
> |
} |
1357 |
> |
|
1358 |
> |
info->the_integrator = myNVT; |
1359 |
> |
break; |
1360 |
> |
|
1361 |
> |
case NPTi_ENS: |
1362 |
> |
if (globals->haveZconstraints()){ |
1363 |
> |
|
1364 |
> |
std::cerr << "ZConstraint is temporarily disabled\n"; |
1365 |
> |
|
1366 |
> |
// setupZConstraint(info[k]); |
1367 |
> |
// myNPTi = new ZConstraint<NPTi<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1368 |
> |
} |
1369 |
> |
// else |
1370 |
> |
myNPTi = new NPTi(&(info[k]), the_ff); |
1371 |
> |
|
1372 |
> |
myNPTi->setTargetTemp(globals->getTargetTemp()); |
1373 |
> |
|
1374 |
> |
if (globals->haveTargetPressure()) |
1375 |
> |
myNPTi->setTargetPressure(globals->getTargetPressure()); |
1376 |
> |
else{ |
1377 |
> |
sprintf(painCave.errMsg, |
1378 |
> |
"SimSetup error: If you use a constant pressure\n" |
1379 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1380 |
> |
painCave.isFatal = 1; |
1381 |
> |
simError(); |
1382 |
> |
} |
1383 |
> |
|
1384 |
> |
if (globals->haveTauThermostat()) |
1385 |
> |
myNPTi->setTauThermostat(globals->getTauThermostat()); |
1386 |
> |
else{ |
1387 |
> |
sprintf(painCave.errMsg, |
1388 |
> |
"SimSetup error: If you use an NPT\n" |
1389 |
> |
" ensemble, you must set tauThermostat.\n"); |
1390 |
> |
painCave.isFatal = 1; |
1391 |
> |
simError(); |
1392 |
> |
} |
1393 |
> |
|
1394 |
> |
if (globals->haveTauBarostat()) |
1395 |
> |
myNPTi->setTauBarostat(globals->getTauBarostat()); |
1396 |
> |
else{ |
1397 |
> |
sprintf(painCave.errMsg, |
1398 |
> |
"SimSetup error: If you use an NPT\n" |
1399 |
> |
" ensemble, you must set tauBarostat.\n"); |
1400 |
> |
painCave.isFatal = 1; |
1401 |
> |
simError(); |
1402 |
> |
} |
1403 |
> |
|
1404 |
> |
info->the_integrator = myNPTi; |
1405 |
> |
break; |
1406 |
> |
|
1407 |
> |
case NPTf_ENS: |
1408 |
> |
if (globals->haveZconstraints()){ |
1409 |
|
|
1410 |
< |
if (globals->haveTauThermostat()) |
1411 |
< |
myNPTi->setTauThermostat(globals->getTauThermostat()); |
1412 |
< |
else{ |
1413 |
< |
sprintf(painCave.errMsg, |
1414 |
< |
"SimSetup error: If you use an NPT\n" |
1415 |
< |
" ensemble, you must set tauThermostat.\n"); |
1416 |
< |
painCave.isFatal = 1; |
1417 |
< |
simError(); |
1418 |
< |
} |
1410 |
> |
std::cerr << "ZConstraint is temporarily disabled\n"; |
1411 |
|
|
1412 |
< |
if (globals->haveTauBarostat()) |
1413 |
< |
myNPTi->setTauBarostat(globals->getTauBarostat()); |
1414 |
< |
else{ |
1415 |
< |
sprintf(painCave.errMsg, |
1416 |
< |
"SimSetup error: If you use an NPT\n" |
1417 |
< |
" ensemble, you must set tauBarostat.\n"); |
1418 |
< |
painCave.isFatal = 1; |
1419 |
< |
simError(); |
1420 |
< |
} |
1421 |
< |
|
1422 |
< |
info->the_integrator = myNPTi; |
1423 |
< |
break; |
1424 |
< |
|
1425 |
< |
case NPTf_ENS: |
1426 |
< |
if (globals->haveZconstraints()){ |
1427 |
< |
setupZConstraint(info[k]); |
1428 |
< |
myNPTf = new ZConstraint<NPTf<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1429 |
< |
} |
1430 |
< |
else |
1431 |
< |
myNPTf = new NPTf<NPT <RealIntegrator> >(&(info[k]), the_ff); |
1432 |
< |
|
1433 |
< |
myNPTf->setTargetTemp(globals->getTargetTemp()); |
1434 |
< |
|
1435 |
< |
if (globals->haveTargetPressure()) |
1436 |
< |
myNPTf->setTargetPressure(globals->getTargetPressure()); |
1437 |
< |
else{ |
1438 |
< |
sprintf(painCave.errMsg, |
1439 |
< |
"SimSetup error: If you use a constant pressure\n" |
1440 |
< |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1441 |
< |
painCave.isFatal = 1; |
1442 |
< |
simError(); |
1443 |
< |
} |
1444 |
< |
|
1445 |
< |
if (globals->haveTauThermostat()) |
1446 |
< |
myNPTf->setTauThermostat(globals->getTauThermostat()); |
1447 |
< |
else{ |
1448 |
< |
sprintf(painCave.errMsg, |
1449 |
< |
"SimSetup error: If you use an NPT\n" |
1450 |
< |
" ensemble, you must set tauThermostat.\n"); |
1451 |
< |
painCave.isFatal = 1; |
1452 |
< |
simError(); |
1453 |
< |
} |
1454 |
< |
|
1455 |
< |
if (globals->haveTauBarostat()) |
1456 |
< |
myNPTf->setTauBarostat(globals->getTauBarostat()); |
1457 |
< |
else{ |
1458 |
< |
sprintf(painCave.errMsg, |
1459 |
< |
"SimSetup error: If you use an NPT\n" |
1460 |
< |
" ensemble, you must set tauBarostat.\n"); |
1461 |
< |
painCave.isFatal = 1; |
1462 |
< |
simError(); |
1463 |
< |
} |
1464 |
< |
|
1473 |
< |
info->the_integrator = myNPTf; |
1474 |
< |
break; |
1412 |
> |
// setupZConstraint(info[k]); |
1413 |
> |
// myNPTf = new ZConstraint<NPTf<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1414 |
> |
} |
1415 |
> |
// else |
1416 |
> |
myNPTf = new NPTf(&(info[k]), the_ff); |
1417 |
> |
|
1418 |
> |
myNPTf->setTargetTemp(globals->getTargetTemp()); |
1419 |
> |
|
1420 |
> |
if (globals->haveTargetPressure()) |
1421 |
> |
myNPTf->setTargetPressure(globals->getTargetPressure()); |
1422 |
> |
else{ |
1423 |
> |
sprintf(painCave.errMsg, |
1424 |
> |
"SimSetup error: If you use a constant pressure\n" |
1425 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1426 |
> |
painCave.isFatal = 1; |
1427 |
> |
simError(); |
1428 |
> |
} |
1429 |
> |
|
1430 |
> |
if (globals->haveTauThermostat()) |
1431 |
> |
myNPTf->setTauThermostat(globals->getTauThermostat()); |
1432 |
> |
|
1433 |
> |
else{ |
1434 |
> |
sprintf(painCave.errMsg, |
1435 |
> |
"SimSetup error: If you use an NPT\n" |
1436 |
> |
" ensemble, you must set tauThermostat.\n"); |
1437 |
> |
painCave.isFatal = 1; |
1438 |
> |
simError(); |
1439 |
> |
} |
1440 |
> |
|
1441 |
> |
if (globals->haveTauBarostat()) |
1442 |
> |
myNPTf->setTauBarostat(globals->getTauBarostat()); |
1443 |
> |
|
1444 |
> |
else{ |
1445 |
> |
sprintf(painCave.errMsg, |
1446 |
> |
"SimSetup error: If you use an NPT\n" |
1447 |
> |
" ensemble, you must set tauBarostat.\n"); |
1448 |
> |
painCave.isFatal = 1; |
1449 |
> |
simError(); |
1450 |
> |
} |
1451 |
> |
|
1452 |
> |
info->the_integrator = myNPTf; |
1453 |
> |
break; |
1454 |
> |
|
1455 |
> |
case NPTxyz_ENS: |
1456 |
> |
if (globals->haveZconstraints()){ |
1457 |
> |
|
1458 |
> |
std::cerr << "ZConstraint is temporarily disabled\n"; |
1459 |
> |
|
1460 |
> |
// setupZConstraint(info[k]); |
1461 |
> |
// myNPTxyz = new ZConstraint<NPTxyz<NPT <RealIntegrator> > >(&(info[k]), the_ff); |
1462 |
> |
} |
1463 |
> |
// else |
1464 |
> |
myNPTxyz = new NPTxyz(&(info[k]), the_ff); |
1465 |
|
|
1466 |
< |
default: |
1467 |
< |
sprintf(painCave.errMsg, |
1468 |
< |
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1469 |
< |
painCave.isFatal = 1; |
1470 |
< |
simError(); |
1466 |
> |
myNPTxyz->setTargetTemp(globals->getTargetTemp()); |
1467 |
> |
|
1468 |
> |
if (globals->haveTargetPressure()) |
1469 |
> |
myNPTxyz->setTargetPressure(globals->getTargetPressure()); |
1470 |
> |
else{ |
1471 |
> |
sprintf(painCave.errMsg, |
1472 |
> |
"SimSetup error: If you use a constant pressure\n" |
1473 |
> |
" ensemble, you must set targetPressure in the BASS file.\n"); |
1474 |
> |
painCave.isFatal = 1; |
1475 |
> |
simError(); |
1476 |
> |
} |
1477 |
> |
|
1478 |
> |
if (globals->haveTauThermostat()) |
1479 |
> |
myNPTxyz->setTauThermostat(globals->getTauThermostat()); |
1480 |
> |
else{ |
1481 |
> |
sprintf(painCave.errMsg, |
1482 |
> |
"SimSetup error: If you use an NPT\n" |
1483 |
> |
" ensemble, you must set tauThermostat.\n"); |
1484 |
> |
painCave.isFatal = 1; |
1485 |
> |
simError(); |
1486 |
> |
} |
1487 |
> |
|
1488 |
> |
if (globals->haveTauBarostat()) |
1489 |
> |
myNPTxyz->setTauBarostat(globals->getTauBarostat()); |
1490 |
> |
else{ |
1491 |
> |
sprintf(painCave.errMsg, |
1492 |
> |
"SimSetup error: If you use an NPT\n" |
1493 |
> |
" ensemble, you must set tauBarostat.\n"); |
1494 |
> |
painCave.isFatal = 1; |
1495 |
> |
simError(); |
1496 |
> |
} |
1497 |
> |
|
1498 |
> |
info->the_integrator = myNPTxyz; |
1499 |
> |
break; |
1500 |
> |
|
1501 |
> |
default: |
1502 |
> |
sprintf(painCave.errMsg, |
1503 |
> |
"SimSetup Error. Unrecognized ensemble in case statement.\n"); |
1504 |
> |
painCave.isFatal = 1; |
1505 |
> |
simError(); |
1506 |
|
} |
1507 |
|
} |
1508 |
|
} |
1530 |
|
#endif // is_mpi |
1531 |
|
} |
1532 |
|
|
1533 |
< |
void SimSetup::setupZConstraint(SimInfo& theInfo){ |
1534 |
< |
int nZConstraints; |
1535 |
< |
ZconStamp** zconStamp; |
1533 |
> |
// void SimSetup::setupZConstraint(SimInfo& theInfo){ |
1534 |
> |
// int nZConstraints; |
1535 |
> |
// ZconStamp** zconStamp; |
1536 |
|
|
1537 |
< |
if (globals->haveZconstraintTime()){ |
1538 |
< |
//add sample time of z-constraint into SimInfo's property list |
1539 |
< |
DoubleData* zconsTimeProp = new DoubleData(); |
1540 |
< |
zconsTimeProp->setID(ZCONSTIME_ID); |
1541 |
< |
zconsTimeProp->setData(globals->getZconsTime()); |
1542 |
< |
theInfo.addProperty(zconsTimeProp); |
1543 |
< |
} |
1544 |
< |
else{ |
1545 |
< |
sprintf(painCave.errMsg, |
1546 |
< |
"ZConstraint error: If you use an ZConstraint\n" |
1547 |
< |
" , you must set sample time.\n"); |
1548 |
< |
painCave.isFatal = 1; |
1549 |
< |
simError(); |
1550 |
< |
} |
1537 |
> |
// if (globals->haveZconstraintTime()){ |
1538 |
> |
// //add sample time of z-constraint into SimInfo's property list |
1539 |
> |
// DoubleData* zconsTimeProp = new DoubleData(); |
1540 |
> |
// zconsTimeProp->setID(ZCONSTIME_ID); |
1541 |
> |
// zconsTimeProp->setData(globals->getZconsTime()); |
1542 |
> |
// theInfo.addProperty(zconsTimeProp); |
1543 |
> |
// } |
1544 |
> |
// else{ |
1545 |
> |
// sprintf(painCave.errMsg, |
1546 |
> |
// "ZConstraint error: If you use an ZConstraint\n" |
1547 |
> |
// " , you must set sample time.\n"); |
1548 |
> |
// painCave.isFatal = 1; |
1549 |
> |
// simError(); |
1550 |
> |
// } |
1551 |
|
|
1552 |
< |
//push zconsTol into siminfo, if user does not specify |
1553 |
< |
//value for zconsTol, a default value will be used |
1554 |
< |
DoubleData* zconsTol = new DoubleData(); |
1555 |
< |
zconsTol->setID(ZCONSTOL_ID); |
1556 |
< |
if (globals->haveZconsTol()){ |
1557 |
< |
zconsTol->setData(globals->getZconsTol()); |
1558 |
< |
} |
1559 |
< |
else{ |
1560 |
< |
double defaultZConsTol = 0.01; |
1561 |
< |
sprintf(painCave.errMsg, |
1562 |
< |
"ZConstraint Waring: Tolerance for z-constraint methodl is not specified\n" |
1563 |
< |
" , default value %f is used.\n", |
1564 |
< |
defaultZConsTol); |
1565 |
< |
painCave.isFatal = 0; |
1566 |
< |
simError(); |
1552 |
> |
// //push zconsTol into siminfo, if user does not specify |
1553 |
> |
// //value for zconsTol, a default value will be used |
1554 |
> |
// DoubleData* zconsTol = new DoubleData(); |
1555 |
> |
// zconsTol->setID(ZCONSTOL_ID); |
1556 |
> |
// if (globals->haveZconsTol()){ |
1557 |
> |
// zconsTol->setData(globals->getZconsTol()); |
1558 |
> |
// } |
1559 |
> |
// else{ |
1560 |
> |
// double defaultZConsTol = 0.01; |
1561 |
> |
// sprintf(painCave.errMsg, |
1562 |
> |
// "ZConstraint Waring: Tolerance for z-constraint methodl is not specified\n" |
1563 |
> |
// " , default value %f is used.\n", |
1564 |
> |
// defaultZConsTol); |
1565 |
> |
// painCave.isFatal = 0; |
1566 |
> |
// simError(); |
1567 |
|
|
1568 |
< |
zconsTol->setData(defaultZConsTol); |
1569 |
< |
} |
1570 |
< |
theInfo.addProperty(zconsTol); |
1568 |
> |
// zconsTol->setData(defaultZConsTol); |
1569 |
> |
// } |
1570 |
> |
// theInfo.addProperty(zconsTol); |
1571 |
|
|
1572 |
< |
//set Force Subtraction Policy |
1573 |
< |
StringData* zconsForcePolicy = new StringData(); |
1574 |
< |
zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID); |
1572 |
> |
// //set Force Subtraction Policy |
1573 |
> |
// StringData* zconsForcePolicy = new StringData(); |
1574 |
> |
// zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID); |
1575 |
|
|
1576 |
< |
if (globals->haveZconsForcePolicy()){ |
1577 |
< |
zconsForcePolicy->setData(globals->getZconsForcePolicy()); |
1578 |
< |
} |
1579 |
< |
else{ |
1580 |
< |
sprintf(painCave.errMsg, |
1581 |
< |
"ZConstraint Warning: User does not set force Subtraction policy, " |
1582 |
< |
"PolicyByMass is used\n"); |
1583 |
< |
painCave.isFatal = 0; |
1584 |
< |
simError(); |
1585 |
< |
zconsForcePolicy->setData("BYMASS"); |
1586 |
< |
} |
1576 |
> |
// if (globals->haveZconsForcePolicy()){ |
1577 |
> |
// zconsForcePolicy->setData(globals->getZconsForcePolicy()); |
1578 |
> |
// } |
1579 |
> |
// else{ |
1580 |
> |
// sprintf(painCave.errMsg, |
1581 |
> |
// "ZConstraint Warning: User does not set force Subtraction policy, " |
1582 |
> |
// "PolicyByMass is used\n"); |
1583 |
> |
// painCave.isFatal = 0; |
1584 |
> |
// simError(); |
1585 |
> |
// zconsForcePolicy->setData("BYMASS"); |
1586 |
> |
// } |
1587 |
|
|
1588 |
< |
theInfo.addProperty(zconsForcePolicy); |
1588 |
> |
// theInfo.addProperty(zconsForcePolicy); |
1589 |
|
|
1590 |
< |
//Determine the name of ouput file and add it into SimInfo's property list |
1591 |
< |
//Be careful, do not use inFileName, since it is a pointer which |
1592 |
< |
//point to a string at master node, and slave nodes do not contain that string |
1590 |
> |
// //Determine the name of ouput file and add it into SimInfo's property list |
1591 |
> |
// //Be careful, do not use inFileName, since it is a pointer which |
1592 |
> |
// //point to a string at master node, and slave nodes do not contain that string |
1593 |
|
|
1594 |
< |
string zconsOutput(theInfo.finalName); |
1594 |
> |
// string zconsOutput(theInfo.finalName); |
1595 |
|
|
1596 |
< |
zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1596 |
> |
// zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1597 |
|
|
1598 |
< |
StringData* zconsFilename = new StringData(); |
1599 |
< |
zconsFilename->setID(ZCONSFILENAME_ID); |
1600 |
< |
zconsFilename->setData(zconsOutput); |
1598 |
> |
// StringData* zconsFilename = new StringData(); |
1599 |
> |
// zconsFilename->setID(ZCONSFILENAME_ID); |
1600 |
> |
// zconsFilename->setData(zconsOutput); |
1601 |
|
|
1602 |
< |
theInfo.addProperty(zconsFilename); |
1602 |
> |
// theInfo.addProperty(zconsFilename); |
1603 |
|
|
1604 |
< |
//setup index, pos and other parameters of z-constraint molecules |
1605 |
< |
nZConstraints = globals->getNzConstraints(); |
1606 |
< |
theInfo.nZconstraints = nZConstraints; |
1604 |
> |
// //setup index, pos and other parameters of z-constraint molecules |
1605 |
> |
// nZConstraints = globals->getNzConstraints(); |
1606 |
> |
// theInfo.nZconstraints = nZConstraints; |
1607 |
|
|
1608 |
< |
zconStamp = globals->getZconStamp(); |
1609 |
< |
ZConsParaItem tempParaItem; |
1608 |
> |
// zconStamp = globals->getZconStamp(); |
1609 |
> |
// ZConsParaItem tempParaItem; |
1610 |
|
|
1611 |
< |
ZConsParaData* zconsParaData = new ZConsParaData(); |
1612 |
< |
zconsParaData->setID(ZCONSPARADATA_ID); |
1611 |
> |
// ZConsParaData* zconsParaData = new ZConsParaData(); |
1612 |
> |
// zconsParaData->setID(ZCONSPARADATA_ID); |
1613 |
|
|
1614 |
< |
for (int i = 0; i < nZConstraints; i++){ |
1615 |
< |
tempParaItem.havingZPos = zconStamp[i]->haveZpos(); |
1616 |
< |
tempParaItem.zPos = zconStamp[i]->getZpos(); |
1617 |
< |
tempParaItem.zconsIndex = zconStamp[i]->getMolIndex(); |
1618 |
< |
tempParaItem.kRatio = zconStamp[i]->getKratio(); |
1614 |
> |
// for (int i = 0; i < nZConstraints; i++){ |
1615 |
> |
// tempParaItem.havingZPos = zconStamp[i]->haveZpos(); |
1616 |
> |
// tempParaItem.zPos = zconStamp[i]->getZpos(); |
1617 |
> |
// tempParaItem.zconsIndex = zconStamp[i]->getMolIndex(); |
1618 |
> |
// tempParaItem.kRatio = zconStamp[i]->getKratio(); |
1619 |
|
|
1620 |
< |
zconsParaData->addItem(tempParaItem); |
1621 |
< |
} |
1620 |
> |
// zconsParaData->addItem(tempParaItem); |
1621 |
> |
// } |
1622 |
|
|
1623 |
< |
//check the uniqueness of index |
1624 |
< |
if(!zconsParaData->isIndexUnique()){ |
1625 |
< |
sprintf(painCave.errMsg, |
1626 |
< |
"ZConstraint Error: molIndex is not unique\n"); |
1627 |
< |
painCave.isFatal = 1; |
1628 |
< |
simError(); |
1629 |
< |
} |
1623 |
> |
// //check the uniqueness of index |
1624 |
> |
// if(!zconsParaData->isIndexUnique()){ |
1625 |
> |
// sprintf(painCave.errMsg, |
1626 |
> |
// "ZConstraint Error: molIndex is not unique\n"); |
1627 |
> |
// painCave.isFatal = 1; |
1628 |
> |
// simError(); |
1629 |
> |
// } |
1630 |
|
|
1631 |
< |
//sort the parameters by index of molecules |
1632 |
< |
zconsParaData->sortByIndex(); |
1631 |
> |
// //sort the parameters by index of molecules |
1632 |
> |
// zconsParaData->sortByIndex(); |
1633 |
|
|
1634 |
< |
//push data into siminfo, therefore, we can retrieve later |
1635 |
< |
theInfo.addProperty(zconsParaData); |
1636 |
< |
} |
1634 |
> |
// //push data into siminfo, therefore, we can retrieve later |
1635 |
> |
// theInfo.addProperty(zconsParaData); |
1636 |
> |
// } |