Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

colvarproxy_volmaps.C

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 
00003 // This file is part of the Collective Variables module (Colvars).
00004 // The original version of Colvars and its updates are located at:
00005 // https://github.com/Colvars/colvars
00006 // Please update all Colvars source files before making any changes.
00007 // If you wish to distribute your changes, please submit them to the
00008 // Colvars repository at GitHub.
00009 
00010 #include "colvarmodule.h"
00011 #include "colvarproxy_volmaps.h"
00012 #include "colvarmodule_utils.h"
00013 
00014 
00015 colvarproxy_volmaps::colvarproxy_volmaps()
00016 {
00017   volmaps_rms_applied_force_ = volmaps_max_applied_force_ = 0.0;
00018 }
00019 
00020 
00021 colvarproxy_volmaps::~colvarproxy_volmaps() {}
00022 
00023 
00024 int colvarproxy_volmaps::volmaps_available()
00025 {
00026   return COLVARS_NOT_IMPLEMENTED;
00027 }
00028 
00029 
00030 int colvarproxy_volmaps::reset()
00031 {
00032   for (size_t i = 0; i < volmaps_ids.size(); i++) {
00033     clear_volmap(i);
00034   }
00035   volmaps_ids.clear();
00036   volmaps_refcount.clear();
00037   volmaps_values.clear();
00038   volmaps_new_colvar_forces.clear();
00039   return COLVARS_OK;
00040 }
00041 
00042 
00043 int colvarproxy_volmaps::add_volmap_slot(int volmap_id)
00044 {
00045   volmaps_ids.push_back(volmap_id);
00046   volmaps_refcount.push_back(1);
00047   volmaps_values.push_back(0.0);
00048   volmaps_new_colvar_forces.push_back(0.0);
00049   return (volmaps_ids.size() - 1);
00050 }
00051 
00052 
00053 int colvarproxy_volmaps::check_volmap_by_id(int /* volmap_id */)
00054 {
00055   return cvm::error("Error: selecting volumetric maps is not available.\n",
00056                     COLVARS_NOT_IMPLEMENTED);
00057 }
00058 
00059 
00060 int colvarproxy_volmaps::check_volmap_by_name(const char * /* volmap_name */)
00061 {
00062   return cvm::error("Error: selecting volumetric maps by name is not "
00063                     "available.\n", COLVARS_NOT_IMPLEMENTED);
00064 }
00065 
00066 
00067 int colvarproxy_volmaps::init_volmap_by_name(char const * /* volmap_name */)
00068 {
00069   return -1;
00070 }
00071 
00072 
00073 int colvarproxy_volmaps::init_volmap_by_id(int /* volmap_id */)
00074 {
00075   return -1;
00076 }
00077 
00078 
00079 int colvarproxy_volmaps::init_volmap_by_name(std::string const &volmap_name)
00080 {
00081   return init_volmap_by_name(volmap_name.c_str());
00082 }
00083 
00084 
00085 int colvarproxy_volmaps::check_volmap_by_name(std::string const &volmap_name)
00086 {
00087   return check_volmap_by_name(volmap_name.c_str());
00088 }
00089 
00090 
00091 void colvarproxy_volmaps::clear_volmap(int index)
00092 {
00093   if (((size_t) index) >= volmaps_ids.size()) {
00094     cvm::error("Error: trying to unrequest a volumetric map that was not "
00095                "previously requested.\n", COLVARS_INPUT_ERROR);
00096   }
00097 
00098   if (volmaps_refcount[index] > 0) {
00099     volmaps_refcount[index] -= 1;
00100   }
00101 }
00102 
00103 
00104 int colvarproxy_volmaps::get_volmap_id_from_name(char const *volmap_name)
00105 {
00106   // Raise error
00107   colvarproxy_volmaps::check_volmap_by_name(volmap_name);
00108   return -1;
00109 }
00110 
00111 
00112 int colvarproxy_volmaps::compute_volmap(int /* flags */,
00113                                         int /* volmap_id */,
00114                                         cvm::atom_iter /* atom_begin */,
00115                                         cvm::atom_iter /* atom_end */,
00116                                         cvm::real * /* value */,
00117                                         cvm::real * /* atom_field */)
00118 {
00119   return COLVARS_NOT_IMPLEMENTED;
00120 }
00121 
00122 
00123 void colvarproxy_volmaps::compute_rms_volmaps_applied_force()
00124 {
00125   volmaps_rms_applied_force_ =
00126     compute_norm2_stats<cvm::real, 0, false>(volmaps_new_colvar_forces);
00127 }
00128 
00129 
00130 void colvarproxy_volmaps::compute_max_volmaps_applied_force()
00131 {
00132   volmaps_max_applied_force_ =
00133     compute_norm2_stats<cvm::real, 1, false>(volmaps_new_colvar_forces);
00134 }

Generated on Thu Apr 25 02:42:21 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002