--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/02 22:19:03 443 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/07 14:30:36 466 @@ -66,6 +66,7 @@ void SimSetup::createSim( void ){ MakeStamps *the_stamps; Globals* the_globals; + ExtendedSystem* the_extendedsystem; int i, j; // get the stamps and globals; @@ -80,16 +81,33 @@ void SimSetup::createSim( void ){ // get the ones we know are there, yet still may need some work. n_components = the_globals->getNComponents(); strcpy( force_field, the_globals->getForceField() ); + + // get the ensemble and set up an extended system if we need it: strcpy( ensemble, the_globals->getEnsemble() ); + if( !strcasecmp( ensemble, "NPT" ) ) { + the_extendedsystem = new ExtendedSystem( simnfo ); + the_extendedsystem->setTargetTemp(the_globals->getTargetTemp()); + the_extendedsystem->setTargetPressure(the_globals->getTargetPressure()); + } else if ( !strcasecmp( ensemble, "NVT") ) { + the_extendedsystem = new ExtendedSystem( simnfo ); + the_extendedsystem->setTargetTemp(the_globals->getTargetTemp()); + } else if ( !strcasecmp( ensemble, "NVE") ) { + } else { + sprintf( painCave.errMsg, + "SimSetup Warning. Unrecognized Ensemble -> %s, " + "reverting to NVE for this simulation.\n", + ensemble ); + painCave.isFatal = 0; + simError(); + strcpy( ensemble, "NVE" ); + } strcpy( simnfo->ensemble, ensemble ); strcpy( simnfo->mixingRule, the_globals->getMixingRule() ); simnfo->usePBC = the_globals->getPBC(); - - if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF(); - else if( !strcmp( force_field, "LJ" ) ) the_ff = new LJ_FF(); + else if( !strcasecmp( force_field, "LJ" ) ) the_ff = new LJ_FF(); else{ sprintf( painCave.errMsg, "SimSetup Error. Unrecognized force field -> %s\n", @@ -655,8 +673,12 @@ void SimSetup::createSim( void ){ // new AllLong( simnfo ); - if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic( simnfo, the_ff ); - if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, the_ff ); + if( !strcmp( force_field, "TraPPE_Ex" ) ) new Symplectic(simnfo, + the_ff, + the_extendedsystem); + if( !strcmp( force_field, "LJ" ) ) new Verlet( *simnfo, + the_ff, + the_extendedsystem ); #ifdef IS_MPI mpiSim->mpiRefresh();