--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/07/09 22:14:06 586 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/07/15 03:27:24 605 @@ -14,10 +14,12 @@ // some defines for ensemble and Forcefield cases -#define NVE_ENS 0 -#define NVT_ENS 1 -#define NPTi_ENS 2 -#define NPTf_ENS 3 +#define NVE_ENS 0 +#define NVT_ENS 1 +#define NPTi_ENS 2 +#define NPTf_ENS 3 +#define NPTim_ENS 4 +#define NPTfm_ENS 5 #define FF_DUFF 0 @@ -117,6 +119,8 @@ void SimSetup::createSim( void ){ else if( !strcasecmp( ensemble, "NPTi" ) || !strcasecmp( ensemble, "NPT") ) ensembleCase = NPTi_ENS; 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, " @@ -783,6 +787,9 @@ void SimSetup::createSim( void ){ NVT* myNVT = NULL; NPTi* myNPTi = NULL; NPTf* myNPTf = NULL; + NPTim* myNPTim = NULL; + NPTfm* myNPTfm = NULL; + switch( ensembleCase ){ case NVE_ENS: @@ -875,8 +882,76 @@ void SimSetup::createSim( void ){ } break; + case NPTim_ENS: + myNPTim = new NPTim( simnfo, the_ff ); + myNPTim->setTargetTemp( the_globals->getTargetTemp()); + + if (the_globals->haveTargetPressure()) + myNPTim->setTargetPressure(the_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( the_globals->haveTauThermostat() ) + myNPTim->setTauThermostat( the_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( the_globals->haveTauBarostat() ) + myNPTim->setTauBarostat( the_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: + myNPTfm = new NPTfm( simnfo, the_ff ); + myNPTfm->setTargetTemp( the_globals->getTargetTemp()); + + if (the_globals->haveTargetPressure()) + myNPTfm->setTargetPressure(the_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( the_globals->haveTauThermostat() ) + myNPTfm->setTauThermostat( the_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( the_globals->haveTauBarostat() ) + myNPTfm->setTauBarostat( the_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; + default: sprintf( painCave.errMsg, "SimSetup Error. Unrecognized ensemble in case statement.\n");