ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Thermo.cpp
(Generate patch)

Comparing trunk/OOPSE/libmdtools/Thermo.cpp (file contents):
Revision 1192 by gezelter, Mon May 24 21:03:30 2004 UTC vs.
Revision 1253 by gezelter, Tue Jun 8 16:49:46 2004 UTC

# Line 200 | Line 200 | void Thermo::getPressureTensor(double press[3][3]){
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;
211
212  // use velocities of molecular centers of mass and molecular masses:
207    for (i=0; i < 9; i++) {    
208      p_local[i] = 0.0;
209      p_global[i] = 0.0;
210    }
211  
212 +  // use velocities of integrableObjects and their masses:  
213 +
214    for (i=0; i < info->integrableObjects.size(); i++) {
215  
216      molmass = info->integrableObjects[i]->getMass();
217      
218      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);
219      
220      p_local[0] += molmass * (vcom[0] * vcom[0]);
221      p_local[1] += molmass * (vcom[0] * vcom[1]);
# Line 241 | Line 226 | void Thermo::getPressureTensor(double press[3][3]){
226      p_local[6] += molmass * (vcom[2] * vcom[0]);
227      p_local[7] += molmass * (vcom[2] * vcom[1]);
228      p_local[8] += molmass * (vcom[2] * vcom[2]);
229 <    
229 >
230    }
231  
232    // Get total for entire system from MPI.
233 <
233 >  
234   #ifdef IS_MPI
235    MPI_Allreduce(p_local,p_global,9,MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
236   #else
# Line 256 | Line 241 | void Thermo::getPressureTensor(double press[3][3]){
241  
242    volume = this->getVolume();
243  
244 +
245 +
246    for(i = 0; i < 3; i++) {
247      for (j = 0; j < 3; j++) {
248        k = 3*i + j;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines