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 ); |
293 |
|
n_oriented = info->n_oriented; |
294 |
|
n_constraints = info->n_constraints; |
295 |
|
|
296 |
< |
kebar = kb * temperature * (double)info->ndf / |
297 |
< |
( 2.0 * (double)info->ndfRaw ); |
296 |
> |
kebar = kb * temperature * (double)info->ndfRaw / |
297 |
> |
( 2.0 * (double)info->ndf ); |
298 |
|
|
299 |
|
for(vr = 0; vr < n_atoms; vr++){ |
300 |
|
|
399 |
|
} |
400 |
|
|
401 |
|
} |
402 |
+ |
|
403 |
+ |
void Thermo::getCOM(double COM[3]){ |
404 |
+ |
|
405 |
+ |
double mtot, mtot_local; |
406 |
+ |
double aPos[3], amass; |
407 |
+ |
double COM_local[3]; |
408 |
+ |
int i, n_atoms, j; |
409 |
+ |
Atom** atoms; |
410 |
+ |
|
411 |
+ |
// We are very careless here with the distinction between n_atoms and n_local |
412 |
+ |
// We should really fix this before someone pokes an eye out. |
413 |
+ |
|
414 |
+ |
n_atoms = info->n_atoms; |
415 |
+ |
atoms = info->atoms; |
416 |
+ |
|
417 |
+ |
mtot_local = 0.0; |
418 |
+ |
COM_local[0] = 0.0; |
419 |
+ |
COM_local[1] = 0.0; |
420 |
+ |
COM_local[2] = 0.0; |
421 |
+ |
|
422 |
+ |
for(i = 0; i < n_atoms; i++){ |
423 |
+ |
|
424 |
+ |
amass = atoms[i]->getMass(); |
425 |
+ |
atoms[i]->getPos( aPos ); |
426 |
|
|
427 |
+ |
for(j = 0; j < 3; j++) |
428 |
+ |
COM_local[j] += aPos[j] * amass; |
429 |
+ |
|
430 |
+ |
mtot_local += amass; |
431 |
+ |
} |
432 |
+ |
|
433 |
+ |
#ifdef IS_MPI |
434 |
+ |
MPI_Allreduce(&mtot_local,&mtot,1,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
435 |
+ |
MPI_Allreduce(COM_local,COM,3,MPI_DOUBLE,MPI_SUM, MPI_COMM_WORLD); |
436 |
+ |
#else |
437 |
+ |
mtot = mtot_local; |
438 |
+ |
for(i = 0; i < 3; i++) { |
439 |
+ |
COM[i] = COM_local[i]; |
440 |
+ |
} |
441 |
+ |
#endif |
442 |
+ |
|
443 |
+ |
for (i = 0; i < 3; i++) { |
444 |
+ |
COM[i] = COM[i] / mtot; |
445 |
+ |
} |
446 |
+ |
} |