System

class System

System is a facade design pattern in order to constrain and/or simplify the interface with multiple configurations and multiple lists of potentials. The typing and grouping of multiple configurations should be the same, but the domain and particle which physically exist may be different. There are three types of potentials.

  1. The first is without optimizations.

  2. The second is with optimizations, which may be periodically compared with the first.

  3. The remaining potentials are used for reference. For example, cheap energy calculations in dual-cut configurational bias. Also Mayer-sampling.

Finally, the System also contains the ThermoParams.

Configurations

Store and retrieve a list of configurations.

void add(std::shared_ptr<Configuration> configuration)

Add a configuration.

int num_configurations() const

Return the number of configurations.

const Configuration &configuration(const int config = 0) const

Return the configuration.

int dimension(const int config = 0) const

Return the dimensionality of the system.

Potentails

Store and retrieve a list of potentials.

void add(std::shared_ptr<Potential> potential, const int config = 0)

Add a potential. By default, the potential is considered unoptimized.

void set_unoptimized(const int index, std::shared_ptr<Potential> potential, const int config = 0)

Set an unoptimized potential.

void add_to_unoptimized(std::shared_ptr<Potential> potential, const int config = 0)

Add an unoptimized potential.

const PotentialFactory &unoptimized(const int config = 0) const

Return the unoptimized potentials.

const Potential &potential(const int index, const int config = 0) const

Return an unoptimized potential.

void add_to_optimized(std::shared_ptr<Potential> potential, const int config = 0)

Add an optimized potential.

const PotentialFactory &optimized(const int config = 0) const

Return the optimized potentials.

void add_to_reference(std::shared_ptr<Potential> ref, const int index = 0, const int config = 0)

Add a reference potential.

param index:

Store different references by index.

int num_references(const int config = 0) const

Return the number of reference potentials.

const Potential &reference(const int ref, const int potential, const int config = 0) const

Return a reference potential.

const std::vector<std::vector<PotentialFactory>> references() const

Return the list of reference potentials.

const PotentialFactory &potentials(const int config = 0) const

Return a constant reference to the full potentials.

void remove_opt_overlap()

Remove optimization when overlap is detected, which is default.

Neighbor Criteria

Define and store various criteria used for defining neighbors

void add(std::shared_ptr<NeighborCriteria> neighbor_criteria, const int config = 0)

Add a NeighborCriteria.

const NeighborCriteria &neighbor_criteria(const int index, const int config) const

Return a NeighborCriteria by index in order added.

const std::vector<std::shared_ptr<NeighborCriteria>> &neighbor_criteria(const int config) const

Return a NeighborCriteria by index in order added.

Energy

Compute energies using a combination of configurations and potentials.

void precompute()

Precompute quantities for optimizations before calculation of energies.

double unoptimized_energy(const int config)

Return the unoptimized energy. The following use optimized if available.

double energy(const int config = 0)

Return the energy of all.

double perturbed_energy(const Select &select, const int config = 0)

Return the energy of the selection. But do not finalize this energy (e.g., Ewald, neighbors, etc).

double stored_energy(const int config = 0) const

Return the last computed energy.

std::vector<double> stored_energy_profile(const int config = 0) const

Return the profile of energies that were last computed.

double reference_energy(const int ref = 0, const int config = 0)

Return the reference energy.

double reference_energy(const Select &select, const int ref = 0, const int config = 0)

Return the reference energy of the selection.

double initialize(const int config = 0)

Initialize and return total energy.

ThermoParams

Store and retreive the thermodynamic parameters such as temperature, pressure, etc.

void set(std::shared_ptr<ThermoParams> thermo_params)

Set the thermodynamic parameters.

const ThermoParams &thermo_params() const

Return the thermodynamic parameters.

void set_beta(const double beta)

Set the inverse temperature, \(\beta\).

Public Functions

System()

Empty constructor.

void change_volume(const double delta_volume, argtype args = argtype())

Change the volume.

args:

  • configuration: index of configuration (default: 0)

  • see Configuration for remaining arguments.

double delta_volume_previous() const

Return the previous delta_volume.

double total_volume() const

Return the total volume of all Configurations.

Change the volume in the opposite amount as the last volume change. This is implemented to keep the total volume constant for Gibbs ensemble. Return the actual volume change.

args:

  • Same as change_volume above.

void revert(const Select &select, const int config = 0)

Revert changes due to energy computation of perturbations.

void finalize(const Select &select, const int config = 0)

Finalize changes due to energy computation of perturbations.

void load_cache(const bool load)

Set cache to load energy calculations.

void unload_cache(const System &system)

Set cache to unload energy calclatuions.

std::string status_header() const

Return the header of the status for periodic output.

std::string status() const

Return the brief status for periodic output.

void check(const int config = 0) const

Run checks.

void serialize(std::ostream &sstr) const

Serialize.

System(std::istream &sstr)

Deserialize.