Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
colvarproxy_vmd.h
1// -*- c++ -*-
2
3// This file is part of the Collective Variables module (Colvars).
4// The original version of Colvars and its updates are located at:
5// https://github.com/Colvars/colvars
6// Please update all Colvars source files before making any changes.
7// If you wish to distribute your changes, please submit them to the
8// Colvars repository at GitHub.
9
10#ifndef COLVARPROXY_VMD_H
11#define COLVARPROXY_VMD_H
12
13#include "colvarproxy_vmd_version.h"
14
15#include <tcl.h>
16
17#include "DrawMolecule.h"
18#include "Timestep.h"
19#include "Inform.h"
20
21#include "colvarmodule.h"
22#include "colvarproxy.h"
23#include "colvartypes.h"
24#include "colvaratoms.h"
25
26
27int tcl_colvars(ClientData clientData, Tcl_Interp *interp,
28 int objc, Tcl_Obj *const objv[]);
29
33
34public:
35
40 colvarproxy_vmd(Tcl_Interp *interp, VMDApp *vmd, int molid);
41
44
45 virtual ~colvarproxy_vmd();
46
47 virtual int request_deletion();
48
49 virtual int setup();
50
51 virtual int update_input();
52
54
55 virtual int get_molid(int &molid);
56
57 virtual int get_frame(long int &f);
58
59 virtual int set_frame(long int f);
60
61 virtual void init_tcl_pointers();
62
63 virtual void add_energy(cvm::real energy);
64
65 virtual void request_total_force(bool yesno);
66
67 virtual void log(std::string const &message);
68
69 virtual void error(std::string const &message);
70
71 virtual int set_unit_system(std::string const &units_in, bool check_only);
72
73 virtual int run_force_callback();
74
75 virtual int run_colvar_callback(std::string const &name,
76 std::vector<const colvarvalue *> const &cvcs,
77 colvarvalue &value);
78
79 virtual int run_colvar_gradient_callback(std::string const &name,
80 std::vector<const colvarvalue *> const &cvc_values,
81 std::vector<cvm::matrix2d<cvm::real> > &gradient);
82
83 virtual int load_atoms_pdb(char const *filename,
84 cvm::atom_group &atoms,
85 std::string const &pdb_field,
86 double const pdb_field_value = 0.0);
87
88 virtual int load_coords_pdb(char const *filename,
89 std::vector<cvm::atom_pos> &pos,
90 const std::vector<int> &indices,
91 std::string const &pdb_field,
92 double const pdb_field_value = 0.0);
93
94
96
97 virtual int init_atom(int atom_number);
98
99 virtual int check_atom_id(int atom_number);
100
101 virtual int init_atom(cvm::residue_id const &residue,
102 std::string const &atom_name,
103 std::string const &segment_id);
104
105 virtual int check_atom_id(cvm::residue_id const &residue,
106 std::string const &atom_name,
107 std::string const &segment_id);
108
110
111 virtual int init_volmap_by_id(int volmap_id);
112
113 virtual int check_volmap_by_id(int volmap_id);
114
115 virtual void clear_volmap(int index);
116
117 virtual int compute_volmap(int flags,
118 int volmap_id,
119 cvm::atom_iter atom_begin,
120 cvm::atom_iter atom_end,
121 cvm::real *value,
122 cvm::real *atom_field);
123
124 template<int flags>
125 void compute_voldata(VolumetricData const *voldata,
126 cvm::atom_iter atom_begin,
127 cvm::atom_iter atom_end,
128 cvm::real *value,
129 cvm::real *atom_field);
130
133 *lambda = 0.0;
134 return COLVARS_OK;
135 }
136
138 int send_alch_lambda(void) { return COLVARS_OK; }
139
141 int get_dE_dlambda(cvm::real* dE_dlambda) {
142 *dE_dlambda = 0.0;
143 return COLVARS_OK;
144 }
145
146protected:
147
149 VMDApp *vmd;
150
153
155 DrawMolecule *vmdmol;
156
158 long int vmdmol_frame;
159
162};
163
164
165#endif
Group of atom objects, mostly used by a colvar::cvc object to gather all atomic data.
Definition: colvaratoms.h:159
Arbitrary size array (two dimensions) suitable for linear algebra operations (i.e....
Definition: colvartypes.h:376
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:95
int residue_id
Residue identifier.
Definition: colvarmodule.h:193
Communication between colvars and VMD (implementation of colvarproxy)
Definition: colvarproxy_vmd.h:32
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.
virtual void log(std::string const &message)
Print a message to the main log.
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.
Inform msgColvars
output object
Definition: colvarproxy_vmd.h:161
int get_dE_dlambda(cvm::real *dE_dlambda)
Get energy derivative with respect to lambda (stub)
Definition: colvarproxy_vmd.h:141
colvarproxy_vmd(Tcl_Interp *interp, VMDApp *vmd, int molid)
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)
virtual void request_total_force(bool yesno)
Tell the proxy whether total forces are needed (they may not always be available)
virtual int init_volmap_by_id(int volmap_id)
virtual int check_volmaps_available()
Test whether this implementation can use volumetric maps as CVs.
int update_atomic_properties()
Update mass, charge, etc.
virtual void add_energy(cvm::real energy)
Pass restraint energy value for current timestep to MD engine.
VMDApp * vmd
pointer to the VMD main object
Definition: colvarproxy_vmd.h:149
virtual int init_atom(int atom_number)
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.
virtual void error(std::string const &message)
Print a message to the main log and/or let the host code know about it.
DrawMolecule * vmdmol
pointer to VMD molecule (derived from vmdmolid)
Definition: colvarproxy_vmd.h:155
virtual int update_input()
int get_alch_lambda(cvm::real *lambda)
Get value of alchemical lambda parameter from back-end (stub)
Definition: colvarproxy_vmd.h:132
long int vmdmol_frame
current frame (returned by vmdmol->frame())
Definition: colvarproxy_vmd.h:158
int vmdmolid
VMD molecule ID being used (must be provided at construction)
Definition: colvarproxy_vmd.h:152
virtual int set_unit_system(std::string const &units_in, bool check_only)
Request to set the units used internally by Colvars.
virtual cvm::real rand_gaussian()
Pseudo-random number with Gaussian distribution.
virtual int check_volmap_by_id(int volmap_id)
virtual int request_deletion()
Request deallocation of the module (currently only implemented by VMD)
virtual int run_force_callback()
Run a user-defined colvar forces script.
virtual void init_tcl_pointers()
Set Tcl pointers.
virtual int init_atom(cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id)
virtual int check_atom_name_selections_available()
Check whether it is possible to select atoms by residue number name.
virtual int setup()
(Re)initialize required member data (called after the module)
virtual void clear_volmap(int index)
Used by the CVC destructors.
virtual int check_atom_id(int atom_number)
int send_alch_lambda(void)
Set value of alchemical lambda parameter in back-end (stub)
Definition: colvarproxy_vmd.h:138
virtual int set_frame(long int f)
Set the current frame number (as well as colvarmodule::it)
virtual int get_frame(long int &f)
Save the current frame number in the argument given.
virtual int get_molid(int &molid)
Definition: colvarproxy.h:542
Value of a collective variable: this is a metatype which can be set at runtime. By default it is set ...
Definition: colvarvalue.h:43
Collective variables main module.
Colvars proxy classes.