Simpatico  v1.10
KineticEnergyAnalyzer.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 "KineticEnergyAnalyzer.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("KineticEnergyAnalyzer"); }
24 
25  /*
26  * Destructor.
27  */
29  {}
30 
31  /*
32  * Compute current value.
33  */
36 
37  /*
38  * Get value current value (call only on master)
39  */
41  {
42  if (!simulation().domain().isMaster()) {
43  UTIL_THROW("Error: Not master processor");
44  }
45  return simulation().kineticEnergy();
46  }
47 
48 }
virtual void compute()
Function to compute value.
Simulation & simulation()
Get the parent Simulation by reference.
double kineticEnergy()
Return precomputed total kinetic energy.
KineticEnergyAnalyzer(Simulation &simulation)
Constructor.
Parallel domain decomposition (DD) MD simulation.
Main object for a domain-decomposition MD simulation.
#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
void setClassName(const char *className)
Set class name string.
virtual ~KineticEnergyAnalyzer()
Destructor.
void computeKineticEnergy()
Compute total kinetic energy.
virtual double value()
Current value, set by compute function.