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 1993 by gezelter, Tue Apr 29 17:32:31 2014 UTC vs.
Revision 2033 by gezelter, Sat Nov 1 14:12:16 2014 UTC

# Line 57 | Line 57
57   #include "primitives/Torsion.hpp"
58   #include "primitives/Inversion.hpp"
59   #include "nonbonded/NonBondedInteraction.hpp"
60 < #include "perturbations/ElectricField.hpp"
60 > #include "perturbations/UniformField.hpp"
61   #include "parallel/ForceMatrixDecomposition.hpp"
62  
63   #include <cstdio>
# Line 394 | Line 394 | namespace OpenMD {
394      switcher_->setSwitch(rSwitch_, rCut_);
395    }
396  
397
398
399  
397    void ForceManager::initialize() {
398  
399      if (!info_->isTopologyDone()) {
# Line 405 | Line 402 | namespace OpenMD {
402        interactionMan_->setSimInfo(info_);
403        interactionMan_->initialize();
404  
405 <      // We want to delay the cutoffs until after the interaction
406 <      // manager has set up the atom-atom interactions so that we can
407 <      // query them for suggested cutoff values
405 >      //! We want to delay the cutoffs until after the interaction
406 >      //! manager has set up the atom-atom interactions so that we can
407 >      //! query them for suggested cutoff values
408        setupCutoffs();
409  
410        info_->prepareTopology();      
# Line 423 | Line 420 | namespace OpenMD {
420  
421      ForceFieldOptions& fopts = forceField_->getForceFieldOptions();
422      
423 <    // Force fields can set options on how to scale van der Waals and
424 <    // electrostatic interactions for atoms connected via bonds, bends
425 <    // and torsions in this case the topological distance between
426 <    // atoms is:
427 <    // 0 = topologically unconnected
428 <    // 1 = bonded together
429 <    // 2 = connected via a bend
430 <    // 3 = connected via a torsion
423 >    //! Force fields can set options on how to scale van der Waals and
424 >    //! electrostatic interactions for atoms connected via bonds, bends
425 >    //! and torsions in this case the topological distance between
426 >    //! atoms is:
427 >    //! 0 = topologically unconnected
428 >    //! 1 = bonded together
429 >    //! 2 = connected via a bend
430 >    //! 3 = connected via a torsion
431      
432      vdwScale_.reserve(4);
433      fill(vdwScale_.begin(), vdwScale_.end(), 0.0);
# Line 448 | Line 445 | namespace OpenMD {
445      electrostaticScale_[2] = fopts.getelectrostatic13scale();
446      electrostaticScale_[3] = fopts.getelectrostatic14scale();    
447      
448 <    if (info_->getSimParams()->haveElectricField()) {
449 <      ElectricField* eField = new ElectricField(info_);
448 >    if (info_->getSimParams()->haveUniformField()) {
449 >      UniformField* eField = new UniformField(info_);
450        perturbations_.push_back(eField);
451      }
452  
# Line 741 | Line 738 | namespace OpenMD {
738      idat.f1 = &f1;
739      idat.sw = &sw;
740      idat.shiftedPot = (cutoffMethod_ == SHIFTED_POTENTIAL) ? true : false;
741 <    idat.shiftedForce = (cutoffMethod_ == SHIFTED_FORCE || cutoffMethod_ == TAYLOR_SHIFTED) ? true : false;
741 >    idat.shiftedForce = (cutoffMethod_ == SHIFTED_FORCE ||
742 >                         cutoffMethod_ == TAYLOR_SHIFTED) ? true : false;
743      idat.doParticlePot = doParticlePot_;
744      idat.doElectricField = doElectricField_;
745      idat.doSitePotential = doSitePotential_;
# Line 765 | Line 763 | namespace OpenMD {
763        }
764  
765        for (vector<pair<int, int> >::iterator it = neighborList_.begin();
766 <             it != neighborList_.end(); ++it) {
766 >           it != neighborList_.end(); ++it) {
767                  
768          cg1 = (*it).first;
769          cg2 = (*it).second;
# Line 958 | Line 956 | namespace OpenMD {
956      curSnapshot->setLongRangePotential(longRangePotential);
957      
958      curSnapshot->setExcludedPotentials(*(fDecomp_->getExcludedSelfPotential()) +
959 <                                         *(fDecomp_->getExcludedPotential()));
959 >                                       *(fDecomp_->getExcludedPotential()));
960  
961    }
962  
# Line 994 | Line 992 | namespace OpenMD {
992      
993      if (info_->getSimParams()->getUseLongRangeCorrections()) {
994        /*
995 <      RealType vol = curSnapshot->getVolume();
996 <      RealType Elrc(0.0);
997 <      RealType Wlrc(0.0);
998 <
999 <      set<AtomType*>::iterator i;
1000 <      set<AtomType*>::iterator j;
995 >        RealType vol = curSnapshot->getVolume();
996 >        RealType Elrc(0.0);
997 >        RealType Wlrc(0.0);
998 >
999 >        set<AtomType*>::iterator i;
1000 >        set<AtomType*>::iterator j;
1001      
1002 <      RealType n_i, n_j;
1003 <      RealType rho_i, rho_j;
1004 <      pair<RealType, RealType> LRI;
1002 >        RealType n_i, n_j;
1003 >        RealType rho_i, rho_j;
1004 >        pair<RealType, RealType> LRI;
1005        
1006 <      for (i = atomTypes_.begin(); i != atomTypes_.end(); ++i) {
1006 >        for (i = atomTypes_.begin(); i != atomTypes_.end(); ++i) {
1007          n_i = RealType(info_->getGlobalCountOfType(*i));
1008          rho_i = n_i /  vol;
1009          for (j = atomTypes_.begin(); j != atomTypes_.end(); ++j) {
1010 <          n_j = RealType(info_->getGlobalCountOfType(*j));
1011 <          rho_j = n_j / vol;
1010 >        n_j = RealType(info_->getGlobalCountOfType(*j));
1011 >        rho_j = n_j / vol;
1012            
1013 <          LRI = interactionMan_->getLongRangeIntegrals( (*i), (*j) );
1013 >        LRI = interactionMan_->getLongRangeIntegrals( (*i), (*j) );
1014  
1015 <          Elrc += n_i   * rho_j * LRI.first;
1016 <          Wlrc -= rho_i * rho_j * LRI.second;
1015 >        Elrc += n_i   * rho_j * LRI.first;
1016 >        Wlrc -= rho_i * rho_j * LRI.second;
1017          }
1018 <      }
1019 <      Elrc *= 2.0 * NumericConstant::PI;
1020 <      Wlrc *= 2.0 * NumericConstant::PI;
1018 >        }
1019 >        Elrc *= 2.0 * NumericConstant::PI;
1020 >        Wlrc *= 2.0 * NumericConstant::PI;
1021  
1022 <      RealType lrp = curSnapshot->getLongRangePotential();
1023 <      curSnapshot->setLongRangePotential(lrp + Elrc);
1024 <      stressTensor += Wlrc * SquareMatrix3<RealType>::identity();
1025 <      curSnapshot->setStressTensor(stressTensor);
1022 >        RealType lrp = curSnapshot->getLongRangePotential();
1023 >        curSnapshot->setLongRangePotential(lrp + Elrc);
1024 >        stressTensor += Wlrc * SquareMatrix3<RealType>::identity();
1025 >        curSnapshot->setStressTensor(stressTensor);
1026        */
1027      
1028      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines