| 10 |
|
#include "SRI.hpp" |
| 11 |
|
#include "Integrator.hpp" |
| 12 |
|
#include "simError.h" |
| 13 |
+ |
#include "MatVec3.h" |
| 14 |
|
|
| 15 |
|
#ifdef IS_MPI |
| 16 |
|
#define __C |
| 196 |
|
const double e_convert = 4.184e-4; |
| 197 |
|
|
| 198 |
|
double molmass, volume; |
| 199 |
< |
double vcom[3]; |
| 199 |
> |
double vcom[3], pcom[3], fcom[3], scaled[3]; |
| 200 |
|
double p_local[9], p_global[9]; |
| 201 |
|
int i, j, k, nMols; |
| 202 |
|
Molecule* molecules; |
| 211 |
|
p_global[i] = 0.0; |
| 212 |
|
} |
| 213 |
|
|
| 214 |
< |
for (i=0; i < nMols; i++) { |
| 214 |
< |
molmass = molecules[i].getCOMvel(vcom); |
| 214 |
> |
for (i=0; i < info->integrableObjects.size(); i++) { |
| 215 |
|
|
| 216 |
< |
p_local[0] += molmass * (vcom[0] * vcom[0]); |
| 217 |
< |
p_local[1] += molmass * (vcom[0] * vcom[1]); |
| 218 |
< |
p_local[2] += molmass * (vcom[0] * vcom[2]); |
| 219 |
< |
p_local[3] += molmass * (vcom[1] * vcom[0]); |
| 220 |
< |
p_local[4] += molmass * (vcom[1] * vcom[1]); |
| 221 |
< |
p_local[5] += molmass * (vcom[1] * vcom[2]); |
| 222 |
< |
p_local[6] += molmass * (vcom[2] * vcom[0]); |
| 223 |
< |
p_local[7] += molmass * (vcom[2] * vcom[1]); |
| 224 |
< |
p_local[8] += molmass * (vcom[2] * vcom[2]); |
| 216 |
> |
molmass = info->integrableObjects[i]->getMass(); |
| 217 |
> |
|
| 218 |
> |
info->integrableObjects[i]->getVel(vcom); |
| 219 |
> |
info->integrableObjects[i]->getPos(pcom); |
| 220 |
> |
info->integrableObjects[i]->getFrc(fcom); |
| 221 |
> |
|
| 222 |
> |
matVecMul3(info->HmatInv, pcom, scaled); |
| 223 |
> |
|
| 224 |
> |
for(j=0; j<3; j++) |
| 225 |
> |
scaled[j] -= roundMe(scaled[j]); |
| 226 |
> |
|
| 227 |
> |
// calc the wrapped real coordinates from the wrapped scaled coordinates |
| 228 |
> |
|
| 229 |
> |
matVecMul3(info->Hmat, scaled, pcom); |
| 230 |
> |
|
| 231 |
> |
p_local[0] += molmass * (vcom[0] * vcom[0]) + fcom[0]*pcom[0]*eConvert; |
| 232 |
> |
p_local[1] += molmass * (vcom[0] * vcom[1]) + fcom[0]*pcom[1]*eConvert; |
| 233 |
> |
p_local[2] += molmass * (vcom[0] * vcom[2]) + fcom[0]*pcom[2]*eConvert; |
| 234 |
> |
p_local[3] += molmass * (vcom[1] * vcom[0]) + fcom[1]*pcom[0]*eConvert; |
| 235 |
> |
p_local[4] += molmass * (vcom[1] * vcom[1]) + fcom[1]*pcom[1]*eConvert; |
| 236 |
> |
p_local[5] += molmass * (vcom[1] * vcom[2]) + fcom[1]*pcom[2]*eConvert; |
| 237 |
> |
p_local[6] += molmass * (vcom[2] * vcom[0]) + fcom[2]*pcom[0]*eConvert; |
| 238 |
> |
p_local[7] += molmass * (vcom[2] * vcom[1]) + fcom[2]*pcom[1]*eConvert; |
| 239 |
> |
p_local[8] += molmass * (vcom[2] * vcom[2]) + fcom[2]*pcom[2]*eConvert; |
| 240 |
> |
|
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
// Get total for entire system from MPI. |
| 255 |
|
for(i = 0; i < 3; i++) { |
| 256 |
|
for (j = 0; j < 3; j++) { |
| 257 |
|
k = 3*i + j; |
| 258 |
< |
press[i][j] = (p_global[k] + info->tau[k]*e_convert) / volume; |
| 258 |
> |
press[i][j] = p_global[k] / volume; |
| 259 |
|
|
| 260 |
|
} |
| 261 |
|
} |