--- trunk/OOPSE/libmdtools/SimSetup.cpp 2003/03/21 17:42:12 378 +++ trunk/OOPSE/libmdtools/SimSetup.cpp 2003/03/24 21:55:34 394 @@ -333,30 +333,6 @@ void SimSetup::createSim( void ){ // get some of the tricky things that may still be in the globals - if( simnfo->n_dipoles ){ - - if( !the_globals->haveRRF() ){ - sprintf( painCave.errMsg, - "SimSetup Error, system has dipoles, but no rRF was set.\n"); - painCave.isFatal = 1; - simError(); - } - if( !the_globals->haveDielectric() ){ - sprintf( painCave.errMsg, - "SimSetup Error, system has dipoles, but no" - " dielectric was set.\n" ); - painCave.isFatal = 1; - simError(); - } - - simnfo->rRF = the_globals->getRRF(); - simnfo->dielectric = the_globals->getDielectric(); - } - -#ifdef IS_MPI - strcpy( checkPointMsg, "rRf and dielectric check out" ); - MPIcheckPoint(); -#endif // is_mpi if( the_globals->haveBox() ){ simnfo->box_x = the_globals->getBox(); @@ -424,11 +400,86 @@ void SimSetup::createSim( void ){ if( tot_torsions ){ makeTorsions(); } - + if (the_globals->getUseRF() ) { + simnfo->useReactionField = 1; + + if( !the_globals->haveECR() ){ + sprintf( painCave.errMsg, + "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; + simError(); + double smallest; + smallest = simnfo->box_x; + if (simnfo->box_y <= smallest) smallest = simnfo->box_y; + if (simnfo->box_z <= smallest) smallest = simnfo->box_z; + simnfo->ecr = 0.5 * smallest; + } else { + simnfo->ecr = the_globals->getECR(); + } + if( !the_globals->haveEST() ){ + sprintf( painCave.errMsg, + "SimSetup Warning: using default value of 0.05 * the " + "electrostaticCutoffRadius for the electrostaticSkinThickness\n" + ); + painCave.isFatal = 0; + simError(); + simnfo->est = 0.05 * simnfo->ecr; + } else { + simnfo->est = the_globals->getEST(); + } + + if(!the_globals->haveDielectric() ){ + sprintf( painCave.errMsg, + "SimSetup Error: You are trying to use Reaction Field without" + "setting a dielectric constant!\n" + ); + painCave.isFatal = 1; + simError(); + } + simnfo->dielectric = the_globals->getDielectric(); + } else { + if (simnfo->n_dipoles) { + + if( !the_globals->haveECR() ){ + sprintf( painCave.errMsg, + "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; + simError(); + double smallest; + smallest = simnfo->box_x; + if (simnfo->box_y <= smallest) smallest = simnfo->box_y; + if (simnfo->box_z <= smallest) smallest = simnfo->box_z; + simnfo->ecr = 0.5 * smallest; + } else { + simnfo->ecr = the_globals->getECR(); + } + + if( !the_globals->haveEST() ){ + sprintf( painCave.errMsg, + "SimSetup Warning: using default value of 5% of the" + "electrostaticCutoffRadius for the " + "electrostaticSkinThickness\n" + ); + painCave.isFatal = 0; + simError(); + simnfo->est = 0.05 * simnfo->ecr; + } else { + simnfo->est = the_globals->getEST(); + } + } + } +#ifdef IS_MPI + strcpy( checkPointMsg, "electrostatic parameters check out" ); + MPIcheckPoint(); +#endif // is_mpi if( the_globals->haveInitialConfig() ){