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 ModelParams 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.
-
const std::string &config() const
Return the configuration name.
-
int configuration_index() const
Return the configuration index.
-
void set_configuration_index(const int configuration_index)
Set the configuration index.
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
Model: Derived class Model name (default: ModelEmpty).
VisitModel: Derived class VisitModel name (default: VisitModel).
config: Name of Configuration in System (default: 0).
group: Name of Group defined within Configuration (default: the whole Configuration).
cell_index: Optionally set the index of the cell, only used with VisitModelCell. This also overrides group.
prevent_cache: Set this to true in order to prevent the use of cache (default: false)
table_size: Set size of ModelTwoBodyTable (default: 0). Do not use if size <= 0.
table_hard_sphere_threshold: If using a table above, set the ModelTwoBodyTable hard_sphere_threshold (default: 0.85).
[parameter]: Optionally, override ModelParams as described in Configuration arguments.
[parameter][type1]: Optionally, override ModelParams as described in Configuration arguments.
[parameter][type1]_[type2]: Optionally, override ModelParams as described in Configuration arguments.
-
int group_index() const