Simpatico  v1.10
StressAnalyzer.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 "StressAnalyzer.h"
9 #include <ddMd/simulation/Simulation.h>
10 #include <util/space/Tensor.h>
11 
12 namespace DdMd
13 {
14 
15  using namespace Util;
16 
17  /*
18  * Constructor.
19  */
21  : SymmTensorAverageAnalyzer(simulation)
22  { setClassName("StressAnalyzer"); }
23 
24  /*
25  * Destructor.
26  */
28  {}
29 
30  /*
31  * Compute current value.
32  */
34  {
37  }
38 
39  /*
40  * Get value current value (call only on master)
41  */
43  {
44  if (!simulation().domain().isMaster()) {
45  UTIL_THROW("Error: Not master processor");
46  }
47  Tensor stress;
48  stress = simulation().virialStress();
49  stress += simulation().kineticStress();
50  return stress;
51  }
52 
53 }
Simulation & simulation()
Get the parent Simulation by reference.
virtual ~StressAnalyzer()
Destructor.
virtual void compute()
Compute current value of stress tensor.
Parallel domain decomposition (DD) MD simulation.
StressAnalyzer(Simulation &simulation)
Constructor.
Main object for a domain-decomposition MD simulation.
A Tensor represents a Cartesian tensor.
Definition: Tensor.h:32
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Definition: global.h:51
Utility classes for scientific computation.
Definition: accumulators.mod:1
Tensor kineticStress() const
Return total kinetic stress.
void computeVirialStress()
Calculate and store all virial stress contributions.
virtual Tensor value()
Get current value, set by compute function.
void setClassName(const char *className)
Set class name string.
Analyzer that computes average of a sequence of symmetric Tensor values.
Tensor virialStress() const
Return total virial stress.
void computeKineticStress()
Calculate and store kinetic stress.