--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/07 21:42:19 474 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/10 16:27:21 487 @@ -87,13 +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()); - the_extendedsystem->setQmass(the_globals->getQmass()); - the_extendedsystem->setTauRelax(the_globals->getTauRelax()); + 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()); - the_extendedsystem->setQmass(the_globals->getQmass()); + + 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, @@ -283,7 +328,7 @@ void SimSetup::createSim( void ){ for( j=0; jgetNAtoms(); local_bonds += comp_stamps[i]->getNBonds(); @@ -440,9 +485,13 @@ void SimSetup::createSim( void ){ makeMolecules(); simnfo->identArray = new int[simnfo->n_atoms]; + simnfo->molMembershipArray = new int[simnfo->n_atoms]; for(i=0; in_atoms; i++){ simnfo->identArray[i] = the_atoms[i]->getIdent(); } + for(i=0; i< simnfo->n_mol; i++) { + the_molecules[i].atomicRollCall(simnfo->molMembershipArray); + } if (the_globals->getUseRF() ) { simnfo->useReactionField = 1; @@ -683,13 +732,9 @@ void SimSetup::createSim( void ){ 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";