--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/09/25 19:27:15 787 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/10/30 18:59:20 845 @@ -1,10 +1,9 @@ #include -#include +#include #include -#include +#include #include #include - #include "SimSetup.hpp" #include "ReadWrite.hpp" #include "parse_me.h" @@ -22,7 +21,9 @@ #define NVT_ENS 1 #define NPTi_ENS 2 #define NPTf_ENS 3 +#define NPTxyz_ENS 4 + #define FF_DUFF 0 #define FF_LJ 1 #define FF_EAM 2 @@ -30,6 +31,8 @@ SimSetup::SimSetup(){ using namespace std; SimSetup::SimSetup(){ + + initSuspend = false; isInfoArray = 0; nInfo = 1; @@ -52,6 +55,7 @@ void SimSetup::setSimInfo(SimInfo* the_info, int theNi info = the_info; nInfo = theNinfo; isInfoArray = 1; + initSuspend = true; } @@ -99,16 +103,19 @@ void SimSetup::createSim(void){ sysObjectsCreation(); - // check on the post processing info - - finalInfoCheck(); - // initialize the system coordinates - if (!isInfoArray){ + if ( !initSuspend ){ initSystemCoords(); + + if( !(globals->getUseInitTime()) ) + info[0].currentTime = 0.0; } + + // check on the post processing info + finalInfoCheck(); + // make the output filenames makeOutNames(); @@ -600,6 +607,9 @@ void SimSetup::gatherInfo(void){ } else if (!strcasecmp(ensemble, "NPTf")){ ensembleCase = NPTf_ENS; + } + else if (!strcasecmp(ensemble, "NPTxyz")){ + ensembleCase = NPTxyz_ENS; } else{ sprintf(painCave.errMsg, @@ -686,58 +696,12 @@ void SimSetup::gatherInfo(void){ } // check for the temperature set flag - + if (globals->haveTempSet()) info[i].setTemp = globals->getTempSet(); - - // get some of the tricky things that may still be in the globals - - double boxVector[3]; - if (globals->haveBox()){ - boxVector[0] = globals->getBox(); - boxVector[1] = globals->getBox(); - boxVector[2] = globals->getBox(); - - info[i].setBox(boxVector); - } - else if (globals->haveDensity()){ - double vol; - vol = (double) tot_nmol / globals->getDensity(); - boxVector[0] = pow(vol, (1.0 / 3.0)); - boxVector[1] = boxVector[0]; - boxVector[2] = boxVector[0]; - - info[i].setBox(boxVector); - } - else{ - if (!globals->haveBoxX()){ - sprintf(painCave.errMsg, - "SimSetup error, no periodic BoxX size given.\n"); - painCave.isFatal = 1; - simError(); - } - boxVector[0] = globals->getBoxX(); - - if (!globals->haveBoxY()){ - sprintf(painCave.errMsg, - "SimSetup error, no periodic BoxY size given.\n"); - painCave.isFatal = 1; - simError(); - } - boxVector[1] = globals->getBoxY(); - - if (!globals->haveBoxZ()){ - sprintf(painCave.errMsg, - "SimSetup error, no periodic BoxZ size given.\n"); - painCave.isFatal = 1; - simError(); - } - boxVector[2] = globals->getBoxZ(); - - info[i].setBox(boxVector); - } + } - + //setup seed for random number generator int seedValue; @@ -841,7 +805,7 @@ void SimSetup::finalInfoCheck(void){ theEst = globals->getEST(); } - info[i].setEcr(theEcr, theEst); + info[i].setDefaultEcr(theEcr, theEst); if (!globals->haveDielectric()){ sprintf(painCave.errMsg, @@ -886,9 +850,10 @@ void SimSetup::finalInfoCheck(void){ theEst = globals->getEST(); } - info[i].setEcr(theEcr, theEst); + info[i].setDefaultEcr(theEcr, theEst); } } + info[i].checkCutOffs(); } #ifdef IS_MPI @@ -1346,6 +1311,7 @@ void SimSetup::makeIntegrator(void){ NVT* myNVT = NULL; NPTi >* myNPTi = NULL; NPTf >* myNPTf = NULL; + NPTxyz >* myNPTxyz = NULL; for (k = 0; k < nInfo; k++){ switch (ensembleCase){ @@ -1449,6 +1415,7 @@ void SimSetup::makeIntegrator(void){ if (globals->haveTauThermostat()) myNPTf->setTauThermostat(globals->getTauThermostat()); + else{ sprintf(painCave.errMsg, "SimSetup error: If you use an NPT\n" @@ -1459,6 +1426,7 @@ void SimSetup::makeIntegrator(void){ if (globals->haveTauBarostat()) myNPTf->setTauBarostat(globals->getTauBarostat()); + else{ sprintf(painCave.errMsg, "SimSetup error: If you use an NPT\n" @@ -1470,6 +1438,49 @@ void SimSetup::makeIntegrator(void){ info->the_integrator = myNPTf; break; + case NPTxyz_ENS: + if (globals->haveZconstraints()){ + setupZConstraint(info[k]); + myNPTxyz = new ZConstraint > >(&(info[k]), the_ff); + } + else + myNPTxyz = new NPTxyz >(&(info[k]), the_ff); + + myNPTxyz->setTargetTemp(globals->getTargetTemp()); + + if (globals->haveTargetPressure()) + myNPTxyz->setTargetPressure(globals->getTargetPressure()); + else{ + sprintf(painCave.errMsg, + "SimSetup error: If you use a constant pressure\n" + " ensemble, you must set targetPressure in the BASS file.\n"); + painCave.isFatal = 1; + simError(); + } + + if (globals->haveTauThermostat()) + myNPTxyz->setTauThermostat(globals->getTauThermostat()); + else{ + sprintf(painCave.errMsg, + "SimSetup error: If you use an NPT\n" + " ensemble, you must set tauThermostat.\n"); + painCave.isFatal = 1; + simError(); + } + + if (globals->haveTauBarostat()) + myNPTxyz->setTauBarostat(globals->getTauBarostat()); + else{ + sprintf(painCave.errMsg, + "SimSetup error: If you use an NPT\n" + " ensemble, you must set tauBarostat.\n"); + painCave.isFatal = 1; + simError(); + } + + info->the_integrator = myNPTxyz; + break; + default: sprintf(painCave.errMsg, "SimSetup Error. Unrecognized ensemble in case statement.\n");