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

Comparing trunk/OOPSE/libmdtools/NPTi.cpp (file contents):
Revision 763 by tim, Mon Sep 15 16:52:02 2003 UTC vs.
Revision 853 by mmeineke, Thu Nov 6 19:11:38 2003 UTC

# Line 1 | Line 1
1 < #include <cmath>
1 > #include <math.h>
2   #include "Atom.hpp"
3   #include "SRI.hpp"
4   #include "AbstractClasses.hpp"
# Line 7 | Line 7
7   #include "Thermo.hpp"
8   #include "ReadWrite.hpp"
9   #include "Integrator.hpp"
10 < #include "simError.h"
10 > #include "simError.h"
11  
12   #ifdef IS_MPI
13   #include "mpiSimulation.hpp"
14   #endif
15  
16
16   // Basic isotropic thermostating and barostating via the Melchionna
17   // modification of the Hoover algorithm:
18   //
19   //    Melchionna, S., Ciccotti, G., and Holian, B. L., 1993,
20 < //       Molec. Phys., 78, 533.
20 > //       Molec. Phys., 78, 533.
21   //
22   //           and
23 < //
23 > //
24   //    Hoover, W. G., 1986, Phys. Rev. A, 34, 2499.
25  
26   template<typename T> NPTi<T>::NPTi ( SimInfo *theInfo, ForceFields* the_ff):
27    T( theInfo, the_ff )
28   {
29 <  chi = 0.0;
29 >  GenericData* data;
30 >  DoubleArrayData * etaValue;
31 >  vector<double> etaArray;
32 >
33    eta = 0.0;
34 <  integralOfChidt = 0.0;
33 <  have_tau_thermostat = 0;
34 <  have_tau_barostat = 0;
35 <  have_target_temp = 0;
36 <  have_target_pressure = 0;
37 <  have_chi_tolerance = 0;
38 <  have_eta_tolerance = 0;
39 <  have_pos_iter_tolerance = 0;
34 >  oldEta = 0.0;
35  
36 <  oldPos = new double[3*nAtoms];
37 <  oldVel = new double[3*nAtoms];
38 <  oldJi = new double[3*nAtoms];
39 < #ifdef IS_MPI
45 <  Nparticles = mpiSim->getTotAtoms();
46 < #else
47 <  Nparticles = theInfo->n_atoms;
48 < #endif
36 >  // retrieve eta from simInfo if
37 >  data = info->getProperty(ETAVALUE_ID);
38 >  if(data){
39 >    etaValue = dynamic_cast<DoubleArrayData*>(data);
40  
41 +    if(etaValue){
42 +      etaArray = etaValue->getData();
43 +      eta = etaArray[0];
44 +      oldEta = eta;
45 +    }
46 +  }
47 +
48   }
49  
50   template<typename T> NPTi<T>::~NPTi() {
51 <  delete[] oldPos;
54 <  delete[] oldVel;
55 <  delete[] oldJi;
51 >  //nothing for now
52   }
53  
54 < template<typename T> void NPTi<T>::moveA() {
54 > template<typename T> void NPTi<T>::resetIntegrator() {
55 >  eta = 0.0;
56 >  T::resetIntegrator();
57 > }
58  
59 <
60 < //   int i, j;
61 < //   DirectionalAtom* dAtom;
62 < //   double Tb[3], ji[3];
63 < //   double A[3][3], I[3][3];
65 < //   double angle, mass;
66 < //   double vel[3], pos[3], frc[3];
59 > template<typename T> void NPTi<T>::evolveEtaA() {
60 >  eta += dt2 * ( instaVol * (instaPress - targetPressure) /
61 >                 (p_convert*NkBT*tb2));
62 >  oldEta = eta;
63 > }
64  
65 < //   double rj[3];
69 < //   double instaTemp, instaPress, instaVol;
70 < //   double tt2, tb2, scaleFactor;
65 > template<typename T> void NPTi<T>::evolveEtaB() {
66  
67 < //   tt2 = tauThermostat * tauThermostat;
68 < //   tb2 = tauBarostat * tauBarostat;
67 >  prevEta = eta;
68 >  eta = oldEta + dt2 * ( instaVol * (instaPress - targetPressure) /
69 >                 (p_convert*NkBT*tb2));
70 > }
71  
72 < //   instaTemp = tStats->getTemperature();
73 < //   instaPress = tStats->getPressure();
77 < //   instaVol = tStats->getVolume();
78 <  
79 < //    // first evolve chi a half step
80 <  
81 < //   chi += dt2 * ( instaTemp / targetTemp - 1.0) / tt2;
82 < //   eta += dt2 * ( instaVol * (instaPress - targetPressure) /
83 < //               (p_convert*NkBT*tb2));
72 > template<typename T> void NPTi<T>::getVelScaleA(double sc[3], double vel[3]) {
73 >  int i;
74  
75 < //   integralOfChidt += dt2* chi;
75 >  for(i=0; i<3; i++) sc[i] = vel[i] * ( chi + eta );
76 > }
77  
78 < //   for( i=0; i<nAtoms; i++ ){
79 < //     atoms[i]->getVel( vel );
89 < //     atoms[i]->getPos( pos );
90 < //     atoms[i]->getFrc( frc );
78 > template<typename T> void NPTi<T>::getVelScaleB(double sc[3], int index ){
79 >  int i;
80  
81 < //     mass = atoms[i]->getMass();
81 >  for(i=0; i<3; i++) sc[i] = oldVel[index*3 + i] * ( chi + eta );
82 > }
83  
94 //     for (j=0; j < 3; j++) {
95 //       vel[j] += dt2 * ((frc[j] / mass ) * eConvert - vel[j]*(chi+eta));
96 //       rj[j] = pos[j];
97 //     }
84  
85 < //     atoms[i]->setVel( vel );
85 > template<typename T> void NPTi<T>::getPosScale(double pos[3], double COM[3],
86 >                                               int index, double sc[3]){
87 >  int j;
88  
89 < //     info->wrapVector(rj);
89 >  for(j=0; j<3; j++)
90 >    sc[j] = ( oldPos[index*3+j] + pos[j]) / 2.0 - COM[j];
91  
92 < //     for (j = 0; j < 3; j++)
93 < //       pos[j] += dt * (vel[j] + eta*rj[j]);
92 >  for(j=0; j<3; j++)
93 >    sc[j] *= eta;
94 > }
95  
96 < //     atoms[i]->setPos( pos );
96 > template<typename T> void NPTi<T>::scaleSimBox( void ){
97  
98 < //     if( atoms[i]->isDirectional() ){
98 >  double scaleFactor;
99  
110 //       dAtom = (DirectionalAtom *)atoms[i];
111          
112 //       // get and convert the torque to body frame
113      
114 //       dAtom->getTrq( Tb );
115 //       dAtom->lab2Body( Tb );
116      
117 //       // get the angular momentum, and propagate a half step
118
119 //       dAtom->getJ( ji );
120
121 //       for (j=0; j < 3; j++)
122 //         ji[j] += dt2 * (Tb[j] * eConvert - ji[j]*chi);
123      
124 //       // use the angular velocities to propagate the rotation matrix a
125 //       // full time step
126
127 //       dAtom->getA(A);
128 //       dAtom->getI(I);
129    
130 //       // rotate about the x-axis      
131 //       angle = dt2 * ji[0] / I[0][0];
132 //       this->rotate( 1, 2, angle, ji, A );
133
134 //       // rotate about the y-axis
135 //       angle = dt2 * ji[1] / I[1][1];
136 //       this->rotate( 2, 0, angle, ji, A );
137      
138 //       // rotate about the z-axis
139 //       angle = dt * ji[2] / I[2][2];
140 //       this->rotate( 0, 1, angle, ji, A);
141      
142 //       // rotate about the y-axis
143 //       angle = dt2 * ji[1] / I[1][1];
144 //       this->rotate( 2, 0, angle, ji, A );
145      
146 //        // rotate about the x-axis
147 //       angle = dt2 * ji[0] / I[0][0];
148 //       this->rotate( 1, 2, angle, ji, A );
149      
150 //       dAtom->setJ( ji );
151 //       dAtom->setA( A  );    
152 //     }                
153
154 //   }
155
156 //   // Scale the box after all the positions have been moved:
157  
158 //   scaleFactor = exp(dt*eta);
159
160 //   if ((scaleFactor > 1.1) || (scaleFactor < 0.9)) {
161 //     sprintf( painCave.errMsg,
162 //              "NPTi error: Attempting a Box scaling of more than 10 percent"
163 //              " check your tauBarostat, as it is probably too small!\n"
164 //              " eta = %lf, scaleFactor = %lf\n", eta, scaleFactor
165 //              );
166 //     painCave.isFatal = 1;
167 //     simError();
168 //   } else {        
169 //     info->scaleBox(exp(dt*eta));      
170 //   }
171  
172
173  //new version of NPTi
174  int i, j, k;
175  DirectionalAtom* dAtom;
176  double Tb[3], ji[3];
177  double A[3][3], I[3][3];
178  double angle, mass;
179  double vel[3], pos[3], frc[3];
180
181  double rj[3];
182  double instaTemp, instaPress, instaVol;
183  double tt2, tb2, scaleFactor;
184  double COM[3];
185
186  tt2 = tauThermostat * tauThermostat;
187  tb2 = tauBarostat * tauBarostat;
188
189  instaTemp = tStats->getTemperature();
190  instaPress = tStats->getPressure();
191  instaVol = tStats->getVolume();
192  
193  tStats->getCOM(COM);
194  
195  //evolve velocity half step
196  for( i=0; i<nAtoms; i++ ){
197
198    atoms[i]->getVel( vel );
199    atoms[i]->getFrc( frc );
200
201    mass = atoms[i]->getMass();
202
203    for (j=0; j < 3; j++) {
204      // velocity half step  (use chi from previous step here):
205      vel[j] += dt2 * ((frc[j] / mass ) * eConvert - vel[j]*(chi + eta));
206  
207    }
208
209    atoms[i]->setVel( vel );
210  
211    if( atoms[i]->isDirectional() ){
212
213      dAtom = (DirectionalAtom *)atoms[i];
214
215      // get and convert the torque to body frame
216      
217      dAtom->getTrq( Tb );
218      dAtom->lab2Body( Tb );
219      
220      // get the angular momentum, and propagate a half step
221
222      dAtom->getJ( ji );
223
224      for (j=0; j < 3; j++)
225        ji[j] += dt2 * (Tb[j] * eConvert - ji[j]*chi);
226      
227      // use the angular velocities to propagate the rotation matrix a
228      // full time step
229
230      dAtom->getA(A);
231      dAtom->getI(I);
232    
233      // rotate about the x-axis      
234      angle = dt2 * ji[0] / I[0][0];
235      this->rotate( 1, 2, angle, ji, A );
236
237      // rotate about the y-axis
238      angle = dt2 * ji[1] / I[1][1];
239      this->rotate( 2, 0, angle, ji, A );
240      
241      // rotate about the z-axis
242      angle = dt * ji[2] / I[2][2];
243      this->rotate( 0, 1, angle, ji, A);
244      
245      // rotate about the y-axis
246      angle = dt2 * ji[1] / I[1][1];
247      this->rotate( 2, 0, angle, ji, A );
248      
249       // rotate about the x-axis
250      angle = dt2 * ji[0] / I[0][0];
251      this->rotate( 1, 2, angle, ji, A );
252      
253      dAtom->setJ( ji );
254      dAtom->setA( A  );    
255    }    
256  }
257
258  // evolve chi and eta  half step
259  
260  chi += dt2 * ( instaTemp / targetTemp - 1.0) / tt2;
261  eta += dt2 * ( instaVol * (instaPress - targetPressure) / (p_convert*NkBT*tb2));
262
263  //calculate the integral of chidt
264  integralOfChidt += dt2*chi;
265
266  //save the old positions
267  for(i = 0; i < nAtoms; i++){
268    atoms[i]->getPos(pos);
269    for(j = 0; j < 3; j++)
270      oldPos[i*3 + j] = pos[j];
271  }
272  
273  //the first estimation of r(t+dt) is equal to  r(t)
274    
275  for(k = 0; k < 4; k ++){
276
277    for(i =0 ; i < nAtoms; i++){
278
279      atoms[i]->getVel(vel);
280      atoms[i]->getPos(pos);
281
282      for(j = 0; j < 3; j++)
283        rj[j] = (oldPos[i*3 + j] + pos[j])/2 - COM[j];
284
285      
286      //wrapVector(r(t)) = r(t)-R0
287      //info->wrapVector(rj);
288      
289      for(j = 0; j < 3; j++)
290        pos[j] = oldPos[i*3 + j] + dt*(vel[j] + eta*rj[j]);
291
292      atoms[i]->setPos( pos );
293
294    }
295
296  }
297    
298
299  // Scale the box after all the positions have been moved:
300  
100    scaleFactor = exp(dt*eta);
101  
102    if ((scaleFactor > 1.1) || (scaleFactor < 0.9)) {
# Line 308 | Line 107 | template<typename T> void NPTi<T>::moveA() {
107               );
108      painCave.isFatal = 1;
109      simError();
110 <  } else {        
111 <    info->scaleBox(scaleFactor);      
112 <  }  
110 >  } else {
111 >    info->scaleBox(scaleFactor);
112 >  }
113  
315  //advance volume;
316  volume = volume * exp(dt*eta);
114   }
115  
116 < template<typename T> void NPTi<T>::moveB( void ){
116 > template<typename T> bool NPTi<T>::etaConverged() {
117  
118 < /*
119 <  int i, j;
323 <  DirectionalAtom* dAtom;
324 <  double Tb[3], ji[3];
325 <  double vel[3], frc[3];
326 <  double mass;
327 <
328 <  double instaTemp, instaPress, instaVol;
329 <  double tt2, tb2;
330 <  
331 <  tt2 = tauThermostat * tauThermostat;
332 <  tb2 = tauBarostat * tauBarostat;
333 <
334 <  instaTemp = tStats->getTemperature();
335 <  instaPress = tStats->getPressure();
336 <  instaVol = tStats->getVolume();
118 >  return ( fabs(prevEta - eta) <= etaTolerance );
119 > }
120  
121 <  chi += dt2 * ( instaTemp / targetTemp - 1.0) / tt2;
339 <  eta += dt2 * ( instaVol * (instaPress - targetPressure) /
340 <                 (p_convert*NkBT*tb2));
341 <  integralOfChidt += dt2*chi;
342 <  
343 <  for( i=0; i<nAtoms; i++ ){
121 > template<typename T> double NPTi<T>::getConservedQuantity(void){
122  
123 <    atoms[i]->getVel( vel );
124 <    atoms[i]->getFrc( frc );
123 >  double conservedQuantity;
124 >  double Energy;
125 >  double thermostat_kinetic;
126 >  double thermostat_potential;
127 >  double barostat_kinetic;
128 >  double barostat_potential;
129  
130 <    mass = atoms[i]->getMass();
130 >  Energy = tStats->getTotalE();
131  
132 <    // velocity half step
133 <    for (j=0; j < 3; j++)
352 <      vel[j] += dt2 * ((frc[j] / mass ) * eConvert - vel[j]*(chi+eta));
353 <    
354 <    atoms[i]->setVel( vel );
132 >  thermostat_kinetic = fkBT* tt2 * chi * chi /
133 >    (2.0 * eConvert);
134  
135 <    if( atoms[i]->isDirectional() ){
135 >  thermostat_potential = fkBT* integralOfChidt / eConvert;
136  
358      dAtom = (DirectionalAtom *)atoms[i];
137  
138 <      // get and convert the torque to body frame      
138 >  barostat_kinetic = 3.0 * NkBT * tb2 * eta * eta /
139 >    (2.0 * eConvert);
140  
141 <      dAtom->getTrq( Tb );
142 <      dAtom->lab2Body( Tb );
141 >  barostat_potential = (targetPressure * tStats->getVolume() / p_convert) /
142 >    eConvert;
143  
144 <      // get the angular momentum, and propagate a half step
144 >  conservedQuantity = Energy + thermostat_kinetic + thermostat_potential +
145 >    barostat_kinetic + barostat_potential;
146  
147 <      dAtom->getJ( ji );
147 > //   cout.width(8);
148 > //   cout.precision(8);
149  
150 <      for (j=0; j < 3; j++)
151 <        ji[j] += dt2 * (Tb[j] * eConvert - ji[j]*chi);    
152 <
153 <      dAtom->setJ( ji );
373 <    }
374 <  }
375 <
376 < */
377 <  
378 <  //new version of NPTi
379 <  int i, j, k;
380 <  DirectionalAtom* dAtom;
381 <  double Tb[3], ji[3];
382 <  double vel[3], frc[3];
383 <  double mass;
384 <
385 <  double instTemp, instPress, instVol;
386 <  double tt2, tb2;
387 <  double oldChi, prevChi;
388 <  double oldEta, preEta;
389 <  
390 <  tt2 = tauThermostat * tauThermostat;
391 <  tb2 = tauBarostat * tauBarostat;
392 <
393 <
394 <  // Set things up for the iteration:
395 <
396 <  oldChi = chi;
397 <  oldEta = eta;
398 <
399 <  for( i=0; i<nAtoms; i++ ){
400 <
401 <    atoms[i]->getVel( vel );
402 <
403 <    for (j=0; j < 3; j++)
404 <      oldVel[3*i + j]  = vel[j];
405 <
406 <    if( atoms[i]->isDirectional() ){
407 <
408 <      dAtom = (DirectionalAtom *)atoms[i];
409 <
410 <      dAtom->getJ( ji );
411 <
412 <      for (j=0; j < 3; j++)
413 <        oldJi[3*i + j] = ji[j];
414 <
415 <    }
416 <  }
417 <
418 <  // do the iteration:
419 <
420 <  instVol = tStats->getVolume();
421 <  
422 <  for (k=0; k < 4; k++) {
423 <    
424 <    instTemp = tStats->getTemperature();
425 <    instPress = tStats->getPressure();
426 <
427 <    // evolve chi another half step using the temperature at t + dt/2
428 <
429 <    prevChi = chi;
430 <    chi = oldChi + dt2 * ( instTemp / targetTemp - 1.0) /
431 <      (tauThermostat*tauThermostat);
432 <
433 <    preEta = eta;
434 <    eta = oldEta + dt2 * ( instVol * (instPress - targetPressure) /
435 <       (p_convert*NkBT*tb2));
436 <
437 <  
438 <    for( i=0; i<nAtoms; i++ ){
439 <
440 <      atoms[i]->getFrc( frc );
441 <      atoms[i]->getVel(vel);
442 <      
443 <      mass = atoms[i]->getMass();
444 <      
445 <      // velocity half step
446 <      for (j=0; j < 3; j++)
447 <        vel[j] = oldVel[3*i+j] + dt2 * ((frc[j] / mass ) * eConvert - oldVel[3*i + j]*(chi + eta));
448 <      
449 <      atoms[i]->setVel( vel );
450 <      
451 <      if( atoms[i]->isDirectional() ){
452 <
453 <        dAtom = (DirectionalAtom *)atoms[i];
454 <  
455 <        // get and convert the torque to body frame      
456 <  
457 <        dAtom->getTrq( Tb );
458 <        dAtom->lab2Body( Tb );      
459 <            
460 <        for (j=0; j < 3; j++)
461 <          ji[j] = oldJi[3*i + j] + dt2 * (Tb[j] * eConvert - oldJi[3*i+j]*chi);
462 <      
463 <          dAtom->setJ( ji );
464 <      }
465 <    }
466 <
467 <    if (fabs(prevChi - chi) <= chiTolerance && fabs(preEta -eta) <= etaTolerance)
468 <      break;
469 <  }
470 <
471 <  //calculate integral of chida
472 <  integralOfChidt += dt2*chi;
473 <
474 <
150 > //   cerr << info->getTime() << "\t" << Energy << "\t" << thermostat_kinetic <<
151 > //       "\t" << thermostat_potential << "\t" << barostat_kinetic <<
152 > //       "\t" << barostat_potential << "\t" << conservedQuantity << endl;
153 >  return conservedQuantity;
154   }
155  
156 < template<typename T> void NPTi<T>::resetIntegrator() {
157 <  chi = 0.0;
158 <  eta = 0.0;
159 < }
156 > template<typename T> string NPTi<T>::getAdditionalParameters(void){
157 >  string parameters;
158 >  const int BUFFERSIZE = 2000; // size of the read buffer
159 >  char buffer[BUFFERSIZE];
160  
161 < template<typename T> int NPTi<T>::readyCheck() {
161 >  sprintf(buffer,"\t%G\t%G;", chi, integralOfChidt);
162 >  parameters += buffer;
163  
164 <  //check parent's readyCheck() first
165 <  if (T::readyCheck() == -1)
486 <    return -1;
487 <
488 <  // First check to see if we have a target temperature.
489 <  // Not having one is fatal.
490 <  
491 <  if (!have_target_temp) {
492 <    sprintf( painCave.errMsg,
493 <             "NPTi error: You can't use the NPTi integrator\n"
494 <             "   without a targetTemp!\n"
495 <             );
496 <    painCave.isFatal = 1;
497 <    simError();
498 <    return -1;
499 <  }
164 >  sprintf(buffer,"\t%G\t0\t0;", eta);
165 >  parameters += buffer;
166  
167 <  if (!have_target_pressure) {
168 <    sprintf( painCave.errMsg,
503 <             "NPTi error: You can't use the NPTi integrator\n"
504 <             "   without a targetPressure!\n"
505 <             );
506 <    painCave.isFatal = 1;
507 <    simError();
508 <    return -1;
509 <  }
510 <  
511 <  // We must set tauThermostat.
512 <  
513 <  if (!have_tau_thermostat) {
514 <    sprintf( painCave.errMsg,
515 <             "NPTi error: If you use the NPTi\n"
516 <             "   integrator, you must set tauThermostat.\n");
517 <    painCave.isFatal = 1;
518 <    simError();
519 <    return -1;
520 <  }    
167 >  sprintf(buffer,"\t0\t%G\t0;", eta);
168 >  parameters += buffer;
169  
170 <  // We must set tauBarostat.
171 <  
524 <  if (!have_tau_barostat) {
525 <    sprintf( painCave.errMsg,
526 <             "NPTi error: If you use the NPTi\n"
527 <             "   integrator, you must set tauBarostat.\n");
528 <    painCave.isFatal = 1;
529 <    simError();
530 <    return -1;
531 <  }    
170 >  sprintf(buffer,"\t0\t0\t%G;", eta);
171 >  parameters += buffer;
172  
173 <  if (!have_chi_tolerance) {
534 <    sprintf( painCave.errMsg,
535 <             "NPTi warning: setting chi tolerance to 1e-6\n");
536 <    chiTolerance = 1e-6;
537 <    have_chi_tolerance = 1;
538 <    painCave.isFatal = 0;
539 <    simError();
540 <  }
173 >  return parameters;
174  
542    if (!have_eta_tolerance) {
543    sprintf( painCave.errMsg,
544             "NPTi warning: setting eta tolerance to 1e-6\n");
545    etaTolerance = 1e-6;
546    have_eta_tolerance = 1;
547    painCave.isFatal = 0;
548    simError();
549  }
550  // We need NkBT a lot, so just set it here:
551
552  NkBT = (double)Nparticles * kB * targetTemp;
553  fkBT = (double)info->ndf * kB * targetTemp;
554
555  return 1;
175   }
557
558 template<typename T> double NPTi<T>::getConservedQuantity(void){
559
560  double conservedQuantity;
561  double tb2;
562  double eta2;  
563  double E_NPT;
564  double U;
565  double TS;
566  double PV;
567  double extra;
568
569  static double pre_U;
570  static double pre_TS;
571  static double pre_PV;
572  static double pre_extra;
573  static int hackCount = 0;
574
575  double delta_U;
576  double delta_TS;
577  double delta_PV;
578  double delta_extra;
579
580  U = tStats->getTotalE();
581
582  TS = fkBT *
583    (integralOfChidt + tauThermostat * tauThermostat * chi * chi / 2.0) / eConvert;
584
585  PV = (targetPressure * tStats->getVolume() / p_convert) / eConvert;
586
587  tb2 = tauBarostat * tauBarostat;
588  eta2 = eta * eta;
589
590  extra = (fkBT * tb2 * eta2 / 2.0 ) / eConvert;
591  /*
592  if(hackCount == 0){
593    pre_U = U;
594    pre_TS =TS;
595    pre_PV = PV;
596    pre_extra =extra;
597    hackCount ++;
598  }
599
600  delta_U = U - pre_U;
601  delta_TS = TS - pre_TS;
602  delta_PV = PV - pre_PV;
603  delta_extra = extra - pre_extra;
604 */
605  cout.width(8);
606  cout.precision(8);
607
608  
609  cout << info->getTime() << "\t"
610       << chi << "\t"
611       << eta << "\t"
612       << U << "\t"
613       << TS << "\t"
614       << PV << "\t"
615       << extra << "\t"
616       << U+TS+PV+extra << endl;
617
618 /*
619    pre_U = U;
620    pre_TS =TS;
621    pre_PV = PV;
622    pre_extra =extra;
623
624
625  cout << info->getTime() << "\t"
626       << U << "\t"
627       << U+TS << "\t"
628       << U+TS+PV << "\t"
629       << U+TS+PV+extra << endl;
630 */
631  conservedQuantity = U+TS+PV+extra;
632  return conservedQuantity;
633 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines