200 |
|
const double e_convert = 4.184e-4; |
201 |
|
|
202 |
|
double molmass, volume; |
203 |
< |
double vcom[3], pcom[3], fcom[3], scaled[3]; |
203 |
> |
double vcom[3]; |
204 |
|
double p_local[9], p_global[9]; |
205 |
< |
int i, j, k, nMols; |
206 |
< |
Molecule* molecules; |
205 |
> |
int i, j, k; |
206 |
|
|
208 |
– |
nMols = info->n_mol; |
209 |
– |
molecules = info->molecules; |
210 |
– |
//tau = info->tau; |
207 |
|
|
208 |
< |
// use velocities of molecular centers of mass and molecular masses: |
208 |
> |
|
209 |
|
for (i=0; i < 9; i++) { |
210 |
|
p_local[i] = 0.0; |
211 |
|
p_global[i] = 0.0; |
212 |
|
} |
213 |
|
|
214 |
+ |
// use velocities of integrableObjects and their masses: |
215 |
+ |
|
216 |
|
for (i=0; i < info->integrableObjects.size(); i++) { |
217 |
|
|
218 |
|
molmass = info->integrableObjects[i]->getMass(); |
219 |
|
|
220 |
|
info->integrableObjects[i]->getVel(vcom); |
223 |
– |
info->integrableObjects[i]->getPos(pcom); |
224 |
– |
info->integrableObjects[i]->getFrc(fcom); |
225 |
– |
|
226 |
– |
matVecMul3(info->HmatInv, pcom, scaled); |
227 |
– |
|
228 |
– |
for(j=0; j<3; j++) |
229 |
– |
scaled[j] -= roundMe(scaled[j]); |
230 |
– |
|
231 |
– |
// calc the wrapped real coordinates from the wrapped scaled coordinates |
232 |
– |
|
233 |
– |
matVecMul3(info->Hmat, scaled, pcom); |
221 |
|
|
222 |
|
p_local[0] += molmass * (vcom[0] * vcom[0]); |
223 |
|
p_local[1] += molmass * (vcom[0] * vcom[1]); |
232 |
|
} |
233 |
|
|
234 |
|
// Get total for entire system from MPI. |
235 |
< |
|
235 |
> |
|
236 |
|
#ifdef IS_MPI |
237 |
|
MPI_Allreduce(p_local,p_global,9,MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); |
238 |
|
#else |