Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

colvarproxy_vmd Class Reference

\brief Communication between colvars and VMD (implementation of colvarproxy). More...

#include <colvarproxy_vmd.h>

Inheritance diagram for colvarproxy_vmd:

colvarproxy colvarproxy_io colvarproxy_tcl colvarproxy_script colvarproxy_replicas colvarproxy_smp colvarproxy_volmaps colvarproxy_atom_groups colvarproxy_atoms colvarproxy_system List of all members.

Public Methods

 colvarproxy_vmd (Tcl_Interp *interp, VMDApp *vmd, int molid)
 Constructor
Parameters:
interl  Pointer to Tcl interpreter
vmd  Pointer to VMDApp object
molid  Molecule ID (>= 0).
More...


int update_atomic_properties ()
 \brief Update mass, charge, etc. More...

virtual ~colvarproxy_vmd ()
virtual int request_deletion ()
 Request deallocation of the module (currently only implemented by VMD). More...

virtual int setup ()
 (Re)initialize required member data (called after the module). More...

virtual int update_input ()
 Update data required by Colvars module (e.g. read atom positions) TODO Break up colvarproxy_namd and colvarproxy_lammps function into these. More...

virtual cvm::real rand_gaussian ()
 \brief Pseudo-random number with Gaussian distribution. More...

virtual int get_molid (int &molid)
 Get the molecule ID when called in VMD; raise error otherwise
Parameters:
molid  Set this argument equal to the current VMD molid.
More...


virtual int get_frame (long int &f)
 \brief Save the current frame number in the argument given. More...

virtual int set_frame (long int f)
 \brief Set the current frame number (as well as colvarmodule::it). More...

virtual void init_tcl_pointers ()
 Set Tcl pointers. More...

virtual void add_energy (cvm::real energy)
 Pass restraint energy value for current timestep to MD engine. More...

virtual void request_total_force (bool yesno)
 \brief Tell the proxy whether total forces are needed (they may not always be available). More...

virtual void log (std::string const &message)
 Print a message to the main log. More...

virtual void error (std::string const &message)
 Print a message to the main log and/or let the host code know about it. More...

virtual int set_unit_system (std::string const &units_in, bool check_only)
 \brief Request to set the units used internally by Colvars. More...

virtual int run_force_callback ()
 Run a user-defined colvar forces script. More...

virtual int run_colvar_callback (std::string const &name, std::vector< const colvarvalue * > const &cvcs, colvarvalue &value)
virtual int run_colvar_gradient_callback (std::string const &name, std::vector< const colvarvalue * > const &cvc_values, std::vector< cvm::matrix2d< cvm::real > > &gradient)
virtual int load_atoms (char const *filename, cvm::atom_group &atoms, std::string const &pdb_field, double const pdb_field_value=0.0)
 \brief Select atom IDs from a file (usually PDB)
Parameters:
filename  name of the file
atoms  array to which atoms read from "filename" will be appended
pdb_field  (optional) if the file is a PDB and this string is non-empty, select atoms for which this field is non-zero
pdb_field_value  (optional) if non-zero, select only atoms whose pdb_field equals this.
More...


virtual int load_coords (char const *filename, std::vector< cvm::atom_pos > &pos, const std::vector< int > &indices, std::string const &pdb_field, double const pdb_field_value=0.0)
virtual int init_atom (int atom_number)
 Prepare this atom for collective variables calculation, selecting it by numeric index (1-based). More...

virtual int check_atom_id (int atom_number)
 Check that this atom number is valid, but do not initialize the corresponding atom yet. More...

virtual int init_atom (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id)
 Select this atom for collective variables calculation, using name and residue number. Not all programs support this: leave this function as is in those cases. More...

virtual int check_atom_id (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id)
 Check that this atom is valid, but do not initialize it yet. More...

virtual int init_volmap_by_id (int volmap_id)
 Request and prepare this volumetric map for use by Colvars
Parameters:
volmap_id  Numeric ID used by the MD engine
Returns:
Index of the map in the colvarproxy arrays.
More...


virtual int check_volmap_by_id (int volmap_id)
 Check that the given volmap ID is valid (return COLVARS_OK if it is)
Parameters:
volmap_id  Numeric ID used by the MD engine
Returns:
Error code.
More...


virtual void clear_volmap (int index)
 \brief Used by the CVC destructors. More...

virtual int compute_volmap (int flags, int volmap_id, cvm::atom_iter atom_begin, cvm::atom_iter atom_end, cvm::real *value, cvm::real *atom_field)
 Re-weigh an atomic field (e.g. a colvar) by the value of a volumetric map
Parameters:
flags  Combination of flags
volmap_id  Numeric index of the map (no need to request it)
atom_begin  Iterator pointing to first atom
atom_end  Iterator pointing past the last atom
value  Pointer to location of total to increment
atom_field  Array of atomic field values (if NULL, ones are used).
More...


template<int flags> void compute_voldata (VolumetricData const *voldata, cvm::atom_iter atom_begin, cvm::atom_iter atom_end, cvm::real *value, cvm::real *atom_field)
int get_alch_lambda (cvm::real *lambda)
 Get value of alchemical lambda parameter from back-end (stub). More...

int send_alch_lambda (void)
 Set value of alchemical lambda parameter in back-end (stub). More...

int get_dE_dlambda (cvm::real *dE_dlambda)
 Get energy derivative with respect to lambda (stub). More...


Protected Attributes

VMDAppvmd
 pointer to the VMD main object. More...

int vmdmolid
 VMD molecule ID being used (must be provided at construction). More...

DrawMoleculevmdmol
 pointer to VMD molecule (derived from vmdmolid). More...

long int vmdmol_frame
 current frame (returned by vmdmol->frame()). More...

Inform msgColvars
 output object. More...


Detailed Description

\brief Communication between colvars and VMD (implementation of colvarproxy).

Definition at line 32 of file colvarproxy_vmd.h.


Constructor & Destructor Documentation

colvarproxy_vmd::colvarproxy_vmd Tcl_Interp *    interp,
VMDApp   vmd,
int    molid
 

Constructor

Parameters:
interl  Pointer to Tcl interpreter
vmd  Pointer to VMDApp object
molid  Molecule ID (>= 0).

Definition at line 71 of file colvarproxy_vmd.C.

References colvarproxy_system::angstrom_value_, colvarproxy::b_simulation_running, colvarmodule::cite_feature, COLVARPROXY_VERSION, colvarproxy::colvars, colvarmodule::cv_traj_freq, colvarproxy::get_version_from_string, colvarproxy_script::have_scripts, colvarproxy_system::kcal_mol_value_, colvarmodule::log, colvarmodule::restart_out_freq, colvarproxy_tcl::set_tcl_interp, setup, colvarmodule::setup_input, colvarmodule::setup_output, colvarproxy_atoms::updated_charges_, colvarproxy_atoms::updated_masses_, colvarproxy::version_int, vmd_srandom, and VMDCON_INFO.

colvarproxy_vmd::~colvarproxy_vmd   [virtual]
 

Definition at line 123 of file colvarproxy_vmd.C.


Member Function Documentation

void colvarproxy_vmd::add_energy cvm::real    energy [virtual]
 

Pass restraint energy value for current timestep to MD engine.

Reimplemented from colvarproxy_system.

Definition at line 261 of file colvarproxy_vmd.C.

int colvarproxy_vmd::check_atom_id cvm::residue_id const &    residue,
std::string const &    atom_name,
std::string const &    segment_id
[virtual]
 

Check that this atom is valid, but do not initialize it yet.

Reimplemented from colvarproxy_atoms.

Definition at line 684 of file colvarproxy_vmd.C.

References BaseMolecule::atom, BaseMolecule::atomNames, Residue::atoms, COLVARS_INPUT_ERROR, colvarmodule::error, MolAtom::nameindex, BaseMolecule::nResidues, ResizeArray< int >::num, Residue::resid, BaseMolecule::residue, MolAtom::segnameindex, BaseMolecule::segNames, and vmdmol.

int colvarproxy_vmd::check_atom_id int    atom_number [virtual]
 

Check that this atom number is valid, but do not initialize the corresponding atom yet.

Reimplemented from colvarproxy_atoms.

Definition at line 634 of file colvarproxy_vmd.C.

References COLVARS_INPUT_ERROR, colvarmodule::debug, colvarmodule::error, colvarmodule::log, BaseMolecule::nAtoms, and vmdmol.

Referenced by init_atom.

int colvarproxy_vmd::check_volmap_by_id int    volmap_id [virtual]
 

Check that the given volmap ID is valid (return COLVARS_OK if it is)

Parameters:
volmap_id  Numeric ID used by the MD engine
Returns:
Error code.

Reimplemented from colvarproxy_volmaps.

Definition at line 775 of file colvarproxy_vmd.C.

References COLVARS_INPUT_ERROR, colvarmodule::error, BaseMolecule::num_volume_data, and vmdmol.

Referenced by init_volmap_by_id.

void colvarproxy_vmd::clear_volmap int    index [virtual]
 

\brief Used by the CVC destructors.

Reimplemented from colvarproxy_volmaps.

Definition at line 785 of file colvarproxy_vmd.C.

References colvarproxy_volmaps::clear_volmap.

template<int flags>
void colvarproxy_vmd::compute_voldata VolumetricData const *    voldata,
cvm::atom_iter    atom_begin,
cvm::atom_iter    atom_end,
cvm::real   value,
cvm::real   atom_field
 

Definition at line 792 of file colvarproxy_vmd.C.

References colvarproxy_system::internal_to_angstrom, colvarproxy_system::position_distance, colvarproxy_volmaps::volmap_flag_gradients, colvarproxy_volmaps::volmap_flag_use_atom_field, VolumetricData::voxel_coord_from_cartesian_coord, VolumetricData::voxel_gradient_interpolate, VolumetricData::voxel_value_interpolate, VolumetricData::xsize, VolumetricData::ysize, and VolumetricData::zsize.

int colvarproxy_vmd::compute_volmap int    flags,
int    volmap_id,
cvm::atom_iter    atom_begin,
cvm::atom_iter    atom_end,
cvm::real   value,
cvm::real   atom_field
[virtual]
 

Re-weigh an atomic field (e.g. a colvar) by the value of a volumetric map

Parameters:
flags  Combination of flags
volmap_id  Numeric index of the map (no need to request it)
atom_begin  Iterator pointing to first atom
atom_end  Iterator pointing past the last atom
value  Pointer to location of total to increment
atom_field  Array of atomic field values (if NULL, ones are used).

Reimplemented from colvarproxy_volmaps.

Definition at line 855 of file colvarproxy_vmd.C.

References BaseMolecule::get_volume_data, NULL, vmdmol, colvarproxy_volmaps::volmap_flag_gradients, colvarproxy_volmaps::volmap_flag_null, and colvarproxy_volmaps::volmap_flag_use_atom_field.

void colvarproxy_vmd::error std::string const &    message [virtual]
 

Print a message to the main log and/or let the host code know about it.

Reimplemented from colvarproxy.

Definition at line 316 of file colvarproxy_vmd.C.

References colvarproxy::add_error_msg, and log.

Referenced by setup, update_atomic_properties, and update_input.

int colvarproxy_vmd::get_alch_lambda cvm::real   lambda [inline, virtual]
 

Get value of alchemical lambda parameter from back-end (stub).

Reimplemented from colvarproxy_system.

Definition at line 127 of file colvarproxy_vmd.h.

int colvarproxy_vmd::get_dE_dlambda cvm::real   dE_dlambda [inline, virtual]
 

Get energy derivative with respect to lambda (stub).

Reimplemented from colvarproxy_system.

Definition at line 136 of file colvarproxy_vmd.h.

int colvarproxy_vmd::get_frame long int &    f [virtual]
 

\brief Save the current frame number in the argument given.

Reimplemented from colvarproxy_io.

Definition at line 330 of file colvarproxy_vmd.C.

References vmdmol_frame.

int colvarproxy_vmd::get_molid int &    molid [virtual]
 

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

Parameters:
molid  Set this argument equal to the current VMD molid.

Reimplemented from colvarproxy_system.

Definition at line 323 of file colvarproxy_vmd.C.

References vmdmolid.

int colvarproxy_vmd::init_atom cvm::residue_id const &    residue,
std::string const &    atom_name,
std::string const &    segment_id
[virtual]
 

Select this atom for collective variables calculation, using name and residue number. Not all programs support this: leave this function as is in those cases.

Reimplemented from colvarproxy_atoms.

Definition at line 722 of file colvarproxy_vmd.C.

References colvarproxy_atoms::add_atom_slot, colvarproxy_atoms::atoms_charges, colvarproxy_atoms::atoms_ids, colvarproxy_atoms::atoms_masses, colvarproxy_atoms::atoms_refcount, BaseMolecule::charge, check_atom_id, colvarmodule::debug, colvarmodule::log, BaseMolecule::mass, and vmdmol.

int colvarproxy_vmd::init_atom int    atom_number [virtual]
 

Prepare this atom for collective variables calculation, selecting it by numeric index (1-based).

Reimplemented from colvarproxy_atoms.

Definition at line 653 of file colvarproxy_vmd.C.

References colvarproxy_atoms::add_atom_slot, colvarproxy_atoms::atoms_charges, colvarproxy_atoms::atoms_ids, colvarproxy_atoms::atoms_masses, colvarproxy_atoms::atoms_refcount, BaseMolecule::charge, check_atom_id, COLVARS_INPUT_ERROR, BaseMolecule::mass, and vmdmol.

void colvarproxy_vmd::init_tcl_pointers   [virtual]
 

Set Tcl pointers.

Reimplemented from colvarproxy_tcl.

Definition at line 353 of file colvarproxy_vmd.C.

References colvarproxy_tcl::init_tcl_pointers.

int colvarproxy_vmd::init_volmap_by_id int    volmap_id [virtual]
 

Request and prepare this volumetric map for use by Colvars

Parameters:
volmap_id  Numeric ID used by the MD engine
Returns:
Index of the map in the colvarproxy arrays.

Reimplemented from colvarproxy_volmaps.

Definition at line 754 of file colvarproxy_vmd.C.

References colvarproxy_volmaps::add_volmap_slot, check_volmap_by_id, colvarproxy_volmaps::volmaps_ids, and colvarproxy_volmaps::volmaps_refcount.

int colvarproxy_vmd::load_atoms char const *    filename,
cvm::atom_group &    atoms,
std::string const &    pdb_field,
double const    pdb_field_value = 0.0
[virtual]
 

\brief Select atom IDs from a file (usually PDB)

Parameters:
filename  name of the file
atoms  array to which atoms read from "filename" will be appended
pdb_field  (optional) if the file is a PDB and this string is non-empty, select atoms for which this field is non-zero
pdb_field_value  (optional) if non-zero, select only atoms whose pdb_field equals this.

Reimplemented from colvarproxy_atoms.

Definition at line 565 of file colvarproxy_vmd.C.

References atoms, FileSpec::autobonds, BaseMolecule::beta, COLVARS_ERROR, COLVARS_FILE_ERROR, COLVARS_INPUT_ERROR, e_pdb_beta, e_pdb_field, e_pdb_occ, e_pdb_x, e_pdb_y, e_pdb_z, colvarmodule::error, colvarmodule::get_error, DrawMolecule::get_frame, colvarmodule::log, MoleculeList::mol_from_id, VMDApp::molecule_delete, VMDApp::molecule_load, VMDApp::molecule_make_top, VMDApp::moleculeList, BaseMolecule::nAtoms, BaseMolecule::occupancy, pdb_field_str2enum, Timestep::pos, colvarmodule::set_error_bits, vmd, and vmdmolid.

int colvarproxy_vmd::load_coords char const *    filename,
std::vector< cvm::atom_pos > &    pos,
const std::vector< int > &    indices,
std::string const &    pdb_field,
double const    pdb_field_value = 0.0
[virtual]
 

Definition at line 439 of file colvarproxy_vmd.C.

References colvarproxy_system::angstrom_to_internal, colvarmodule::atom_pos, FileSpec::autobonds, BaseMolecule::beta, COLVARS_BUG_ERROR, COLVARS_ERROR, COLVARS_FILE_ERROR, COLVARS_INPUT_ERROR, e_pdb_beta, e_pdb_field, e_pdb_none, e_pdb_occ, e_pdb_x, e_pdb_y, e_pdb_z, colvarmodule::error, colvarmodule::get_error, DrawMolecule::get_frame, MoleculeList::mol_from_id, VMDApp::molecule_delete, VMDApp::molecule_load, VMDApp::molecule_make_top, VMDApp::moleculeList, BaseMolecule::nAtoms, BaseMolecule::occupancy, pdb_field_str2enum, Timestep::pos, vmd, and vmdmolid.

void colvarproxy_vmd::log std::string const &    message [virtual]
 

Print a message to the main log.

Reimplemented from colvarproxy.

Definition at line 306 of file colvarproxy_vmd.C.

References msgColvars.

Referenced by error.

cvm::real colvarproxy_vmd::rand_gaussian   [virtual]
 

\brief Pseudo-random number with Gaussian distribution.

Reimplemented from colvarproxy_system.

Definition at line 149 of file colvarproxy_vmd.C.

References vmd_random_gaussian.

int colvarproxy_vmd::request_deletion   [virtual]
 

Request deallocation of the module (currently only implemented by VMD).

Reimplemented from colvarproxy.

Definition at line 127 of file colvarproxy_vmd.C.

References colvarproxy::b_delete_requested.

void colvarproxy_vmd::request_total_force bool    yesno [virtual]
 

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

Reimplemented from colvarproxy_system.

Definition at line 295 of file colvarproxy_vmd.C.

References colvarmodule::log, and colvarproxy_system::total_force_requested.

int colvarproxy_vmd::run_colvar_callback std::string const &    name,
std::vector< const colvarvalue * > const &    cvcs,
colvarvalue   value
[virtual]
 

Reimplemented from colvarproxy_script.

Definition at line 372 of file colvarproxy_vmd.C.

References colvarproxy_tcl::tcl_run_colvar_callback.

int colvarproxy_vmd::run_colvar_gradient_callback std::string const &    name,
std::vector< const colvarvalue * > const &    cvc_values,
std::vector< cvm::matrix2d< cvm::real > > &    gradient
[virtual]
 

Reimplemented from colvarproxy_script.

Definition at line 380 of file colvarproxy_vmd.C.

References colvarproxy_tcl::tcl_run_colvar_gradient_callback.

int colvarproxy_vmd::run_force_callback   [virtual]
 

Run a user-defined colvar forces script.

Reimplemented from colvarproxy_script.

Definition at line 367 of file colvarproxy_vmd.C.

References colvarproxy_tcl::tcl_run_force_callback.

int colvarproxy_vmd::send_alch_lambda void    [inline, virtual]
 

Set value of alchemical lambda parameter in back-end (stub).

Reimplemented from colvarproxy_system.

Definition at line 133 of file colvarproxy_vmd.h.

int colvarproxy_vmd::set_frame long int    f [virtual]
 

\brief Set the current frame number (as well as colvarmodule::it).

Reimplemented from colvarproxy_io.

Definition at line 337 of file colvarproxy_vmd.C.

References colvarproxy::colvars, COLVARS_NO_SUCH_FRAME, DrawMolecule::get_frame, colvarmodule::it, NULL, update_input, vmdmol, and vmdmol_frame.

Referenced by setup.

int colvarproxy_vmd::set_unit_system std::string const &    units_in,
bool    check_only
[virtual]
 

\brief Request to set the units used internally by Colvars.

Reimplemented from colvarproxy_system.

Definition at line 155 of file colvarproxy_vmd.C.

References colvarproxy_system::angstrom_value_, COLVARS_ERROR, colvarmodule::error, colvarproxy_system::kcal_mol_value_, and colvarproxy_system::units.

int colvarproxy_vmd::setup   [virtual]
 

(Re)initialize required member data (called after the module).

Reimplemented from colvarproxy.

Definition at line 134 of file colvarproxy_vmd.C.

References colvarproxy::colvars, COLVARS_ERROR, error, DrawMolecule::frame, MoleculeList::mol_from_id, VMDApp::moleculeList, set_frame, colvarproxy::setup, colvarmodule::update_engine_parameters, vmd, vmdmol, and vmdmolid.

Referenced by colvarproxy_vmd.

int colvarproxy_vmd::update_atomic_properties  
 

\brief Update mass, charge, etc.

Definition at line 266 of file colvarproxy_vmd.C.

References colvarproxy_atoms::atoms_charges, colvarproxy_atoms::atoms_ids, colvarproxy_atoms::atoms_masses, BaseMolecule::charge, COLVARS_BUG_ERROR, error, BaseMolecule::mass, NULL, and vmdmol.

Referenced by update_input.

int colvarproxy_vmd::update_input   [virtual]
 

Update data required by Colvars module (e.g. read atom positions) TODO Break up colvarproxy_namd and colvarproxy_lammps function into these.

Reimplemented from colvarproxy.

Definition at line 192 of file colvarproxy_vmd.C.

References Timestep::a_length, Timestep::alpha, colvarproxy_system::angstrom_to_internal, colvarmodule::atom_pos, colvarproxy_atoms::atoms_ids, colvarproxy_atoms::atoms_new_colvar_forces, colvarproxy_atoms::atoms_positions, Timestep::b_length, Timestep::beta, colvarproxy_system::boundaries_non_periodic, colvarproxy_system::boundaries_pbc_ortho, colvarproxy_system::boundaries_pbc_triclinic, colvarproxy_system::boundaries_type, colvarproxy_system::boundaries_unsupported, Timestep::c_length, COLVARS_ERROR, COLVARS_NO_SUCH_FRAME, error, Timestep::gamma, DrawMolecule::get_frame, Timestep::get_transform_vectors, MoleculeList::mol_from_id, VMDApp::moleculeList, NULL, colvarproxy_system::reset_pbc_lattice, colvarproxy_system::unit_cell_x, colvarproxy_system::unit_cell_y, colvarproxy_system::unit_cell_z, update_atomic_properties, colvarproxy::update_input, colvarproxy_system::update_pbc_lattice, vmd, vmdmol, vmdmol_frame, and vmdmolid.

Referenced by set_frame.


Member Data Documentation

Inform colvarproxy_vmd::msgColvars [protected]
 

output object.

Definition at line 156 of file colvarproxy_vmd.h.

Referenced by log.

VMDApp* colvarproxy_vmd::vmd [protected]
 

pointer to the VMD main object.

Definition at line 144 of file colvarproxy_vmd.h.

Referenced by load_atoms, load_coords, setup, and update_input.

DrawMolecule* colvarproxy_vmd::vmdmol [protected]
 

pointer to VMD molecule (derived from vmdmolid).

Definition at line 150 of file colvarproxy_vmd.h.

Referenced by check_atom_id, check_volmap_by_id, compute_volmap, init_atom, set_frame, setup, update_atomic_properties, and update_input.

long int colvarproxy_vmd::vmdmol_frame [protected]
 

current frame (returned by vmdmol->frame()).

Definition at line 153 of file colvarproxy_vmd.h.

Referenced by get_frame, set_frame, and update_input.

int colvarproxy_vmd::vmdmolid [protected]
 

VMD molecule ID being used (must be provided at construction).

Definition at line 147 of file colvarproxy_vmd.h.

Referenced by get_molid, load_atoms, load_coords, setup, and update_input.


The documentation for this class was generated from the following files:
Generated on Tue Dec 3 02:47:20 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002