8 Tcl command-line interface: list of commands

This section lists all the commands used in VMD to control the behavior of the Colvars module from within a run script.

8.1 Commands to manage the Colvars module

cv addenergy <E>

    Add an energy to the MD engine (no effect in VMD)

    Parameters

    E : float - Amount of energy to add
cv config <conf>

    Read configuration from the given string

    Parameters

    conf : string - Configuration string
cv configfile <conf_file>

    Read configuration from a file

    Parameters

    conf_file : string - Path to configuration file
cv delete

    Delete this Colvars module instance (VMD only)
cv featurereport

    Return a summary of Colvars features used so far and their citations

    Returns

    report : string - Feature report and citations
cv frame [frame]

    Get or set current frame number (VMD only)

    Parameters

    frame : integer - Frame number (optional)

    Returns

    frame : integer - Frame number
cv getatomappliedforces

    Get the list of forces applied by Colvars to atoms

    Returns

    forces : array of arrays of floats - Atomic forces
cv getatomappliedforcesmax

    Get the maximum norm of forces applied by Colvars to atoms

    Returns

    force : float - Maximum atomic force
cv getatomappliedforcesmaxid

    Get the atom ID with the largest applied force

    Returns

    id : int - ID of the atom with the maximum atomic force
cv getatomappliedforcesrms

    Get the root-mean-square norm of forces applied by Colvars to atoms

    Returns

    force : float - RMS atomic force
cv resetatomappliedforces

    Reset forces applied by Colvars to atoms
cv getatomids

    Get the list of indices of atoms used in Colvars

    Returns

    indices : array of ints - Atom indices
cv getatomcharges

    Get the list of charges of atoms used in Colvars

    Returns

    charges : array of floats - Atomic charges
cv getatommasses

    Get the list of masses of atoms used in Colvars

    Returns

    masses : array of floats - Atomic masses
cv getatompositions

    Get the list of cached positions of atoms used in Colvars

    Returns

    positions : array of arrays of floats - Atomic positions
cv getatomtotalforces

    Get the list of cached total forces of atoms used in Colvars

    Returns

    forces : array of arrays of floats - Atomic total foces
cv getconfig

    Get the module's configuration string read so far

    Returns

    conf : string - Current configuration string
cv getenergy

    Get the current Colvars energy

    Returns

    E : float - Amount of energy (internal units)
cv getnumactiveatomgroups

    Get the number of atom groups that currently have positive ref counts

    Returns

    count : integer - Total number of atom groups
cv getnumactiveatoms

    Get the number of atoms that currently have positive ref counts

    Returns

    count : integer - Total number of atoms
cv getnumatoms

    Get the number of requested atoms, including those not in use now

    Returns

    count : integer - Total number of atoms
cv getstepabsolute

    Get the current step number of the simulation (including restarts)

    Returns

    step : int - Absolute step number
cv getsteprelative

    Get the current step number from the start of this job

    Returns

    step : int - Relative step number
cv help [command]

    Get the help string of the Colvars scripting interface

    Parameters

    command : string - Get the help string of this specific command (optional)

    Returns

    help : string - Help string
cv languageversion

    Get the C++ language version number

    Returns

    version : string - C++ language version
cv list [param]

    Return a list of all variables or biases

    Parameters

    param : string - "colvars" or "biases"; default is "colvars" (optional)

    Returns

    list : sequence of strings - List of elements
cv listcommands

    Get the list of script functions, prefixed with "cv_", "colvar_" or "bias_"

    Returns

    list : sequence of strings - List of commands
cv listindexfiles

    Get a list of the index files loaded in this session

    Returns

    list : sequence of strings - List of index file names
cv listinputfiles

    Get a list of all input/configuration files loaded in this session

    Returns

    list : sequence of strings - List of file names
cv load <prefix>

    Load data from a state file into all matching colvars and biases

    Parameters

    prefix : string - Path to existing state file or input prefix
cv loadfromstring <buffer>

    Load state data from a string into all matching colvars and biases

    Parameters

    buffer : string - String buffer containing the state information
cv molid [molid]

    Get or set the molecule ID on which Colvars is defined (VMD only)

    Parameters

    molid : integer - New molecule ID; -1 means undefined (optional)

    Returns

    molid : integer - Current molecule ID
cv printframe

    Return the values that would be written to colvars.traj

    Returns

    values : string - The values
cv patchversion

    Get the Colvars patch version number (used for bugfixes only)

    Returns

    version : string - Colvars version
cv printframelabels

    Return the labels that would be written to colvars.traj

    Returns

    Labels : string - The labels
cv reset

    Delete all internal configuration
cv resetindexgroups

    Clear the index groups loaded so far, allowing to replace them
cv save <prefix>

    Change the prefix of all output files and save them

    Parameters

    prefix : string - Output prefix with trailing ".colvars.state" gets removed)
cv savetostring

    Write the Colvars state to a string and return it

    Returns

    state : string - The saved state
cv targettemperature [T]

    Get/set target temperature, overriding internally what the MD engine reports

    Parameters

    T : float - New target temperature in K (internal use) (optional)

    Returns

    T : float - Current target temperature in K
cv timestep [dt]

    Get/set integration timestep, overriding internally what the MD engine reports

    Parameters

    dt : float - New integration timestep in MD engine units (optional)

    Returns

    dt : float - Current integration timestep in MD engine units
cv units [units]

    Get or set the current Colvars unit system

    Parameters

    units : string - The new unit system (optional)

    Returns

    units : string - The current unit system
cv update

    Recalculate colvars and biases
cv version

    Get the Colvars version string

    Returns

    version : string - Colvars version

8.2 Commands to manage individual collective variables

cv colvar name addforce <force>

    Apply the given force onto this colvar (no effects outside run)

    Parameters

    force : float or array - Applied force; must match colvar dimensionality

    Returns

    force : float or array - Applied force; matches colvar dimensionality
cv colvar name communicateforces

    Communicate bias forces from this colvar to atoms
cv colvar name cvcflags <flags>

    Enable or disable individual components by setting their active flags

    Parameters

    flags : integer array - Zero/nonzero value disables/enables the CVC
cv colvar name delete

    Delete this colvar, along with all biases that depend on it
cv colvar name get <feature>

    Get the value of the given feature for this colvar

    Parameters

    feature : string - Name of the feature

    Returns

    state : 1/0 - State of the given feature
cv colvar name getappliedforce

    Return the total of the forces applied to this colvar

    Returns

    force : float - Applied force; matches the colvar dimensionality
cv colvar name resetbiasforce

    Return the total of the forces applied to this colvar
cv colvar name getatomgroups

    Return the atom indices used by this colvar as a list of lists

    Returns

    groups : array of arrays of ints - Atom indices
cv colvar name getatomids

    Return the list of atom indices used by this colvar

    Returns

    indices : array of ints - Atom indices
cv colvar name getconfig

    Return the configuration string of this colvar

    Returns

    conf : string - Current configuration string
cv colvar name getgradients

    Return the atomic gradients of this colvar

    Returns

    gradients : array of arrays of floats - Atomic gradients
cv colvar name gettotalforce

    Return the sum of internal and external forces to this colvar

    Returns

    force : float - Total force; matches the colvar dimensionality
cv colvar name getvolmapids

    Return the list of volumetric map indices used by this colvar
cv colvar name help [command]

    Get a help summary or the help string of one colvar subcommand

    Parameters

    command : string - Get the help string of this specific command (optional)

    Returns

    help : string - Help string
cv colvar name modifycvcs <confs>

    Modify configuration of individual components by passing string arguments

    Parameters

    confs : sequence of strings - New configurations; empty strings are skipped
cv colvar name run_ave

    Get the current running average of the value of this colvar

    Returns

    value : float or array - Averaged value; matches the colvar dimensionality
cv colvar name set <feature> <value>

    Set the given feature of this colvar to a new value

    Parameters

    feature : string - Name of the feature

    value : string - String representation of the new feature value
cv colvar name state

    Print a string representation of the feature state of this colvar

    Returns

    state : string - The feature state
cv colvar name type

    Get the type description of this colvar

    Returns

    type : string - Type description
cv colvar name update

    Recompute this colvar and return its up-to-date value

    Returns

    value : float or array - Current value; matches the colvar dimensionality
cv colvar name value

    Get the current value of this colvar

    Returns

    value : float or array - Current value; matches the colvar dimensionality
cv colvar name width

    Get the width of this colvar

    Returns

    width : float - Value of the width

8.3 Commands to manage individual biases

cv bias name bin

    Get the current grid bin index (flattened if more than 1d)

    Returns

    bin : integer - Bin index
cv bias name bincount [index]

    Get the number of samples at the given grid bin (1D ABF only for now)

    Parameters

    index : integer - Grid index; defaults to current bin (optional)

    Returns

    samples : integer - Number of samples
cv bias name local_sample_count [radius]

    Get the number of samples around the current binsamples : integer - Number of samples

    Parameters

    radius : integer - Sum over radius bins around current bin (optional)
cv bias name binnum

    Get the total number of grid points of this bias (1D ABF only for now)

    Returns

    Bins : integer - Number of grid points
cv bias name delete

    Delete this bias
cv bias name energy

    Get the current energy of this bias

    Returns

    E : float - Energy value
cv bias name get <feature>

    Get the value of the given feature for this bias

    Parameters

    feature : string - Name of the feature

    Returns

    state : 1/0 - State of the given feature
cv bias name getconfig

    Return the configuration string of this bias

    Returns

    conf : string - Current configuration string
cv bias name help [command]

    Get a help summary or the help string of one bias subcommand

    Parameters

    command : string - Get the help string of this specific command (optional)

    Returns

    help : string - Help string
cv bias name load <prefix>

    Load data into this bias

    Parameters

    prefix : string - Read from a file with this name or prefix
cv bias name loadfromstring <buffer>

    Load state data into this bias from a string

    Parameters

    buffer : string - String buffer containing the state information
cv bias name save <prefix>

    Save data from this bias into a file with the given prefix

    Parameters

    prefix : string - Prefix for the state file of this bias
cv bias name savetostring

    Save data from this bias into a string and return it

    Returns

    state : string - The bias state
cv bias name set <feature> <value>

    Set the given feature of this bias to a new value

    Parameters

    feature : string - Name of the feature

    value : string - String representation of the new feature value
cv bias name share

    Share bias information with other replicas (multiple-walker scheme)
cv bias name state

    Print a string representation of the feature state of this bias

    Returns

    state : string - String representation of the bias features
cv bias name type

    Print the type of this bias object

    Returns

    type : string - Type of this bias object (e.g. metadynamics)
cv bias name update

    Recompute this bias and return its up-to-date energy

    Returns

    E : float - Energy value