Collective Variables Module - Developer Documentation
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
colvardeps Class Referenceabstract

Parent class for a member object of a bias, cv or cvc etc. containing features and their dependencies, and handling dependency resolution. More...

#include <colvardeps.h>

Inheritance diagram for colvardeps:
Inheritance graph
[legend]

Classes

class  feature
 
struct  feature_state
 This contains the current state of each feature for each object. More...
 

Public Types

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
}
 

Public Member Functions

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)
 
virtual const std::vector< feature * > & features ()=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 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 Attributes

std::string description
 

Protected Member Functions

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

int time_step_factor
 

Detailed Description

Parent class for a member object of a bias, cv or cvc etc. containing features and their dependencies, and handling dependency resolution.

There are 3 kinds of features:

  1. Dynamic features are under the control of the dependency resolution system. They may be enabled or disabled depending on dependencies.
  2. User features may be enabled based on user input (they may trigger a failure upon dependency resolution, though)
  3. Static features are static properties of the object, determined programatically at initialization time.

In all classes, feature 0 is active. When an object is inactivated all its children dependencies are dereferenced (free_children_deps) While the object is inactive, no dependency solving is done on children it is done when the object is activated back (restore_children_deps)

Member Enumeration Documentation

◆ features_atomgroup

Enumerator
f_ag_implicit_gradient 

Does not have explicit atom gradients from parent CVC.

Perform a standard minimum msd fit for given atoms ie. not using refpositionsgroup

◆ features_biases

Enumerator
f_cvb_active 

Bias is active.

f_cvb_awake 

Bias is awake (active on its own accord) this timestep.

f_cvb_apply_force 

will apply forces

f_cvb_get_total_force 

requires total forces

f_cvb_history_dependent 

depends on simulation history

f_cvb_time_dependent 

depends on time

f_cvb_scalar_variables 

requires scalar colvars

f_cvb_calc_pmf 

whether this bias will compute a PMF

f_cvb_calc_ti_samples 

whether this bias will compute TI samples

f_cvb_write_ti_samples 

whether this bias will write TI samples

f_cvb_write_ti_pmf 

whether this bias should write the TI PMF

◆ features_colvar

Enumerator
f_cv_active 

Calculate colvar.

f_cv_awake 

Colvar is awake (active on its own accord) this timestep.

f_cv_gradient 

Gradients are calculated and temporarily stored, so that external forces can be applied.

f_cv_collect_gradient 

Collect atomic gradient data from all cvcs into vector atomic_gradient.

f_cv_fdiff_velocity 

Calculate the velocity with finite differences.

f_cv_total_force 

The total force is calculated, projecting the atomic forces on the inverse gradient.

f_cv_total_force_calc 

Calculate total force from atomic forces.

f_cv_subtract_applied_force 

Subtract the applied force from the total force.

f_cv_Jacobian 

Estimate Jacobian derivative.

f_cv_hide_Jacobian 

Do not report the Jacobian force as part of the total force instead, apply a correction internally to cancel it.

f_cv_extended_Lagrangian 

The variable has a harmonic restraint around a moving center with fictitious mass; bias forces will be applied to the center.

f_cv_Langevin 

The extended system coordinate undergoes Langevin dynamics.

f_cv_output_energy 

Output the potential and kinetic energies (for extended Lagrangian colvars only)

f_cv_output_value 

Output the value to the trajectory file (on by default)

f_cv_output_velocity 

Output the velocity to the trajectory file.

f_cv_output_applied_force 

Output the applied force to the trajectory file.

f_cv_output_total_force 

Output the total force to the trajectory file.

f_cv_lower_boundary 

A lower boundary is defined.

f_cv_upper_boundary 

An upper boundary is defined.

f_cv_grid 

Provide a discretization of the values of the colvar to be used by the biases or in analysis (needs lower and upper boundary)

f_cv_runave 

Compute running average.

f_cv_corrfunc 

Compute time correlation function.

f_cv_scripted 

Value and gradient computed by user script.

f_cv_custom_function 

Value and gradient computed by user function through Lepton.

f_cv_periodic 

Colvar is periodic.

f_cv_scalar 

is scalar

f_cv_multiple_ts 

multiple timestep through time_step_factor

f_cv_ntot 

Number of colvar features.

◆ features_cvc

Enumerator
f_cvc_implicit_gradient 

CVC doesn't calculate and store explicit atom gradients.

f_cvc_debug_gradient 

If enabled, calc_gradients() will call debug_gradients() for every group needed.

Member Function Documentation

◆ decr_ref_count()

int colvardeps::decr_ref_count ( int  f)

Decrement the reference count of a feature disabling it if it's dynamic and count reaches zero

◆ disable()

int colvardeps::disable ( int  f)

Disable a feature, decrease the reference count of its dependencies and recursively disable them as applicable

◆ do_feature_side_effects()

virtual void colvardeps::do_feature_side_effects ( int  id)
inlinevirtual

Implements possible actions to be carried out when a given feature is enabled Base function does nothing, can be overloaded

Reimplemented in colvarmodule::atom_group, and colvar.

◆ enable()

int colvardeps::enable ( int  f,
bool  dry_run = false,
bool  toplevel = true 
)

enable a feature and recursively solve its dependencies for proper reference counting, one should not add spurious calls to enable() dry_run is set to true to recursively test if a feature is available, without enabling it

◆ free_children_deps()

void colvardeps::free_children_deps ( )

disable all enabled features to free their dependencies to be done when deleting the object Cannot be in the base class destructor because it needs the derived class features()

◆ provide()

void colvardeps::provide ( int  feature_id,
bool  truefalse = true 
)

Set the feature's available flag, without checking To be used for dynamic properties dependencies will be checked by enable()

◆ remove_all_children()

void colvardeps::remove_all_children ( )

Used before deleting an object, if not handled by that object's destructor (useful for cvcs because their children are member objects)

Member Data Documentation

◆ time_step_factor

int colvardeps::time_step_factor
protected

Time step multiplier (for coarse-timestep biases & colvars) Biases and colvars will only be calculated at those times (f_cvb_awake and f_cv_awake); a Biases use this to apply "impulse" biasing forces at the outer timestep Unused by lower-level objects (cvcs and atom groups)


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