--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/08/26 20:02:29 722 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/09/23 20:34:31 782 @@ -22,8 +22,6 @@ #define NVT_ENS 1 #define NPTi_ENS 2 #define NPTf_ENS 3 -#define NPTim_ENS 4 -#define NPTfm_ENS 5 #define FF_DUFF 0 #define FF_LJ 1 @@ -604,12 +602,6 @@ 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{ sprintf(painCave.errMsg, "SimSetup Warning. Unrecognized Ensemble -> %s, " @@ -688,6 +680,12 @@ void SimSetup::gatherInfo(void){ 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 if (globals->haveTempSet()) @@ -1342,21 +1340,23 @@ 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; + 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 +1378,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 +1421,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()); @@ -1453,95 +1457,15 @@ void SimSetup::makeIntegrator(void){ if (globals->haveTauBarostat()) myNPTf->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(); - } - 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(); } - break; - case NPTfm_ENS: - if (globals->haveZconstraints()){ - setupZConstraint(info[k]); - myNPTfm = new ZConstraint >(&(info[k]), the_ff); - } - else - myNPTfm = new NPTfm(&(info[k]), the_ff); - - myNPTfm->setTargetTemp(globals->getTargetTemp()); - - if (globals->haveTargetPressure()) - myNPTfm->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()); - 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()) - myNPTfm->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; default: @@ -1615,7 +1539,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,11 +1548,11 @@ void SimSetup::setupZConstraint(SimInfo& theInfo){ } else{ sprintf(painCave.errMsg, - "ZConstraint Warning: User does not set force substraction policy, " - "average force substraction policy is used\n"); + "ZConstraint Warning: User does not set force Subtraction policy, " + "PolicyByMass is used\n"); painCave.isFatal = 0; simError(); - zconsForcePolicy->setData("BYNUMBER"); + zconsForcePolicy->setData("BYMASS"); } theInfo.addProperty(zconsForcePolicy); @@ -1666,9 +1590,17 @@ void SimSetup::setupZConstraint(SimInfo& theInfo){ zconsParaData->addItem(tempParaItem); } + //check the uniqueness of index + if(!zconsParaData->isIndexUnique()){ + sprintf(painCave.errMsg, + "ZConstraint Error: molIndex is not unique\n"); + painCave.isFatal = 1; + simError(); + } + //sort the parameters by index of molecules zconsParaData->sortByIndex(); - + //push data into siminfo, therefore, we can retrieve later theInfo.addProperty(zconsParaData); }