Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
colvarparams.h
Go to the documentation of this file.
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 COLVARPARAMS_H
11#define COLVARPARAMS_H
12
13#include <map>
14
16
17
19
20 public:
21
23 int param_exists(std::string const &param_name);
24
26 virtual std::vector<std::string> get_param_names();
27
29 virtual std::vector<std::string> get_param_grad_names();
30
32 virtual void const *get_param_ptr(std::string const &param_name);
33
35 virtual void const *get_param_grad_ptr(std::string const &param_name);
36
38 virtual cvm::real get_param(std::string const &param_name);
39
41 virtual int set_param(std::string const &param_name, void const *new_value);
42
43 protected:
44
47
49 virtual ~colvarparams();
50
52 std::map<std::string, void const *> param_map;
53
55 std::map<std::string, colvarvalue const *> param_grad_map;
56
58 void register_param(std::string const &param_name, void *param_ptr);
59
61 void register_param_grad(std::string const &param_name,
62 colvarvalue *param_grad_ptr);
63
64};
65
66#endif
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:95
Definition: colvarparams.h:18
colvarparams()
Default constructor.
Definition: colvarparams.cpp:20
void register_param(std::string const &param_name, void *param_ptr)
Register the given parameter.
Definition: colvarparams.cpp:28
virtual cvm::real get_param(std::string const &param_name)
Value of the parameter param_name (must be a scalar)
Definition: colvarparams.cpp:94
virtual std::vector< std::string > get_param_names()
Get a copy of the names of registered parameters.
Definition: colvarparams.cpp:51
std::map< std::string, void const * > param_map
Pointers to relevant parameters that may be accessed by other objects.
Definition: colvarparams.h:52
virtual void const * get_param_ptr(std::string const &param_name)
Pointer to the parameter param_name.
Definition: colvarparams.cpp:73
virtual ~colvarparams()
Default destructor.
Definition: colvarparams.cpp:24
std::map< std::string, colvarvalue const * > param_grad_map
Derivatives of the object with respect to internal parameters.
Definition: colvarparams.h:55
virtual std::vector< std::string > get_param_grad_names()
Get a copy of the names of registered parameter gradients.
Definition: colvarparams.cpp:62
void register_param_grad(std::string const &param_name, colvarvalue *param_grad_ptr)
Register the gradient of the given parameter.
Definition: colvarparams.cpp:35
virtual void const * get_param_grad_ptr(std::string const &param_name)
Pointer to the gradient of parameter param_name.
Definition: colvarparams.cpp:83
virtual int set_param(std::string const &param_name, void const *new_value)
Set the named parameter to the given value.
Definition: colvarparams.cpp:102
int param_exists(std::string const &param_name)
Whether the parameter param_name exists.
Definition: colvarparams.cpp:42
Value of a collective variable: this is a metatype which can be set at runtime. By default it is set ...
Definition: colvarvalue.h:43