# | Line 1 | Line 1 | |
---|---|---|
1 | + | #include <algorithm> |
2 | #include <cstdlib> | |
3 | #include <iostream> | |
4 | #include <cmath> | |
5 | + | #include <string> |
6 | ||
7 | #include "SimSetup.hpp" | |
8 | #include "parse_me.h" | |
# | Line 20 | Line 22 | |
22 | #define NPTf_ENS 3 | |
23 | #define NPTim_ENS 4 | |
24 | #define NPTfm_ENS 5 | |
25 | + | #define NVEZCONS_ENS 6 |
26 | ||
27 | ||
28 | #define FF_DUFF 0 | |
29 | #define FF_LJ 1 | |
30 | #define FF_EAM 2 | |
31 | + | |
32 | + | using namespace std; |
33 | ||
34 | SimSetup::SimSetup(){ | |
35 | ||
# | Line 618 | Line 623 | void SimSetup::gatherInfo( void ){ | |
623 | else if( !strcasecmp( ensemble, "NPTf" )) ensembleCase = NPTf_ENS; | |
624 | else if( !strcasecmp( ensemble, "NPTim" )) ensembleCase = NPTim_ENS; | |
625 | else if( !strcasecmp( ensemble, "NPTfm" )) ensembleCase = NPTfm_ENS; | |
626 | + | else if( !strcasecmp( ensemble, "NVEZCONS")) ensembleCase = NVEZCONS_ENS; |
627 | else{ | |
628 | sprintf( painCave.errMsg, | |
629 | "SimSetup Warning. Unrecognized Ensemble -> %s, " | |
# | Line 1303 | Line 1309 | void SimSetup::makeIntegrator( void ){ | |
1309 | NPTf<RealIntegrator>* myNPTf = NULL; | |
1310 | NPTim<RealIntegrator>* myNPTim = NULL; | |
1311 | NPTfm<RealIntegrator>* myNPTfm = NULL; | |
1312 | < | |
1312 | > | ZConstraint<NVE<RealIntegrator> >* myNVEZCons = NULL; |
1313 | > | |
1314 | > | cerr << "setting integrator" <<endl; |
1315 | > | |
1316 | switch( ensembleCase ){ | |
1317 | ||
1318 | case NVE_ENS: | |
# | Line 1465 | Line 1474 | void SimSetup::makeIntegrator( void ){ | |
1474 | simError(); | |
1475 | } | |
1476 | break; | |
1477 | + | |
1478 | + | case NVEZCONS_ENS: |
1479 | + | { |
1480 | ||
1481 | + | if(globals->haveZConsTime()){ |
1482 | + | |
1483 | + | //add sample time of z-constraint into SimInfo's property list |
1484 | + | DoubleData* zconsTimeProp = new DoubleData(); |
1485 | + | zconsTimeProp->setID("zconstime"); |
1486 | + | zconsTimeProp->setData(globals->getZConsTime()); |
1487 | + | info->addProperty(zconsTimeProp); |
1488 | + | } |
1489 | + | else{ |
1490 | + | sprintf( painCave.errMsg, |
1491 | + | "ZConstraint error: If you use an ZConstraint\n" |
1492 | + | " , you must set sample time.\n"); |
1493 | + | painCave.isFatal = 1; |
1494 | + | simError(); |
1495 | + | } |
1496 | + | |
1497 | + | if(globals->haveIndexOfAllZConsMols()){ |
1498 | + | |
1499 | + | //add index of z-constraint molecules into SimInfo's property list |
1500 | + | vector<int> tempIndex = globals->getIndexOfAllZConsMols(); |
1501 | + | sort(tempIndex.begin(), tempIndex.end()); |
1502 | + | |
1503 | + | IndexData* zconsIndex = new IndexData(); |
1504 | + | zconsIndex->setID("zconsindex"); |
1505 | + | zconsIndex->setIndexData(tempIndex); |
1506 | + | info->addProperty(zconsIndex); |
1507 | + | } |
1508 | + | else{ |
1509 | + | sprintf( painCave.errMsg, |
1510 | + | "SimSetup error: If you use an ZConstraint\n" |
1511 | + | " , you must set index of z-constraint molecules.\n"); |
1512 | + | painCave.isFatal = 1; |
1513 | + | simError(); |
1514 | + | |
1515 | + | } |
1516 | + | |
1517 | + | //Determine the name of ouput file and add it into SimInfo's property list |
1518 | + | //Be careful, do not use inFileName, since it is a pointer which |
1519 | + | //point to a string at master node, and slave nodes do not contain that string |
1520 | + | |
1521 | + | string zconsOutput(info->finalName); |
1522 | + | |
1523 | + | zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; |
1524 | + | |
1525 | + | StringData* zconsFilename = new StringData(); |
1526 | + | zconsFilename->setID("zconsfilename"); |
1527 | + | zconsFilename->setData(zconsOutput); |
1528 | + | |
1529 | + | info->addProperty(zconsFilename); |
1530 | + | |
1531 | + | myNVEZCons = new ZConstraint<NVE<RealIntegrator> >( info, the_ff ); |
1532 | + | |
1533 | + | break; |
1534 | + | } |
1535 | + | |
1536 | default: | |
1537 | sprintf( painCave.errMsg, | |
1538 | "SimSetup Error. Unrecognized ensemble in case statement.\n"); |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |