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 1755 by gezelter, Thu Jun 14 01:58:35 2012 UTC vs.
Revision 1761 by gezelter, Fri Jun 22 20:01:37 2012 UTC

# Line 586 | 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 649 | 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 656 | 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 704 | Line 724 | namespace OpenMD {
724            
725            in_switching_region = switcher_->getSwitch(rgrpsq, sw, dswdr,
726                                                       rgrp);
727 +
728            atomListRow = fDecomp_->getAtomsInGroupRow(cg1);
729            atomListColumn = fDecomp_->getAtomsInGroupColumn(cg2);
730  
# Line 718 | Line 739 | namespace OpenMD {
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;
# Line 842 | Line 865 | namespace OpenMD {
865        }
866      }
867      
868 +    // collects pairwise information
869      fDecomp_->collectData();
870          
871      if (info_->requiresSelfCorrection()) {
872 <
849 <      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        }
853
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 884 | Line 913 | namespace OpenMD {
913      }
914      
915   #ifdef IS_MPI
887
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