35 |
|
double aVel[3], aJ[3], I[3][3]; |
36 |
|
int j, kl; |
37 |
|
|
38 |
– |
DirectionalAtom *dAtom; |
39 |
– |
|
40 |
– |
int n_atoms; |
38 |
|
double kinetic_global; |
39 |
< |
Atom** atoms; |
43 |
< |
|
39 |
> |
vector<StuntDouble *> integrableObjects = info->integrableObjects; |
40 |
|
|
45 |
– |
n_atoms = info->n_atoms; |
46 |
– |
atoms = info->atoms; |
47 |
– |
|
41 |
|
kinetic = 0.0; |
42 |
|
kinetic_global = 0.0; |
50 |
– |
for( kl=0; kl < n_atoms; kl++ ){ |
51 |
– |
|
52 |
– |
atoms[kl]->getVel(aVel); |
53 |
– |
amass = atoms[kl]->getMass(); |
54 |
– |
|
55 |
– |
for (j=0; j < 3; j++) |
56 |
– |
kinetic += amass * aVel[j] * aVel[j]; |
43 |
|
|
44 |
< |
if( atoms[kl]->isDirectional() ){ |
45 |
< |
|
46 |
< |
dAtom = (DirectionalAtom *)atoms[kl]; |
44 |
> |
for (kl=0; kl<integrableObjects.size(); kl++) { |
45 |
> |
integrableObjects[kl]->getVel(aVel); |
46 |
> |
amass = integrableObjects[kl]->getMass(); |
47 |
|
|
48 |
< |
dAtom->getJ( aJ ); |
49 |
< |
dAtom->getI( I ); |
50 |
< |
|
48 |
> |
for(j=0; j<3; j++) |
49 |
> |
kinetic += amass*aVel[j]*aVel[j]; |
50 |
> |
|
51 |
> |
if (integrableObjects[kl]->isDirectional()){ |
52 |
> |
|
53 |
> |
integrableObjects[kl]->getJ( aJ ); |
54 |
> |
integrableObjects[kl]->getI( I ); |
55 |
> |
|
56 |
|
for (j=0; j<3; j++) |
57 |
|
kinetic += aJ[j]*aJ[j] / I[j][j]; |
58 |
|
|
94 |
|
#else |
95 |
|
potential = potential_local; |
96 |
|
#endif // is_mpi |
106 |
– |
|
107 |
– |
#ifdef IS_MPI |
108 |
– |
/* |
109 |
– |
std::cerr << "node " << worldRank << ": after pot = " << potential << "\n"; |
110 |
– |
*/ |
111 |
– |
#endif |
97 |
|
|
98 |
|
return potential; |
99 |
|
} |
110 |
|
|
111 |
|
const double kb = 1.9872156E-3; // boltzman's constant in kcal/(mol K) |
112 |
|
double temperature; |
113 |
< |
|
113 |
> |
|
114 |
|
temperature = ( 2.0 * this->getKinetic() ) / ((double)info->ndf * kb ); |
115 |
|
return temperature; |
116 |
|
} |
270 |
|
|
271 |
|
av2 = 2.0 * kebar / atoms[vr]->getMass(); |
272 |
|
vbar = sqrt( av2 ); |
273 |
< |
|
289 |
< |
// vbar = sqrt( 8.31451e-7 * temperature / atoms[vr]->getMass() ); |
290 |
< |
|
273 |
> |
|
274 |
|
// picks random velocities from a gaussian distribution |
275 |
|
// centered on vbar |
276 |
|
|