--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/07/09 13:56:36 580 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/07/15 03:08:00 604 @@ -14,11 +14,14 @@ // 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 #define FF_LJ 1 @@ -116,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, " @@ -779,7 +784,11 @@ void SimSetup::createSim( void ){ // make the integrator - NVT* myNVT = NULL; + NVT* myNVT = NULL; + NPTi* myNPTi = NULL; + NPTf* myNPTf = NULL; + NPTim* myNPTim = NULL; + switch( ensembleCase ){ case NVE_ENS: @@ -792,18 +801,123 @@ void SimSetup::createSim( void ){ if (the_globals->haveTauThermostat()) myNVT->setTauThermostat(the_globals->getTauThermostat()); -// else if (the_globals->haveQmass()) -// myNVT->setQmass(the_globals->getQmass()); + else { sprintf( painCave.errMsg, "SimSetup error: If you use the NVT\n" - " ensemble, you must set either tauThermostat or qMass.\n" - " Neither of these was found in the BASS file.\n"); + " ensemble, you must set tauThermostat.\n"); + painCave.isFatal = 1; + simError(); + } + break; + + case NPTi_ENS: + myNPTi = new NPTi( simnfo, the_ff ); + myNPTi->setTargetTemp( the_globals->getTargetTemp()); + + if (the_globals->haveTargetPressure()) + myNPTi->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() ) + myNPTi->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() ) + myNPTi->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 NPTf_ENS: + myNPTf = new NPTf( simnfo, the_ff ); + myNPTf->setTargetTemp( the_globals->getTargetTemp()); + + if (the_globals->haveTargetPressure()) + myNPTf->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() ) + myNPTf->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() ) + myNPTf->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 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; + + + default: sprintf( painCave.errMsg, "SimSetup Error. Unrecognized ensemble in case statement.\n");