Collective Variables Module - Developer Documentation
Public Member Functions | Protected Member Functions | List of all members
colvarbias_restraint_harmonic Class Reference

Harmonic bias restraint (implementation of colvarbias_restraint) More...

#include <colvarbias_restraint.h>

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

Public Member Functions

 colvarbias_restraint_harmonic (char const *key)
 
virtual int init (std::string const &conf)
 Parse config string and (re)initialize.
 
virtual int update ()
 
virtual std::string const get_state_params () const
 
virtual int set_state_params (std::string const &conf)
 
virtual std::ostream & write_state_data (std::ostream &os)
 Write all mutable data not already written by get_state_params()
 
virtual std::istream & read_state_data (std::istream &os)
 Read all mutable data not already set by set_state_params()
 
virtual std::ostream & write_traj_label (std::ostream &os)
 Write a label to the trajectory file (comment line)
 
virtual std::ostream & write_traj (std::ostream &os)
 Output quantities such as the bias energy to the trajectory file.
 
virtual int change_configuration (std::string const &conf)
 Load new configuration - force constant and/or centers only.
 
virtual cvm::real energy_difference (std::string const &conf)
 Calculate change in energy from using alternate configuration.
 
- Public Member Functions inherited from colvarbias_restraint_centers_moving
 colvarbias_restraint_centers_moving (char const *key)
 
- Public Member Functions inherited from colvarbias_restraint_centers
 colvarbias_restraint_centers (char const *key)
 
- Public Member Functions inherited from colvarbias_restraint
virtual std::ostream & write_state (std::ostream &os)
 Write the bias configuration to a restart file or other stream.
 
virtual std::istream & read_state (std::istream &is)
 Read the bias configuration from a restart file or other stream.
 
 colvarbias_restraint (char const *key)
 Constructor.
 
- 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 calc_energy (std::vector< colvarvalue > const &values=std::vector< colvarvalue >(0))
 Compute the energy of the bias with alternative values of the collective variables (suitable for bias exchange)
 
virtual void communicate_forces ()
 Send forces to the collective variables.
 
virtual int bin_num ()
 Give the total number of bins for a given bias.
 
virtual int current_bin ()
 Calculate the bin index for a given bias.
 
virtual int bin_count (int bin_index)
 
virtual int replica_share ()
 
virtual void analyze ()
 Perform analysis tasks.
 
 colvarbias (char const *key)
 Constructor.
 
virtual int reset ()
 Set to zero all mutable data.
 
virtual int clear ()
 Delete everything.
 
virtual ~colvarbias ()
 Destructor.
 
std::istream & read_state_data_key (std::istream &is, char const *key)
 Read a keyword from the state data (typically a header)
 
virtual int setup_output ()
 (Re)initialize the output files (does not write them yet)
 
virtual int write_state_to_replicas ()
 If this bias is communicating with other replicas through files, send it to them.
 
cvm::real get_energy ()
 
virtual const std::vector< feature * > & features ()
 Implementation of the feature list accessor for colvarbias.
 
virtual std::vector< feature * > & modify_features ()
 
- Public Member Functions inherited from colvarparse
 colvarparse (const std::string &conf)
 Constructor that stores the object's config string.
 
void init ()
 Set the object ready to parse a new configuration string.
 
void init (const std::string &conf)
 Set a new config string for this object.
 
const std::string & get_config ()
 
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=(int) 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=(size_t) 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, 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=(cvm::real) 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,(int) 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,(size_t) 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,(long) 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,(cvm::real) 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=NULL, size_t *save_pos=NULL)
 Low-level function for parsing configuration strings; automatically adds the requested keyword to the list of valid ones. More...
 
bool brace_check (std::string const &conf, size_t const start_pos=0)
 Check if the content of the file has matching braces.
 
- 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=f_type_not_set)
 Pair a numerical feature ID with a description and type.
 
bool is_dynamic (int id)
 
bool is_static (int id)
 
bool is_user (int id)
 
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 id)
 
void init_cvb_requires ()
 
void init_cv_requires ()
 
void init_cvc_requires ()
 
void init_ag_requires ()
 
void print_state ()
 print all enabled features and those of children, for debugging
 
- Public Member Functions inherited from colvarbias_ti
 colvarbias_ti (char const *key)
 
virtual int clear_state_data ()
 Delete only the allocatable data (save memory)
 
virtual int init_grids ()
 
virtual int update_system_forces (std::vector< colvarvalue > const *subtract_forces)
 
virtual int write_output_files ()
 Write any output files that this bias may have (e.g. PMF files)
 
- Public Member Functions inherited from colvarbias_restraint_moving
 colvarbias_restraint_moving (char const *key)
 
- Public Member Functions inherited from colvarbias_restraint_k_moving
 colvarbias_restraint_k_moving (char const *key)
 
- Public Member Functions inherited from colvarbias_restraint_k
 colvarbias_restraint_k (char const *key)
 

Protected Member Functions

virtual cvm::real restraint_potential (size_t i) const
 Potential function for the i-th colvar.
 
virtual colvarvalue const restraint_force (size_t i) const
 Force function for the i-th colvar.
 
virtual cvm::real d_restraint_potential_dk (size_t i) const
 Derivative of the potential function with respect to the force constant.
 
- Protected Member Functions inherited from colvarbias_restraint_centers_moving
virtual int update_centers (cvm::real lambda)
 Update the centers by interpolating between initial and target.
 
int update_acc_work ()
 Update the accumulated work.
 
- Protected Member Functions inherited from colvarparse
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)
 
bool _get_keyval_scalar_string_ (std::string const &conf, char const *key, std::string &value, std::string const &def_value, Parse_Mode const parse_mode)
 
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)
 
- 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.
 

Additional Inherited Members

- Public Types inherited from colvarparse
enum  Parse_Mode { parse_normal, parse_silent }
 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_apply_force, f_cvb_get_total_force,
  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_ntot
}
 
enum  features_colvar {
  f_cv_active, f_cv_awake, f_cv_gradient, f_cv_collect_gradient,
  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_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_grid,
  f_cv_runave, f_cv_corrfunc, f_cv_scripted, f_cv_custom_function,
  f_cv_periodic, 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_gradient, f_cvc_implicit_gradient,
  f_cvc_inv_gradient, f_cvc_debug_gradient, f_cvc_Jacobian, f_cvc_pbc_minimum_image,
  f_cvc_one_site_total_force, f_cvc_com_based, f_cvc_scalable, f_cvc_scalable_com,
  f_cvc_ntot
}
 
enum  features_atomgroup {
  f_ag_active, f_ag_center, f_ag_rotate, f_ag_fitting_group,
  f_ag_implicit_gradient, f_ag_fit_gradients, f_ag_atom_forces, f_ag_scalable,
  f_ag_scalable_com, f_ag_ntot
}
 
- 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.
 
- Public Attributes inherited from colvarbias
std::string name
 Name of this bias.
 
std::string bias_type
 Type of this bias.
 
int rank
 If there is more than one bias of this type, record its rank.
 
std::string output_prefix
 Use this prefix for all output files.
 
- Public Attributes inherited from colvardeps
std::string description
 
- 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 Attributes inherited from colvarbias_restraint_centers_moving
std::vector< colvarvaluetarget_centers
 New restraint centers.
 
std::vector< colvarvalueinitial_centers
 Initial value of the restraint centers.
 
std::vector< colvarvaluecenters_incr
 Amplitude of the restraint centers' increment at each step towards the new values (calculated from target_nsteps)
 
bool b_output_centers
 Whether to write the current restraint centers to the trajectory file.
 
bool b_output_acc_work
 Whether to write the current accumulated work to the trajectory file.
 
cvm::real acc_work
 Accumulated work.
 
- Protected Attributes inherited from colvarbias_restraint_centers
std::vector< colvarvaluecolvar_centers
 Restraint centers.
 
- 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_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)
 
size_t state_file_step
 Step number read from the last state file.
 
- Protected Attributes inherited from colvardeps
int time_step_factor
 
- Protected Attributes inherited from colvarbias_ti
std::vector< colvarvalueti_system_forces
 Forces exerted from the system to the associated variables.
 
colvar_grid_gradientti_avg_forces
 Averaged system forces.
 
colvar_grid_countti_count
 Histogram of sampled data.
 
std::vector< int > ti_bin
 
- Protected Attributes inherited from colvarbias_restraint_moving
bool b_chg_centers
 Moving target?
 
bool b_chg_force_k
 Changing force constant?
 
int target_nstages
 Number of stages over which to perform the change If zero, perform a continuous change.
 
int stage
 Number of current stage of the perturbation.
 
std::vector< cvm::reallambda_schedule
 Lambda-schedule for custom varying force constant.
 
long target_nsteps
 Number of steps required to reach the target force constant or restraint centers.
 
- Protected Attributes inherited from colvarbias_restraint_k_moving
cvm::real target_force_k
 Restraint force constant (target value)
 
cvm::real starting_force_k
 Restraint force constant (starting value)
 
cvm::real force_k_exp
 Exponent for varying the force constant.
 
cvm::real restraint_FE
 Intermediate quantity to compute the restraint free energy (in TI, would be the accumulating FE derivative)
 
cvm::real target_equil_steps
 Equilibration steps for restraint FE calculation through TI.
 
- Protected Attributes inherited from colvarbias_restraint_k
cvm::real force_k
 Restraint force constant.
 

Detailed Description

Harmonic bias restraint (implementation of colvarbias_restraint)


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