--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/07 20:06:31 469 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/04/10 20:08:56 489 @@ -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, @@ -280,7 +328,7 @@ void SimSetup::createSim( void ){ for( j=0; jgetNAtoms(); local_bonds += comp_stamps[i]->getNBonds(); @@ -337,6 +385,7 @@ void SimSetup::createSim( void ){ if(mol2proc[i] == worldRank ){ the_molecules[molIndex].setStampID( molCompType[i] ); the_molecules[molIndex].setMyIndex( molIndex ); + the_molecules[molIndex].setGlobalIndex( i ); molIndex++; } } @@ -348,6 +397,7 @@ void SimSetup::createSim( void ){ for(j=0; jidentArray = 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; @@ -680,13 +734,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";