Collective Variables Module - Developer Documentation
Loading...
Searching...
No Matches
colvarproxy_volmaps.h
1// -*- c++ -*-
2
3#ifndef COLVARPROXY_VOLMAPS_H
4#define COLVARPROXY_VOLMAPS_H
5
6#include "colvarmodule.h"
7
8
11
12public:
13
16
18 virtual ~colvarproxy_volmaps();
19
21 int reset();
22
24 virtual int check_volmaps_available();
25
27 int add_volmap_slot(int volmap_id);
28
32 virtual int request_engine_volmap_by_id(int volmap_id);
33
37 virtual int request_engine_volmap_by_name(std::string const &volmap_name);
38
42 virtual int init_internal_volmap_by_id(int volmap_id);
43
47 virtual int init_internal_volmap_by_name(std::string const &filename);
48
52 virtual int load_internal_volmap_from_file(std::string const &filename);
53
55 virtual int clear_volmap(int index);
56
58 inline int get_volmap_id(int index) const
59 {
60 return volmaps_ids[index];
61 }
62
64 inline cvm::real get_engine_volmap_value(int index) const
65 {
66 return volmaps_values[index];
67 }
68
70 inline void apply_engine_volmap_force(int index, cvm::real const &new_force)
71 {
72 volmaps_new_colvar_forces[index] += new_force;
73 }
74
76
82 virtual int compute_volmap(int flags,
83 int volmap_index,
85 cvm::real *value,
86 cvm::real *atom_field);
87
89 enum {
90 volmap_flag_null = 0,
91 volmap_flag_gradients = 1,
92 volmap_flag_use_atom_field = (1<<8)
93 };
94
97
100
101protected:
102
104 std::vector<int> volmaps_ids;
105
107 std::vector<size_t> volmaps_refcount;
108
110 std::vector<cvm::real> volmaps_values;
111
113 std::vector<cvm::real> volmaps_new_colvar_forces;
114
116 std::vector<std::string> volmaps_filenames;
117
120
123};
124
125
126#endif
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:98
Container of grid-based objects.
Definition: colvarproxy_volmaps.h:10
int get_volmap_id(int index) const
Get the numeric ID of the given volumetric map (for the MD program)
Definition: colvarproxy_volmaps.h:58
int reset()
Clear volumetric map data.
Definition: colvarproxy_volmaps.cpp:30
cvm::real volmaps_rms_applied_force_
Root-mean-square of the the applied forces.
Definition: colvarproxy_volmaps.h:119
cvm::real get_engine_volmap_value(int index) const
Read the current value of the volumetric map.
Definition: colvarproxy_volmaps.h:64
virtual int init_internal_volmap_by_id(int volmap_id)
Definition: colvarproxy_volmaps.cpp:68
void compute_max_volmaps_applied_force()
Compute the maximum norm among all applied forces.
Definition: colvarproxy_volmaps.cpp:118
std::vector< int > volmaps_ids
Array of numeric IDs of volumetric maps (-1 if loaded internally)
Definition: colvarproxy_volmaps.h:104
virtual int request_engine_volmap_by_id(int volmap_id)
Definition: colvarproxy_volmaps.cpp:56
std::vector< std::string > volmaps_filenames
Names of files containing maps (empty when maps are loaded by MD engine)
Definition: colvarproxy_volmaps.h:116
virtual int clear_volmap(int index)
Used by the CVC destructors.
Definition: colvarproxy_volmaps.cpp:86
virtual int check_volmaps_available()
Test whether this implementation can use volumetric maps as CVs.
Definition: colvarproxy_volmaps.cpp:24
std::vector< size_t > volmaps_refcount
Keep track of how many times each vol map is used by a separate colvar object.
Definition: colvarproxy_volmaps.h:107
void apply_engine_volmap_force(int index, cvm::real const &new_force)
Request that this force is applied to the given volumetric map by the engine.
Definition: colvarproxy_volmaps.h:70
virtual int init_internal_volmap_by_name(std::string const &filename)
Definition: colvarproxy_volmaps.cpp:74
void compute_rms_volmaps_applied_force()
Compute the root-mean-square of the applied forces.
Definition: colvarproxy_volmaps.cpp:111
cvm::real volmaps_max_applied_force_
Maximum norm among all applied forces.
Definition: colvarproxy_volmaps.h:122
std::vector< cvm::real > volmaps_values
Current total values of the volmaps (when computed by the MD engine)
Definition: colvarproxy_volmaps.h:110
int add_volmap_slot(int volmap_id)
Create a slot for a volumetric map not requested yet.
Definition: colvarproxy_volmaps.cpp:45
virtual int load_internal_volmap_from_file(std::string const &filename)
Definition: colvarproxy_volmaps.cpp:80
virtual ~colvarproxy_volmaps()
Destructor.
Definition: colvarproxy_volmaps.cpp:21
virtual int request_engine_volmap_by_name(std::string const &volmap_name)
Definition: colvarproxy_volmaps.cpp:62
std::vector< cvm::real > volmaps_new_colvar_forces
Forces applied from colvars, to be communicated to the MD engine.
Definition: colvarproxy_volmaps.h:113
colvarproxy_volmaps()
Contructor.
Definition: colvarproxy_volmaps.cpp:15
virtual int compute_volmap(int flags, int volmap_index, cvm::atom_group *ag, cvm::real *value, cvm::real *atom_field)
Re-weigh an atomic field (e.g. a colvar) by the value of a volumetric map.
Definition: colvarproxy_volmaps.cpp:101
Store the information of a group of atoms in a structure-of-arrays (SoA) style.
Definition: colvaratoms.h:52
Collective variables main module.