Simpatico  v1.10
McEnergyAverage.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 "McEnergyAverage.h" // class header
9 //#include <util/misc/FileMaster.h>
10 //#include <util/archives/Serializable_includes.h>
11 
12 
13 #include <cstdio>
14 
15 namespace McMd
16 {
17 
18  using namespace Util;
19 
20  /*
21  * Constructor.
22  */
24  : AverageAnalyzer<McSystem>(system)
25  { setClassName("McEnergyAverage"); }
26 
27 
28  /*
29  * Evaluate energy, and add to accumulator.
30  */
31  void McEnergyAverage::sample(long iStep)
32  {
33  if (isAtInterval(iStep)) {
34  accumulator_.sample(system().potentialEnergy(), outputFile_);
35  }
36  }
37 
38 }
A System for use in a Markov chain Monte Carlo simulation.
Definition: McSystem.h:52
McSystem & system()
Return reference to parent system.
Utility classes for scientific computation.
Definition: accumulators.mod:1
Average accumulator_
Average object - statistical accumulator.
virtual void sample(long iStep)
Calculate, analyze and/or output a physical quantity.
McEnergyAverage(McSystem &system)
Constructor.
AverageAnalyzer averages of total potential energy.
void sample(double value)
Add a sampled value to the ensemble.
Definition: Average.cpp:94
Single-processor Monte Carlo (MC) and molecular dynamics (MD).
void setClassName(const char *className)
Set class name string.
bool isAtInterval(long counter) const
Return true iff counter is a multiple of the interval.