faunus
Public Types | Public Member Functions | Public Attributes | List of all members
Faunus::Energy::EnergyTerm Class Referenceabstract

All energies inherit from this class. More...

#include <externalpotential.h>

Inheritance diagram for Faunus::Energy::EnergyTerm:
Inheritance graph
[legend]
Collaboration diagram for Faunus::Energy::EnergyTerm:
Collaboration graph
[legend]

Public Types

enum  MonteCarloState { ACCEPTED, TRIAL, NONE }
 

Public Member Functions

virtual double energy (const Change &change)=0
 energy due to change
 
virtual void to_json (json &j) const
 json output
 
virtual void sync (EnergyTerm *other_energy, const Change &change)
 Sync (copy from) another energy instance. More...
 
virtual void init ()
 reset and initialize
 
virtual void updateState (const Change &change)
 Update internal state to reflect change in e.g. Space. More...
 
virtual void force (PointVector &forces)
 update forces on all particles
 

Public Attributes

MonteCarloState state = MonteCarloState::NONE
 
std::string name
 Meaningful name.
 
std::string citation_information
 Possible reference; may be left empty.
 
TimeRelativeOfTotal< std::chrono::microseconds > timer
 Timer for measuring speed.
 

Detailed Description

All energies inherit from this class.

Member Function Documentation

◆ sync()

void Faunus::Energy::EnergyTerm::sync ( EnergyTerm other_energy,
const Change change 
)
virtual

Sync (copy from) another energy instance.

Parameters
other_energyOther energy instance to copy data from
changeDescribes the difference with the other energy term

Reimplemented in Faunus::Energy::Hamiltonian, Faunus::Energy::NonbondedCached< TPairEnergy, TPairingPolicy >, Faunus::Energy::Ewald, and Faunus::Energy::Penalty.

◆ updateState()

void Faunus::Energy::EnergyTerm::updateState ( const Change change)
virtual

Update internal state to reflect change in e.g. Space.

This should be called whenever the Space is modified (particles, volume, etc) as some energy terms may depend on this.

One example is Ewald summation that needs to update k-vectors before calculating the energy.

Reimplemented in Faunus::Energy::Hamiltonian, and Faunus::Energy::Ewald.


The documentation for this class was generated from the following files: