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 1761 by gezelter, Fri Jun 22 20:01:37 2012 UTC vs.
Revision 1780 by jmarr, Mon Aug 20 18:28:22 2012 UTC

# Line 58 | Line 58
58   #include "primitives/Torsion.hpp"
59   #include "primitives/Inversion.hpp"
60   #include "nonbonded/NonBondedInteraction.hpp"
61 + #include "perturbations/ElectricField.hpp"
62   #include "parallel/ForceMatrixDecomposition.hpp"
63  
64   #include <cstdio>
# Line 423 | Line 424 | namespace OpenMD {
424      electrostaticScale_[2] = fopts.getelectrostatic13scale();
425      electrostaticScale_[3] = fopts.getelectrostatic14scale();    
426      
427 +    if (info_->getSimParams()->haveElectricField()) {
428 +      ElectricField* eField = new ElectricField(info_);
429 +      perturbations_.push_back(eField);
430 +    }
431 +
432      fDecomp_->distributeInitialData();
433  
434      initialized_ = true;
# Line 449 | Line 455 | namespace OpenMD {
455      Molecule::CutoffGroupIterator ci;
456      CutoffGroup* cg;
457      
458 <    // forces are zeroed here, before any are accumulated.
458 >    // forces and potentials are zeroed here, before any are
459 >    // accumulated.
460      
461 +    Snapshot* snap = info_->getSnapshotManager()->getCurrentSnapshot();
462 +
463 +    snap->setBondPotential(0.0);
464 +    snap->setBendPotential(0.0);
465 +    snap->setTorsionPotential(0.0);
466 +    snap->setInversionPotential(0.0);
467 +
468 +    potVec zeroPot(0.0);
469 +    snap->setLongRangePotential(zeroPot);
470 +    snap->setExcludedPotentials(zeroPot);
471 +
472 +    snap->setRestraintPotential(0.0);
473 +    snap->setRawPotential(0.0);
474 +
475      for (mol = info_->beginMolecule(mi); mol != NULL;
476           mol = info_->nextMolecule(mi)) {
477        for(atom = mol->beginAtom(ai); atom != NULL;
# Line 608 | Line 629 | namespace OpenMD {
629      curSnapshot->setTorsionPotential(torsionPotential);
630      curSnapshot->setInversionPotential(inversionPotential);
631      
632 <    RealType shortRangePotential = bondPotential + bendPotential +
633 <      torsionPotential +  inversionPotential;    
632 >    // RealType shortRangePotential = bondPotential + bendPotential +
633 >    //   torsionPotential +  inversionPotential;    
634  
635 <    curSnapshot->setShortRangePotential(shortRangePotential);
635 >    // curSnapshot->setShortRangePotential(shortRangePotential);
636    }
637    
638    void ForceManager::longRangeInteractions() {
# Line 660 | Line 681 | namespace OpenMD {
681      InteractionData idat;
682      SelfData sdat;
683      RealType mf;
663    RealType lrPot;
684      RealType vpair;
685      RealType dVdFQ1(0.0);
686      RealType dVdFQ2(0.0);
# Line 854 | Line 874 | namespace OpenMD {
874  
875            fDecomp_->collectIntermediateData();
876  
877 <          for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {
877 >          for (unsigned int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {
878              fDecomp_->fillSelfData(sdat, atom1);
879              interactionMan_->doPreForce(sdat);
880            }
# Line 869 | Line 889 | namespace OpenMD {
889      fDecomp_->collectData();
890          
891      if (info_->requiresSelfCorrection()) {
892 <      for (int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {
892 >      for (unsigned int atom1 = 0; atom1 < info_->getNAtoms(); atom1++) {
893          fDecomp_->fillSelfData(sdat, atom1);
894          interactionMan_->doSelfCorrection(sdat);
895        }
# Line 880 | Line 900 | namespace OpenMD {
900  
901      longRangePotential = *(fDecomp_->getEmbeddingPotential()) +
902        *(fDecomp_->getPairwisePotential());
883
884    curSnapshot->setLongRangePotentialFamilies(longRangePotential);
885
886    lrPot = longRangePotential.sum();
903  
904 <    //store the long range potential  
889 <    curSnapshot->setLongRangePotential(lrPot);
904 >    curSnapshot->setLongRangePotential(longRangePotential);
905      
906      curSnapshot->setExcludedPotentials(*(fDecomp_->getExcludedSelfPotential()) +
907                                           *(fDecomp_->getExcludedPotential()));
# Line 895 | Line 910 | namespace OpenMD {
910  
911    
912    void ForceManager::postCalculation() {
913 +
914 +    vector<Perturbation*>::iterator pi;
915 +    for (pi = perturbations_.begin(); pi != perturbations_.end(); ++pi) {
916 +      (*pi)->applyPerturbation();
917 +    }
918 +
919      SimInfo::MoleculeIterator mi;
920      Molecule* mol;
921      Molecule::RigidBodyIterator rbIter;
922      RigidBody* rb;
923      Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
924 <    
924 >  
925      // collect the atomic forces onto rigid bodies
926      
927      for (mol = info_->beginMolecule(mi); mol != NULL;
# Line 919 | Line 940 | namespace OpenMD {
940      curSnapshot->setStressTensor(stressTensor);
941      
942    }
922
943   } //end namespace OpenMD

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines