00001 // -*- c++ -*- 00002 00003 #ifndef COLVARPROXY_VOLMAPS_H 00004 #define COLVARPROXY_VOLMAPS_H 00005 00006 00008 class colvarproxy_volmaps { 00009 00010 public: 00011 00013 colvarproxy_volmaps(); 00014 00016 virtual ~colvarproxy_volmaps(); 00017 00019 int reset(); 00020 00022 virtual int volmaps_available(); 00023 00025 int add_volmap_slot(int volmap_id); 00026 00030 virtual int init_volmap_by_id(int volmap_id); 00031 00035 virtual int init_volmap_by_name(char const *volmap_name); 00036 00040 virtual int check_volmap_by_id(int volmap_id); 00041 00045 virtual int check_volmap_by_name(char const *volmap_name); 00046 00048 int init_volmap_by_name(std::string const &volmap_name); 00049 00051 int check_volmap_by_name(std::string const &volmap_name); 00052 00054 virtual void clear_volmap(int index); 00055 00057 virtual int get_volmap_id_from_name(char const *volmap_name); 00058 00060 inline int get_volmap_id(int index) const 00061 { 00062 return volmaps_ids[index]; 00063 } 00064 00066 inline cvm::real get_volmap_value(int index) const 00067 { 00068 return volmaps_values[index]; 00069 } 00070 00072 inline void apply_volmap_force(int index, cvm::real const &new_force) 00073 { 00074 volmaps_new_colvar_forces[index] += new_force; 00075 } 00076 00084 virtual int compute_volmap(int flags, 00085 int volmap_id, 00086 cvm::atom_iter atom_begin, 00087 cvm::atom_iter atom_end, 00088 cvm::real *value, 00089 cvm::real *atom_field); 00090 00092 enum { 00093 volmap_flag_null = 0, 00094 volmap_flag_gradients = 1, 00095 volmap_flag_use_atom_field = (1<<8) 00096 }; 00097 00099 void compute_rms_volmaps_applied_force(); 00100 00102 void compute_max_volmaps_applied_force(); 00103 00104 protected: 00105 00107 std::vector<int> volmaps_ids; 00108 00111 std::vector<size_t> volmaps_refcount; 00112 00114 std::vector<cvm::real> volmaps_values; 00115 00118 std::vector<cvm::real> volmaps_new_colvar_forces; 00119 00121 cvm::real volmaps_rms_applied_force_; 00122 00124 cvm::real volmaps_max_applied_force_; 00125 }; 00126 00127 00128 #endif