Simpatico  v1.10
PressureAnalyzer.cpp
1 /*
2 * Simpatico - Simulation Package for Polymeric and Molecular Liquids
3 *
4 * Copyright 2010 - 2017, The Regents of the University of Minnesota
5 * Distributed under the terms of the GNU General Public License.
6 */
7 
8 #include "PressureAnalyzer.h"
9 #include <ddMd/simulation/Simulation.h>
10 
11 #include <sstream>
12 
13 namespace DdMd
14 {
15 
16  using namespace Util;
17 
18  /*
19  * Constructor.
20  */
22  : AverageAnalyzer(simulation)
23  { setClassName("PressureAnalyzer"); }
24 
25  /*
26  * Destructor.
27  */
29  {}
30 
31  /*
32  * Compute current value.
33  */
35  {
38  }
39 
40  /*
41  * Get value current value (call only on master)
42  */
44  {
45  if (!simulation().domain().isMaster()) {
46  UTIL_THROW("Error: Not master processor");
47  }
48  double pressure;
49  pressure = simulation().virialPressure();
50  pressure += simulation().kineticPressure();
51  return pressure;
52  }
53 
54 }
Simulation & simulation()
Get the parent Simulation by reference.
double kineticPressure() const
Return total kinetic pressure.
Parallel domain decomposition (DD) MD simulation.
Main object for a domain-decomposition MD simulation.
double virialPressure() const
Return total virial pressure.
virtual double value()
Get current value of pressure.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Definition: global.h:51
Analyze average and block averages of a single floating point variable.
Utility classes for scientific computation.
Definition: accumulators.mod:1
virtual ~PressureAnalyzer()
Destructor.
void computeVirialStress()
Calculate and store all virial stress contributions.
virtual void compute()
Compute current value of pressure.
PressureAnalyzer(Simulation &simulation)
Constructor.
void setClassName(const char *className)
Set class name string.
void computeKineticStress()
Calculate and store kinetic stress.