Potential
-
class Potential
A potential represents both the model and the method used to compute the model (e.g., VisitModel) for a given Configuration. A potential also allows customization of the model parameters templated but separate from those in the Configuration.
Public Functions
-
int group_index() const
Return the index of the group.
-
int cell_index() const
Return the index of the cell.
Construct with model and default visitor.
Construct with visitor and default model.
-
const VisitModel &visit_model() const
Return the method used to compute.
Construct with model and visitor.
-
void set(const ModelParams &model_params)
Set the model parameters. If not set, use the one from configuration.
-
void set_model_params(const Configuration &config)
Set the model parameters to the one in the configuration.
-
void set_model_param(const std::string &name, const int site_type, const double value)
Modify model parameter of a given site type and name to value.
-
void set_model_param(const std::string &name, const int site_type0, const int site_type1, const double value)
Modify model parameter of given site types and name to value.
-
const ModelParams &model_params() const
Return the model parameters.
-
const ModelParams &model_params(const Configuration &config) const
Return the model parameters. Use model parameters from configuration if they have not been overridden.
-
bool does_cutoff_fit_domain(const Configuration &config, const bool fatal = false) const
Check that the cutoff is within the allowed range for the Domain.
- param fatal:
Generate a fatal error if returning false
-
void precompute(Configuration *config)
Precompute quantities for optimizations before calculation of energies.
-
virtual double energy(Configuration *config)
Compute the energy of the entire configuration.
-
virtual double select_energy(const Select &select, Configuration *config)
Compute the energy of a selection of the configuration.
-
double stored_energy() const
Return the last computed value of the energy.
-
void set_stored_energy(const double energy)
Set the last computed value of the energy.
-
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 to the configuration due to the last energy computation.
-
void serialize(std::ostream &ostr) const
Serialize.
-
Potential(std::istream &istr)
Deserialize.
Arguments
group_index: set the index of the group in the configuration which contributes to this potential (default: 0, representing entire config).
group: name of group defined within system (default: “”). Cannot be used with group_index.
cell_index: set the index of the cell, only used with VisitModelCell. This also overrides group_index.
prevent_cache: set this to true in order to prevent the use of cache (default: False)
table_size: set size of tabular potential (default: 0). Do not use table if size <= 0.
table_hard_sphere_threshold: If using a table above, set the ModelTwoBodyTable hard_sphere_threshold (default: 0.85).
[parameter]/[i]/[j]: as described in Configuration arguments.
Model: derived class Model name (default: ModelEmpty).
VisitModel: derived class VisitModel name (default: VisitModel).
-
int group_index() const