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

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

#include <colvarproxy_vmd.h>

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

Public Member Functions

 colvarproxy_vmd (Tcl_Interp *interp, VMDApp *vmd, int molid)
 
int update_atomic_properties ()
 Update mass, charge, etc.
 
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 ()
 
virtual cvm::real rand_gaussian ()
 Pseudo-random number with Gaussian distribution. More...
 
virtual int get_molid (int &molid)
 
virtual int get_frame (long int &f)
 Save the current frame number in the argument given. More...
 
virtual int set_frame (long int f)
 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)
 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)
 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_pdb (char const *filename, cvm::atom_group &atoms, std::string const &pdb_field, double const pdb_field_value=0.0)
 Read a selection of atom IDs from a PDB coordinate file. More...
 
virtual int load_coords_pdb (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)
 Load a set of coordinates from a PDB file. More...
 
virtual int check_atom_name_selections_available ()
 Check whether it is possible to select atoms by residue number name. More...
 
virtual int init_atom (int atom_number)
 
virtual int check_atom_id (int atom_number)
 
virtual int init_atom (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id)
 
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 check_volmaps_available ()
 Test whether this implementation can use volumetric maps as CVs. More...
 
virtual int init_volmap_by_id (int volmap_id)
 
virtual int check_volmap_by_id (int volmap_id)
 
virtual void clear_volmap (int index)
 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)
 
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...
 
- Public Member Functions inherited from colvarproxy
 colvarproxy ()
 Constructor.
 
 ~colvarproxy () override
 Destructor.
 
std::string const & engine_name () const
 
bool io_available () override
 Ensure that we're on the main thread (derived class will do actual check) More...
 
virtual int request_deletion ()
 Request deallocation of the module (currently only implemented by VMD) More...
 
bool delete_requested () const
 Whether deallocation was requested.
 
virtual int reset ()
 Reset proxy state, e.g. requested atoms. More...
 
virtual int parse_module_config ()
 (Re)initialize the module
 
virtual int load_atoms_pdb (char const *filename, cvm::atom_group &atoms, std::string const &pdb_field, double pdb_field_value)
 Read a selection of atom IDs from a PDB coordinate file. More...
 
virtual int load_coords_pdb (char const *filename, std::vector< cvm::atom_pos > &pos, std::vector< int > const &sorted_ids, std::string const &pdb_field, double pdb_field_value)
 Load a set of coordinates from a PDB file. More...
 
virtual int setup ()
 (Re)initialize required member data (called after the module) More...
 
bool engine_ready () const
 Whether the engine allows to fully initialize Colvars immediately.
 
void add_config (std::string const &cmd, std::string const &conf)
 Enqueue new configuration text, to be parsed as soon as possible.
 
virtual int update_input ()
 
virtual int update_output ()
 Update data based on the results of a Colvars call (e.g. send forces)
 
int end_of_step ()
 Carry out operations needed before next simulation step is run.
 
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...
 
void add_error_msg (std::string const &message)
 Record error message (used by VMD to collect them after a script call)
 
std::string const & get_error_msgs ()
 Retrieve accumulated error messages.
 
void clear_error_msgs ()
 As the name says.
 
bool simulation_running () const
 Whether a simulation is running (warn against irrecovarable errors)
 
bool simulation_continuing () const
 
int post_run ()
 Called at the end of a simulation segment (i.e. "run" command)
 
void print_input_atomic_data ()
 Print a full list of all input atomic arrays for debug purposes.
 
void print_output_atomic_data ()
 Print a full list of all applied forces for debug purposes.
 
int get_version_from_string (char const *version_string)
 Convert a version string "YYYY-MM-DD" into an integer.
 
int version_number () const
 Get the version number (higher = more recent)
 
- Public Member Functions inherited from colvarproxy_system
 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 Member Functions inherited from colvarproxy_atoms
 colvarproxy_atoms ()
 Constructor.
 
virtual ~colvarproxy_atoms ()
 Destructor.
 
virtual int init_atom (int atom_number)
 
virtual int check_atom_id (int atom_number)
 
virtual int check_atom_name_selections_available ()
 Check whether it is possible to select atoms by residue number name. More...
 
virtual int init_atom (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id)
 
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 void clear_atom (int index)
 Used by the atom class destructor: rather than deleting the array slot (costly) set the corresponding atoms_refcount to zero. More...
 
int reset ()
 Clear atomic data.
 
int get_atom_id (int index) const
 
cvm::real get_atom_mass (int index) const
 
void increase_refcount (int index)
 
cvm::real get_atom_charge (int index) const
 
cvm::rvector get_atom_position (int index) const
 
cvm::rvector get_atom_total_force (int index) const
 
void apply_atom_force (int index, cvm::rvector const &new_force)
 
cvm::rvector get_atom_velocity (int)
 Read the current velocity of the given atom.
 
std::vector< int > const * get_atom_ids () const
 
size_t get_num_active_atoms () const
 Return number of atoms with positive reference count.
 
std::vector< cvm::real > const * get_atom_masses () const
 
std::vector< cvm::real > * modify_atom_masses ()
 
std::vector< cvm::real > const * get_atom_charges ()
 
std::vector< cvm::real > * modify_atom_charges ()
 
std::vector< cvm::rvector > const * get_atom_positions () const
 
std::vector< cvm::rvector > * modify_atom_positions ()
 
std::vector< cvm::rvector > const * get_atom_total_forces () const
 
std::vector< cvm::rvector > * modify_atom_total_forces ()
 
std::vector< cvm::rvector > const * get_atom_applied_forces () const
 
std::vector< cvm::rvector > * modify_atom_applied_forces ()
 
void compute_rms_atoms_applied_force ()
 Compute the root-mean-square of the applied forces.
 
void compute_max_atoms_applied_force ()
 Compute the maximum norm among all applied forces.
 
cvm::real rms_atoms_applied_force () const
 Get the root-mean-square of the applied forces.
 
cvm::real max_atoms_applied_force () const
 Get the maximum norm among all applied forces.
 
int max_atoms_applied_force_id () const
 Get the atom ID with the largest applied force.
 
bool modified_atom_list () const
 Whether the atom list has been modified internally.
 
void reset_modified_atom_list ()
 Reset the modified atom list flag.
 
bool updated_masses () const
 Record whether masses have been updated.
 
bool updated_charges () const
 Record whether masses have been updated.
 
- Public Member Functions inherited from colvarproxy_atom_groups
 colvarproxy_atom_groups ()
 Constructor.
 
virtual ~colvarproxy_atom_groups ()
 Destructor.
 
int reset ()
 Clear atom group data.
 
virtual int scalable_group_coms ()
 Whether this proxy implementation has capability for scalable groups. More...
 
virtual int init_atom_group (std::vector< int > const &atoms_ids)
 Prepare this group for collective variables calculation, selecting atoms by internal ids (0-based) More...
 
virtual void clear_atom_group (int index)
 Used by the atom_group class destructor. More...
 
int get_atom_group_id (int index) const
 Get the numeric ID of the given atom group (for the MD program)
 
cvm::real get_atom_group_mass (int index) const
 Get the mass of the given atom group.
 
cvm::real get_atom_group_charge (int index) const
 Get the charge of the given atom group.
 
cvm::rvector get_atom_group_com (int index) const
 Read the current position of the center of mass given atom group.
 
cvm::rvector get_atom_group_total_force (int index) const
 Read the current total force of the given atom group.
 
void apply_atom_group_force (int index, cvm::rvector const &new_force)
 Request that this force is applied to the given atom group.
 
cvm::rvector get_atom_group_velocity (int)
 Read the current velocity of the given atom group.
 
std::vector< int > const * get_atom_group_ids () const
 
size_t get_num_active_atom_groups () const
 Return number of atom groups with positive reference count.
 
std::vector< cvm::real > * modify_atom_group_masses ()
 
std::vector< cvm::real > * modify_atom_group_charges ()
 
std::vector< cvm::rvector > * modify_atom_group_positions ()
 
std::vector< cvm::rvector > * modify_atom_group_total_forces ()
 
std::vector< cvm::rvector > * modify_atom_group_applied_forces ()
 
void compute_rms_atom_groups_applied_force ()
 Compute the root-mean-square of the applied forces.
 
void compute_max_atom_groups_applied_force ()
 Compute the maximum norm among all applied forces.
 
cvm::real rms_atom_groups_applied_force () const
 Get the root-mean-square of the applied forces.
 
cvm::real max_atom_groups_applied_force () const
 Get the maximum norm among all applied forces.
 
- Public Member Functions inherited from colvarproxy_volmaps
 colvarproxy_volmaps ()
 Contructor.
 
virtual ~colvarproxy_volmaps ()
 Destructor.
 
int reset ()
 Clear volumetric map data.
 
virtual int check_volmaps_available ()
 Test whether this implementation can use volumetric maps as CVs. More...
 
int add_volmap_slot (int volmap_id)
 Create a slot for a volumetric map not requested yet.
 
virtual int init_volmap_by_id (int volmap_id)
 
virtual int init_volmap_by_name (char const *volmap_name)
 
virtual int check_volmap_by_id (int volmap_id)
 
virtual int check_volmap_by_name (char const *volmap_name)
 
int init_volmap_by_name (std::string const &volmap_name)
 Request and prepare this volumetric map for use by Colvars.
 
int check_volmap_by_name (std::string const &volmap_name)
 Check that the given volmap name is valid (return COLVARS_OK if it is)
 
virtual void clear_volmap (int index)
 Used by the CVC destructors. More...
 
virtual int get_volmap_id_from_name (char const *volmap_name)
 Get the numeric ID of the given volumetric map (for the MD program) More...
 
int get_volmap_id (int index) const
 Get the numeric ID of the given volumetric map (for the MD program)
 
cvm::real get_volmap_value (int index) const
 Read the current value of the volumetric map.
 
void apply_volmap_force (int index, cvm::real const &new_force)
 Request that this force is applied to the given volumetric map.
 
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)
 
void compute_rms_volmaps_applied_force ()
 Compute the root-mean-square of the applied forces.
 
void compute_max_volmaps_applied_force ()
 Compute the maximum norm among all applied forces.
 
- Public Member Functions inherited from colvarproxy_smp
 colvarproxy_smp ()
 Constructor.
 
virtual ~colvarproxy_smp ()
 Destructor.
 
virtual int check_smp_enabled ()
 Whether threaded parallelization is available (TODO: make this a cvm::deps feature)
 
virtual int smp_colvars_loop ()
 Distribute calculation of colvars (and their components) across threads.
 
virtual int smp_biases_loop ()
 Distribute calculation of biases across threads.
 
virtual int smp_biases_script_loop ()
 Distribute calculation of biases across threads 2nd through last, with all scripted biased on 1st thread.
 
virtual int smp_thread_id ()
 Index of this thread.
 
virtual int smp_num_threads ()
 Number of threads sharing this address space.
 
virtual int smp_lock ()
 Lock the proxy's shared data for access by a thread, if threads are implemented; if not implemented, does nothing.
 
virtual int smp_trylock ()
 Attempt to lock the proxy's shared data.
 
virtual int smp_unlock ()
 Release the lock.
 
- Public Member Functions inherited from colvarproxy_replicas
 colvarproxy_replicas ()
 Constructor.
 
virtual ~colvarproxy_replicas ()
 Destructor.
 
virtual int replica_enabled ()
 Indicate if multi-replica support is available and active. More...
 
virtual int replica_index ()
 Index of this replica. More...
 
virtual int num_replicas ()
 Total number of replicas. More...
 
virtual void replica_comm_barrier ()
 Synchronize replica with others. More...
 
virtual int replica_comm_recv (char *msg_data, int buf_len, int src_rep)
 Receive data from other replica. More...
 
virtual int replica_comm_send (char *msg_data, int msg_len, int dest_rep)
 Send data to other replica. More...
 
- Public Member Functions inherited from colvarproxy_script
 colvarproxy_script ()
 Constructor.
 
virtual ~colvarproxy_script ()
 Destructor.
 
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 &cvcs, std::vector< cvm::matrix2d< cvm::real > > &gradient)
 
- Public Member Functions inherited from colvarproxy_tcl
 colvarproxy_tcl ()
 Constructor.
 
virtual ~colvarproxy_tcl ()
 Destructor.
 
bool tcl_available ()
 Is Tcl available? (trigger initialization if needed)
 
char const * tcl_get_str (void *obj)
 Get a string representation of the Tcl object pointed to by obj.
 
int tcl_run_script (std::string const &script)
 
int tcl_run_file (std::string const &fileName)
 
int tcl_run_force_callback ()
 Tcl implementation of run_force_callback()
 
int tcl_run_colvar_callback (std::string const &name, std::vector< const colvarvalue * > const &cvcs, colvarvalue &value)
 Tcl implementation of run_colvar_callback()
 
int tcl_run_colvar_gradient_callback (std::string const &name, std::vector< const colvarvalue * > const &cvcs, std::vector< cvm::matrix2d< cvm::real > > &gradient)
 Tcl implementation of run_colvar_gradient_callback()
 
Tcl_Interp * get_tcl_interp ()
 Get a pointer to the Tcl interpreter.
 
void set_tcl_interp (Tcl_Interp *interp)
 Set the pointer to the Tcl interpreter.
 
virtual void init_tcl_pointers ()
 Set Tcl pointers. More...
 
- Public Member Functions inherited from colvarproxy_io
 colvarproxy_io ()
 Constructor.
 
virtual ~colvarproxy_io ()
 Destructor.
 
virtual bool io_available ()
 Ensure that we're on the main thread (derived class will do actual check) More...
 
virtual int get_frame (long int &)
 Save the current frame number in the argument given. More...
 
virtual int set_frame (long int)
 Set the current frame number (as well as colvarmodule::it) More...
 
virtual int backup_file (char const *filename)
 Rename the given file, before overwriting it. More...
 
int backup_file (std::string const &filename)
 Rename the given file, before overwriting it.
 
virtual int remove_file (char const *filename)
 Remove the given file (on Windows only, rename to filename.old)
 
int remove_file (std::string const &filename)
 Remove the given file (on Windows only, rename to filename.old)
 
virtual int rename_file (char const *filename, char const *newfilename)
 Rename the given file.
 
int rename_file (std::string const &filename, std::string const &newfilename)
 Rename the given file.
 
std::string const & input_prefix () const
 Prefix of the input state file to be read next.
 
virtual int set_input_prefix (std::string const &prefix)
 Initialize input_prefix (NOTE: it will be erased after state file is read)
 
std::string const & output_prefix () const
 Default prefix to be used for all output files (final configuration)
 
virtual int set_output_prefix (std::string const &prefix)
 Set default output prefix.
 
std::string const & restart_output_prefix () const
 Prefix of the restart (checkpoint) file to be written next.
 
virtual int set_restart_output_prefix (std::string const &prefix)
 Set default restart state file prefix.
 
int default_restart_frequency () const
 Default restart frequency (as set by the simulation engine)
 
virtual int set_default_restart_frequency (int freq)
 Communicate/set the restart frequency of the simulation engine.
 
std::istream & input_stream (std::string const &input_name, std::string const description="file/channel", bool error_on_fail=true)
 
std::istream & input_stream_from_string (std::string const &input_name, std::string const &content, std::string const description="string")
 
bool input_stream_exists (std::string const &input_name)
 Check if the file/channel is open (without opening it if not)
 
int close_input_stream (std::string const &input_name)
 Closes the given input stream.
 
int close_input_streams ()
 Closes all input streams.
 
int delete_input_stream (std::string const &input_name)
 Same as close_input_stream(), but also removes the corresponding entry from memory.
 
std::list< std::string > list_input_stream_names () const
 List all input streams that were opened at some point.
 
virtual std::ostream & output_stream (std::string const &output_name, std::string const description)
 
virtual bool output_stream_exists (std::string const &output_name)
 Check if the file/channel is open (without opening it if not)
 
virtual int flush_output_stream (std::string const &output_name)
 Flushes the given output file/channel. More...
 
virtual int flush_output_streams ()
 Flushes all output files/channels. More...
 
virtual int close_output_stream (std::string const &output_name)
 Closes the given output file/channel. More...
 
virtual int close_output_streams ()
 Close all open files/channels to prevent data loss. More...
 

Protected Attributes

VMDApp * vmd
 pointer to the VMD main object
 
int vmdmolid
 VMD molecule ID being used (must be provided at construction)
 
DrawMolecule * vmdmol
 pointer to VMD molecule (derived from vmdmolid)
 
long int vmdmol_frame
 current frame (returned by vmdmol->frame())
 
Inform msgColvars
 output object
 
- Protected Attributes inherited from colvarproxy
bool engine_ready_
 Whether the engine allows to fully initialize Colvars immediately.
 
std::string error_output
 Collected error messages.
 
bool b_simulation_running
 Whether a simulation is running (warn against irrecovarable errors)
 
bool b_simulation_continuing
 
bool b_delete_requested
 Whether the entire module should be deallocated by the host engine.
 
int version_int
 Integer representing the version string (allows comparisons)
 
size_t features_hash
 Track which features have been acknowledged during the last run.
 
std::string engine_name_ = "standalone"
 Name of the simulation engine that the derived proxy object supports.
 
void * config_queue_
 Queue of config strings or files to be fed to the module.
 
- Protected Attributes inherited from colvarproxy_system
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
 
- Protected Attributes inherited from colvarproxy_atoms
std::vector< int > atoms_ids
 Array of 0-based integers used to uniquely associate atoms within the host program.
 
std::vector< size_t > atoms_refcount
 Keep track of how many times each atom is used by a separate colvar object.
 
std::vector< cvm::realatoms_masses
 Masses of the atoms (allow redefinition during a run, as done e.g. in LAMMPS)
 
std::vector< cvm::realatoms_charges
 Charges of the atoms (allow redefinition during a run, as done e.g. in LAMMPS)
 
std::vector< cvm::rvectoratoms_positions
 Current three-dimensional positions of the atoms.
 
std::vector< cvm::rvectoratoms_total_forces
 Most recent total forces on each atom.
 
std::vector< cvm::rvectoratoms_new_colvar_forces
 Forces applied from colvars, to be communicated to the MD integrator.
 
cvm::real atoms_rms_applied_force_
 Root-mean-square of the applied forces.
 
cvm::real atoms_max_applied_force_
 Maximum norm among all applied forces.
 
int atoms_max_applied_force_id_
 ID of the atom with the maximum norm among all applied forces.
 
bool modified_atom_list_
 Whether the atom list has been modified internally.
 
bool updated_masses_
 Whether the masses and charges have been updated from the host code.
 
bool updated_charges_
 
- Protected Attributes inherited from colvarproxy_atom_groups
std::vector< int > atom_groups_ids
 Array of 0-based integers used to uniquely associate atom groups within the host program.
 
std::vector< size_t > atom_groups_refcount
 Keep track of how many times each group is used by a separate cvc.
 
std::vector< cvm::realatom_groups_masses
 Total masses of the atom groups.
 
std::vector< cvm::realatom_groups_charges
 Total charges of the atom groups (allow redefinition during a run, as done e.g. in LAMMPS)
 
std::vector< cvm::rvectoratom_groups_coms
 Current centers of mass of the atom groups.
 
std::vector< cvm::rvectoratom_groups_total_forces
 Most recently updated total forces on the com of each group.
 
std::vector< cvm::rvectoratom_groups_new_colvar_forces
 Forces applied from colvars, to be communicated to the MD integrator.
 
cvm::real atom_groups_rms_applied_force_
 Root-mean-square of the applied group forces.
 
cvm::real atom_groups_max_applied_force_
 Maximum norm among all applied group forces.
 
- Protected Attributes inherited from colvarproxy_volmaps
std::vector< int > volmaps_ids
 Array of numeric IDs of volumetric maps.
 
std::vector< size_t > volmaps_refcount
 Keep track of how many times each vol map is used by a separate colvar object.
 
std::vector< cvm::realvolmaps_values
 Current values of the vol maps.
 
std::vector< cvm::realvolmaps_new_colvar_forces
 Forces applied from colvars, to be communicated to the MD integrator.
 
cvm::real volmaps_rms_applied_force_
 Root-mean-square of the the applied forces.
 
cvm::real volmaps_max_applied_force_
 Maximum norm among all applied forces.
 
- Protected Attributes inherited from colvarproxy_smp
omp_lock_t * omp_lock_state
 Lock state for OpenMP.
 
- Protected Attributes inherited from colvarproxy_tcl
Tcl_Interp * tcl_interp_
 Pointer to Tcl interpreter object.
 
- Protected Attributes inherited from colvarproxy_io
std::string input_prefix_str
 Prefix of the input state file to be read next.
 
std::string output_prefix_str
 Default prefix to be used for all output files (final configuration)
 
std::string restart_output_prefix_str
 Prefix of the restart (checkpoint) file to be written next.
 
int restart_frequency_engine
 How often the simulation engine will write its own restart.
 
std::map< std::string, std::istream * > input_streams_
 Container of input files/channels indexed by path name.
 
std::istream * input_stream_error_
 Object whose reference is returned when read errors occur.
 
std::map< std::string, std::ostream * > output_streams_
 Currently open output files/channels.
 
std::ostream * output_stream_error_
 Object whose reference is returned when write errors occur.
 

Additional Inherited Members

- Public Types inherited from colvarproxy_volmaps
enum  { volmap_flag_null = 0 , volmap_flag_gradients = 1 , volmap_flag_use_atom_field = (1<<8) }
 Flags controlling what computation is done on the map.
 
- Public Attributes inherited from colvarproxy
colvarmodulecolvars
 Pointer to the main object.
 
- Public Attributes inherited from colvarproxy_system
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.
 
- Public Attributes inherited from colvarproxy_smp
bool b_smp_active
 
- Public Attributes inherited from colvarproxy_script
colvarscriptscript
 
bool have_scripts
 Do we have a scripting interface?
 
- Protected Types inherited from colvarproxy_system
enum  Boundaries_type { boundaries_non_periodic , boundaries_pbc_ortho , boundaries_pbc_triclinic , boundaries_unsupported }
 Type of boundary conditions. More...
 
- Protected Member Functions inherited from colvarproxy_atoms
int add_atom_slot (int atom_id)
 
- Protected Member Functions inherited from colvarproxy_atom_groups
int add_atom_group_slot (int atom_group_id)
 Used by all init_atom_group() functions: create a slot for an atom group not requested yet.
 

Detailed Description

Communication between colvars and VMD (implementation of colvarproxy)

Constructor & Destructor Documentation

◆ colvarproxy_vmd()

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

Constructor

Parameters
interlPointer to Tcl interpreter
vmdPointer to VMDApp object
molidMolecule ID (>= 0)

Member Function Documentation

◆ add_energy()

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

Pass restraint energy value for current timestep to MD engine.

Reimplemented from colvarproxy_system.

◆ check_atom_id() [1/2]

virtual 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.

◆ check_atom_id() [2/2]

virtual 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.

◆ check_atom_name_selections_available()

virtual int colvarproxy_vmd::check_atom_name_selections_available ( )
virtual

Check whether it is possible to select atoms by residue number name.

Reimplemented from colvarproxy_atoms.

◆ check_volmap_by_id()

virtual 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_idNumeric ID used by the MD engine
Returns
Error code

Reimplemented from colvarproxy_volmaps.

◆ check_volmaps_available()

virtual int colvarproxy_vmd::check_volmaps_available ( )
virtual

Test whether this implementation can use volumetric maps as CVs.

Reimplemented from colvarproxy_volmaps.

◆ clear_volmap()

virtual void colvarproxy_vmd::clear_volmap ( int  index)
virtual

Used by the CVC destructors.

Reimplemented from colvarproxy_volmaps.

◆ compute_volmap()

virtual 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
flagsCombination of flags
volmap_idNumeric index of the map (no need to request it)
atom_beginIterator pointing to first atom
atom_endIterator pointing past the last atom
valuePointer to location of total to increment
atom_fieldArray of atomic field values (if NULL, ones are used)

Reimplemented from colvarproxy_volmaps.

◆ error()

virtual 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.

◆ get_alch_lambda()

int colvarproxy_vmd::get_alch_lambda ( cvm::real lambda)
inlinevirtual

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

Reimplemented from colvarproxy_system.

◆ get_dE_dlambda()

int colvarproxy_vmd::get_dE_dlambda ( cvm::real dE_dlambda)
inlinevirtual

Get energy derivative with respect to lambda (stub)

Reimplemented from colvarproxy_system.

◆ get_frame()

virtual int colvarproxy_vmd::get_frame ( long int &  )
virtual

Save the current frame number in the argument given.

Reimplemented from colvarproxy_io.

◆ get_molid()

virtual int colvarproxy_vmd::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 from colvarproxy_system.

◆ init_atom() [1/2]

virtual 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.

◆ init_atom() [2/2]

virtual 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.

◆ init_tcl_pointers()

virtual void colvarproxy_vmd::init_tcl_pointers ( )
virtual

Set Tcl pointers.

Reimplemented from colvarproxy_tcl.

◆ init_volmap_by_id()

virtual int colvarproxy_vmd::init_volmap_by_id ( int  volmap_id)
virtual

Request and prepare this volumetric map for use by Colvars

Parameters
volmap_idNumeric ID used by the MD engine
Returns
Index of the map in the colvarproxy arrays

Reimplemented from colvarproxy_volmaps.

◆ load_atoms_pdb()

virtual int colvarproxy_vmd::load_atoms_pdb ( char const *  filename,
cvm::atom_group atoms,
std::string const &  pdb_field,
double const  pdb_field_value = 0.0 
)
virtual

Read a selection of atom IDs from a PDB coordinate file.

Parameters
[in]filenamename of the file
[in,out]atomsarray into which atoms will be read from "filename"
[in]pdb_fieldif the file is a PDB and this string is non-empty, select atoms for which this field is non-zero
[in]pdb_field_valueif non-zero, select only atoms whose pdb_field equals this

Reimplemented from colvarproxy.

◆ load_coords_pdb()

virtual int colvarproxy_vmd::load_coords_pdb ( char const *  filename,
std::vector< cvm::atom_pos > &  pos,
const std::vector< int > &  sorted_ids,
std::string const &  pdb_field,
double const  pdb_field_value = 0.0 
)
virtual

Load a set of coordinates from a PDB file.

Parameters
[in]filenamename of the file
[in,out]posarray of coordinates to fill; if not empty, the number of its elements must match the number of entries in "filename"
[in]sorted_idsarray of sorted internal IDs, used to loop through the file only once
[in]pdb_fieldif non-empty, only atoms for which this field is non-zero will be processed
[in]pdb_field_valueif non-zero, process only atoms whose pdb_field equals this

Reimplemented from colvarproxy.

◆ log()

virtual void colvarproxy_vmd::log ( std::string const &  message)
virtual

Print a message to the main log.

Reimplemented from colvarproxy.

◆ rand_gaussian()

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

Pseudo-random number with Gaussian distribution.

Reimplemented from colvarproxy_system.

◆ request_deletion()

virtual int colvarproxy_vmd::request_deletion ( )
virtual

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

Reimplemented from colvarproxy.

◆ request_total_force()

virtual void colvarproxy_vmd::request_total_force ( bool  yesno)
virtual

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

Reimplemented from colvarproxy_system.

◆ run_colvar_callback()

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

Reimplemented from colvarproxy_script.

◆ run_colvar_gradient_callback()

virtual 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.

◆ run_force_callback()

virtual int colvarproxy_vmd::run_force_callback ( )
virtual

Run a user-defined colvar forces script.

Reimplemented from colvarproxy_script.

◆ send_alch_lambda()

int colvarproxy_vmd::send_alch_lambda ( void  )
inlinevirtual

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

Reimplemented from colvarproxy_system.

◆ set_frame()

virtual int colvarproxy_vmd::set_frame ( long int  )
virtual

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

Reimplemented from colvarproxy_io.

◆ set_unit_system()

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

Request to set the units used internally by Colvars.

Reimplemented from colvarproxy_system.

◆ setup()

virtual int colvarproxy_vmd::setup ( )
virtual

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

Reimplemented from colvarproxy.

◆ update_input()

virtual 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.


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