123 |
|
|
124 |
|
double Thermo::getTemperature(){ |
125 |
|
|
126 |
< |
const double kb = 1.9872179E-3; // boltzman's constant in kcal/(mol K) |
126 |
> |
const double kb = 1.9872156E-3; // boltzman's constant in kcal/(mol K) |
127 |
|
double temperature; |
128 |
|
|
129 |
|
temperature = ( 2.0 * this->getKinetic() ) / ((double)info->ndf * kb ); |
130 |
|
return temperature; |
131 |
|
} |
132 |
|
|
133 |
– |
double Thermo::getEnthalpy() { |
134 |
– |
|
135 |
– |
const double e_convert = 4.184E-4; // convert kcal/mol -> (amu A^2)/fs^2 |
136 |
– |
double u, p, v; |
137 |
– |
double press[3][3]; |
138 |
– |
|
139 |
– |
u = this->getTotalE(); |
140 |
– |
|
141 |
– |
this->getPressureTensor(press); |
142 |
– |
p = (press[0][0] + press[1][1] + press[2][2]) / 3.0; |
143 |
– |
|
144 |
– |
v = this->getVolume(); |
145 |
– |
|
146 |
– |
return (u + (p*v)/e_convert); |
147 |
– |
} |
148 |
– |
|
133 |
|
double Thermo::getVolume() { |
134 |
|
|
135 |
|
return info->boxVol; |
256 |
|
|
257 |
|
void Thermo::velocitize() { |
258 |
|
|
275 |
– |
double x,y; |
259 |
|
double aVel[3], aJ[3], I[3][3]; |
260 |
|
int i, j, vr, vd; // velocity randomizer loop counters |
261 |
|
double vdrift[3]; |
276 |
|
n_oriented = info->n_oriented; |
277 |
|
n_constraints = info->n_constraints; |
278 |
|
|
279 |
< |
kebar = kb * temperature * (double)info->ndf / |
280 |
< |
( 2.0 * (double)info->ndfRaw ); |
279 |
> |
kebar = kb * temperature * (double)info->ndfRaw / |
280 |
> |
( 2.0 * (double)info->ndf ); |
281 |
|
|
282 |
|
for(vr = 0; vr < n_atoms; vr++){ |
283 |
|
|
382 |
|
} |
383 |
|
|
384 |
|
} |
385 |
+ |
|
386 |
+ |
void Thermo::getCOM(double COM[3]){ |
387 |
+ |
|
388 |
+ |
double mtot, mtot_local; |
389 |
+ |
double aPos[3], amass; |
390 |
+ |
double COM_local[3]; |
391 |
+ |
int i, n_atoms, j; |
392 |
+ |
Atom** atoms; |
393 |
|
|
394 |
+ |
// We are very careless here with the distinction between n_atoms and n_local |
395 |
+ |
// We should really fix this before someone pokes an eye out. |
396 |
+ |
|
397 |
+ |
n_atoms = info->n_atoms; |
398 |
+ |
atoms = info->atoms; |
399 |
+ |
|
400 |
+ |
mtot_local = 0.0; |
401 |
+ |
COM_local[0] = 0.0; |
402 |
+ |
COM_local[1] = 0.0; |
403 |
+ |
COM_local[2] = 0.0; |
404 |
+ |
|
405 |
+ |
for(i = 0; i < n_atoms; i++){ |
406 |
+ |
|
407 |
+ |
amass = atoms[i]->getMass(); |
408 |
+ |
atoms[i]->getPos( aPos ); |
409 |
+ |
|
410 |
+ |
for(j = 0; j < 3; j++) |
411 |
+ |
COM_local[j] += aPos[j] * amass; |
412 |
+ |
|
413 |
+ |
mtot_local += amass; |
414 |
+ |
} |
415 |
+ |
|
416 |
+ |
#ifdef IS_MPI |
417 |
+ |
MPI_Allreduce(&mtot_local,&mtot,1,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
418 |
+ |
MPI_Allreduce(COM_local,COM,3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
419 |
+ |
#else |
420 |
+ |
mtot = mtot_local; |
421 |
+ |
for(i = 0; i < 3; i++) { |
422 |
+ |
COM[i] = COM_local[i]; |
423 |
+ |
} |
424 |
+ |
#endif |
425 |
+ |
|
426 |
+ |
for (i = 0; i < 3; i++) { |
427 |
+ |
COM[i] = COM[i] / mtot; |
428 |
+ |
} |
429 |
+ |
} |