| 98 |
|
progressBar = new ProgressBar(); |
| 99 |
|
|
| 100 |
|
//save statistics, before writeStat, we must save statistics |
| 101 |
– |
thermo.saveStat(); |
| 101 |
|
saveConservedQuantity(); |
| 102 |
+ |
stats->collectStats(); |
| 103 |
+ |
|
| 104 |
|
if (simParams->getRNEMDParameters()->getUseRNEMD()) |
| 105 |
|
rnemd_->getStarted(); |
| 106 |
|
|
| 107 |
< |
statWriter->writeStat(currentSnapshot_->statData); |
| 107 |
> |
statWriter->writeStat(); |
| 108 |
|
|
| 109 |
< |
currSample = sampleTime + currentSnapshot_->getTime(); |
| 110 |
< |
currStatus = statusTime + currentSnapshot_->getTime(); |
| 111 |
< |
currThermal = thermalTime + currentSnapshot_->getTime(); |
| 109 |
> |
currSample = sampleTime + snap->getTime(); |
| 110 |
> |
currStatus = statusTime + snap->getTime(); |
| 111 |
> |
currThermal = thermalTime + snap->getTime(); |
| 112 |
|
if (needReset) { |
| 113 |
< |
currReset = resetTime + currentSnapshot_->getTime(); |
| 113 |
> |
currReset = resetTime + snap->getTime(); |
| 114 |
|
} |
| 115 |
|
if (simParams->getRNEMDParameters()->getUseRNEMD()){ |
| 116 |
< |
currRNEMD = RNEMD_exchangeTime + currentSnapshot_->getTime(); |
| 116 |
> |
currRNEMD = RNEMD_exchangeTime + snap->getTime(); |
| 117 |
|
} |
| 118 |
|
needPotential = false; |
| 119 |
|
needStress = false; |
| 124 |
|
|
| 125 |
|
initialize(); |
| 126 |
|
|
| 127 |
< |
while (currentSnapshot_->getTime() < runTime) { |
| 127 |
> |
while (snap->getTime() < runTime) { |
| 128 |
|
preStep(); |
| 129 |
|
integrateStep(); |
| 130 |
|
postStep(); |
| 134 |
|
|
| 135 |
|
|
| 136 |
|
void VelocityVerletIntegrator::preStep() { |
| 137 |
< |
RealType difference = currentSnapshot_->getTime() + dt - currStatus; |
| 137 |
> |
RealType difference = snap->getTime() + dt - currStatus; |
| 138 |
|
|
| 139 |
|
if (difference > 0 || fabs(difference) < OpenMD::epsilon) { |
| 140 |
|
needPotential = true; |
| 148 |
|
info_->getSnapshotManager()->advance(); |
| 149 |
|
|
| 150 |
|
//increase time |
| 151 |
< |
currentSnapshot_->increaseTime(dt); |
| 151 |
> |
snap->increaseTime(dt); |
| 152 |
|
|
| 153 |
|
if (needVelocityScaling) { |
| 154 |
< |
if (currentSnapshot_->getTime() >= currThermal) { |
| 154 |
> |
if (snap->getTime() >= currThermal) { |
| 155 |
|
velocitizer_->velocitize(targetScalingTemp); |
| 156 |
|
currThermal += thermalTime; |
| 157 |
|
} |
| 158 |
|
} |
| 159 |
|
if (useRNEMD) { |
| 160 |
< |
if (currentSnapshot_->getTime() >= currRNEMD) { |
| 160 |
> |
if (snap->getTime() >= currRNEMD) { |
| 161 |
|
rnemd_->doRNEMD(); |
| 162 |
|
currRNEMD += RNEMD_exchangeTime; |
| 163 |
|
} |
| 164 |
|
rnemd_->collectData(); |
| 165 |
|
} |
| 166 |
|
|
| 167 |
< |
if (currentSnapshot_->getTime() >= currSample) { |
| 167 |
> |
if (snap->getTime() >= currSample) { |
| 168 |
|
dumpWriter->writeDumpAndEor(); |
| 169 |
|
|
| 170 |
|
currSample += sampleTime; |
| 171 |
|
} |
| 172 |
|
|
| 173 |
< |
if (currentSnapshot_->getTime() >= currStatus) { |
| 173 |
> |
if (snap->getTime() >= currStatus) { |
| 174 |
|
//save statistics, before writeStat, we must save statistics |
| 175 |
< |
thermo.saveStat(); |
| 175 |
> |
stats->collectStats(); |
| 176 |
|
saveConservedQuantity(); |
| 177 |
|
|
| 178 |
|
if (simParams->getRNEMDParameters()->getUseRNEMD()) { |
| 179 |
|
rnemd_->getStatus(); |
| 180 |
|
} |
| 181 |
|
|
| 182 |
< |
statWriter->writeStat(currentSnapshot_->statData); |
| 182 |
> |
statWriter->writeStat(); |
| 183 |
|
|
| 184 |
< |
progressBar->setStatus(currentSnapshot_->getTime(), runTime); |
| 184 |
> |
progressBar->setStatus(snap->getTime(), runTime); |
| 185 |
|
progressBar->update(); |
| 186 |
|
|
| 187 |
|
needPotential = false; |
| 189 |
|
currStatus += statusTime; |
| 190 |
|
} |
| 191 |
|
|
| 192 |
< |
if (needReset && currentSnapshot_->getTime() >= currReset) { |
| 192 |
> |
if (needReset && snap->getTime() >= currReset) { |
| 193 |
|
resetIntegrator(); |
| 194 |
|
currReset += resetTime; |
| 195 |
|
} |
| 224 |
|
} |
| 225 |
|
|
| 226 |
|
StatWriter* VelocityVerletIntegrator::createStatWriter() { |
| 226 |
– |
|
| 227 |
– |
std::string statFileFormatString = simParams->getStatFileFormat(); |
| 228 |
– |
StatsBitSet mask = parseStatFileFormat(statFileFormatString); |
| 229 |
– |
|
| 230 |
– |
// if we're doing a thermodynamic integration, we'll want the raw |
| 231 |
– |
// potential as well as the full potential: |
| 232 |
– |
|
| 233 |
– |
|
| 234 |
– |
if (simParams->getUseThermodynamicIntegration()) |
| 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::RESTRAINT_POTENTIAL); |
| 241 |
– |
} |
| 242 |
– |
|
| 243 |
– |
if (simParams->havePrintPressureTensor() && |
| 244 |
– |
simParams->getPrintPressureTensor()){ |
| 245 |
– |
mask.set(Stats::PRESSURE_TENSOR_XX); |
| 246 |
– |
mask.set(Stats::PRESSURE_TENSOR_XY); |
| 247 |
– |
mask.set(Stats::PRESSURE_TENSOR_XZ); |
| 248 |
– |
mask.set(Stats::PRESSURE_TENSOR_YX); |
| 249 |
– |
mask.set(Stats::PRESSURE_TENSOR_YY); |
| 250 |
– |
mask.set(Stats::PRESSURE_TENSOR_YZ); |
| 251 |
– |
mask.set(Stats::PRESSURE_TENSOR_ZX); |
| 252 |
– |
mask.set(Stats::PRESSURE_TENSOR_ZY); |
| 253 |
– |
mask.set(Stats::PRESSURE_TENSOR_ZZ); |
| 254 |
– |
} |
| 227 |
|
|
| 228 |
< |
if (simParams->getAccumulateBoxDipole()) { |
| 229 |
< |
mask.set(Stats::BOX_DIPOLE_X); |
| 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()) { |
| 270 |
< |
mask.set(Stats::TAGGED_PAIR_DISTANCE); |
| 271 |
< |
} |
| 272 |
< |
} |
| 273 |
< |
|
| 274 |
< |
if (simParams->getRNEMDParameters()->getUseRNEMD()) { |
| 275 |
< |
mask.set(Stats::RNEMD_EXCHANGE_TOTAL); |
| 276 |
< |
} |
| 228 |
> |
stats = new Stats(info_); |
| 229 |
> |
statWriter = new StatWriter(info_->getStatFileName(), stats); |
| 230 |
|
|
| 231 |
< |
|
| 279 |
< |
return new StatWriter(info_->getStatFileName(), mask); |
| 231 |
> |
return statWriter; |
| 232 |
|
} |
| 233 |
|
|
| 282 |
– |
|
| 234 |
|
} //end namespace OpenMD |