Collective Variables Module - Developer Documentation
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
colvar Class Reference

A collective variable (main class); to be defined, it needs at least one object of a derived class of colvar::cvc; it calculates and returns a colvarvalue object. More...

#include <colvar.h>

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

Classes

class  alpha_angles
 Colvar component: alpha helix content of a contiguous segment of 5 or more residues, implemented as a sum of phi/psi dihedral angles and hydrogen bonds (colvarvalue::type_scalar type, range [0:1]) More...
 
class  angle
 Colvar component: angle between the centers of mass of three groups (colvarvalue::type_scalar type, range [0:PI]) More...
 
class  cartesian
 
class  coordnum
 Colvar component: coordination number between two groups (colvarvalue::type_scalar type, range [0:N1*N2]) More...
 
class  cvc
 Colvar component (base class); most implementations of cvc utilize one or more colvarmodule::atom or colvarmodule::atom_group objects to access atoms. More...
 
class  dihedPC
 Colvar component: dihedPC Projection of the config onto a dihedral principal component See e.g. Altis et al., J. Chem. Phys 126, 244111 (2007) Based on a set of 'dihedral' cvcs. More...
 
class  dihedral
 Colvar component: dihedral between the centers of mass of four groups (colvarvalue::type_scalar type, range [-PI:PI]) More...
 
class  dipole_angle
 Colvar component: angle between the dipole of a molecule and an axis formed by two groups of atoms(colvarvalue::type_scalar type, range [0:PI]) More...
 
class  distance
 Colvar component: distance between the centers of mass of two groups (colvarvalue::type_scalar type, range [0:*)) More...
 
class  distance_dir
 Colvar component: distance unit vector (direction) between centers of mass of two groups (colvarvalue::type_unit3vector type, range [-1:1]x[-1:1]x[-1:1]) More...
 
class  distance_inv
 Colvar component: average distance between two groups of atoms, weighted as the sixth power, as in NMR refinements(colvarvalue::type_scalar type, range (0:*)) More...
 
class  distance_pairs
 Colvar component: N1xN2 vector of pairwise distances (colvarvalue::type_vector type, range (0:*) for each component) More...
 
class  distance_vec
 
class  distance_xy
 Colvar component: projection of the distance vector on a plane (colvarvalue::type_scalar type, range [0:*)) More...
 
class  distance_z
 Colvar component: projection of the distance vector along an axis(colvarvalue::type_scalar type, range (-*:*)) More...
 
class  eigenvector
 Colvar component: projection of 3N coordinates onto an eigenvector(colvarvalue::type_scalar type, range (-*:*)) More...
 
class  groupcoordnum
 Colvar component: coordination number between two groups (colvarvalue::type_scalar type, range [0:N1*N2]) More...
 
class  gyration
 Colvar component: Radius of gyration of an atom group (colvarvalue::type_scalar type, range [0:*)) More...
 
class  h_bond
 Colvar component: hydrogen bond, defined as the product of a colvar::coordnum and 1/2*(1-cos((180-ang)/ang_tol)) (colvarvalue::type_scalar type, range [0:1]) More...
 
class  inertia
 Colvar component: moment of inertia of an atom group (colvarvalue::type_scalar type, range [0:*)) More...
 
class  inertia_z
 Colvar component: moment of inertia of an atom group around a user-defined axis (colvarvalue::type_scalar type, range [0:*)) More...
 
class  orientation
 Colvar component: orientation in space of an atom group, with respect to a set of reference coordinates (colvarvalue::type_quaternion type, range [-1:1]x[-1:1]x[-1:1]x[-1:1]) More...
 
class  orientation_angle
 Colvar component: angle of rotation with respect to a set of reference coordinates (colvarvalue::type_scalar type, range [0:PI)) More...
 
class  orientation_proj
 Colvar component: cosine of the angle of rotation with respect to a set of reference coordinates (colvarvalue::type_scalar type, range [-1:1]) More...
 
class  rmsd
 Colvar component: root mean square deviation (RMSD) of a group with respect to a set of reference coordinates; uses colvar::orientation to calculate the rotation matrix (colvarvalue::type_scalar type, range [0:*)) More...
 
class  selfcoordnum
 Colvar component: self-coordination number within a group (colvarvalue::type_scalar type, range [0:N*(N-1)/2]) More...
 
class  spin_angle
 Colvar component: angle of rotation around a predefined axis (colvarvalue::type_scalar type, range [-PI:PI]) More...
 
class  tilt
 Colvar component: projection of the orientation vector onto a predefined axis (colvarvalue::type_scalar type, range [-1:1]) More...
 

Public Member Functions

colvarvalue const & value () const
 Current value (previously set by calc() or by read_traj())
 
colvarvalue const & actual_value () const
 Current actual value (not extended DOF)
 
colvarvalue const & velocity () const
 Current velocity (previously set by calc() or by read_traj())
 
colvarvalue const & total_force () const
 Current total force (previously obtained from calc() or read_traj()). Note: this is calculated using the atomic forces from the last simulation step. More...
 
std::vector< feature * > & features ()
 Implementation of the feature list accessor for colvar.
 
int refresh_deps ()
 
bool periodic_boundaries () const
 Is the interval defined by the two boundaries periodic?
 
bool periodic_boundaries (colvarvalue const &lb, colvarvalue const &ub) const
 Is the interval defined by the two boundaries periodic?
 
 colvar ()
 Constructor.
 
int init (std::string const &conf)
 Main init function.
 
int init_components (std::string const &conf)
 Parse the CVC configuration and allocate their data.
 
int init_grid_parameters (std::string const &conf)
 Init defaults for grid options.
 
int init_extended_Lagrangian (std::string const &conf)
 Init extended Lagrangian parameters.
 
int init_output_flags (std::string const &conf)
 Init output flags.
 
void setup ()
 Get ready for a run and re-initialize internal data if needed.
 
 ~colvar ()
 Destructor.
 
int calc ()
 Calculate the colvar's value and related quantities.
 
int calc_cvcs (int first=0, size_t num_cvcs=0)
 Calculate a subset of the colvar components (CVCs) currently active (default: all active CVCs) Note: both arguments refer to the sect of active CVCs, not all CVCs.
 
int check_cvc_range (int first_cvc, size_t num_cvcs)
 Ensure that the selected range of CVCs is consistent.
 
int calc_cvc_values (int first, size_t num_cvcs)
 Calculate the values of the given subset of CVCs.
 
int calc_cvc_gradients (int first, size_t num_cvcs)
 Same as colvar::calc_cvc_values but for gradients.
 
int calc_cvc_total_force (int first, size_t num_cvcs)
 Same as colvar::calc_cvc_values but for total forces.
 
int calc_cvc_Jacobians (int first, size_t num_cvcs)
 Same as colvar::calc_cvc_values but for Jacobian derivatives/forces.
 
int collect_cvc_data ()
 Collect quantities from CVCs and update aggregated data for the colvar.
 
int collect_cvc_values ()
 Collect the values of the CVCs.
 
int collect_cvc_gradients ()
 Same as colvar::collect_cvc_values but for gradients.
 
int collect_cvc_total_forces ()
 Same as colvar::collect_cvc_values but for total forces.
 
int collect_cvc_Jacobians ()
 Same as colvar::collect_cvc_values but for Jacobian derivatives/forces.
 
int calc_colvar_properties ()
 Calculate the quantities associated to the colvar (but not to the CVCs)
 
colvarvalue const applied_force () const
 Get the current applied force.
 
void reset_bias_force ()
 Set the total biasing force to zero.
 
void add_bias_force (colvarvalue const &force)
 Add to the total force from biases.
 
void add_bias_force_actual_value (colvarvalue const &force)
 Apply a force to the actual value (only meaningful with extended Lagrangian)
 
cvm::real update_forces_energy ()
 Collect all forces on this colvar, integrate internal equations of motion of internal degrees of freedom; see also colvar::communicate_forces() return colvar energy if extended Lagrandian active.
 
void communicate_forces ()
 Communicate forces (previously calculated in colvar::update()) to the external degrees of freedom.
 
int set_cvc_flags (std::vector< bool > const &flags)
 Enables and disables individual CVCs based on flags.
 
int update_cvc_flags ()
 Updates the flags in the CVC objects, and their number.
 
size_t num_active_cvcs () const
 Return the number of CVC objects with an active flag (as set by update_cvc_flags)
 
int get_time_step_factor () const
 returns time_step_factor
 
cvm::real dist2 (colvarvalue const &x1, colvarvalue const &x2) const
 Use the internal metrics (as from cvc objects) to calculate square distances and gradients. More...
 
colvarvalue dist2_lgrad (colvarvalue const &x1, colvarvalue const &x2) const
 Use the internal metrics (as from cvc objects) to calculate square distances and gradients. More...
 
colvarvalue dist2_rgrad (colvarvalue const &x1, colvarvalue const &x2) const
 Use the internal metrics (as from cvc objects) to calculate square distances and gradients. More...
 
void wrap (colvarvalue &x) const
 Use the internal metrics (as from cvc objects) to wrap a value into a standard interval. More...
 
int parse_analysis (std::string const &conf)
 Read the analysis tasks.
 
void analyze ()
 Perform analysis tasks.
 
std::istream & read_traj (std::istream &is)
 Read the value from a collective variable trajectory file.
 
std::ostream & write_traj (std::ostream &os)
 Output formatted values to the trajectory file.
 
std::ostream & write_traj_label (std::ostream &os)
 Write a label to the trajectory file (comment line)
 
std::istream & read_restart (std::istream &is)
 Read the collective variable from a restart file.
 
std::ostream & write_restart (std::ostream &os)
 Write the collective variable to a restart file.
 
int write_output_files ()
 Write output files (if defined, e.g. in analysis mode)
 
size_t n_components () const
 
- 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=dummy_string, size_t &save_pos=dummy_pos)
 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
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)
 
int enable (int f, bool dry_run=false, bool toplevel=true)
 
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 Attributes

std::string name
 Name.
 
cvm::real width
 Typical fluctuation amplitude for this collective variable (e.g. local width of a free energy basin) More...
 
std::vector< colvarbias * > biases
 List of biases that depend on this colvar.
 
colvarvalue fb
 Bias force; reset_bias_force() should be called before the biases are updated.
 
colvarvalue fb_actual
 Bias force to the actual value (only useful with extended Lagrangian)
 
colvarvalue f
 Total applied force; fr (if extended_lagrangian is defined), fb (if biases are applied) and the walls' forces (if defined) contribute to it.
 
colvarvalue f_old
 Applied force at the previous step (to be subtracted from total force if needed)
 
colvarvalue ft
 Total force, as derived from the atomic trajectory; should equal the system force plus f.
 
cvm::real period
 Period, if this variable is periodic.
 
bool expand_boundaries
 Expand the boundaries of multiples of width, to keep the value always within range.
 
colvarvalue lower_boundary
 Location of the lower boundary.
 
colvarvalue lower_wall
 Location of the lower wall.
 
cvm::real lower_wall_k
 Force constant for the lower boundary potential (|x-xb|^2)
 
bool hard_lower_boundary
 Whether this colvar has a hard lower boundary.
 
colvarvalue upper_boundary
 Location of the upper boundary.
 
colvarvalue upper_wall
 Location of the upper wall.
 
cvm::real upper_wall_k
 Force constant for the upper boundary potential (|x-xb|^2)
 
bool hard_upper_boundary
 Whether this colvar has a hard upper boundary.
 
std::vector< int > atom_ids
 Sorted array of (zero-based) IDs for all atoms involved.
 
std::vector< cvm::rvectoratomic_gradients
 Array of atomic gradients collected from all cvcs with appropriate components, rotations etc. For scalar variables only!
 
- Public Attributes inherited from colvardeps
std::string description
 

Static Public Attributes

static std::vector< feature * > cv_features
 Implementation of the feature list for colvar.
 
- Static Public Attributes inherited from colvarparse
static std::string const white_space = " \t"
 Accepted white space delimiters, used in key_lookup()
 
static std::string dummy_string = ""
 Used as a default argument by key_lookup.
 
static size_t dummy_pos = 0
 Used as a default argument by key_lookup.
 

Protected Types

enum  acf_type_e { acf_notset, acf_vel, acf_coor, acf_p2coor }
 Type of autocorrelation function (ACF) More...
 

Protected Member Functions

colvarvalue fdiff_velocity (colvarvalue const &xold, colvarvalue const &xnew)
 
int calc_vel_acf (std::list< colvarvalue > &v_history, colvarvalue const &v)
 Velocity ACF, scalar product between v(0) and v(t)
 
void calc_coor_acf (std::list< colvarvalue > &x_history, colvarvalue const &x)
 Coordinate ACF, scalar product between x(0) and x(t) (does not work with scalar numbers)
 
void calc_p2coor_acf (std::list< colvarvalue > &x_history, colvarvalue const &x)
 Coordinate ACF, second order Legendre polynomial between x(0) and x(t) (does not work with scalar numbers)
 
int calc_acf ()
 Calculate the auto-correlation function (ACF)
 
void write_acf (std::ostream &os)
 Save the ACF to a file.
 
void calc_runave ()
 Calculate the running average and its standard deviation.
 
void build_atom_list (void)
 Initialize the sorted list of atom IDs for atoms involved in all cvcs (called when enabling f_cv_collect_gradients)
 
- Protected Member Functions inherited from colvarparse
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.
 
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.
 

Protected Attributes

colvarvalue x
 Value of the colvar.
 
colvarvalue x_reported
 Cached reported value (x may be manipulated)
 
colvarvalue v_fdiff
 Finite-difference velocity.
 
colvarvalue v_reported
 Cached reported velocity.
 
colvarvalue xr
 Restraint center.
 
colvarvalue vr
 Velocity of the restraint center.
 
cvm::real ext_mass
 Mass of the restraint center.
 
cvm::real ext_force_k
 Restraint force constant.
 
cvm::real ext_gamma
 Friction coefficient for Langevin extended dynamics.
 
cvm::real ext_sigma
 Amplitude of Gaussian white noise for Langevin extended dynamics.
 
colvarvalue fr
 Harmonic restraint force.
 
colvarvalue fj
 Jacobian force, when Jacobian_force is enabled.
 
colvarvalue ft_reported
 Cached reported total force.
 
size_t n_active_cvcs
 Number of CVC objects with an active flag.
 
cvm::real active_cvc_square_norm
 Sum of square coefficients for active cvcs.
 
int time_step_factor
 
colvarvalue f_accumulated
 Biasing force collected between updates, to be applied at next update for coarse-time-step colvars.
 
colvarvalue x_old
 Previous value (to calculate velocities during analysis)
 
colvarvalue x_restart
 Value read from the most recent state file (if any)
 
bool after_restart
 True if a state file was just read.
 
std::list< std::list
< colvarvalue > > 
acf_x_history
 
std::list< std::list
< colvarvalue > > 
acf_v_history
 
std::list< std::list
< colvarvalue > >::iterator 
acf_x_history_p
 
std::list< std::list
< colvarvalue > >::iterator 
acf_v_history_p
 
std::list< std::list
< colvarvalue > > 
x_history
 Time series of values and velocities used in running averages.
 
std::list< std::list
< colvarvalue > >::iterator 
x_history_p
 
std::string acf_colvar_name
 Collective variable with which the correlation is calculated (default: itself)
 
size_t acf_length
 Length of autocorrelation function (ACF)
 
size_t acf_offset
 After how many steps the ACF starts.
 
size_t acf_stride
 How many timesteps separate two ACF values.
 
size_t acf_nframes
 Number of frames for each ACF point.
 
bool acf_normalize
 Normalize the ACF to a maximum value of 1?
 
std::vector< cvm::realacf
 ACF values.
 
std::string acf_outfile
 Name of the file to write the ACF.
 
acf_type_e acf_type
 Type of autocorrelation function (ACF)
 
size_t runave_length
 Length of running average series.
 
size_t runave_stride
 Timesteps to skip between two values in the running average series.
 
cvm::ofstream runave_os
 Name of the file to write the running average.
 
colvarvalue runave
 Current value of the running average.
 
cvm::real runave_variance
 Current value of the square deviation from the running average.
 
cvm::real kinetic_energy
 If extended Lagrangian active: colvar energies (kinetic and harmonic potential)
 
cvm::real potential_energy
 
std::vector< cvc * > cvcs
 Array of cvc objects.
 
std::vector< bool > cvc_flags
 Flags to enable or disable cvcs at next colvar evaluation.
 
- Protected Attributes inherited from colvarparse
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::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.
 
bool save_delimiters
 Whether or not to accumulate data_begin_pos and data_end_pos in key_lookup(); it may be useful to disable this after the constructor is called, because other files may be read (e.g. restart) that would mess up the registry; in any case, nothing serious happens until check_keywords() is invoked (which should happen only right after construction)
 
std::string config_string
 Configuration string of the object.
 

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_apply_force, f_cvb_get_total_force, f_cvb_history_dependent,
  f_cvb_scalar_variables, f_cvb_calc_pmf, f_cvb_ntot
}
 
enum  features_colvar {
  f_cv_active, 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_periodic, f_cv_scalar,
  f_cv_linear, f_cv_homogeneous, f_cv_ntot
}
 
enum  features_cvc {
  f_cvc_active, f_cvc_scalar, f_cvc_gradient, f_cvc_inv_gradient,
  f_cvc_debug_gradient, f_cvc_Jacobian, 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_fit_gradient_group, f_ag_fit_gradient_ref, f_ag_atom_forces, f_ag_scalable,
  f_ag_scalable_com, f_ag_ntot
}
 
- 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.
 

Detailed Description

A collective variable (main class); to be defined, it needs at least one object of a derived class of colvar::cvc; it calculates and returns a colvarvalue object.

This class parses the configuration, defines the behaviour and stores the value (colvar::x) and all related data of a collective variable. How the value is calculated is defined in colvar::cvc and its derived classes. The colvar object contains pointers to multiple colvar::cvc derived objects, which can be combined together into one collective variable. This makes possible to implement new collective variables at runtime based on the existing ones. Currently, this possibility is limited to a polynomial, using the coefficients cvc::sup_coeff and the exponents cvc::sup_np. In case of non-scalar variables, only exponents equal to 1 are accepted.

Please note that most of its members are colvarvalue objects, i.e. they can handle different data types together, and must all be set to the same type of colvar::value() before using them together in assignments or other operations; this is usually done automatically in the constructor. If you add a new member of colvarvalue type, you should also add its initialization line in the colvar constructor.

Member Enumeration Documentation

enum colvar::acf_type_e
protected

Type of autocorrelation function (ACF)

Enumerator
acf_notset 

Unset type.

acf_vel 

Velocity ACF, scalar product between v(0) and v(t)

acf_coor 

Coordinate ACF, scalar product between x(0) and x(t)

acf_p2coor 

Coordinate ACF, second order Legendre polynomial between x(0) and x(t) (does not work with scalar numbers)

Member Function Documentation

cvm::real colvar::dist2 ( colvarvalue const &  x1,
colvarvalue const &  x2 
) const

Use the internal metrics (as from cvc objects) to calculate square distances and gradients.

Handles correctly symmetries and periodic boundary conditions

colvarvalue colvar::dist2_lgrad ( colvarvalue const &  x1,
colvarvalue const &  x2 
) const

Use the internal metrics (as from cvc objects) to calculate square distances and gradients.

Handles correctly symmetries and periodic boundary conditions

colvarvalue colvar::dist2_rgrad ( colvarvalue const &  x1,
colvarvalue const &  x2 
) const

Use the internal metrics (as from cvc objects) to calculate square distances and gradients.

Handles correctly symmetries and periodic boundary conditions

int colvar::refresh_deps ( )
virtual

This function is called whenever feature states are changed outside of the object's control, that is, by parents Eventually it may also be used when properties of children change

Reimplemented from colvardeps.

colvarvalue const & colvar::total_force ( ) const
inline

Current total force (previously obtained from calc() or read_traj()). Note: this is calculated using the atomic forces from the last simulation step.

Total atom forces are read from the MD program, the total force acting on the collective variable is calculated summing those from all colvar components, the bias and walls forces are subtracted.

void colvar::wrap ( colvarvalue x) const

Use the internal metrics (as from cvc objects) to wrap a value into a standard interval.

Handles correctly symmetries and periodic boundary conditions

Member Data Documentation

std::list< std::list<colvarvalue> > colvar::acf_x_history
protected

Time series of values and velocities used in correlation functions

std::list< std::list<colvarvalue> >::iterator colvar::acf_x_history_p
protected

Time series of values and velocities used in correlation functions (pointers)x

int colvar::time_step_factor
protected

Time step multiplier (for coarse-time-step colvars) Colvar will only be calculated at those times; biases may ignore the information and always update their own forces (which is typically inexpensive) especially if they rely on other colvars. In this case, the colvar will accumulate forces applied between colvar updates. Alternately they may use it to calculate "impulse" biasing forces at longer intervals. Impulse forces must be multiplied by the timestep factor.

cvm::real colvar::width

Typical fluctuation amplitude for this collective variable (e.g. local width of a free energy basin)

In metadynamics calculations, colvarbias_meta, this value is used to calculate the width of a gaussian. In ABF calculations, colvarbias_abf, it is used to calculate the grid spacing in the direction of this collective variable.

std::list< std::list<colvarvalue> >::iterator colvar::x_history_p
protected

Time series of values and velocities used in correlation functions (pointers)x


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