ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/brains/ForceManager.cpp
(Generate patch)

Comparing trunk/src/brains/ForceManager.cpp (file contents):
Revision 1880 by gezelter, Mon Jun 17 18:28:30 2013 UTC vs.
Revision 1915 by gezelter, Mon Jul 29 17:55:17 2013 UTC

# Line 99 | Line 99 | namespace OpenMD {
99     *      Use the maximum suggested value that was found.
100     *
101     * cutoffMethod : (one of HARD, SWITCHED, SHIFTED_FORCE, TAYLOR_SHIFTED,
102 <   *                        or SHIFTED_POTENTIAL)
102 >   *                        SHIFTED_POTENTIAL, or EWALD_FULL)
103     *      If cutoffMethod was explicitly set, use that choice.
104     *      If cutoffMethod was not explicitly set, use SHIFTED_FORCE
105     *
# Line 172 | Line 172 | namespace OpenMD {
172      stringToCutoffMethod["SHIFTED_POTENTIAL"] = SHIFTED_POTENTIAL;    
173      stringToCutoffMethod["SHIFTED_FORCE"] = SHIFTED_FORCE;
174      stringToCutoffMethod["TAYLOR_SHIFTED"] = TAYLOR_SHIFTED;
175 +    stringToCutoffMethod["EWALD_FULL"] = EWALD_FULL;
176    
177      if (simParams_->haveCutoffMethod()) {
178        string cutMeth = toUpperCopy(simParams_->getCutoffMethod());
# Line 182 | Line 183 | namespace OpenMD {
183                  "ForceManager::setupCutoffs: Could not find chosen cutoffMethod %s\n"
184                  "\tShould be one of: "
185                  "HARD, SWITCHED, SHIFTED_POTENTIAL, TAYLOR_SHIFTED,\n"
186 <                "\tor SHIFTED_FORCE\n",
186 >                "\tSHIFTED_FORCE, or EWALD_FULL\n",
187                  cutMeth.c_str());
188          painCave.isFatal = 1;
189          painCave.severity = OPENMD_ERROR;
# Line 228 | Line 229 | namespace OpenMD {
229              cutoffMethod_ = SHIFTED_FORCE;
230            } else if (myMethod == "TAYLOR_SHIFTED") {
231              cutoffMethod_ = TAYLOR_SHIFTED;
232 +          } else if (myMethod == "EWALD_FULL") {
233 +            cutoffMethod_ = EWALD_FULL;
234            }
235          
236            if (simParams_->haveSwitchingRadius())
237              rSwitch_ = simParams_->getSwitchingRadius();
238  
239            if (myMethod == "SHIFTED_POTENTIAL" || myMethod == "SHIFTED_FORCE" ||
240 <              myMethod == "TAYLOR_SHIFTED") {
240 >              myMethod == "TAYLOR_SHIFTED" || myMethod == "EWALD_FULL") {
241              if (simParams_->haveSwitchingRadius()){
242                sprintf(painCave.errMsg,
243                        "ForceManager::setupCutoffs : DEPRECATED ERROR MESSAGE\n"
# Line 695 | Line 698 | namespace OpenMD {
698      RealType vij;
699      Vector3d fij, fg, f1;
700      tuple3<RealType, RealType, RealType> cuts;
701 <    RealType rCutSq;
701 >    RealType rCut, rCutSq, rListSq;
702      bool in_switching_region;
703      RealType sw, dswdr, swderiv;
704      vector<int> atomListColumn, atomListRow;
# Line 713 | Line 716 | namespace OpenMD {
716      vector<int>::iterator ia, jb;
717  
718      int loopStart, loopEnd;
719 <
719 >    
720 >    idat.rcut = &rCut;
721      idat.vdwMult = &vdwMult;
722      idat.electroMult = &electroMult;
723      idat.pot = &workPot;
# Line 746 | Line 750 | namespace OpenMD {
750          if (update_nlist) {
751            if (!usePeriodicBoundaryConditions_)
752              Mat3x3d bbox = thermo->getBoundingBox();
753 <          neighborList = fDecomp_->buildNeighborList();
753 >          fDecomp_->buildNeighborList(neighborList_);
754          }
755        }
756  
757 <      for (vector<pair<int, int> >::iterator it = neighborList.begin();
758 <             it != neighborList.end(); ++it) {
757 >      for (vector<pair<int, int> >::iterator it = neighborList_.begin();
758 >             it != neighborList_.end(); ++it) {
759                  
760          cg1 = (*it).first;
761          cg2 = (*it).second;
762          
763 <        cuts = fDecomp_->getGroupCutoffs(cg1, cg2);
763 >        fDecomp_->getGroupCutoffs(cg1, cg2, rCut, rCutSq, rListSq);
764  
765          d_grp  = fDecomp_->getIntergroupVector(cg1, cg2);
766  
767 <        curSnapshot->wrapVector(d_grp);        
768 <        rgrpsq = d_grp.lengthSquare();
769 <        rCutSq = cuts.second;
767 >        // already wrapped in the getIntergroupVector call:
768 >        // curSnapshot->wrapVector(d_grp);        
769 >        rgrpsq = d_grp.lengthSquare();
770  
771          if (rgrpsq < rCutSq) {
772 <          idat.rcut = &cuts.first;
772 >
773            if (iLoop == PAIR_LOOP) {
774              vij = 0.0;
775              fij.zero();
# Line 921 | Line 925 | namespace OpenMD {
925      
926      // collects pairwise information
927      fDecomp_->collectData();
928 +    if (cutoffMethod_ == EWALD_FULL) {
929 +      interactionMan_->doReciprocalSpaceSum();
930 +    }
931          
932      if (info_->requiresSelfCorrection()) {
933        for (unsigned int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines