42 |
|
#include <cmath> |
43 |
|
#include "restraints/ThermoIntegrationForceManager.hpp" |
44 |
|
#include "integrators/Integrator.hpp" |
45 |
+ |
#include "math/SquareMatrix3.hpp" |
46 |
|
#include "primitives/Molecule.hpp" |
47 |
|
#include "utils/simError.h" |
48 |
|
#include "utils/OOPSEConstant.hpp" |
91 |
|
|
92 |
|
// build the scaling factor used to modulate the forces and torques |
93 |
|
factor_ = pow(tIntLambda_, tIntK_); |
94 |
< |
|
94 |
> |
|
95 |
> |
sprintf(painCave.errMsg,"%f is the factor\n",factor_); |
96 |
> |
painCave.isFatal = 0; |
97 |
> |
simError(); |
98 |
> |
|
99 |
|
} |
100 |
|
|
101 |
|
ThermoIntegrationForceManager::~ThermoIntegrationForceManager(){ |
110 |
|
StuntDouble* integrableObject; |
111 |
|
Vector3d frc; |
112 |
|
Vector3d trq; |
113 |
+ |
Mat3x3d tempTau; |
114 |
|
|
109 |
– |
curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); |
110 |
– |
|
115 |
|
// perform the standard calcForces first |
116 |
|
ForceManager::calcForces(needPotential, needStress); |
117 |
|
|
118 |
+ |
curSnapshot = info_->getSnapshotManager()->getCurrentSnapshot(); |
119 |
+ |
|
120 |
|
// now scale forces and torques of all the integrableObjects |
121 |
|
|
122 |
|
for (mol = info_->beginMolecule(mi); mol != NULL; |
134 |
|
integrableObject->setTrq(trq); |
135 |
|
} |
136 |
|
} |
131 |
– |
|
132 |
– |
// set vraw to be the unmodulated potential |
133 |
– |
lrPot_ = curSnapshot->statData[Stats::POTENTIAL_ENERGY]; |
134 |
– |
curSnapshot->statData[Stats::VRAW] = lrPot_; |
135 |
– |
|
136 |
– |
// modulate the potential and update the snapshot |
137 |
– |
lrPot_ *= factor_; |
138 |
– |
curSnapshot->statData[Stats::POTENTIAL_ENERGY] = lrPot_; |
137 |
|
} |
138 |
+ |
|
139 |
+ |
// set vraw to be the unmodulated potential |
140 |
+ |
lrPot_ = curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL]; |
141 |
+ |
curSnapshot->statData[Stats::VRAW] = lrPot_; |
142 |
|
|
143 |
+ |
// modulate the potential and update the snapshot |
144 |
+ |
lrPot_ *= factor_; |
145 |
+ |
curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot_; |
146 |
+ |
|
147 |
+ |
// scale the pressure tensor |
148 |
+ |
tempTau = curSnapshot->statData.getTau(); |
149 |
+ |
tempTau *= factor_; |
150 |
+ |
curSnapshot->statData.setTau(tempTau); |
151 |
+ |
|
152 |
|
// do crystal restraint forces for thermodynamic integration |
153 |
|
if (simParam->getUseSolidThermInt()) { |
154 |
|
|
155 |
|
lrPot_ += restraint_->Calc_Restraint_Forces(); |
156 |
< |
curSnapshot->statData[Stats::POTENTIAL_ENERGY] = lrPot_; |
156 |
> |
curSnapshot->statData[Stats::LONG_RANGE_POTENTIAL] = lrPot_; |
157 |
|
|
158 |
|
vHarm_ = restraint_->getVharm(); |
159 |
|
curSnapshot->statData[Stats::VHARM] = vHarm_; |