forked from Colvars/colvars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolvarproxy_tcl.h
89 lines (67 loc) · 2.07 KB
/
colvarproxy_tcl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// -*- c++ -*-
// This file is part of the Collective Variables module (Colvars).
// The original version of Colvars and its updates are located at:
// https://github.com/Colvars/colvars
// Please update all Colvars source files before making any changes.
// If you wish to distribute your changes, please submit them to the
// Colvars repository at GitHub.
#ifndef COLVARPROXY_TCL_H
#define COLVARPROXY_TCL_H
#if defined(NAMD_TCL) || defined(VMDTCL)
#define COLVARS_TCL
#endif
#ifdef COLVARS_TCL
#include <tcl.h>
#else
// Allow for placeholders Tcl_Interp* variables
typedef void Tcl_Interp;
#endif
#include <vector>
/// Methods for using Tcl within Colvars
class colvarproxy_tcl {
public:
/// Constructor
colvarproxy_tcl();
/// Destructor
virtual ~colvarproxy_tcl();
/// Is Tcl available? (trigger initialization if needed)
inline bool tcl_available() {
#if defined(COLVARS_TCL)
return true;
#else
return false;
#endif
}
/// Get a string representation of the Tcl object pointed to by obj
char const *tcl_get_str(void *obj);
int tcl_run_script(std::string const &script);
int tcl_run_file(std::string const &fileName);
/// Tcl implementation of run_force_callback()
int tcl_run_force_callback();
/// Tcl implementation of run_colvar_callback()
int tcl_run_colvar_callback(
std::string const &name,
std::vector<const colvarvalue *> const &cvcs,
colvarvalue &value);
/// Tcl implementation of run_colvar_gradient_callback()
int tcl_run_colvar_gradient_callback(
std::string const &name,
std::vector<const colvarvalue *> const &cvcs,
std::vector<cvm::matrix2d<cvm::real> > &gradient);
/// Get a pointer to the Tcl interpreter
inline Tcl_Interp *get_tcl_interp()
{
return tcl_interp_;
}
/// Set the pointer to the Tcl interpreter
inline void set_tcl_interp(Tcl_Interp *interp)
{
tcl_interp_ = interp;
}
/// Set Tcl pointers
virtual void init_tcl_pointers();
protected:
/// Pointer to Tcl interpreter object
Tcl_Interp *tcl_interp_;
};
#endif