67 |
|
|
68 |
|
forceMan_->init(); |
69 |
|
|
70 |
< |
// remove center of mass drift velocity (in case we passed in a configuration |
71 |
< |
// that was drifting |
70 |
> |
// remove center of mass drift velocity (in case we passed in a |
71 |
> |
// configuration that was drifting) |
72 |
|
velocitizer_->removeComDrift(); |
73 |
|
|
74 |
|
// initialize the forces before the first step |
75 |
|
calcForce(true, true); |
76 |
|
|
77 |
< |
//execute constraint algorithm to make sure at the very beginning the system is constrained |
77 |
> |
// execute the constraint algorithm to make sure that the system is |
78 |
> |
// constrained at the very beginning |
79 |
|
if (info_->getNGlobalConstraints() > 0) { |
80 |
|
rattle->constraintA(); |
81 |
|
calcForce(true, true); |
82 |
< |
rattle->constraintB(); |
83 |
< |
info_->getSnapshotManager()->advance();//copy the current snapshot to previous snapshot |
82 |
> |
rattle->constraintB(); |
83 |
> |
//copy the current snapshot to previous snapshot |
84 |
> |
info_->getSnapshotManager()->advance(); |
85 |
|
} |
86 |
|
|
87 |
|
if (needVelocityScaling) { |
91 |
|
dumpWriter = createDumpWriter(); |
92 |
|
|
93 |
|
statWriter = createStatWriter(); |
94 |
< |
|
94 |
> |
|
95 |
> |
dumpWriter->writeDumpAndEor(); |
96 |
> |
|
97 |
|
if (simParams->getUseSolidThermInt()) { |
98 |
|
restWriter = createRestWriter(); |
99 |
< |
restWriter->writeZangle(); |
99 |
> |
restWriter->writeZAngFile(); |
100 |
|
} |
101 |
|
|
98 |
– |
dumpWriter->writeDumpAndEor(); |
99 |
– |
|
100 |
– |
|
102 |
|
//save statistics, before writeStat, we must save statistics |
103 |
|
thermo.saveStat(); |
104 |
|
saveConservedQuantity(); |
105 |
+ |
if (simParams->getUseRNEMD()) |
106 |
+ |
rnemd_->getStatus(); |
107 |
+ |
|
108 |
|
statWriter->writeStat(currentSnapshot_->statData); |
109 |
|
|
110 |
|
currSample = sampleTime + currentSnapshot_->getTime(); |
111 |
< |
currStatus = statusTime + currentSnapshot_->getTime();; |
111 |
> |
currStatus = statusTime + currentSnapshot_->getTime(); |
112 |
|
currThermal = thermalTime + currentSnapshot_->getTime(); |
113 |
|
if (needReset) { |
114 |
|
currReset = resetTime + currentSnapshot_->getTime(); |
115 |
|
} |
116 |
+ |
if (simParams->getUseRNEMD()){ |
117 |
+ |
currRNEMD = RNEMD_swapTime + currentSnapshot_->getTime(); |
118 |
+ |
} |
119 |
|
needPotential = false; |
120 |
|
needStress = false; |
121 |
|
|
142 |
|
|
143 |
|
|
144 |
|
void VelocityVerletIntegrator::preStep() { |
145 |
< |
double difference = currentSnapshot_->getTime() + dt - currStatus; |
145 |
> |
RealType difference = currentSnapshot_->getTime() + dt - currStatus; |
146 |
|
|
147 |
|
if (difference > 0 || fabs(difference) < oopse::epsilon) { |
148 |
|
needPotential = true; |
149 |
|
needStress = true; |
150 |
|
} |
144 |
– |
|
151 |
|
} |
152 |
|
|
153 |
|
void VelocityVerletIntegrator::postStep() { |
157 |
|
|
158 |
|
//increase time |
159 |
|
currentSnapshot_->increaseTime(dt); |
160 |
< |
|
160 |
> |
|
161 |
|
if (needVelocityScaling) { |
162 |
|
if (currentSnapshot_->getTime() >= currThermal) { |
163 |
|
velocitizer_->velocitize(targetScalingTemp); |
164 |
|
currThermal += thermalTime; |
165 |
|
} |
166 |
|
} |
167 |
< |
|
167 |
> |
if (useRNEMD) { |
168 |
> |
if (currentSnapshot_->getTime() >= currRNEMD) { |
169 |
> |
rnemd_->doSwap(); |
170 |
> |
currRNEMD += RNEMD_swapTime; |
171 |
> |
} |
172 |
> |
} |
173 |
> |
|
174 |
|
if (currentSnapshot_->getTime() >= currSample) { |
175 |
|
dumpWriter->writeDumpAndEor(); |
176 |
< |
|
176 |
> |
|
177 |
|
if (simParams->getUseSolidThermInt()) |
178 |
< |
restWriter->writeZangle(); |
179 |
< |
|
178 |
> |
restWriter->writeZAngFile(); |
179 |
> |
|
180 |
|
currSample += sampleTime; |
181 |
|
} |
182 |
< |
|
182 |
> |
|
183 |
|
if (currentSnapshot_->getTime() >= currStatus) { |
184 |
|
//save statistics, before writeStat, we must save statistics |
185 |
|
thermo.saveStat(); |
186 |
|
saveConservedQuantity(); |
187 |
+ |
|
188 |
+ |
if (simParams->getUseRNEMD()) |
189 |
+ |
rnemd_->getStatus(); |
190 |
+ |
|
191 |
|
statWriter->writeStat(currentSnapshot_->statData); |
192 |
< |
|
192 |
> |
|
193 |
|
needPotential = false; |
194 |
|
needStress = false; |
195 |
|
currStatus += statusTime; |
196 |
|
} |
197 |
< |
|
198 |
< |
if (needReset && currentSnapshot_->getTime() >= currReset) { |
199 |
< |
resetIntegrator(); |
200 |
< |
currReset += resetTime; |
201 |
< |
} |
186 |
< |
|
197 |
> |
|
198 |
> |
if (needReset && currentSnapshot_->getTime() >= currReset) { |
199 |
> |
resetIntegrator(); |
200 |
> |
currReset += resetTime; |
201 |
> |
} |
202 |
|
} |
203 |
|
|
204 |
|
|
206 |
|
dumpWriter->writeEor(); |
207 |
|
|
208 |
|
if (simParams->getUseSolidThermInt()) { |
209 |
< |
restWriter->writeZangle(); |
209 |
> |
restWriter->writeZAngFile(); |
210 |
|
delete restWriter; |
211 |
|
restWriter = NULL; |
212 |
|
} |
247 |
|
mask.set(Stats::VHARM); |
248 |
|
} |
249 |
|
|
250 |
< |
if (simParams->havePrintPressureTensor() && simParams->getPrintPressureTensor()){ |
251 |
< |
mask.set(Stats::PRESSURE_TENSOR_X); |
252 |
< |
mask.set(Stats::PRESSURE_TENSOR_Y); |
253 |
< |
mask.set(Stats::PRESSURE_TENSOR_Z); |
250 |
> |
if (simParams->havePrintPressureTensor() && |
251 |
> |
simParams->getPrintPressureTensor()){ |
252 |
> |
mask.set(Stats::PRESSURE_TENSOR_XX); |
253 |
> |
mask.set(Stats::PRESSURE_TENSOR_XY); |
254 |
> |
mask.set(Stats::PRESSURE_TENSOR_XZ); |
255 |
> |
mask.set(Stats::PRESSURE_TENSOR_YX); |
256 |
> |
mask.set(Stats::PRESSURE_TENSOR_YY); |
257 |
> |
mask.set(Stats::PRESSURE_TENSOR_YZ); |
258 |
> |
mask.set(Stats::PRESSURE_TENSOR_ZX); |
259 |
> |
mask.set(Stats::PRESSURE_TENSOR_ZY); |
260 |
> |
mask.set(Stats::PRESSURE_TENSOR_ZZ); |
261 |
|
} |
262 |
|
|
263 |
+ |
if (simParams->getAccumulateBoxDipole()) { |
264 |
+ |
mask.set(Stats::BOX_DIPOLE_X); |
265 |
+ |
mask.set(Stats::BOX_DIPOLE_Y); |
266 |
+ |
mask.set(Stats::BOX_DIPOLE_Z); |
267 |
+ |
} |
268 |
+ |
|
269 |
+ |
if (simParams->haveTaggedAtomPair() && simParams->havePrintTaggedPairDistance()) { |
270 |
+ |
if (simParams->getPrintTaggedPairDistance()) { |
271 |
+ |
mask.set(Stats::TAGGED_PAIR_DISTANCE); |
272 |
+ |
} |
273 |
+ |
} |
274 |
+ |
|
275 |
+ |
if (simParams->getUseRNEMD()) { |
276 |
+ |
mask.set(Stats::RNEMD_SWAP_TOTAL); |
277 |
+ |
} |
278 |
+ |
|
279 |
+ |
|
280 |
|
return new StatWriter(info_->getStatFileName(), mask); |
281 |
|
} |
282 |
|
|