--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/07/29 16:32:37 656 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/07/31 15:35:07 658 @@ -1,6 +1,8 @@ +#include #include #include #include +#include #include "SimSetup.hpp" #include "parse_me.h" @@ -20,11 +22,14 @@ #define NPTf_ENS 3 #define NPTim_ENS 4 #define NPTfm_ENS 5 +#define NVEZCONS_ENS 6 #define FF_DUFF 0 #define FF_LJ 1 #define FF_EAM 2 + +using namespace std; SimSetup::SimSetup(){ @@ -618,6 +623,7 @@ void SimSetup::gatherInfo( void ){ else if( !strcasecmp( ensemble, "NPTf" )) ensembleCase = NPTf_ENS; else if( !strcasecmp( ensemble, "NPTim" )) ensembleCase = NPTim_ENS; else if( !strcasecmp( ensemble, "NPTfm" )) ensembleCase = NPTfm_ENS; + else if( !strcasecmp( ensemble, "NVEZCONS")) ensembleCase = NVEZCONS_ENS; else{ sprintf( painCave.errMsg, "SimSetup Warning. Unrecognized Ensemble -> %s, " @@ -1303,7 +1309,10 @@ void SimSetup::makeIntegrator( void ){ NPTf* myNPTf = NULL; NPTim* myNPTim = NULL; NPTfm* myNPTfm = NULL; - + ZConstraint >* myNVEZCons = NULL; + + cerr << "setting integrator" <haveZConsTime()){ + + //add sample time of z-constraint into SimInfo's property list + DoubleData* zconsTimeProp = new DoubleData(); + zconsTimeProp->setID("zconstime"); + zconsTimeProp->setData(globals->getZConsTime()); + info->addProperty(zconsTimeProp); + } + else{ + sprintf( painCave.errMsg, + "ZConstraint error: If you use an ZConstraint\n" + " , you must set sample time.\n"); + painCave.isFatal = 1; + simError(); + } + + if(globals->haveIndexOfAllZConsMols()){ + + //add index of z-constraint molecules into SimInfo's property list + vector tempIndex = globals->getIndexOfAllZConsMols(); + sort(tempIndex.begin(), tempIndex.end()); + + IndexData* zconsIndex = new IndexData(); + zconsIndex->setID("zconsindex"); + zconsIndex->setIndexData(tempIndex); + info->addProperty(zconsIndex); + } + else{ + sprintf( painCave.errMsg, + "SimSetup error: If you use an ZConstraint\n" + " , you must set index of z-constraint molecules.\n"); + painCave.isFatal = 1; + simError(); + + } + + //Determine the name of ouput file and add it into SimInfo's property list + //Be careful, do not use inFileName, since it is a pointer which + //point to a string at master node, and slave nodes do not contain that string + + string zconsOutput(info->finalName); + + zconsOutput = zconsOutput.substr(0, zconsOutput.rfind(".")) + ".fz"; + + StringData* zconsFilename = new StringData(); + zconsFilename->setID("zconsfilename"); + zconsFilename->setData(zconsOutput); + + info->addProperty(zconsFilename); + + myNVEZCons = new ZConstraint >( info, the_ff ); + + break; + } + default: sprintf( painCave.errMsg, "SimSetup Error. Unrecognized ensemble in case statement.\n");