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 1733 by jmichalk, Tue Jun 5 17:48:40 2012 UTC vs.
Revision 1760 by gezelter, Thu Jun 21 19:26:46 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 475 | Line 476 | namespace OpenMD {
476      // Zero out the stress tensor
477      stressTensor *= 0.0;
478      // Zero out the heatFlux
479 <    fDecomp_->setHeatFlux( V3Zero );    
479 >    fDecomp_->setHeatFlux( Vector3d(0.0) );    
480    }
481    
482    void ForceManager::shortRangeInteractions() {
# 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      idat.vpair = &vpair;
680      idat.dVdFQ1 = &dVdFQ1;
# Line 672 | Line 692 | namespace OpenMD {
692      } else {
693        loopStart = PAIR_LOOP;
694      }
675  
695      for (int iLoop = loopStart; iLoop <= loopEnd; iLoop++) {
696      
697        if (iLoop == loopStart) {
# Line 704 | Line 723 | namespace OpenMD {
723            
724            in_switching_region = switcher_->getSwitch(rgrpsq, sw, dswdr,
725                                                       rgrp);
726 <          
726 >
727            atomListRow = fDecomp_->getAtomsInGroupRow(cg1);
728            atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2);
729  
730            if (doHeatFlux_)
731              gvel2 = fDecomp_->getGroupVelocityColumn(cg2);
732 <        
732 >
733            for (ia = atomListRow.begin();
734                 ia != atomListRow.end(); ++ia) {            
735              atom1 = (*ia);
736 <            
736 >
737              for (jb = atomListColumn.begin();
738                   jb != atomListColumn.end(); ++jb) {              
739                atom2 = (*jb);
740  
741 <              if (!fDecomp_->skipAtomPair(atom1, atom2)) {
741 >              if (!fDecomp_->skipAtomPair(atom1, atom2, cg1, cg2)) {
742 >
743                  vpair = 0.0;
744                  workPot = 0.0;
745 +                exPot = 0.0;
746                  f1 = V3Zero;
747                  dVdFQ1 = 0.0;
748                  dVdFQ2 = 0.0;
749  
750                  fDecomp_->fillInteractionData(idat, atom1, atom2);
751 <                
751 >
752                  topoDist = fDecomp_->getTopologicalDistance(atom1, atom2);
753                  vdwMult = vdwScale_[topoDist];
754                  electroMult = electrostaticScale_[topoDist];
# Line 843 | Line 864 | namespace OpenMD {
864        }
865      }
866      
867 +    // collects pairwise information
868      fDecomp_->collectData();
869          
870      if (info_->requiresSelfCorrection()) {
871 <
850 <      for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {          
871 >      for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {
872          fDecomp_->fillSelfData(sdat, atom1);
873          interactionMan_->doSelfCorrection(sdat);
874        }
854
875      }
876  
877 +    // collects single-atom information
878 +    fDecomp_->collectSelfData();
879 +
880      longRangePotential = *(fDecomp_->getEmbeddingPotential()) +
881        *(fDecomp_->getPairwisePotential());
882  
883 +    curSnapshot->setLongRangePotentialFamilies(longRangePotential);
884 +
885      lrPot = longRangePotential.sum();
886  
887 <    //store the stressTensor and long range potential    
888 <    curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot;
889 <    curSnapshot->statData[Stats::VANDERWAALS_POTENTIAL] = longRangePotential[VANDERWAALS_FAMILY];
890 <    curSnapshot->statData[Stats::ELECTROSTATIC_POTENTIAL] = longRangePotential[ELECTROSTATIC_FAMILY];
887 >    //store the long range potential  
888 >    curSnapshot->setLongRangePotential(lrPot);
889 >
890 >    curSnapshot->setExcludedPotentials(*(fDecomp_->getExcludedPotential()));
891 >
892    }
893  
894    
# Line 885 | Line 911 | namespace OpenMD {
911      }
912      
913   #ifdef IS_MPI
888
914      MPI::COMM_WORLD.Allreduce(MPI::IN_PLACE, stressTensor.getArrayPointer(), 9,
915                                MPI::REALTYPE, MPI::SUM);
916   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines