Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
colvarproxy_tcl.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_TCL_H
11#define COLVARPROXY_TCL_H
12
13#if defined(NAMD_TCL) || defined(VMDTCL)
14#define COLVARS_TCL
15#endif
16
17#ifdef COLVARS_TCL
18#include <tcl.h>
19#else
20// Allow for placeholders Tcl_Interp* variables
21typedef void Tcl_Interp;
22#endif
23
24#include <vector>
25
26
29
30public:
31
34
36 virtual ~colvarproxy_tcl();
37
39 inline bool tcl_available() {
40#if defined(COLVARS_TCL)
41 return true;
42#else
43 return false;
44#endif
45 }
46
48 char const *tcl_get_str(void *obj);
49
50 int tcl_run_script(std::string const &script);
51
52 int tcl_run_file(std::string const &fileName);
53
56
59 std::string const &name,
60 std::vector<const colvarvalue *> const &cvcs,
61 colvarvalue &value);
62
65 std::string const &name,
66 std::vector<const colvarvalue *> const &cvcs,
67 std::vector<cvm::matrix2d<cvm::real> > &gradient);
68
70 inline Tcl_Interp *get_tcl_interp()
71 {
72 return tcl_interp_;
73 }
74
76 inline void set_tcl_interp(Tcl_Interp *interp)
77 {
78 tcl_interp_ = interp;
79 }
80
82 virtual void init_tcl_pointers();
83
84protected:
86 Tcl_Interp *tcl_interp_;
87};
88
89#endif
Arbitrary size array (two dimensions) suitable for linear algebra operations (i.e....
Definition: colvartypes.h:376
Methods for using Tcl within Colvars.
Definition: colvarproxy_tcl.h:28
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()
Definition: colvarproxy_tcl.cpp:168
colvarproxy_tcl()
Constructor.
Definition: colvarproxy_tcl.cpp:24
int tcl_run_colvar_callback(std::string const &name, std::vector< const colvarvalue * > const &cvcs, colvarvalue &value)
Tcl implementation of run_colvar_callback()
Definition: colvarproxy_tcl.cpp:121
virtual ~colvarproxy_tcl()
Destructor.
Definition: colvarproxy_tcl.cpp:30
Tcl_Interp * get_tcl_interp()
Get a pointer to the Tcl interpreter.
Definition: colvarproxy_tcl.h:70
char const * tcl_get_str(void *obj)
Get a string representation of the Tcl object pointed to by obj.
Definition: colvarproxy_tcl.cpp:52
Tcl_Interp * tcl_interp_
Pointer to Tcl interpreter object.
Definition: colvarproxy_tcl.h:86
int tcl_run_force_callback()
Tcl implementation of run_force_callback()
Definition: colvarproxy_tcl.cpp:97
bool tcl_available()
Is Tcl available? (trigger initialization if needed)
Definition: colvarproxy_tcl.h:39
void set_tcl_interp(Tcl_Interp *interp)
Set the pointer to the Tcl interpreter.
Definition: colvarproxy_tcl.h:76
virtual void init_tcl_pointers()
Set Tcl pointers.
Definition: colvarproxy_tcl.cpp:35
Value of a collective variable: this is a metatype which can be set at runtime. By default it is set ...
Definition: colvarvalue.h:43