36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 |
|
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 |
|
*/ |
42 |
|
|
43 |
|
/** |
54 |
|
#include "utils/ProgressBar.hpp" |
55 |
|
|
56 |
|
namespace OpenMD { |
57 |
< |
VelocityVerletIntegrator::VelocityVerletIntegrator(SimInfo *info) : Integrator(info), rotAlgo(NULL) { |
57 |
> |
VelocityVerletIntegrator::VelocityVerletIntegrator(SimInfo *info) : Integrator(info) { |
58 |
|
dt2 = 0.5 * dt; |
58 |
– |
rotAlgo = new DLM(); |
59 |
– |
rattle = new Rattle(info); |
59 |
|
} |
60 |
|
|
61 |
|
VelocityVerletIntegrator::~VelocityVerletIntegrator() { |
63 |
– |
delete rotAlgo; |
64 |
– |
delete rattle; |
62 |
|
} |
63 |
|
|
64 |
|
void VelocityVerletIntegrator::initialize(){ |
65 |
|
|
66 |
< |
forceMan_->init(); |
66 |
> |
forceMan_->initialize(); |
67 |
|
|
68 |
|
// remove center of mass drift velocity (in case we passed in a |
69 |
|
// configuration that was drifting) |
70 |
|
velocitizer_->removeComDrift(); |
71 |
+ |
|
72 |
+ |
// find the initial fluctuating charges. |
73 |
+ |
flucQ_->initialize(); |
74 |
|
|
75 |
|
// initialize the forces before the first step |
76 |
|
calcForce(); |
78 |
|
// execute the constraint algorithm to make sure that the system is |
79 |
|
// constrained at the very beginning |
80 |
|
if (info_->getNGlobalConstraints() > 0) { |
81 |
< |
rattle->constraintA(); |
81 |
> |
rattle_->constraintA(); |
82 |
|
calcForce(); |
83 |
< |
rattle->constraintB(); |
83 |
> |
rattle_->constraintB(); |
84 |
|
//copy the current snapshot to previous snapshot |
85 |
|
info_->getSnapshotManager()->advance(); |
86 |
|
} |
100 |
|
//save statistics, before writeStat, we must save statistics |
101 |
|
thermo.saveStat(); |
102 |
|
saveConservedQuantity(); |
103 |
< |
if (simParams->getUseRNEMD()) |
103 |
> |
if (simParams->getRNEMDParameters()->getUseRNEMD()) |
104 |
|
rnemd_->getStarted(); |
105 |
|
|
106 |
|
statWriter->writeStat(currentSnapshot_->statData); |
111 |
|
if (needReset) { |
112 |
|
currReset = resetTime + currentSnapshot_->getTime(); |
113 |
|
} |
114 |
< |
if (simParams->getUseRNEMD()){ |
114 |
> |
if (simParams->getRNEMDParameters()->getUseRNEMD()){ |
115 |
|
currRNEMD = RNEMD_exchangeTime + currentSnapshot_->getTime(); |
116 |
|
} |
117 |
|
needPotential = false; |
121 |
|
|
122 |
|
void VelocityVerletIntegrator::doIntegrate() { |
123 |
|
|
124 |
– |
|
124 |
|
initialize(); |
125 |
|
|
126 |
< |
while (currentSnapshot_->getTime() < runTime) { |
127 |
< |
|
128 |
< |
preStep(); |
129 |
< |
|
130 |
< |
integrateStep(); |
132 |
< |
|
133 |
< |
postStep(); |
134 |
< |
|
135 |
< |
} |
136 |
< |
|
126 |
> |
while (currentSnapshot_->getTime() < runTime) { |
127 |
> |
preStep(); |
128 |
> |
integrateStep(); |
129 |
> |
postStep(); |
130 |
> |
} |
131 |
|
finalize(); |
138 |
– |
|
132 |
|
} |
133 |
|
|
134 |
|
|
174 |
|
thermo.saveStat(); |
175 |
|
saveConservedQuantity(); |
176 |
|
|
177 |
< |
if (simParams->getUseRNEMD()) { |
177 |
> |
if (simParams->getRNEMDParameters()->getUseRNEMD()) { |
178 |
|
rnemd_->getStatus(); |
179 |
|
} |
180 |
|
|
203 |
|
|
204 |
|
dumpWriter = NULL; |
205 |
|
statWriter = NULL; |
213 |
– |
|
206 |
|
} |
207 |
|
|
208 |
|
void VelocityVerletIntegrator::integrateStep() { |
215 |
|
|
216 |
|
void VelocityVerletIntegrator::calcForce() { |
217 |
|
forceMan_->calcForces(); |
218 |
+ |
flucQ_->applyConstraints(); |
219 |
|
} |
220 |
|
|
221 |
|
DumpWriter* VelocityVerletIntegrator::createDumpWriter() { |
232 |
|
|
233 |
|
|
234 |
|
if (simParams->getUseThermodynamicIntegration()) |
235 |
< |
mask.set(Stats::VRAW); |
235 |
> |
mask.set(Stats::RAW_POTENTIAL); |
236 |
|
|
237 |
|
// if we've got restraints turned on, we'll also want a report of the |
238 |
|
// total harmonic restraints |
239 |
|
if (simParams->getUseRestraints()){ |
240 |
< |
mask.set(Stats::VHARM); |
240 |
> |
mask.set(Stats::RESTRAINT_POTENTIAL); |
241 |
|
} |
242 |
|
|
243 |
|
if (simParams->havePrintPressureTensor() && |
258 |
|
mask.set(Stats::BOX_DIPOLE_Y); |
259 |
|
mask.set(Stats::BOX_DIPOLE_Z); |
260 |
|
} |
261 |
+ |
|
262 |
+ |
if (simParams->getPrintHeatFlux()) { |
263 |
+ |
mask.set(Stats::HEATFLUX_X); |
264 |
+ |
mask.set(Stats::HEATFLUX_Y); |
265 |
+ |
mask.set(Stats::HEATFLUX_Z); |
266 |
+ |
} |
267 |
|
|
268 |
|
if (simParams->haveTaggedAtomPair() && simParams->havePrintTaggedPairDistance()) { |
269 |
|
if (simParams->getPrintTaggedPairDistance()) { |
271 |
|
} |
272 |
|
} |
273 |
|
|
274 |
< |
if (simParams->getUseRNEMD()) { |
274 |
> |
if (simParams->getRNEMDParameters()->getUseRNEMD()) { |
275 |
|
mask.set(Stats::RNEMD_EXCHANGE_TOTAL); |
276 |
|
} |
277 |
|
|