21 reverseUpdateFlag_(false)
40 {
return energy_.
value(); }
46 { energy_.
set(energy); }
58 {
return energy_.
isSet(); }
64 {
return stress_.value(); }
73 p += stress_.value()(i, i);
83 { stress_.set(stress); }
95 {
return stress_.isSet(); }
126 double totalEnergy = 0.0;
127 communicator.Reduce(&localEnergy, &totalEnergy, 1,
128 MPI::DOUBLE, MPI::SUM, 0);
129 if (communicator.Get_rank() != 0) {
149 communicator.Reduce(&localStress(0,0), &totalStress(0,0),
151 if (communicator.Get_rank() != 0) {
167 stress_.isValid(communicator);
void setStress(const Tensor &stress)
Set a value for the total stress.
void unsetStress()
Mark the stress as unknown (nullify).
const int Dimension
Dimensionality of space.
bool isStressSet() const
Is the stress set (known)?
void reduceStress(Tensor &localStress, MPI::Intracomm &communicator)
Add local stresses from all processors, set total on master.
void set(const T &value)
Set the value and mark as set.
bool isSet() const
Is this object set (is the value known)?
virtual void computeForces()=0
Add force contributions to all atomic forces.
Tensor & zero()
Set all elements of this tensor to zero.
virtual void computeStress(MPI::Intracomm &communicator)
Compute stress on all processors.
Parallel domain decomposition (DD) MD simulation.
A Tensor represents a Cartesian tensor.
virtual void computeForcesAndStress(MPI::Intracomm &communicator)
Compute forces and stress for all processors.
virtual bool isValid(MPI::Intracomm &communicator) const
Is the potential in a valid internal state?
void unsetEnergy()
Mark the energy as unknown (nullify).
const T & value() const
Return value (if set).
void setReverseUpdateFlag(bool reverseUpdateFlag)
Set flag to identify if reverse communication is enabled.
bool isValid(MPI::Intracomm &communicator) const
Test consistency of states on different processors.
Utility classes for scientific computation.
double pressure() const
Return the pressure.
void unset()
Unset the value (mark as unknown).
bool reverseUpdateFlag() const
Get flag to identify if reverse communication is enabled.
double energy() const
Return the total potential, from all processors.
Tensor stress() const
Return the stress tensor.
void reduceEnergy(double localEnergy, MPI::Intracomm &communicator)
Add local energies from all processors, set energy on master.
void setClassName(const char *className)
Set class name string.
void setEnergy(double energy)
Set a value for the total energy.
virtual ~Potential()
Destructor.
bool isEnergySet() const
Is the energy set (known)?