--- trunk/OOPSE/libmdtools/ForceFields.cpp 2004/05/01 18:52:38 1144 +++ trunk/OOPSE/libmdtools/ForceFields.cpp 2004/06/01 17:15:43 1212 @@ -73,7 +73,7 @@ void ForceFields::doForces( int calcPot, int calcStres void ForceFields::doForces( int calcPot, int calcStress ){ - int i, isError; + int i, j, isError; double* frc; double* pos; double* trq; @@ -81,8 +81,21 @@ void ForceFields::doForces( int calcPot, int calcStres double* u_l; double* rc; double* massRatio; + double factor; SimState* config; + Molecule* myMols; + Atom** myAtoms; + int numAtom; + int curIndex; + double mtot; + int numMol; + int numCutoffGroups; + CutoffGroup* myCutoffGroup; + vector::iterator iterCutoff; + double com[3]; + vector rcGroup; + short int passedCalcPot = (short int)calcPot; short int passedCalcStress = (short int)calcStress; @@ -100,7 +113,7 @@ void ForceFields::doForces( int calcPot, int calcStres for(i=0; in_mol; i++ ){ // CalcForces in molecules takes care of mapping rigid body coordinates // into atomic coordinates - entry_plug->molecules[i].calcForces(); + entry_plug->molecules[i].calcForces(); } #ifdef PROFILE @@ -114,9 +127,35 @@ void ForceFields::doForces( int calcPot, int calcStres trq = config->getTrqArray(); A = config->getAmatArray(); u_l = config->getUlArray(); - rc = config->getRcArray(); - massRatio = config->getMassRatioArray(); + if(entry_plug->haveCutoffGroups){ + myMols = entry_plug->molecules; + numMol = entry_plug->n_mol; + for(int i = 0; i < numMol; i++){ + + numCutoffGroups = myMols[i].getNCutoffGroups(); + for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL; + myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ + //get center of mass of the cutoff group + myCutoffGroup->getCOM(com); + + rcGroup.push_back(com[0]); + rcGroup.push_back(com[1]); + rcGroup.push_back(com[2]); + + }// end for(myCutoffGroup) + + }//end for(int i = 0) + + rc = &rcGroup[0]; + } + else{ + // center of mass of the group is the same as position of the atom if cutoff group does not exist + rc = pos; + } + + + isError = 0; entry_plug->lrPot = 0.0; @@ -159,6 +198,40 @@ void ForceFields::doForces( int calcPot, int calcStres } + if (entry_plug->useSolidThermInt && !entry_plug->useLiquidThermInt) { + + factor = pow(entry_plug->thermIntLambda, entry_plug->thermIntK); + for (i=0; i < entry_plug->integrableObjects.size(); i++) { + for (j=0; j< 3; j++) + frc[3*i + j] *= factor; + if (entry_plug->integrableObjects[i]->isDirectional()) { + for (j=0; j< 3; j++) + trq[3*i + j] *= factor; + } + } + entry_plug->vRaw = entry_plug->lrPot; + entry_plug->lrPot *= factor; + entry_plug->lrPot += entry_plug->restraint->Calc_Restraint_Forces(entry_plug->integrableObjects); + entry_plug->vHarm = entry_plug->restraint->getVharm(); + } + + if (entry_plug->useLiquidThermInt) { + + factor = pow(entry_plug->thermIntLambda, entry_plug->thermIntK); + for (i=0; i < entry_plug->integrableObjects.size(); i++) { + for (j=0; j< 3; j++) + frc[3*i + j] *= factor; + if (entry_plug->integrableObjects[i]->isDirectional()) { + for (j=0; j< 3; j++) + trq[3*i + j] *= factor; + } + } + entry_plug->vRaw = entry_plug->lrPot; + entry_plug->lrPot *= factor; + entry_plug->lrPot += entry_plug->restraint->Calc_Restraint_Forces(entry_plug->integrableObjects); + entry_plug->vHarm = entry_plug->restraint->getVharm(); + } + #ifdef IS_MPI sprintf( checkPointMsg, "returned from the force calculation.\n" ); @@ -190,3 +263,22 @@ void ForceFields::initFortran(int ljMixPolicy, int use #endif // is_mpi } + + +void ForceFields::initRestraints(){ + int i; + // store the initial info. + // set the omega values to zero + for (i=0; iintegrableObjects.size(); i++) + entry_plug->integrableObjects[i]->setZangle( 0.0 ); + + entry_plug->restraint->Store_Init_Info(entry_plug->integrableObjects); + +} + +void ForceFields::dumpzAngle(){ + + // store the initial info. + entry_plug->restraint->Write_zAngle_File(entry_plug->integrableObjects); + +}