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

Comparing branches/development/src/flucq/FluctuatingChargeObjectiveFunction.cpp (file contents):
Revision 1756 by gezelter, Mon Jun 18 18:23:20 2012 UTC vs.
Revision 1761 by gezelter, Fri Jun 22 20:01:37 2012 UTC

# Line 52 | Line 52 | namespace OpenMD{
52    RealType FluctuatingChargeObjectiveFunction::value(const DynamicVector<RealType>& x) {
53      setCoor(x);
54      forceMan_->calcForces();
55 +
56      Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
57 <    return curSnapshot->statData[Stats::ELECTROSTATIC_POTENTIAL];
57 >    potVec pot = curSnapshot->getLongRangePotentials();
58 >    potVec exPot = curSnapshot->getExcludedPotentials();  
59 >  
60 >    return pot[ELECTROSTATIC_FAMILY] + exPot[ELECTROSTATIC_FAMILY];
61    }
62    
63    void FluctuatingChargeObjectiveFunction::gradient(DynamicVector<RealType>& grad, const DynamicVector<RealType>& x) {
# Line 63 | Line 67 | namespace OpenMD{
67      
68      forceMan_->calcForces();
69      fqConstraints_->applyConstraints();
70 <    
70 >
71      getGrad(grad);      
72    }
73    
# Line 78 | Line 82 | namespace OpenMD{
82      getGrad(grad);
83  
84      Snapshot* curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot();
85 <    return curSnapshot->statData[Stats::ELECTROSTATIC_POTENTIAL];
85 >    potVec pot = curSnapshot->getLongRangePotentials();
86 >    potVec exPot = curSnapshot->getExcludedPotentials();    
87 >
88 >    return pot[ELECTROSTATIC_FAMILY] + exPot[ELECTROSTATIC_FAMILY];
89    }
90    
91    void FluctuatingChargeObjectiveFunction::setCoor(const DynamicVector<RealType> &x) const {
# Line 114 | Line 121 | namespace OpenMD{
121             atom = mol->nextFluctuatingCharge(j)) {
122  
123          grad[index++] = -atom->getFlucQFrc();
117
124        }
125      }
126    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines