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 855 by mmeineke, Thu Nov 6 22:01:37 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
40 <  Nparticles = mpiSim->getTotAtoms();
41 < #else
42 <  Nparticles = theInfo->n_atoms;
43 < #endif
44 <
36 >  if( theInfo->useInitXSstate ){
37 >    // retrieve eta from simInfo if
38 >    data = info->getProperty(ETAVALUE_ID);
39 >    if(data){
40 >      etaValue = dynamic_cast<DoubleArrayData*>(data);
41 >      
42 >      if(etaValue){
43 >        etaArray = etaValue->getData();
44 >        eta = etaArray[0];
45 >        oldEta = eta;
46 >      }
47 >    }
48 >  }
49   }
50  
51   template<typename T> NPTi<T>::~NPTi() {
52 <  delete[] oldPos;
54 <  delete[] oldVel;
55 <  delete[] oldJi;
52 >  //nothing for now
53   }
54  
55 < template<typename T> void NPTi<T>::moveA() {
55 > template<typename T> void NPTi<T>::resetIntegrator() {
56 >  eta = 0.0;
57 >  T::resetIntegrator();
58 > }
59  
60 <
61 < //   int i, j;
62 < //   DirectionalAtom* dAtom;
63 < //   double Tb[3], ji[3];
64 < //   double A[3][3], I[3][3];
65 < //   double angle, mass;
66 < //   double vel[3], pos[3], frc[3];
60 > template<typename T> void NPTi<T>::evolveEtaA() {
61 >  eta += dt2 * ( instaVol * (instaPress - targetPressure) /
62 >                 (p_convert*NkBT*tb2));
63 >  oldEta = eta;
64 > }
65  
66 < //   double rj[3];
69 < //   double instaTemp, instaPress, instaVol;
70 < //   double tt2, tb2, scaleFactor;
66 > template<typename T> void NPTi<T>::evolveEtaB() {
67  
68 < //   tt2 = tauThermostat * tauThermostat;
69 < //   tb2 = tauBarostat * tauBarostat;
68 >  prevEta = eta;
69 >  eta = oldEta + dt2 * ( instaVol * (instaPress - targetPressure) /
70 >                 (p_convert*NkBT*tb2));
71 > }
72  
73 < //   instaTemp = tStats->getTemperature();
74 < //   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));
73 > template<typename T> void NPTi<T>::getVelScaleA(double sc[3], double vel[3]) {
74 >  int i;
75  
76 < //   integralOfChidt += dt2* chi;
76 >  for(i=0; i<3; i++) sc[i] = vel[i] * ( chi + eta );
77 > }
78  
79 < //   for( i=0; i<nAtoms; i++ ){
80 < //     atoms[i]->getVel( vel );
89 < //     atoms[i]->getPos( pos );
90 < //     atoms[i]->getFrc( frc );
79 > template<typename T> void NPTi<T>::getVelScaleB(double sc[3], int index ){
80 >  int i;
81  
82 < //     mass = atoms[i]->getMass();
82 >  for(i=0; i<3; i++) sc[i] = oldVel[index*3 + i] * ( chi + eta );
83 > }
84  
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 //     }
85  
86 < //     atoms[i]->setVel( vel );
86 > template<typename T> void NPTi<T>::getPosScale(double pos[3], double COM[3],
87 >                                               int index, double sc[3]){
88 >  int j;
89  
90 < //     info->wrapVector(rj);
90 >  for(j=0; j<3; j++)
91 >    sc[j] = ( oldPos[index*3+j] + pos[j]) / 2.0 - COM[j];
92  
93 < //     for (j = 0; j < 3; j++)
94 < //       pos[j] += dt * (vel[j] + eta*rj[j]);
93 >  for(j=0; j<3; j++)
94 >    sc[j] *= eta;
95 > }
96  
97 < //     atoms[i]->setPos( pos );
97 > template<typename T> void NPTi<T>::scaleSimBox( void ){
98  
99 < //     if( atoms[i]->isDirectional() ){
99 >  double scaleFactor;
100  
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  
101    scaleFactor = exp(dt*eta);
102  
103    if ((scaleFactor > 1.1) || (scaleFactor < 0.9)) {
# Line 308 | Line 108 | template<typename T> void NPTi<T>::moveA() {
108               );
109      painCave.isFatal = 1;
110      simError();
111 <  } else {        
112 <    info->scaleBox(scaleFactor);      
313 <  }  
314 <
315 <  //advance volume;
316 <  volume = volume * exp(dt*eta);
317 < }
318 <
319 < template<typename T> void NPTi<T>::moveB( void ){
320 <
321 < /*
322 <  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();
337 <
338 <  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++ ){
344 <
345 <    atoms[i]->getVel( vel );
346 <    atoms[i]->getFrc( frc );
347 <
348 <    mass = atoms[i]->getMass();
349 <
350 <    // velocity half step
351 <    for (j=0; j < 3; j++)
352 <      vel[j] += dt2 * ((frc[j] / mass ) * eConvert - vel[j]*(chi+eta));
353 <    
354 <    atoms[i]->setVel( vel );
355 <
356 <    if( atoms[i]->isDirectional() ){
357 <
358 <      dAtom = (DirectionalAtom *)atoms[i];
359 <
360 <      // get and convert the torque to body frame      
361 <
362 <      dAtom->getTrq( Tb );
363 <      dAtom->lab2Body( Tb );
364 <
365 <      // get the angular momentum, and propagate a half step
366 <
367 <      dAtom->getJ( ji );
368 <
369 <      for (j=0; j < 3; j++)
370 <        ji[j] += dt2 * (Tb[j] * eConvert - ji[j]*chi);    
371 <
372 <      dAtom->setJ( ji );
373 <    }
111 >  } else {
112 >    info->scaleBox(scaleFactor);
113    }
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;
114  
115 <  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;
115 > }
116  
117 + template<typename T> bool NPTi<T>::etaConverged() {
118  
119 <  // Set things up for the iteration:
119 >  return ( fabs(prevEta - eta) <= etaTolerance );
120 > }
121  
122 <  oldChi = chi;
397 <  oldEta = eta;
122 > template<typename T> double NPTi<T>::getConservedQuantity(void){
123  
124 <  for( i=0; i<nAtoms; i++ ){
124 >  double conservedQuantity;
125 >  double Energy;
126 >  double thermostat_kinetic;
127 >  double thermostat_potential;
128 >  double barostat_kinetic;
129 >  double barostat_potential;
130  
131 <    atoms[i]->getVel( vel );
131 >  Energy = tStats->getTotalE();
132  
133 <    for (j=0; j < 3; j++)
134 <      oldVel[3*i + j]  = vel[j];
133 >  thermostat_kinetic = fkBT* tt2 * chi * chi /
134 >    (2.0 * eConvert);
135  
136 <    if( atoms[i]->isDirectional() ){
136 >  thermostat_potential = fkBT* integralOfChidt / eConvert;
137  
408      dAtom = (DirectionalAtom *)atoms[i];
138  
139 <      dAtom->getJ( ji );
139 >  barostat_kinetic = 3.0 * NkBT * tb2 * eta * eta /
140 >    (2.0 * eConvert);
141  
142 <      for (j=0; j < 3; j++)
143 <        oldJi[3*i + j] = ji[j];
142 >  barostat_potential = (targetPressure * tStats->getVolume() / p_convert) /
143 >    eConvert;
144  
145 <    }
146 <  }
145 >  conservedQuantity = Energy + thermostat_kinetic + thermostat_potential +
146 >    barostat_kinetic + barostat_potential;
147  
148 <  // do the iteration:
148 > //   cout.width(8);
149 > //   cout.precision(8);
150  
151 <  instVol = tStats->getVolume();
152 <  
153 <  for (k=0; k < 4; k++) {
154 <    
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 <
151 > //   cerr << info->getTime() << "\t" << Energy << "\t" << thermostat_kinetic <<
152 > //       "\t" << thermostat_potential << "\t" << barostat_kinetic <<
153 > //       "\t" << barostat_potential << "\t" << conservedQuantity << endl;
154 >  return conservedQuantity;
155   }
156  
157 < template<typename T> void NPTi<T>::resetIntegrator() {
158 <  chi = 0.0;
159 <  eta = 0.0;
160 < }
157 > template<typename T> string NPTi<T>::getAdditionalParameters(void){
158 >  string parameters;
159 >  const int BUFFERSIZE = 2000; // size of the read buffer
160 >  char buffer[BUFFERSIZE];
161  
162 < template<typename T> int NPTi<T>::readyCheck() {
162 >  sprintf(buffer,"\t%G\t%G;", chi, integralOfChidt);
163 >  parameters += buffer;
164  
165 <  //check parent's readyCheck() first
166 <  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 <  }
165 >  sprintf(buffer,"\t%G\t0\t0;", eta);
166 >  parameters += buffer;
167  
168 <  if (!have_target_pressure) {
169 <    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 <  }    
168 >  sprintf(buffer,"\t0\t%G\t0;", eta);
169 >  parameters += buffer;
170  
171 <  // We must set tauBarostat.
172 <  
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 <  }    
171 >  sprintf(buffer,"\t0\t0\t%G;", eta);
172 >  parameters += buffer;
173  
174 <  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 <  }
174 >  return parameters;
175  
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;
176   }
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