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