faunus
Public Member Functions | List of all members
Faunus::Energy::Hamiltonian Class Reference

Aggregate and sum energy terms. More...

#include <energy.h>

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

Public Member Functions

 Hamiltonian (Space &spc, const json &j)
 
void init () override
 reset and initialize
 
void updateState (const Change &change) override
 Update internal state to reflect change in e.g. Space. More...
 
void sync (EnergyTerm *other_hamiltonian, const Change &change) override
 Sync (copy from) another energy instance. More...
 
double energy (const Change &change) override
 Energy due to changes.
 
const std::vector< double > & latestEnergies () const
 Energies for each term from the latest call to energy()
 
- Public Member Functions inherited from Faunus::BasePointerVector< EnergyTerm >
auto begin () noexcept
 
auto begin () const noexcept
 
auto end () noexcept
 
auto end () const noexcept
 
auto empty () const noexcept
 
auto size () const noexcept
 
auto & back () noexcept
 
auto & back () const noexcept
 
auto & front () noexcept
 
auto & front () const noexcept
 
auto & at (size_t n)
 
auto & at (size_t n) const
 
void emplace_back (Args &... args)
 Create an (derived) instance and append a pointer to it to the vector.
 
void emplace_back (const Args &... args)
 Create an (derived) instance and append a pointer to it to the vector.
 
auto & push_back (value_type arg)
 Append a pointer to a (derived) instance to the vector.
 
auto & operator= (const BasePointerVector< Tderived > &d)
 Allow assignment to a vector of ancestors.
 
auto find () const
 Pointer list to all matching type.
 
std::shared_ptr< Tderived > findFirstOf () const
 

Additional Inherited Members

- Public Types inherited from Faunus::Energy::EnergyTerm
enum  MonteCarloState { ACCEPTED, TRIAL, NONE }
 
- Public Types inherited from Faunus::BasePointerVector< EnergyTerm >
using value_type = std::shared_ptr< EnergyTerm >
 
- Public Attributes inherited from Faunus::Energy::EnergyTerm
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.
 
- Public Attributes inherited from Faunus::BasePointerVector< EnergyTerm >
std::vector< value_type > vec
 Vector of shared pointers to base class.
 

Detailed Description

Aggregate and sum energy terms.

Constructor & Destructor Documentation

◆ Hamiltonian()

Faunus::Energy::Hamiltonian::Hamiltonian ( Space spc,
const json j 
)
Todo:
Move addEwald to Nonbonded as it now has access to Hamiltonian and can add

Member Function Documentation

◆ sync()

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

Sync (copy from) another energy instance.

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

Reimplemented from Faunus::Energy::EnergyTerm.

◆ updateState()

void Faunus::Energy::Hamiltonian::updateState ( const Change change)
overridevirtual

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 from Faunus::Energy::EnergyTerm.


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