--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/08/28 21:09:47 736 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/10/28 16:03:37 829 @@ -1,10 +1,9 @@ #include -#include +#include #include -#include +#include #include #include - #include "SimSetup.hpp" #include "ReadWrite.hpp" #include "parse_me.h" @@ -22,9 +21,9 @@ #define NVT_ENS 1 #define NPTi_ENS 2 #define NPTf_ENS 3 -#define NPTim_ENS 4 -#define NPTfm_ENS 5 +#define NPTxyz_ENS 4 + #define FF_DUFF 0 #define FF_LJ 1 #define FF_EAM 2 @@ -32,6 +31,8 @@ SimSetup::SimSetup(){ using namespace std; SimSetup::SimSetup(){ + + initSuspend = false; isInfoArray = 0; nInfo = 1; @@ -54,6 +55,7 @@ void SimSetup::setSimInfo(SimInfo* the_info, int theNi info = the_info; nInfo = theNinfo; isInfoArray = 1; + initSuspend = true; } @@ -92,7 +94,6 @@ void SimSetup::createSim(void){ #endif // is_mpi void SimSetup::createSim(void){ - int i, j, k, globalAtomIndex; // gather all of the information from the Bass file @@ -108,8 +109,11 @@ void SimSetup::createSim(void){ // initialize the system coordinates - if (!isInfoArray){ + if ( !initSuspend ){ initSystemCoords(); + + if( !(globals->getUseInitTime()) ) + info[0].currentTime = 0.0; } // make the output filenames @@ -131,7 +135,7 @@ void SimSetup::makeMolecules(void){ void SimSetup::makeMolecules(void){ - int k, l; + int k; int i, j, exI, exJ, tempEx, stampID, atomOffset, excludeOffset; molInit molInfo; DirectionalAtom* dAtom; @@ -553,7 +557,7 @@ void SimSetup::gatherInfo(void){ void SimSetup::gatherInfo(void){ - int i, j, k; + int i; ensembleCase = -1; ffCase = -1; @@ -604,11 +608,8 @@ 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, "NPTxyz")){ + ensembleCase = NPTxyz_ENS; } else{ sprintf(painCave.errMsg, @@ -686,6 +687,12 @@ void SimSetup::gatherInfo(void){ if (globals->haveThermalTime()){ info[i].thermalTime = globals->getThermalTime(); + } + + info[i].resetIntegrator = 0; + if( globals->haveResetTime() ){ + info[i].resetTime = globals->getResetTime(); + info[i].resetIntegrator = 1; } // check for the temperature set flag @@ -916,7 +923,6 @@ void SimSetup::initSystemCoords(void){ if (worldRank == 0){ #endif //is_mpi inName = globals->getInitialConfig(); - double* tempDouble = new double[1000000]; fileInit = new InitializeFromFile(inName); #ifdef IS_MPI } @@ -934,7 +940,7 @@ void SimSetup::initSystemCoords(void){ sprintf(painCave.errMsg, "Cannot intialize a parallel simulation without an initial configuration file.\n"); - painCave.isFatal; + painCave.isFatal = 1;; simError(); #else @@ -1160,7 +1166,7 @@ void SimSetup::calcSysValues(void){ } void SimSetup::calcSysValues(void){ - int i, j, k; + int i; int* molMembershipArray; @@ -1259,7 +1265,11 @@ void SimSetup::makeSysArrays(void){ void SimSetup::makeSysArrays(void){ - int i, j, k, l; + +#ifndef IS_MPI + int k, j; +#endif // is_mpi + int i, l; Atom** the_atoms; Molecule* the_molecules; @@ -1342,21 +1352,24 @@ void SimSetup::makeIntegrator(void){ void SimSetup::makeIntegrator(void){ int k; + NVE* myNVE = NULL; NVT* myNVT = NULL; - NPTi* myNPTi = NULL; - NPTf* myNPTf = NULL; - NPTim* myNPTim = NULL; - NPTfm* myNPTfm = NULL; + NPTi >* myNPTi = NULL; + NPTf >* myNPTf = NULL; + NPTxyz >* myNPTxyz = NULL; for (k = 0; k < nInfo; k++){ switch (ensembleCase){ case NVE_ENS: if (globals->haveZconstraints()){ setupZConstraint(info[k]); - new ZConstraint >(&(info[k]), the_ff); + myNVE = new ZConstraint >(&(info[k]), the_ff); } - else - new NVE(&(info[k]), the_ff); + else{ + myNVE = new NVE(&(info[k]), the_ff); + } + + info->the_integrator = myNVE; break; case NVT_ENS: @@ -1378,15 +1391,17 @@ void SimSetup::makeIntegrator(void){ painCave.isFatal = 1; simError(); } + + info->the_integrator = myNVT; break; case NPTi_ENS: if (globals->haveZconstraints()){ setupZConstraint(info[k]); - myNPTi = new ZConstraint >(&(info[k]), the_ff); + myNPTi = new ZConstraint > >(&(info[k]), the_ff); } else - myNPTi = new NPTi(&(info[k]), the_ff); + myNPTi = new NPTi >(&(info[k]), the_ff); myNPTi->setTargetTemp(globals->getTargetTemp()); @@ -1419,15 +1434,17 @@ void SimSetup::makeIntegrator(void){ painCave.isFatal = 1; simError(); } + + info->the_integrator = myNPTi; break; case NPTf_ENS: if (globals->haveZconstraints()){ setupZConstraint(info[k]); - myNPTf = new ZConstraint >(&(info[k]), the_ff); + myNPTf = new ZConstraint > >(&(info[k]), the_ff); } else - myNPTf = new NPTf(&(info[k]), the_ff); + myNPTf = new NPTf >(&(info[k]), the_ff); myNPTf->setTargetTemp(globals->getTargetTemp()); @@ -1460,71 +1477,32 @@ void SimSetup::makeIntegrator(void){ painCave.isFatal = 1; simError(); } - break; - case NPTim_ENS: - if (globals->haveZconstraints()){ - setupZConstraint(info[k]); - myNPTim = new ZConstraint >(&(info[k]), the_ff); - } - else - myNPTim = new NPTim(&(info[k]), the_ff); - - myNPTim->setTargetTemp(globals->getTargetTemp()); - - if (globals->haveTargetPressure()) - myNPTim->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()) - myNPTim->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()) - myNPTim->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 = myNPTf; break; - case NPTfm_ENS: + case NPTxyz_ENS: if (globals->haveZconstraints()){ setupZConstraint(info[k]); - myNPTfm = new ZConstraint >(&(info[k]), the_ff); + myNPTxyz = new ZConstraint > >(&(info[k]), the_ff); } else - myNPTfm = new NPTfm(&(info[k]), the_ff); + myNPTxyz = new NPTxyz >(&(info[k]), the_ff); - myNPTfm->setTargetTemp(globals->getTargetTemp()); + myNPTxyz->setTargetTemp(globals->getTargetTemp()); if (globals->haveTargetPressure()) - myNPTfm->setTargetPressure(globals->getTargetPressure()); + 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()) - myNPTfm->setTauThermostat(globals->getTauThermostat()); + myNPTxyz->setTauThermostat(globals->getTauThermostat()); else{ sprintf(painCave.errMsg, "SimSetup error: If you use an NPT\n" @@ -1534,7 +1512,7 @@ void SimSetup::makeIntegrator(void){ } if (globals->haveTauBarostat()) - myNPTfm->setTauBarostat(globals->getTauBarostat()); + myNPTxyz->setTauBarostat(globals->getTauBarostat()); else{ sprintf(painCave.errMsg, "SimSetup error: If you use an NPT\n" @@ -1542,6 +1520,8 @@ void SimSetup::makeIntegrator(void){ painCave.isFatal = 1; simError(); } + + info->the_integrator = myNPTxyz; break; default: @@ -1615,7 +1595,7 @@ void SimSetup::setupZConstraint(SimInfo& theInfo){ } theInfo.addProperty(zconsTol); - //set Force Substraction Policy + //set Force Subtraction Policy StringData* zconsForcePolicy = new StringData(); zconsForcePolicy->setID(ZCONSFORCEPOLICY_ID); @@ -1624,7 +1604,7 @@ void SimSetup::setupZConstraint(SimInfo& theInfo){ } else{ sprintf(painCave.errMsg, - "ZConstraint Warning: User does not set force substraction policy, " + "ZConstraint Warning: User does not set force Subtraction policy, " "PolicyByMass is used\n"); painCave.isFatal = 0; simError();