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

Methods for accessing the simulation system (PBCs, integrator, etc) More...

#include <colvarproxy_system.h>

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

Public Member Functions

 colvarproxy_system ()
 Constructor.
 
virtual ~colvarproxy_system ()
 Destructor.
 
virtual int set_unit_system (std::string const &units, bool check_only)
 Request to set the units used internally by Colvars. More...
 
cvm::real angstrom_to_internal (cvm::real l) const
 Convert a length from Angstrom to internal.
 
cvm::real internal_to_angstrom (cvm::real l) const
 Convert a length from internal to Angstrom.
 
cvm::real boltzmann () const
 Boltzmann constant, with unit the same as energy / K.
 
cvm::real target_temperature () const
 Current target temperature of the simulation (K units)
 
virtual int set_target_temperature (cvm::real T)
 Set the current target temperature of the simulation (K units)
 
double dt () const
 Time step of the simulation (fs units)
 
virtual int set_integration_timestep (cvm::real dt)
 Set the current integration timestep of the simulation (fs units)
 
virtual cvm::real rand_gaussian (void)
 Pseudo-random number with Gaussian distribution. More...
 
virtual void add_energy (cvm::real energy)
 Pass restraint energy value for current timestep to MD engine. More...
 
virtual cvm::rvector position_distance (cvm::atom_pos const &pos1, cvm::atom_pos const &pos2) const
 Get the PBC-aware distance vector between two positions. More...
 
void update_pbc_lattice ()
 Recompute PBC reciprocal lattice (assumes XYZ periodicity)
 
void reset_pbc_lattice ()
 Set the lattice vectors to zero.
 
virtual void request_total_force (bool yesno)
 Tell the proxy whether total forces are needed (they may not always be available) More...
 
virtual bool total_forces_enabled () const
 Are total forces being used? More...
 
virtual bool total_forces_same_step () const
 Are total forces from the current step available? More...
 
virtual int get_molid (int &molid)
 
virtual int get_alch_lambda (cvm::real *lambda)
 Get value of alchemical lambda parameter from back-end (if available) More...
 
void set_alch_lambda (cvm::real lambda)
 Set value of alchemical lambda parameter to be sent to back-end at end of timestep.
 
virtual int send_alch_lambda ()
 Send cached value of alchemical lambda parameter to back-end (if available) More...
 
virtual int get_dE_dlambda (cvm::real *dE_dlambda)
 Get energy derivative with respect to lambda (if available) More...
 
virtual int apply_force_dE_dlambda (cvm::real *force)
 Apply a scalar force on dE_dlambda (back-end distributes it onto atoms)
 
virtual int get_d2E_dlambda2 (cvm::real *d2E_dlambda2)
 Get energy second derivative with respect to lambda (if available)
 
virtual cvm::real get_accelMD_factor () const
 Get weight factor from accelMD. More...
 
virtual bool accelMD_enabled () const
 

Public Attributes

std::string units
 Name of the unit system used internally by Colvars (by default, that of the back-end). Supported depending on the back-end: real (A, kcal/mol), metal (A, eV), electron (Bohr, Hartree), gromacs (nm, kJ/mol) Note: calls to back-end PBC functions assume back-end length unit We use different unit from back-end in VMD bc using PBC functions from colvarproxy base class Colvars internal units are user specified, because the module exchanges info in unknown composite dimensions with user input, while it only exchanges quantities of known dimension with the back-end (length and forces)
 
cvm::real indirect_lambda_biasing_force
 Force to be applied onto alch. lambda, propagated from biasing forces on dE_dlambda.
 

Protected Types

enum  Boundaries_type { boundaries_non_periodic , boundaries_pbc_ortho , boundaries_pbc_triclinic , boundaries_unsupported }
 Type of boundary conditions. More...
 

Protected Attributes

cvm::real cached_alch_lambda
 Next value of lambda to be sent to back-end.
 
bool cached_alch_lambda_changed
 Whether lambda has been set and needs to be updated in backend.
 
cvm::real boltzmann_
 Boltzmann constant in internal Colvars units.
 
cvm::real target_temperature_
 Most up to date target temperature (K units); default to 0.0 if undefined.
 
double timestep_
 Current integration timestep (engine units); default to 1.0 if undefined.
 
cvm::real angstrom_value_
 Value of 1 Angstrom in the internal (front-end) Colvars unit for atomic coordinates. More...
 
cvm::real kcal_mol_value_
 Value of 1 kcal/mol in the internal Colvars unit for energy.
 
bool total_force_requested
 Whether the total forces have been requested.
 
Boundaries_type boundaries_type
 Type of boundary conditions.
 
cvm::rvector unit_cell_x
 Bravais lattice vectors.
 
cvm::rvector unit_cell_y
 
cvm::rvector unit_cell_z
 
cvm::rvector reciprocal_cell_x
 Reciprocal lattice vectors.
 
cvm::rvector reciprocal_cell_y
 
cvm::rvector reciprocal_cell_z
 

Detailed Description

Methods for accessing the simulation system (PBCs, integrator, etc)

Member Enumeration Documentation

◆ Boundaries_type

Type of boundary conditions.

Orthogonal and triclinic cells are made available to objects. For any other conditions (mixed periodicity, triclinic cells in LAMMPS) minimum-image distances are computed by the host engine regardless.

Member Function Documentation

◆ add_energy()

void colvarproxy_system::add_energy ( cvm::real  energy)
virtual

Pass restraint energy value for current timestep to MD engine.

Reimplemented in colvarproxy_vmd, colvarproxy_lammps, and colvarproxy_namd.

◆ get_accelMD_factor()

virtual cvm::real colvarproxy_system::get_accelMD_factor ( ) const
inlinevirtual

Get weight factor from accelMD.

Reimplemented in colvarproxy_namd.

◆ get_alch_lambda()

int colvarproxy_system::get_alch_lambda ( cvm::real lambda)
virtual

Get value of alchemical lambda parameter from back-end (if available)

Reimplemented in colvarproxy_vmd.

◆ get_dE_dlambda()

int colvarproxy_system::get_dE_dlambda ( cvm::real dE_dlambda)
virtual

Get energy derivative with respect to lambda (if available)

Reimplemented in colvarproxy_vmd.

◆ get_molid()

int colvarproxy_system::get_molid ( int &  molid)
virtual

Get the molecule ID when called in VMD; raise error otherwise

Parameters
molidSet this argument equal to the current VMD molid

Reimplemented in colvarproxy_vmd.

◆ position_distance()

cvm::rvector colvarproxy_system::position_distance ( cvm::atom_pos const &  pos1,
cvm::atom_pos const &  pos2 
) const
virtual

Get the PBC-aware distance vector between two positions.

Reimplemented in colvarproxy_namd, and colvarproxy_lammps.

◆ rand_gaussian()

cvm::real colvarproxy_system::rand_gaussian ( void  )
virtual

Pseudo-random number with Gaussian distribution.

Reimplemented in colvarproxy_vmd, colvarproxy_namd, and colvarproxy_lammps.

◆ request_total_force()

void colvarproxy_system::request_total_force ( bool  yesno)
virtual

Tell the proxy whether total forces are needed (they may not always be available)

Reimplemented in colvarproxy_vmd, colvarproxy_lammps, and colvarproxy_namd.

◆ send_alch_lambda()

int colvarproxy_system::send_alch_lambda ( void  )
virtual

Send cached value of alchemical lambda parameter to back-end (if available)

Reimplemented in colvarproxy_vmd.

◆ set_unit_system()

int colvarproxy_system::set_unit_system ( std::string const &  units,
bool  check_only 
)
virtual

Request to set the units used internally by Colvars.

Reimplemented in colvarproxy_vmd, colvarproxy_lammps, and colvarproxy_namd.

◆ total_forces_enabled()

bool colvarproxy_system::total_forces_enabled ( ) const
virtual

Are total forces being used?

Reimplemented in colvarproxy_lammps, and colvarproxy_namd.

◆ total_forces_same_step()

bool colvarproxy_system::total_forces_same_step ( ) const
virtual

Are total forces from the current step available?

Reimplemented in colvarproxy_lammps.

Member Data Documentation

◆ angstrom_value_

cvm::real colvarproxy_system::angstrom_value_
protected

Value of 1 Angstrom in the internal (front-end) Colvars unit for atomic coordinates.

  • defaults to 0 in the base class; derived proxy classes must set it
  • in VMD proxy, can only be changed when no variables are defined as user-defined values in composite units must be compatible with that system

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