--- trunk/OOPSE/libmdtools/ForceFields.cpp 2003/12/22 21:27:04 892 +++ trunk/OOPSE/libmdtools/ForceFields.cpp 2004/04/29 02:11:49 1142 @@ -34,6 +34,43 @@ void ForceFields::calcRcut( void ){ } +void ForceFields::setRcut( double LJrcut ) { + +#ifdef IS_MPI + double tempBig = bigSigma; + MPI_Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX, + MPI_COMM_WORLD); +#endif //is_mpi + + if (LJrcut < 2.5 * bigSigma) { + sprintf( painCave.errMsg, + "Setting Lennard-Jones cutoff radius to %lf.\n" + "\tThis value is smaller than %lf, which is\n" + "\t2.5 * bigSigma, where bigSigma is the largest\n" + "\tvalue of sigma present in the simulation.\n" + "\tThis is potentially a problem since the LJ potential may\n" + "\tbe appreciable at this distance. If you don't want the\n" + "\tsmaller cutoff, change the LJrcut variable.\n", + LJrcut, 2.5*bigSigma); + painCave.isFatal = 0; + simError(); + } else { + sprintf( painCave.errMsg, + "Setting Lennard-Jones cutoff radius to %lf.\n" + "\tThis value is larger than %lf, which is\n" + "\t2.5 * bigSigma, where bigSigma is the largest\n" + "\tvalue of sigma present in the simulation. This should\n" + "\tnot be a problem, but could adversely effect performance.\n", + LJrcut, 2.5*bigSigma); + painCave.isFatal = 0; + simError(); + } + + //calc rCut and rList + + entry_plug->setDefaultRcut( LJrcut ); +} + void ForceFields::doForces( int calcPot, int calcStress ){ int i, isError; @@ -41,7 +78,9 @@ void ForceFields::doForces( int calcPot, int calcStres double* pos; double* trq; double* A; - double* u_l;; + double* u_l; + double* rc; + double* massRatio; SimState* config; short int passedCalcPot = (short int)calcPot; @@ -59,6 +98,8 @@ void ForceFields::doForces( int calcPot, int calcStres #endif for(i=0; in_mol; i++ ){ + // CalcForces in molecules takes care of mapping rigid body coordinates + // into atomic coordinates entry_plug->molecules[i].calcForces(); } @@ -73,6 +114,8 @@ void ForceFields::doForces( int calcPot, int calcStres trq = config->getTrqArray(); A = config->getAmatArray(); u_l = config->getUlArray(); + rc = config->getRcArray(); + massRatio = config->getMassRatioArray(); isError = 0; entry_plug->lrPot = 0.0; @@ -87,6 +130,8 @@ void ForceFields::doForces( int calcPot, int calcStres #endif fortranForceLoop( pos, + rc, + massRatio, A, u_l, frc, @@ -97,6 +142,7 @@ void ForceFields::doForces( int calcPot, int calcStres &passedCalcStress, &isError ); + #ifdef PROFILE endProfile(pro8); #endif @@ -109,6 +155,11 @@ void ForceFields::doForces( int calcPot, int calcStres simError(); } + for(i=0; in_mol; i++ ){ + entry_plug->molecules[i].atoms2rigidBodies(); + } + + #ifdef IS_MPI sprintf( checkPointMsg, "returned from the force calculation.\n" );