--- branches/mmeineke/OOPSE/libmdtools/ForceFields.cpp 2003/03/21 17:42:12 377 +++ trunk/OOPSE/libmdtools/ForceFields.cpp 2003/08/07 21:47:18 670 @@ -1,3 +1,8 @@ +#include + +using namespace std; + + #include #ifdef IS_MPI @@ -11,48 +16,70 @@ void ForceFields::doForces( int calcPot, int calcStres #include "fortranWrappers.hpp" +void ForceFields::calcRcut( void ){ + +#ifdef IS_MPI + double tempBig = bigSigma; + MPI_Allreduce( &tempBig, &bigSigma, 1, MPI_DOUBLE, MPI_MAX, + MPI_COMM_WORLD); +#endif //is_mpi + + //calc rCut and rList + + entry_plug->setRcut( 2.5 * bigSigma ); +} + void ForceFields::doForces( int calcPot, int calcStress ){ int i, isError; double* frc; double* pos; double* trq; - double* tau; double* A; - double* u_l; + double* u_l;; + DirectionalAtom* dAtom; + SimState* config; short int passedCalcPot = (short int)calcPot; short int passedCalcStress = (short int)calcStress; - // forces are zeroed here, before any are acumulated. + // forces are zeroed here, before any are accumulated. // NOTE: do not rezero the forces in Fortran. for(i=0; in_atoms; i++){ - entry_plug->atoms[i]->zeroForces(); + entry_plug->atoms[i]->zeroForces(); } - frc = Atom::getFrcArray(); - pos = Atom::getPosArray(); - trq = Atom::getTrqArray(); - A = Atom::getAmatArray(); - u_l = Atom::getUlArray(); + for(i=0; in_mol; i++ ){ + entry_plug->molecules[i].calcForces(); + } - tau = entry_plug->tau; - + config = entry_plug->getConfiguration(); + + frc = config->getFrcArray(); + pos = config->getPosArray(); + trq = config->getTrqArray(); + A = config->getAmatArray(); + u_l = config->getUlArray(); + isError = 0; entry_plug->lrPot = 0.0; + + for (i=0; i<9; i++) { + entry_plug->tau[i] = 0.0; + } + fortranForceLoop( pos, A, u_l, frc, trq, - tau, + entry_plug->tau, &(entry_plug->lrPot), &passedCalcPot, &passedCalcStress, &isError ); - if( isError ){ sprintf( painCave.errMsg, "Error returned from the fortran force calculation.\n" ); @@ -65,6 +92,7 @@ void ForceFields::doForces( int calcPot, int calcStres "returned from the force calculation.\n" ); MPIcheckPoint(); #endif // is_mpi + }