Simpatico
v1.10
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
src
ddMd
analyzers
energy
ExternalEnergyAnalyzer.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 "ExternalEnergyAnalyzer.h"
9
#include <ddMd/simulation/Simulation.h>
10
#include <ddMd/potentials/external/ExternalPotential.h>
11
12
#include <sstream>
13
14
namespace
DdMd
15
{
16
17
using namespace
Util
;
18
19
/*
20
* Constructor.
21
*/
22
ExternalEnergyAnalyzer::ExternalEnergyAnalyzer
(
Simulation
& simulation)
23
:
AverageAnalyzer
(simulation)
24
{
setClassName
(
"ExternalEnergyAnalyzer"
); }
25
26
/*
27
* Destructor.
28
*/
29
ExternalEnergyAnalyzer::~ExternalEnergyAnalyzer
()
30
{}
31
32
/*
33
* Compute current value.
34
*/
35
void
ExternalEnergyAnalyzer::compute
()
36
{
37
MPI::Intracomm& communicator =
simulation
().
domain
().
communicator
();
38
simulation
().
externalPotential
().
computeEnergy
(communicator);
39
}
40
41
/*
42
* Get value current value (call only on master)
43
*/
44
double
ExternalEnergyAnalyzer::value
()
45
{
46
if
(!
simulation
().domain().isMaster()) {
47
UTIL_THROW
(
"Error: Not master processor"
);
48
}
49
return
simulation
().
externalPotential
().
energy
();
50
}
51
52
}
DdMd::Potential::computeEnergy
virtual void computeEnergy(MPI::Intracomm &communicator)=0
Compute potential energy on all processors.
DdMd::Analyzer::simulation
Simulation & simulation()
Get the parent Simulation by reference.
Definition:
ddMd/analyzers/Analyzer.h:255
DdMd
Parallel domain decomposition (DD) MD simulation.
Definition:
ddMd/analyzers/Analyzer.cpp:12
DdMd::Simulation
Main object for a domain-decomposition MD simulation.
Definition:
ddMd/simulation/Simulation.h:84
DdMd::Simulation::externalPotential
const ExternalPotential & externalPotential() const
Get the ExternalPotential by reference.
Definition:
ddMd/simulation/Simulation.h:1165
DdMd::Domain::communicator
MPI::Intracomm & communicator() const
Return Cartesian communicator by reference.
Definition:
Domain.h:257
UTIL_THROW
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Definition:
global.h:51
DdMd::AverageAnalyzer
Analyze average and block averages of a single floating point variable.
Definition:
ddMd/analyzers/AverageAnalyzer.h:34
DdMd::ExternalEnergyAnalyzer::value
virtual double value()
Current value, set by compute function.
Definition:
ExternalEnergyAnalyzer.cpp:44
Util
Utility classes for scientific computation.
Definition:
accumulators.mod:1
DdMd::ExternalEnergyAnalyzer::~ExternalEnergyAnalyzer
virtual ~ExternalEnergyAnalyzer()
Destructor.
Definition:
ExternalEnergyAnalyzer.cpp:29
DdMd::ExternalEnergyAnalyzer::ExternalEnergyAnalyzer
ExternalEnergyAnalyzer(Simulation &simulation)
Constructor.
Definition:
ExternalEnergyAnalyzer.cpp:22
DdMd::ExternalEnergyAnalyzer::compute
virtual void compute()
Function to compute value.
Definition:
ExternalEnergyAnalyzer.cpp:35
DdMd::Potential::energy
double energy() const
Return the total potential, from all processors.
Definition:
Potential.cpp:39
Util::ParamComposite::setClassName
void setClassName(const char *className)
Set class name string.
Definition:
ParamComposite.cpp:377
DdMd::Simulation::domain
Domain & domain()
Get the Domain by reference.
Definition:
ddMd/simulation/Simulation.h:1083
Generated on Wed Mar 7 2018 12:59:39 for Simpatico by
1.8.11