24 |
|
// The NPTim variant scales the molecular center-of-mass coordinates |
25 |
|
// instead of the atomic coordinates |
26 |
|
|
27 |
< |
NPTim::NPTim ( SimInfo *theInfo, ForceFields* the_ff): |
28 |
< |
Integrator( theInfo, the_ff ) |
27 |
> |
template<typename T> NPTim<T>::NPTim ( SimInfo *theInfo, ForceFields* the_ff): |
28 |
> |
T( theInfo, the_ff ) |
29 |
|
{ |
30 |
|
chi = 0.0; |
31 |
|
eta = 0.0; |
32 |
+ |
integralOfChidt = 0.0; |
33 |
|
have_tau_thermostat = 0; |
34 |
|
have_tau_barostat = 0; |
35 |
|
have_target_temp = 0; |
36 |
|
have_target_pressure = 0; |
37 |
|
} |
38 |
|
|
39 |
< |
void NPTim::moveA() { |
39 |
> |
template<typename T> void NPTim<T>::moveA() { |
40 |
|
|
41 |
|
int i, j, k; |
42 |
|
DirectionalAtom* dAtom; |
165 |
|
} |
166 |
|
} |
167 |
|
|
168 |
< |
void NPTim::moveB( void ){ |
168 |
> |
template<typename T> void NPTim<T>::moveB( void ){ |
169 |
|
int i, j; |
170 |
|
DirectionalAtom* dAtom; |
171 |
|
double Tb[3], ji[3]; |
220 |
|
} |
221 |
|
} |
222 |
|
|
223 |
< |
int NPTim::readyCheck() { |
223 |
> |
template<typename T> void NPTim<T>::resetIntegrator() { |
224 |
> |
chi = 0.0; |
225 |
> |
eta = 0.0; |
226 |
> |
} |
227 |
> |
|
228 |
> |
template<typename T> int NPTim<T>::readyCheck() { |
229 |
> |
|
230 |
> |
//check parent's readyCheck() first |
231 |
> |
if (T::readyCheck() == -1) |
232 |
> |
return -1; |
233 |
|
|
234 |
|
// First check to see if we have a target temperature. |
235 |
|
// Not having one is fatal. |
281 |
|
NkBT = (double)info->ndf * kB * targetTemp; |
282 |
|
|
283 |
|
return 1; |
284 |
+ |
} |
285 |
+ |
|
286 |
+ |
template<typename T> double NPTim<T>::getConservedQuantity(void){ |
287 |
+ |
|
288 |
+ |
double conservedQuantity; |
289 |
+ |
double tb2; |
290 |
+ |
double eta2; |
291 |
+ |
|
292 |
+ |
|
293 |
+ |
//HNVE |
294 |
+ |
conservedQuantity = tStats->getTotalE(); |
295 |
+ |
|
296 |
+ |
//HNVT |
297 |
+ |
conservedQuantity += (info->getNDF() * kB * targetTemp * |
298 |
+ |
(integralOfChidt + tauThermostat * tauThermostat * chi * chi /2))/ eConvert ; |
299 |
+ |
|
300 |
+ |
//HNPT |
301 |
+ |
tb2 = tauBarostat *tauBarostat; |
302 |
+ |
eta2 = eta * eta; |
303 |
+ |
|
304 |
+ |
conservedQuantity += (targetPressure * tStats->getVolume() / p_convert + |
305 |
+ |
3*NkBT/2 * tb2 * eta2) / eConvert; |
306 |
+ |
|
307 |
+ |
return conservedQuantity; |
308 |
|
} |