--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/09/19 20:00:27 778 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/10/27 22:07:48 823 @@ -4,7 +4,6 @@ #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, @@ -922,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 } @@ -940,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 @@ -1166,7 +1166,7 @@ void SimSetup::calcSysValues(void){ } void SimSetup::calcSysValues(void){ - int i, j, k; + int i; int* molMembershipArray; @@ -1265,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; @@ -1348,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; + 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: @@ -1384,6 +1391,8 @@ void SimSetup::makeIntegrator(void){ painCave.isFatal = 1; simError(); } + + info->the_integrator = myNVT; break; case NPTi_ENS: @@ -1425,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()); @@ -1463,74 +1474,35 @@ void SimSetup::makeIntegrator(void){ sprintf(painCave.errMsg, "SimSetup error: If you use an NPT\n" " ensemble, you must set tauBarostat.\n"); - 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" @@ -1540,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" @@ -1548,6 +1520,8 @@ void SimSetup::makeIntegrator(void){ painCave.isFatal = 1; simError(); } + + info->the_integrator = myNPTxyz; break; default: