PotentialFactory

class PotentialFactory

A list of potentials.

By default, if one of the potentials returns a large energy, then the rest of the potentials are not calculated. This is the default behavior, which can be disabled with remove_opt_overlap() as done in MayerSampling.

Public Functions

void add(std::shared_ptr<Potential> potential)

Add potential.

void set(const int index, std::shared_ptr<Potential> potential)

Set a potential.

const std::vector<std::shared_ptr<Potential>> &potentials() const

Return the potentials.

const Potential &potential(const int index) const

Return a potential by index of order added.

int num() const

Return the number of potentials.

void precompute(Configuration *config)

Precompute quantities for optimizations before calculation of energies.

void precompute(const int index, Configuration *config)

Precompute a particular potential by index.

void remove_opt_overlap()

Remove optimization when overlap is detected, which is default.

double energy(Configuration *config)

Compute the energy of the given configuration.

double select_energy(const Select &select, Configuration *config)

Compute the energy of the selection in the configuration.

std::vector<double> stored_energy_profile() const

Return the profile of energies that were last computed.

double stored_energy() const

Return the last computed value of the energy.

std::string str() const

Return a human-readable status.

void change_volume(const double delta_volume, const int dimension, Configuration *config)

Change the volume.

void revert(const Select &select)

Revert any changes to the configuration due to the last energy computation.

void finalize(const Select &select, Configuration *config)

Finalize changes due to perturbations.

void load_cache(const bool load)

Set cache to load energy calculations.

void unload_cache(const PotentialFactory &factory)

Set cache to unload energy calclatuions.

void serialize(std::ostream &sstr) const

Serialize.

PotentialFactory(std::istream &sstr)

Deserialize.