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

Comparing branches/development/src/brains/ForceManager.cpp (file contents):
Revision 1744 by gezelter, Tue Jun 5 18:07:08 2012 UTC vs.
Revision 1761 by gezelter, Fri Jun 22 20:01:37 2012 UTC

# Line 110 | Line 110 | namespace OpenMD {
110      Globals* simParams_ = info_->getSimParams();
111      ForceFieldOptions& forceFieldOptions_ = forceField_->getForceFieldOptions();
112      int mdFileVersion;
113 +    rCut_ = 0.0; //Needs a value for a later max() call;  
114      
115      if (simParams_->haveMDfileVersion())
116        mdFileVersion = simParams_->getMDfileVersion();
# Line 585 | Line 586 | namespace OpenMD {
586          }      
587        }      
588      }
589 <    
590 <    RealType  shortRangePotential = bondPotential + bendPotential +
591 <      torsionPotential +  inversionPotential;    
589 >
590 > #ifdef IS_MPI
591 >    // Collect from all nodes.  This should eventually be moved into a
592 >    // SystemDecomposition, but this is a better place than in
593 >    // Thermo to do the collection.
594 >    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bondPotential, 1, MPI::REALTYPE,
595 >                              MPI::SUM);
596 >    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &bendPotential, 1, MPI::REALTYPE,
597 >                              MPI::SUM);
598 >    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &torsionPotential, 1,
599 >                              MPI::REALTYPE, MPI::SUM);
600 >    MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, &inversionPotential, 1,
601 >                              MPI::REALTYPE, MPI::SUM);
602 > #endif
603 >
604      Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
605 <    curSnapshot->statData[Stats::SHORT_RANGE_POTENTIAL] = shortRangePotential;
606 <    curSnapshot->statData[Stats::BOND_POTENTIAL] = bondPotential;
607 <    curSnapshot->statData[Stats::BEND_POTENTIAL] = bendPotential;
608 <    curSnapshot->statData[Stats::DIHEDRAL_POTENTIAL] = torsionPotential;
609 <    curSnapshot->statData[Stats::INVERSION_POTENTIAL] = inversionPotential;    
605 >
606 >    curSnapshot->setBondPotential(bondPotential);
607 >    curSnapshot->setBendPotential(bendPotential);
608 >    curSnapshot->setTorsionPotential(torsionPotential);
609 >    curSnapshot->setInversionPotential(inversionPotential);
610 >    
611 >    RealType shortRangePotential = bondPotential + bendPotential +
612 >      torsionPotential +  inversionPotential;    
613 >
614 >    curSnapshot->setShortRangePotential(shortRangePotential);
615    }
616    
617    void ForceManager::longRangeInteractions() {
# Line 648 | Line 666 | namespace OpenMD {
666      RealType dVdFQ2(0.0);
667      potVec longRangePotential(0.0);
668      potVec workPot(0.0);
669 +    potVec exPot(0.0);
670      vector<int>::iterator ia, jb;
671  
672      int loopStart, loopEnd;
# Line 655 | Line 674 | namespace OpenMD {
674      idat.vdwMult = &vdwMult;
675      idat.electroMult = &electroMult;
676      idat.pot = &workPot;
677 +    idat.excludedPot = &exPot;
678      sdat.pot = fDecomp_->getEmbeddingPotential();
679 +    sdat.excludedPot = fDecomp_->getExcludedSelfPotential();
680      idat.vpair = &vpair;
681      idat.dVdFQ1 = &dVdFQ1;
682      idat.dVdFQ2 = &dVdFQ2;
# Line 672 | Line 693 | namespace OpenMD {
693      } else {
694        loopStart = PAIR_LOOP;
695      }
675  
696      for (int iLoop = loopStart; iLoop <= loopEnd; iLoop++) {
697      
698        if (iLoop == loopStart) {
# Line 704 | Line 724 | namespace OpenMD {
724            
725            in_switching_region = switcher_->getSwitch(rgrpsq, sw, dswdr,
726                                                       rgrp);
727 <          
727 >
728            atomListRow = fDecomp_->getAtomsInGroupRow(cg1);
729            atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2);
730  
731            if (doHeatFlux_)
732              gvel2 = fDecomp_->getGroupVelocityColumn(cg2);
733 <        
733 >
734            for (ia = atomListRow.begin();
735                 ia != atomListRow.end(); ++ia) {            
736              atom1 = (*ia);
737 <            
737 >
738              for (jb = atomListColumn.begin();
739                   jb != atomListColumn.end(); ++jb) {              
740                atom2 = (*jb);
741  
742 <              if (!fDecomp_->skipAtomPair(atom1, atom2)) {
742 >              if (!fDecomp_->skipAtomPair(atom1, atom2, cg1, cg2)) {
743 >
744                  vpair = 0.0;
745                  workPot = 0.0;
746 +                exPot = 0.0;
747                  f1 = V3Zero;
748                  dVdFQ1 = 0.0;
749                  dVdFQ2 = 0.0;
750  
751                  fDecomp_->fillInteractionData(idat, atom1, atom2);
752 <                
752 >
753                  topoDist = fDecomp_->getTopologicalDistance(atom1, atom2);
754                  vdwMult = vdwScale_[topoDist];
755                  electroMult = electrostaticScale_[topoDist];
# Line 843 | Line 865 | namespace OpenMD {
865        }
866      }
867      
868 +    // collects pairwise information
869      fDecomp_->collectData();
870          
871      if (info_->requiresSelfCorrection()) {
872 <
850 <      for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {          
872 >      for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {
873          fDecomp_->fillSelfData(sdat, atom1);
874          interactionMan_->doSelfCorrection(sdat);
875        }
854
876      }
877  
878 +    // collects single-atom information
879 +    fDecomp_->collectSelfData();
880 +
881      longRangePotential = *(fDecomp_->getEmbeddingPotential()) +
882        *(fDecomp_->getPairwisePotential());
883  
884 +    curSnapshot->setLongRangePotentialFamilies(longRangePotential);
885 +
886      lrPot = longRangePotential.sum();
887  
888 <    //store the stressTensor and long range potential    
889 <    curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot;
890 <    curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VANDERWAALS_FAMILY];
891 <    curSnapshot->statData[Stats::ELECTROSTATIC_POTENTIAL] = longRangePotential[ELECTROSTATIC_FAMILY];
888 >    //store the long range potential  
889 >    curSnapshot->setLongRangePotential(lrPot);
890 >    
891 >    curSnapshot->setExcludedPotentials(*(fDecomp_->getExcludedSelfPotential()) +
892 >                                         *(fDecomp_->getExcludedPotential()));
893 >
894    }
895  
896    
# Line 885 | Line 913 | namespace OpenMD {
913      }
914      
915   #ifdef IS_MPI
888
916      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, stressTensor.getArrayPointer(), 9,
917                                MPI::REALTYPE, MPI::SUM);
918   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines