Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
colvarbias_meta Class Reference

Metadynamics bias (implementation of colvarbias) More...

#include <colvarbias_meta.h>

Inheritance diagram for colvarbias_meta:
Inheritance graph
[legend]
Collaboration diagram for colvarbias_meta:
Collaboration graph
[legend]

Classes

class  hill
 A hill for the metadynamics bias. More...
 

Public Types

enum  Communication { single_replica , multiple_replicas }
 Communication between different replicas. More...
 
typedef std::list< hill >::iterator hill_iter
 
- Public Types inherited from colvarparse
enum  Parse_Mode {
  parse_null = 0 , parse_echo = (1<<1) , parse_echo_default = (1<<2) , parse_deprecation_warning = (1<<3) ,
  parse_silent = 0 , parse_required = (1<<16) , parse_override = (1<<17) , parse_restart = (1<<18) ,
  parse_normal = (1<<1) | (1<<2) | (1<<17) , parse_deprecated = (1<<1) | (1<<3) | (1<<17)
}
 How a keyword is parsed in a string. More...
 
- Public Types inherited from colvardeps
enum  features_biases {
  f_cvb_active , f_cvb_awake , f_cvb_step_zero_data , f_cvb_apply_force ,
  f_cvb_bypass_ext_lagrangian , f_cvb_get_total_force , f_cvb_output_acc_work , f_cvb_history_dependent ,
  f_cvb_time_dependent , f_cvb_scalar_variables , f_cvb_calc_pmf , f_cvb_calc_ti_samples ,
  f_cvb_write_ti_samples , f_cvb_write_ti_pmf , f_cvb_scale_biasing_force , f_cvb_extended ,
  f_cvb_ntot
}
 
enum  features_colvar {
  f_cv_active , f_cv_awake , f_cv_gradient , f_cv_collect_gradient ,
  f_cv_collect_atom_ids , f_cv_fdiff_velocity , f_cv_total_force , f_cv_total_force_calc ,
  f_cv_subtract_applied_force , f_cv_Jacobian , f_cv_hide_Jacobian , f_cv_extended_Lagrangian ,
  f_cv_external , f_cv_Langevin , f_cv_output_energy , f_cv_output_value ,
  f_cv_output_velocity , f_cv_output_applied_force , f_cv_output_total_force , f_cv_lower_boundary ,
  f_cv_upper_boundary , f_cv_hard_lower_boundary , f_cv_hard_upper_boundary , f_cv_reflecting_lower_boundary ,
  f_cv_reflecting_upper_boundary , f_cv_grid , f_cv_runave , f_cv_corrfunc ,
  f_cv_scripted , f_cv_custom_function , f_cv_periodic , f_cv_single_cvc ,
  f_cv_scalar , f_cv_linear , f_cv_homogeneous , f_cv_multiple_ts ,
  f_cv_ntot
}
 
enum  features_cvc {
  f_cvc_active , f_cvc_scalar , f_cvc_periodic , f_cvc_width ,
  f_cvc_lower_boundary , f_cvc_upper_boundary , f_cvc_explicit_atom_groups , f_cvc_gradient ,
  f_cvc_explicit_gradient , f_cvc_inv_gradient , f_cvc_Jacobian , f_cvc_one_site_total_force ,
  f_cvc_debug_gradient , f_cvc_pbc_minimum_image , f_cvc_com_based , f_cvc_scalable ,
  f_cvc_scalable_com , f_cvc_collect_atom_ids , f_cvc_ntot
}
 
enum  features_atomgroup {
  f_ag_active , f_ag_center , f_ag_center_origin , f_ag_rotate ,
  f_ag_fitting_group , f_ag_explicit_gradient , f_ag_fit_gradients , f_ag_atom_forces ,
  f_ag_scalable , f_ag_scalable_com , f_ag_collect_atom_ids , f_ag_ntot
}
 

Public Member Functions

 colvarbias_meta (char const *key)
 
virtual int init (std::string const &conf)
 Parse config string and (re)initialize. More...
 
virtual int init_replicas_params (std::string const &conf)
 
virtual int init_well_tempered_params (std::string const &conf)
 
virtual int init_ebmeta_params (std::string const &conf)
 
virtual int clear_state_data ()
 Delete only the allocatable data (save memory) More...
 
virtual int update ()
 
virtual int update_grid_params ()
 
virtual int update_bias ()
 
virtual int update_grid_data ()
 
virtual int replica_share ()
 
virtual size_t replica_share_freq () const
 Report the frequency at which this bias needs to communicate with replicas. More...
 
virtual int calc_energy (std::vector< colvarvalue > const *values)
 
virtual int calc_forces (std::vector< colvarvalue > const *values)
 
virtual std::string const get_state_params () const
 Write the values of specific mutable properties to a string. More...
 
virtual int set_state_params (std::string const &state_conf)
 Read the values of specific mutable properties from a string. More...
 
virtual std::ostream & write_state_data (std::ostream &os)
 Write all mutable data not already written by get_state_params() to a formatted stream. More...
 
virtual cvm::memory_streamwrite_state_data (cvm::memory_stream &os)
 Write all mutable data not already written by get_state_params() to an unformatted stream. More...
 
virtual std::istream & read_state_data (std::istream &is)
 Read all mutable data not already set by set_state_params() from a formatted stream. More...
 
virtual cvm::memory_streamread_state_data (cvm::memory_stream &is)
 Read all mutable data not already set by set_state_params() from an unformatted stream. More...
 
void rebin_grids_after_restart ()
 Function called by read_state_data() to execute rebinning (if requested)
 
virtual int setup_output ()
 (Re)initialize the output files (does not write them yet) More...
 
virtual int write_output_files ()
 Write any output files that this bias may have (e.g. PMF files) More...
 
virtual void write_pmf ()
 
virtual int write_state_to_replicas ()
 If this bias is communicating with other replicas through files, send it to them. More...
 
- Public Member Functions inherited from colvarbias
int add_colvar (std::string const &cv_name)
 Add a new collective variable to this bias.
 
size_t num_variables () const
 How many variables are defined for this bias.
 
std::vector< colvar * > * variables ()
 Access the variables vector.
 
colvarvariables (int i) const
 Access the i-th variable.
 
virtual int update ()
 
virtual bool can_accumulate_data ()
 
virtual int calc_energy (std::vector< colvarvalue > const *values)
 
virtual int calc_forces (std::vector< colvarvalue > const *values)
 
int communicate_forces ()
 Send forces to the collective variables.
 
virtual int end_of_step ()
 Carry out operations needed before next step is run.
 
virtual int change_configuration (std::string const &conf)
 Load new configuration - force constant and/or centers only. More...
 
virtual cvm::real energy_difference (std::string const &conf)
 Calculate change in energy from using alternate configuration. More...
 
virtual int bin_num ()
 Give the total number of bins for a given bias. More...
 
virtual int current_bin ()
 Calculate the bin index for a given bias. More...
 
virtual int bin_count (int bin_index)
 
virtual int local_sample_count (int radius)
 Return the average number of samples in a given "radius" around current bin. More...
 
virtual int replica_share ()
 
virtual size_t replica_share_freq () const
 Report the frequency at which this bias needs to communicate with replicas. More...
 
virtual void analyze ()
 Perform analysis tasks.
 
 colvarbias (char const *key)
 Constructor.
 
virtual int init (std::string const &conf)
 Parse config string and (re)initialize. More...
 
virtual int init_dependencies ()
 Initialize dependency tree. More...
 
virtual int reset ()
 Set to zero all mutable data.
 
virtual int clear ()
 Delete everything.
 
virtual int clear_state_data ()
 Delete only the allocatable data (save memory) More...
 
virtual ~colvarbias ()
 Destructor.
 
virtual std::string const get_state_params () const
 Write the values of specific mutable properties to a string. More...
 
int check_matching_state (std::string const &conf)
 Check the name of the bias vs. the given string, set the matching_state flag accordingly.
 
virtual int set_state_params (std::string const &state_conf)
 Read the values of specific mutable properties from a string. More...
 
virtual std::ostream & write_state_data (std::ostream &os)
 Write all mutable data not already written by get_state_params() to a formatted stream. More...
 
virtual cvm::memory_streamwrite_state_data (cvm::memory_stream &os)
 Write all mutable data not already written by get_state_params() to an unformatted stream. More...
 
virtual std::istream & read_state_data (std::istream &is)
 Read all mutable data not already set by set_state_params() from a formatted stream. More...
 
virtual cvm::memory_streamread_state_data (cvm::memory_stream &is)
 Read all mutable data not already set by set_state_params() from an unformatted stream. More...
 
std::ostream & write_state_data_key (std::ostream &os, std::string const &key, bool header=true) const
 
cvm::memory_streamwrite_state_data_key (cvm::memory_stream &os, std::string const &key, bool header=true) const
 
std::istream & read_state_data_key (std::istream &is, std::string const &key)
 
cvm::memory_streamread_state_data_key (cvm::memory_stream &is, std::string const &key)
 
std::ostream & write_state (std::ostream &os)
 Write the bias configuration to a formatted stream.
 
cvm::memory_streamwrite_state (cvm::memory_stream &os)
 Write the bias configuration to an unformatted stream.
 
std::istream & read_state (std::istream &is)
 Read the bias configuration from a formatted stream.
 
cvm::memory_streamread_state (cvm::memory_stream &is)
 Read the bias configuration from an unformatted stream.
 
int write_state_prefix (std::string const &prefix)
 Write the bias state to a file with the given prefix.
 
int write_state_string (std::string &output)
 Write the bias state to a string.
 
int read_state_prefix (std::string const &prefix)
 Read the bias state from a file with this name or prefix.
 
int read_state_string (char const *buffer)
 Read the bias state from this string buffer.
 
virtual std::ostream & write_traj_label (std::ostream &os)
 Write a label to the trajectory file (comment line) More...
 
virtual std::ostream & write_traj (std::ostream &os)
 Output quantities such as the bias energy to the trajectory file. More...
 
virtual int setup_output ()
 (Re)initialize the output files (does not write them yet) More...
 
virtual int write_output_files ()
 Write any output files that this bias may have (e.g. PMF files) More...
 
virtual int write_state_to_replicas ()
 If this bias is communicating with other replicas through files, send it to them. More...
 
cvm::real get_energy ()
 
virtual const std::vector< feature * > & features () const
 Implementation of the feature list accessor for colvarbias. More...
 
virtual std::vector< feature * > & modify_features ()
 
- Public Member Functions inherited from colvarparse
 colvarparse ()
 Default constructor.
 
 colvarparse (const std::string &conf)
 Constructor that stores the object's config string.
 
void clear ()
 Set the object ready to parse a new configuration string.
 
void set_string (std::string const &conf)
 Set a new config string for this object.
 
 ~colvarparse () override
 Default destructor.
 
std::string const & get_config () const
 Get the configuration string (includes comments)
 
int check_keywords (std::string &conf, char const *key)
 Check that all the keywords within "conf" are in the list of allowed keywords; this will invoke strip_values() first and then loop over all words.
 
void clear_keyword_registry ()
 Use this after parsing a config string (note that check_keywords() calls it already)
 
bool get_keyval (std::string const &conf, char const *key, int &value, int const &def_value=0, Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, size_t &value, size_t const &def_value=0, Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, long &value, long const &def_value=0, Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, cvm::step_number &value, cvm::step_number const &def_value=0, Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, std::string &value, std::string const &def_value=std::string(""), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, cvm::real &value, cvm::real const &def_value=0.0, Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, cvm::rvector &value, cvm::rvector const &def_value=cvm::rvector(), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, cvm::quaternion &value, cvm::quaternion const &def_value=cvm::quaternion(), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, colvarvalue &value, colvarvalue const &def_value=colvarvalue(colvarvalue::type_notset), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, bool &value, bool const &def_value=false, Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, std::vector< int > &values, std::vector< int > const &def_values=std::vector< int >(0, 0), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, std::vector< size_t > &values, std::vector< size_t > const &def_values=std::vector< size_t >(0, 0), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, std::vector< long > &values, std::vector< long > const &def_values=std::vector< long >(0, 0), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, std::vector< std::string > &values, std::vector< std::string > const &def_values=std::vector< std::string >(0, std::string("")), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, std::vector< cvm::real > &values, std::vector< cvm::real > const &def_values=std::vector< cvm::real >(0, 0.0), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, std::vector< cvm::rvector > &values, std::vector< cvm::rvector > const &def_values=std::vector< cvm::rvector >(0, cvm::rvector()), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, std::vector< cvm::quaternion > &values, std::vector< cvm::quaternion > const &def_values=std::vector< cvm::quaternion >(0, cvm::quaternion()), Parse_Mode const parse_mode=parse_normal)
 
bool get_keyval (std::string const &conf, char const *key, std::vector< colvarvalue > &values, std::vector< colvarvalue > const &def_values=std::vector< colvarvalue >(0, colvarvalue(colvarvalue::type_notset)), Parse_Mode const parse_mode=parse_normal)
 
bool key_lookup (std::string const &conf, char const *key, std::string *data=nullptr, size_t *save_pos=nullptr)
 Low-level function for parsing configuration strings; automatically adds the requested keyword to the list of valid ones. More...
 
std::istream & read_config_line (std::istream &is, std::string &line)
 Reads a configuration line, adds it to config_string, and returns the stream. More...
 
template<>
int _get_keyval_scalar_value_ (std::string const &key_str, std::string const &data, bool &value, bool const &)
 
template<>
int _get_keyval_scalar_novalue_ (std::string const &key_str, bool &value, Parse_Mode const &parse_mode)
 
- Public Member Functions inherited from colvarparams
int param_exists (std::string const &param_name)
 Whether the parameter param_name exists.
 
virtual std::vector< std::string > get_param_names ()
 Get a copy of the names of registered parameters.
 
virtual std::vector< std::string > get_param_grad_names ()
 Get a copy of the names of registered parameter gradients.
 
virtual void const * get_param_ptr (std::string const &param_name)
 Pointer to the parameter param_name.
 
virtual void const * get_param_grad_ptr (std::string const &param_name)
 Pointer to the gradient of parameter param_name.
 
virtual cvm::real get_param (std::string const &param_name)
 Value of the parameter param_name (must be a scalar)
 
virtual int set_param (std::string const &param_name, void const *new_value)
 Set the named parameter to the given value. More...
 
- Public Member Functions inherited from colvardeps
int get_time_step_factor () const
 returns time_step_factor
 
void init_feature (int feature_id, const char *description, feature_type type)
 Pair a numerical feature ID with a description and type.
 
bool is_not_set (int id)
 
bool is_dynamic (int id)
 
bool is_static (int id)
 
bool is_user (int id)
 
virtual const std::vector< feature * > & features () const =0
 
virtual std::vector< feature * > & modify_features ()=0
 
void add_child (colvardeps *child)
 
void remove_child (colvardeps *child)
 
void remove_all_children ()
 
bool is_enabled (int f=f_cv_active) const
 
bool is_available (int f=f_cv_active) const
 
void provide (int feature_id, bool truefalse=true)
 
void set_enabled (int feature_id, bool truefalse=true)
 Enable or disable, depending on flag value.
 
int enable (int f, bool dry_run=false, bool toplevel=true)
 
int disable (int f)
 
void free_children_deps ()
 
void restore_children_deps ()
 re-enable children features (to be used when object becomes active)
 
int decr_ref_count (int f)
 
virtual void do_feature_side_effects (int)
 
virtual int init_dependencies ()=0
 Initialize dependency tree for object of a derived class. More...
 
void require_feature_self (int f, int g)
 Make feature f require feature g within the same object.
 
void exclude_feature_self (int f, int g)
 Make features f and g mutually exclusive within the same object.
 
void require_feature_children (int f, int g)
 Make feature f require feature g within children.
 
void require_feature_alt (int f, int g, int h)
 Make feature f require either g or h within the same object.
 
void require_feature_alt (int f, int g, int h, int i)
 Make feature f require any of g, h, or i within the same object.
 
void require_feature_alt (int f, int g, int h, int i, int j)
 Make feature f require any of g, h, i, or j within the same object.
 
void print_state ()
 print all enabled features and those of children, for debugging
 
void check_enabled (int f, std::string const &reason) const
 Check that a feature is enabled, raising COLVARS_BUG_ERROR if not.
 
- Public Member Functions inherited from colvarbias_ti
 colvarbias_ti (char const *key)
 
virtual int init (std::string const &conf)
 Parse config string and (re)initialize. More...
 
virtual int init_grids ()
 
virtual int update ()
 
virtual int update_system_forces (std::vector< colvarvalue > const *subtract_forces)
 
virtual std::string const get_state_params () const
 Write the values of specific mutable properties to a string. More...
 
virtual int set_state_params (std::string const &state_conf)
 Read the values of specific mutable properties from a string. More...
 
virtual std::ostream & write_state_data (std::ostream &os)
 Write all mutable data not already written by get_state_params() to a formatted stream. More...
 
virtual cvm::memory_streamwrite_state_data (cvm::memory_stream &os)
 Write all mutable data not already written by get_state_params() to an unformatted stream. More...
 
virtual std::istream & read_state_data (std::istream &is)
 Read all mutable data not already set by set_state_params() from a formatted stream. More...
 
virtual cvm::memory_streamread_state_data (cvm::memory_stream &is)
 Read all mutable data not already set by set_state_params() from an unformatted stream. More...
 
virtual int write_output_files ()
 Write any output files that this bias may have (e.g. PMF files) More...
 

Public Attributes

Communication comm
 Communication between different replicas.
 
- Public Attributes inherited from colvarbias
std::string name
 Name of this bias.
 
std::string bias_type
 Keyword indicating the type of this bias.
 
std::string state_keyword
 Keyword used in state files (== bias_type most of the time)
 
int rank
 Track how many times a bias of this type was defined.
 
size_t output_freq
 Frequency for writing output files.
 
std::string output_prefix
 Use this prefix for all output files.
 
- Public Attributes inherited from colvardeps
std::string description
 

Protected Member Functions

std::string const hills_traj_file_name () const
 Name of the hill logfile.
 
void recount_hills_off_grid (hill_iter h_first, hill_iter h_last, colvar_grid_scalar *ge)
 Regenerate the hills_off_grid list.
 
template<typename OST >
OST & write_hill_template_ (OST &os, colvarbias_meta::hill const &h)
 
std::ostream & write_hill (std::ostream &os, hill const &h)
 Write a hill to a formatted stream.
 
cvm::memory_streamwrite_hill (cvm::memory_stream &os, hill const &h)
 Write a hill to an unformatted stream.
 
template<typename IST >
IST & read_hill_template_ (IST &is)
 
std::istream & read_hill (std::istream &is)
 Read a new hill from a formatted stream.
 
cvm::memory_streamread_hill (cvm::memory_stream &is)
 Read a new hill from an unformatted stream.
 
std::list< hill >::const_iterator add_hill (hill const &h)
 Add a new hill; if a .hills trajectory is written, write it there; if there is more than one replica, communicate it to the others.
 
std::list< hill >::const_iterator delete_hill (hill_iter &h)
 Remove a previously saved hill (returns an iterator for the next hill in the list)
 
virtual void calc_hills (hill_iter h_first, hill_iter h_last, cvm::real &energy, std::vector< colvarvalue > const *values)
 Calculate the values of the hills, incrementing bias_energy.
 
virtual void calc_hills_force (size_t const &i, hill_iter h_first, hill_iter h_last, std::vector< colvarvalue > &forces, std::vector< colvarvalue > const *values)
 Calculate the forces acting on the i-th colvar, incrementing colvar_forces[i]; must be called after calc_hills each time the values of the colvars are changed.
 
void project_hills (hill_iter h_first, hill_iter h_last, colvar_grid_scalar *ge, colvar_grid_gradient *gf, bool print_progress=false)
 Project the selected hills onto grids.
 
virtual int update_replicas_registry ()
 Read the existing replicas on registry.
 
virtual int read_replica_files ()
 Read new data from replicas' files.
 
virtual int write_replica_state_file ()
 Write full state information to be read by other replicas.
 
virtual int reopen_replica_buffer_file ()
 Call this after write_replica_state_file()
 
- Protected Member Functions inherited from colvarparse
bool get_key_string_value (std::string const &conf, char const *key, std::string &data)
 Get the string value of a keyword, and save it for later parsing.
 
bool get_key_string_multi_value (std::string const &conf, char const *key, std::vector< std::string > &data)
 Get multiple strings from repeated instances of a same keyword.
 
template<typename TYPE >
bool _get_keyval_scalar_ (std::string const &conf, char const *key, TYPE &value, TYPE const &def_value, Parse_Mode const &parse_mode)
 Template for single-value keyword parsers.
 
template<typename TYPE >
bool _get_keyval_vector_ (std::string const &conf, char const *key, std::vector< TYPE > &values, std::vector< TYPE > const &def_values, Parse_Mode const &parse_mode)
 Template for multiple-value keyword parsers.
 
template<typename TYPE >
int _get_keyval_scalar_value_ (std::string const &key_str, std::string const &data, TYPE &value, TYPE const &def_value)
 Extract the value of a variable from a string.
 
template<typename TYPE >
int _get_keyval_scalar_novalue_ (std::string const &key_str, TYPE &value, Parse_Mode const &parse_mode)
 Handle the case where the user provides a keyword without value.
 
template<typename TYPE >
void mark_key_set_user (std::string const &key_str, TYPE const &value, Parse_Mode const &parse_mode)
 Record that the keyword has just been user-defined.
 
template<typename TYPE >
void mark_key_set_default (std::string const &key_str, TYPE const &def_value, Parse_Mode const &parse_mode)
 Record that the keyword has just been set to its default value.
 
void error_key_required (std::string const &key_str, Parse_Mode const &parse_mode)
 Raise error condition due to the keyword being required!
 
bool key_already_set (std::string const &key_str)
 True if the keyword has been set already.
 
void add_keyword (char const *key)
 Add a new valid keyword to the list.
 
void strip_values (std::string &conf)
 Remove all the values from the config string.
 
- Protected Member Functions inherited from colvarparams
 colvarparams ()
 Default constructor.
 
virtual ~colvarparams ()
 Default destructor.
 
void register_param (std::string const &param_name, void *param_ptr)
 Register the given parameter.
 
void register_param_grad (std::string const &param_name, colvarvalue *param_grad_ptr)
 Register the gradient of the given parameter.
 
- Protected Member Functions inherited from colvardeps
bool get_keyval_feature (colvarparse *cvp, std::string const &conf, char const *key, int feature_id, bool const &def_value, colvarparse::Parse_Mode const parse_mode=colvarparse::parse_normal)
 Parse a keyword and enable a feature accordingly.
 

Protected Attributes

cvm::real hill_width
 
std::vector< cvm::realcolvar_sigmas
 The sigma parameters of the Gaussian hills.
 
size_t new_hill_freq
 Number of simulation steps between two hills.
 
bool b_hills_traj
 Write the hill logfile.
 
std::list< hillhills
 List of hills used on this bias (total); if a grid is employed, these don't need to be updated at every time step.
 
hill_iter new_hills_begin
 Iterator to the first of the "newest" hills (when using grids, those who haven't been mapped yet)
 
std::list< hillhills_off_grid
 List of hills used on this bias that are on the boundary edges; these are updated regardless of whether hills are used.
 
hill_iter new_hills_off_grid_begin
 Same as new_hills_begin, but for the off-grid ones.
 
cvm::real hill_weight
 Height of new hills.
 
bool use_grids
 Bin the hills on grids of energy and forces, and use them to force the colvars (as opposed to deriving the hills analytically)
 
bool rebin_grids
 Rebin the hills upon restarting.
 
bool expand_grids
 Should the grids be expanded if necessary?
 
size_t grids_freq
 How often the hills should be projected onto the grids.
 
bool keep_hills
 Keep hills in the restart file (e.g. to accurately rebin later)
 
bool restart_keep_hills
 value of keepHills saved in the most recent restart file
 
bool dump_fes
 Dump the free energy surface (.pmf file) every restartFrequency.
 
bool dump_replica_fes
 Dump the free energy surface (.pmf file) every restartFrequency using only the hills from this replica (only applicable to more than one replica)
 
bool dump_fes_save
 Dump the free energy surface files at different time steps, appending the step number to each file.
 
bool well_tempered
 Whether to use well-tempered metadynamics.
 
cvm::real bias_temperature
 Biasing temperature in well-tempered metadynamics.
 
bool ebmeta
 Ensemble-biased metadynamics (EBmeta) flag.
 
colvar_grid_scalartarget_dist
 Target distribution for EBmeta.
 
cvm::step_number ebmeta_equil_steps
 Number of equilibration steps for EBmeta.
 
bool safely_read_restart
 Try to read the restart information by allocating new grids before replacing the current ones (used e.g. in multiple_replicas)
 
colvar_grid_scalarhills_energy
 Hill energy, cached on a grid.
 
colvar_grid_gradienthills_energy_gradients
 Hill forces, cached on a grid.
 
std::string replica_id
 Identifier for this replica.
 
std::string replica_file_name
 File containing the paths to the output files from this replica.
 
std::vector< colvarbias_meta * > replicas
 Additional, "mirror" metadynamics biases, to collect info from the other replicas. More...
 
size_t replica_update_freq = 0
 Frequency at which data the "mirror" biases are updated.
 
std::string replicas_registry_file
 
std::string replicas_registry
 List of replicas (and their output list files)
 
std::string replica_list_file
 List of files written by this replica.
 
std::string replica_state_file
 
bool replica_state_file_in_sync
 Whether a mirror bias has read the latest version of its state file.
 
size_t update_status
 
std::string replica_hills_file
 
std::streampos replica_hills_file_pos
 Position within replica_hills_file (when reading it)
 
std::ostringstream hills_traj_os_buf
 Cache of the hills trajectory.
 
- Protected Attributes inherited from colvarbias
std::vector< colvar * > colvars
 Pointers to collective variables to which the bias is applied; current values and metric functions will be obtained through each colvar object.
 
std::vector< colvarvaluecolvar_values
 Up to date value of each colvar.
 
std::vector< colvarvaluecolvar_forces
 Current forces from this bias to the variables.
 
std::vector< colvarvalueprevious_colvar_forces
 Forces last applied by this bias to the variables.
 
cvm::real bias_energy
 Current energy of this bias (colvar_forces should be obtained by deriving this)
 
bool b_output_energy
 Whether to write the current bias energy from this bias to the trajectory file.
 
bool has_data
 Whether this bias has already accumulated information (for history-dependent biases)
 
cvm::step_number state_file_step
 Step number read from the last state file.
 
bool matching_state
 Flag used to tell if the state string being read is for this bias.
 
colvar_grid_scalarbiasing_force_scaling_factors
 The biasing forces will be scaled by the factor in this grid if b_bias_force_scaled is true.
 
std::vector< int > biasing_force_scaling_factors_bin
 
- Protected Attributes inherited from colvarparse
std::string const keyword_delimiters_left
 Characters allowed immediately to the left of a kewyord.
 
std::string const keyword_delimiters_right
 Characters allowed immediately to the right of a kewyord.
 
std::list< std::string > allowed_keywords
 List of legal keywords for this object: this is updated by each call to colvarparse::get_keyval() or colvarparse::key_lookup()
 
std::map< std::string, key_set_modekey_set_modes
 Track which keywords have been already set, and how.
 
std::list< size_t > data_begin_pos
 List of delimiters for the values of each keyword in the configuration string; all keywords will be stripped of their values before the keyword check is performed.
 
std::list< size_t > data_end_pos
 List of delimiters for the values of each keyword in the configuration string; all keywords will be stripped of their values before the keyword check is performed.
 
std::string config_string
 Configuration string of the object (includes comments)
 
- Protected Attributes inherited from colvarparams
std::map< std::string, void const * > param_map
 Pointers to relevant parameters that may be accessed by other objects.
 
std::map< std::string, colvarvalue const * > param_grad_map
 Derivatives of the object with respect to internal parameters.
 
- Protected Attributes inherited from colvardeps
int time_step_factor
 
std::vector< feature_statefeature_states
 List of the states of all features.
 
- Protected Attributes inherited from colvarbias_ti
std::vector< colvarvalueti_system_forces
 Forces exerted from the system to the associated variables.
 
std::shared_ptr< colvar_grid_gradientti_avg_forces
 Averaged system forces.
 
std::shared_ptr< colvar_grid_countti_count
 Histogram of sampled data.
 
std::vector< int > ti_bin
 

Private Member Functions

template<typename IST , typename GT >
IST & read_grid_data_template_ (IST &is, std::string const &key, GT *grid, GT *backup_grid)
 
template<typename IST >
IST & read_state_data_template_ (IST &is)
 
template<typename OST >
OST & write_state_data_template_ (OST &os)
 

Additional Inherited Members

- Static Public Member Functions inherited from colvarbias
static void delete_features ()
 
- Static Public Member Functions inherited from colvarparse
static std::string to_lower_cppstr (std::string const &in)
 Return a lowercased copy of the string.
 
static std::istream & getline_nocomments (std::istream &is, std::string &s)
 Works as std::getline() but also removes everything between a comment character and the following newline.
 
static int check_braces (std::string const &conf, size_t const start_pos)
 Check if the content of a config string has matching braces. More...
 
static int check_ascii (std::string const &conf)
 Check that a config string contains non-ASCII characters. More...
 
static void split_string (const std::string &data, const std::string &delim, std::vector< std::string > &dest)
 Split a string with a specified delimiter into a vector. More...
 
- Static Public Attributes inherited from colvarbias
static std::vector< feature * > cvb_features
 Implementation of the feature list for colvarbias.
 
- Static Public Attributes inherited from colvarparse
static const char *const white_space = " \t"
 Accepted white space delimiters, used in key_lookup()
 
- Protected Types inherited from colvarparse
enum  key_set_mode { key_not_set = 0 , key_set_user = 1 , key_set_default = 2 }
 How a keyword has been set.
 
- Protected Types inherited from colvardeps
enum  feature_type { f_type_not_set , f_type_dynamic , f_type_user , f_type_static }
 Enum of possible feature types.
 

Detailed Description

Metadynamics bias (implementation of colvarbias)

Member Enumeration Documentation

◆ Communication

Communication between different replicas.

Enumerator
single_replica 

One replica (default)

multiple_replicas 

Hills added concurrently by several replicas.

Member Function Documentation

◆ calc_energy()

int colvarbias_meta::calc_energy ( std::vector< colvarvalue > const *  values)
virtual

Compute the energy of the bias Uses the vector of colvar values provided if not NULL, and the values currently cached in the bias instance otherwise

Reimplemented from colvarbias.

◆ calc_forces()

int colvarbias_meta::calc_forces ( std::vector< colvarvalue > const *  values)
virtual

Compute the forces due to the bias Uses the vector of colvar values provided if not NULL, and the values currently cached in the bias instance otherwise

Reimplemented from colvarbias.

◆ clear_state_data()

int colvarbias_meta::clear_state_data ( )
virtual

Delete only the allocatable data (save memory)

Reimplemented from colvarbias.

◆ get_state_params()

std::string const colvarbias_meta::get_state_params ( ) const
virtual

Write the values of specific mutable properties to a string.

Reimplemented from colvarbias.

◆ init()

int colvarbias_meta::init ( std::string const &  conf)
virtual

Parse config string and (re)initialize.

Reimplemented from colvarbias.

◆ read_state_data() [1/2]

cvm::memory_stream & colvarbias_meta::read_state_data ( cvm::memory_stream is)
virtual

Read all mutable data not already set by set_state_params() from an unformatted stream.

Reimplemented from colvarbias.

◆ read_state_data() [2/2]

std::istream & colvarbias_meta::read_state_data ( std::istream &  is)
virtual

Read all mutable data not already set by set_state_params() from a formatted stream.

Reimplemented from colvarbias.

◆ replica_share()

int colvarbias_meta::replica_share ( )
virtual

Reimplemented from colvarbias.

◆ replica_share_freq()

size_t colvarbias_meta::replica_share_freq ( ) const
virtual

Report the frequency at which this bias needs to communicate with replicas.

Reimplemented from colvarbias.

◆ set_state_params()

int colvarbias_meta::set_state_params ( std::string const &  state_conf)
virtual

Read the values of specific mutable properties from a string.

Reimplemented from colvarbias.

◆ setup_output()

int colvarbias_meta::setup_output ( )
virtual

(Re)initialize the output files (does not write them yet)

Reimplemented from colvarbias.

◆ update()

int colvarbias_meta::update ( )
virtual

Retrieve colvar values and calculate their biasing forces Some implementations may use calc_energy() and calc_forces()

Reimplemented from colvarbias.

◆ write_output_files()

int colvarbias_meta::write_output_files ( )
virtual

Write any output files that this bias may have (e.g. PMF files)

Reimplemented from colvarbias.

◆ write_state_data() [1/2]

cvm::memory_stream & colvarbias_meta::write_state_data ( cvm::memory_stream os)
virtual

Write all mutable data not already written by get_state_params() to an unformatted stream.

Reimplemented from colvarbias.

◆ write_state_data() [2/2]

std::ostream & colvarbias_meta::write_state_data ( std::ostream &  os)
virtual

Write all mutable data not already written by get_state_params() to a formatted stream.

Reimplemented from colvarbias.

◆ write_state_to_replicas()

int colvarbias_meta::write_state_to_replicas ( )
virtual

If this bias is communicating with other replicas through files, send it to them.

Reimplemented from colvarbias.

Member Data Documentation

◆ hill_width

cvm::real colvarbias_meta::hill_width
protected

Width of a hill in number of grid points

The local width of each collective variable, multiplied by this number, provides the hill width along that direction

◆ replica_hills_file

std::string colvarbias_meta::replica_hills_file
protected

Explicit hills communicated between replicas

This file becomes empty after replica_state_file is rewritten

◆ replica_state_file

std::string colvarbias_meta::replica_state_file
protected

Hills energy and gradients written specifically for other replica (in addition to its own restart file)

◆ replicas

std::vector<colvarbias_meta *> colvarbias_meta::replicas
protected

Additional, "mirror" metadynamics biases, to collect info from the other replicas.

These are supposed to be synchronized by reading data from the other replicas, and not be modified by the "local" replica

◆ replicas_registry_file

std::string colvarbias_meta::replicas_registry_file
protected

List of replicas (and their output list files): contents are copied into replicas_registry for convenience

◆ update_status

size_t colvarbias_meta::update_status
protected

If there was a failure reading one of the files (because they are not complete), this counter is incremented


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