--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/07 14:30:36 466 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/08 21:35:49 481 @@ -87,10 +87,58 @@ void SimSetup::createSim( void ){ if( !strcasecmp( ensemble, "NPT" ) ) { the_extendedsystem = new ExtendedSystem( simnfo ); the_extendedsystem->setTargetTemp(the_globals->getTargetTemp()); - the_extendedsystem->setTargetPressure(the_globals->getTargetPressure()); + if (the_globals->haveTargetPressure()) + the_extendedsystem->setTargetPressure(the_globals->getTargetPressure()); + else { + sprintf( painCave.errMsg, + "SimSetup error: If you use the constant pressure\n" + " ensemble, you must set targetPressure.\n" + " This was found in the BASS file.\n"); + painCave.isFatal = 1; + simError(); + } + + if (the_globals->haveTauThermostat()) + the_extendedsystem->setTauThermostat(the_globals->getTauThermostat()); + else if (the_globals->haveQmass()) + the_extendedsystem->setQmass(the_globals->getQmass()); + else { + sprintf( painCave.errMsg, + "SimSetup error: If you use one of the constant temperature\n" + " ensembles, you must set either tauThermostat or qMass.\n" + " Neither of these was found in the BASS file.\n"); + painCave.isFatal = 1; + simError(); + } + + if (the_globals->haveTauBarostat()) + the_extendedsystem->setTauBarostat(the_globals->getTauBarostat()); + else { + sprintf( painCave.errMsg, + "SimSetup error: If you use the constant pressure\n" + " ensemble, you must set tauBarostat.\n" + " This was found in the BASS file.\n"); + painCave.isFatal = 1; + simError(); + } + } else if ( !strcasecmp( ensemble, "NVT") ) { the_extendedsystem = new ExtendedSystem( simnfo ); the_extendedsystem->setTargetTemp(the_globals->getTargetTemp()); + + if (the_globals->haveTauThermostat()) + the_extendedsystem->setTauThermostat(the_globals->getTauThermostat()); + else if (the_globals->haveQmass()) + the_extendedsystem->setQmass(the_globals->getQmass()); + else { + sprintf( painCave.errMsg, + "SimSetup error: If you use one of the constant temperature\n" + " ensembles, you must set either tauThermostat or qMass.\n" + " Neither of these was found in the BASS file.\n"); + painCave.isFatal = 1; + simError(); + } + } else if ( !strcasecmp( ensemble, "NVE") ) { } else { sprintf( painCave.errMsg, @@ -106,7 +154,11 @@ void SimSetup::createSim( void ){ strcpy( simnfo->mixingRule, the_globals->getMixingRule() ); simnfo->usePBC = the_globals->getPBC(); - if( !strcmp( force_field, "TraPPE_Ex" ) ) the_ff = new TraPPE_ExFF(); + int usesDipoles = 0; + if( !strcmp( force_field, "TraPPE_Ex" ) ){ + the_ff = new TraPPE_ExFF(); + usesDipoles = 1; + } else if( !strcasecmp( force_field, "LJ" ) ) the_ff = new LJ_FF(); else{ sprintf( painCave.errMsg, @@ -478,11 +530,11 @@ void SimSetup::createSim( void ){ } simnfo->dielectric = the_globals->getDielectric(); } else { - if (simnfo->n_dipoles) { + if (usesDipoles) { if( !the_globals->haveECR() ){ sprintf( painCave.errMsg, - "SimSetup Warning: using default value of 1/2 the smallest" + "SimSetup Warning: using default value of 1/2 the smallest " "box length for the electrostaticCutoffRadius.\n" "I hope you have a very fast processor!\n"); painCave.isFatal = 0; @@ -498,7 +550,7 @@ void SimSetup::createSim( void ){ if( !the_globals->haveEST() ){ sprintf( painCave.errMsg, - "SimSetup Warning: using default value of 5% of the" + "SimSetup Warning: using default value of 5%% of the " "electrostaticCutoffRadius for the " "electrostaticSkinThickness\n" ); @@ -673,13 +725,21 @@ void SimSetup::createSim( void ){ // new AllLong( simnfo ); - 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 ); + if( !strcmp( force_field, "TraPPE_Ex" ) ){ + new Symplectic(simnfo, the_ff, the_extendedsystem); + std::cerr << "called new Symplecic\n"; + fprintf( stderr, "called new Symplectic. stderr\n" ); + } + else if( !strcmp( force_field, "LJ" ) ){ + new Verlet( *simnfo, the_ff, the_extendedsystem ); + std::cerr << "called new Verlet\n"; + fprintf( stderr, "called new Verlet. stderr\n" ); + } + else { + std::cerr << "I'm a bug.\n"; + fprintf( stderr, "Ima bug. stderr %s\n", force_field); + } #ifdef IS_MPI mpiSim->mpiRefresh(); #endif