PressureProfileReduction Class Reference

List of all members.

Public Member Functions

 PressureProfileReduction (int rtag, int numslabs, int numpartitions, const char *myname, int outputfreq)
 ~PressureProfileReduction ()
void getData (int firsttimestep, int step, const Lattice &lattice, BigReal *total)

Detailed Description

Definition at line 62 of file Controller.C.


Constructor & Destructor Documentation

PressureProfileReduction::PressureProfileReduction ( int  rtag,
int  numslabs,
int  numpartitions,
const char *  myname,
int  outputfreq 
) [inline]

Definition at line 74 of file Controller.C.

References ReductionMgr::Object(), and ReductionMgr::willRequire().

00076   : nslabs(numslabs), freq(outputfreq) {
00077     name = strdup(myname);
00078     nelements = 3*nslabs * numpartitions;
00079     reduction = ReductionMgr::Object()->willRequire(rtag,nelements);
00080 
00081     average = new BigReal[nelements];
00082     count = 0;
00083   }

PressureProfileReduction::~PressureProfileReduction (  )  [inline]

Definition at line 84 of file Controller.C.

00084                               {
00085     delete [] average;
00086     delete reduction;
00087     free(name);
00088   }


Member Function Documentation

void PressureProfileReduction::getData ( int  firsttimestep,
int  step,
const Lattice lattice,
BigReal total 
) [inline]

Definition at line 90 of file Controller.C.

References endi(), iout, RequireReduction::item(), PRESSUREFACTOR, RequireReduction::require(), and Lattice::volume().

Referenced by Controller::printEnergies().

00091                       {
00092     reduction->require();
00093 
00094     int i;
00095     double inv_volume = 1.0 / lattice.volume();
00096     // accumulate the pressure profile computed for this step into the average.
00097     int arraysize = 3*nslabs;
00098     for (i=0; i<nelements; i++) {
00099       BigReal val = reduction->item(i) * inv_volume;
00100       average[i] += val;
00101       total[i % arraysize] += val;
00102     }
00103     count++;
00104     if (!(step % freq)) {
00105       // convert NAMD internal virial to pressure in units of bar 
00106       BigReal scalefac = PRESSUREFACTOR * nslabs;
00107  
00108       iout << "PPROFILE" << name << ": " << step << " ";
00109       if (step == firsttimestep) {
00110         // output pressure profile for this step
00111         for (i=0; i<nelements; i++) 
00112           iout << reduction->item(i)*scalefac*inv_volume << " ";
00113       } else {
00114         // output pressure profile averaged over the last Freq steps.
00115         scalefac /= count;
00116         for (i=0; i<nelements; i++) 
00117           iout << average[i]*scalefac << " ";
00118       }
00119       iout << "\n" << endi; 
00120       // Clear the average for the next block
00121       memset(average, 0, nelements*sizeof(BigReal));
00122       count = 0;
00123     }
00124   }


The documentation for this class was generated from the following file:
Generated on Thu Nov 23 01:17:20 2017 for NAMD by  doxygen 1.4.7