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) { |
67 |
|
|
68 |
|
forceMan_->calcForces(); |
69 |
|
fqConstraints_->applyConstraints(); |
70 |
< |
|
70 |
> |
|
71 |
|
getGrad(grad); |
72 |
|
} |
73 |
|
|
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 { |
121 |
|
atom = mol->nextFluctuatingCharge(j)) { |
122 |
|
|
123 |
|
grad[index++] = -atom->getFlucQFrc(); |
117 |
– |
|
124 |
|
} |
125 |
|
} |
126 |
|
} |