From da8b07b4f0906c337b1a077dfa1ccbcdfcf60b57 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 17 Jun 2016 08:30:12 -0400 Subject: [PATCH] update colvars library to version 2016-06-14 --- lib/colvars/colvarcomp.cpp | 5 +---- lib/colvars/colvarcomp.h | 19 ++++++++++--------- lib/colvars/colvarcomp_coordnums.cpp | 21 ++++++--------------- lib/colvars/colvarcomp_distances.cpp | 12 ++++-------- lib/colvars/colvardeps.cpp | 10 +++++++--- lib/colvars/colvarmodule.h | 2 +- lib/colvars/colvarparse.cpp | 12 ++++++------ 7 files changed, 35 insertions(+), 46 deletions(-) diff --git a/lib/colvars/colvarcomp.cpp b/lib/colvars/colvarcomp.cpp index 42936d606c..eec43d0963 100644 --- a/lib/colvars/colvarcomp.cpp +++ b/lib/colvars/colvarcomp.cpp @@ -68,6 +68,7 @@ cvm::atom_group *colvar::cvc::parse_group(std::string const &conf, group->key = group_key; if (b_try_scalable) { + // TODO rewrite this logic in terms of dependencies if (is_available(f_cvc_scalable_com) && is_available(f_cvc_com_based)) { enable(f_cvc_scalable_com); enable(f_cvc_scalable); @@ -109,10 +110,6 @@ int colvar::cvc::setup() add_child((cvm::deps *) atom_groups[i]); } - if (b_try_scalable && is_available(f_cvc_scalable)) { - enable(f_cvc_scalable); - } - return COLVARS_OK; } diff --git a/lib/colvars/colvarcomp.h b/lib/colvars/colvarcomp.h index 22e34d7ec0..1ed3c38924 100644 --- a/lib/colvars/colvarcomp.h +++ b/lib/colvars/colvarcomp.h @@ -293,12 +293,7 @@ inline void colvar::cvc::wrap(colvarvalue &x) const /// \brief Colvar component: distance between the centers of mass of /// two groups (colvarvalue::type_scalar type, range [0:*)) -/// -/// This class also serves as the template for many collective -/// variables with two atom groups: in this case, the -/// distance::distance() constructor should be called on the same -/// configuration string, to make the same member data and functions -/// available to the derived object + class colvar::distance : public colvar::cvc { @@ -315,7 +310,7 @@ protected: /// coupling to other colvars (see e.g. Ciccotti et al., 2005) bool b_1site_force; public: - distance(std::string const &conf, bool twogroups = true); + distance(std::string const &conf); distance(); virtual inline ~distance() {} virtual void calc_value(); @@ -764,9 +759,13 @@ public: /// \brief Colvar component: coordination number between two groups /// (colvarvalue::type_scalar type, range [0:N1*N2]) class colvar::coordnum - : public colvar::distance + : public colvar::cvc { protected: + /// First atom group + cvm::atom_group *group1; + /// Second atom group + cvm::atom_group *group2; /// \brief "Cutoff" for isotropic calculation (default) cvm::real r0; /// \brief "Cutoff vector" for anisotropic calculation @@ -819,9 +818,11 @@ public: /// \brief Colvar component: self-coordination number within a group /// (colvarvalue::type_scalar type, range [0:N*(N-1)/2]) class colvar::selfcoordnum - : public colvar::distance + : public colvar::cvc { protected: + /// First atom group + cvm::atom_group *group1; /// \brief "Cutoff" for isotropic calculation (default) cvm::real r0; /// Integer exponent of the function numerator diff --git a/lib/colvars/colvarcomp_coordnums.cpp b/lib/colvars/colvarcomp_coordnums.cpp index 4f42d88ff7..390cdc1e59 100644 --- a/lib/colvars/colvarcomp_coordnums.cpp +++ b/lib/colvars/colvarcomp_coordnums.cpp @@ -71,22 +71,18 @@ cvm::real colvar::coordnum::switching_function(cvm::rvector const &r0_vec, } - colvar::coordnum::coordnum(std::string const &conf) - : distance(conf), b_anisotropic(false), b_group2_center_only(false) + : cvc(conf), b_anisotropic(false), b_group2_center_only(false) { function_type = "coordnum"; x.type(colvarvalue::type_scalar); - // group1 and group2 are already initialized by distance() + group1 = parse_group(conf, "group1"); + group2 = parse_group(conf, "group2"); + if (group1->b_dummy) cvm::fatal_error("Error: only group2 is allowed to be a dummy atom\n"); - - // need to specify this explicitly because the distance() constructor - // has set it to true - feature_states[f_cvc_inv_gradient]->available = false; - bool const b_isotropic = get_keyval(conf, "cutoff", r0, cvm::real(4.0 * cvm::unit_angstrom())); @@ -291,17 +287,12 @@ void colvar::h_bond::apply_force(colvarvalue const &force) colvar::selfcoordnum::selfcoordnum(std::string const &conf) - : distance(conf, false) + : cvc(conf) { function_type = "selfcoordnum"; x.type(colvarvalue::type_scalar); - // group1 is already initialized by distance() - - // need to specify this explicitly because the distance() constructor - // has set it to true - feature_states[f_cvc_inv_gradient]->available = false; - + group1 = parse_group(conf, "group1"); get_keyval(conf, "cutoff", r0, cvm::real(4.0 * cvm::unit_angstrom())); get_keyval(conf, "expNumer", en, int(6) ); diff --git a/lib/colvars/colvarcomp_distances.cpp b/lib/colvars/colvarcomp_distances.cpp index 4f9af72b6d..ff6b03e2c5 100644 --- a/lib/colvars/colvarcomp_distances.cpp +++ b/lib/colvars/colvarcomp_distances.cpp @@ -10,10 +10,7 @@ -// "twogroup" flag defaults to true; set to false by selfCoordNum -// (only distance-derived component based on only one group) - -colvar::distance::distance(std::string const &conf, bool twogroups) +colvar::distance::distance(std::string const &conf) : cvc(conf) { function_type = "distance"; @@ -24,13 +21,12 @@ colvar::distance::distance(std::string const &conf, bool twogroups) if (get_keyval(conf, "forceNoPBC", b_no_PBC, false)) { cvm::log("Computing distance using absolute positions (not minimal-image)"); } - if (twogroups && get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) { + if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) { cvm::log("Computing system force on group 1 only"); } group1 = parse_group(conf, "group1"); - if (twogroups) { - group2 = parse_group(conf, "group2"); - } + group2 = parse_group(conf, "group2"); + x.type(colvarvalue::type_scalar); } diff --git a/lib/colvars/colvardeps.cpp b/lib/colvars/colvardeps.cpp index 00724e8716..b5d9e09270 100644 --- a/lib/colvars/colvardeps.cpp +++ b/lib/colvars/colvardeps.cpp @@ -362,11 +362,15 @@ void cvm::deps::init_cvc_requires() { f_description(f_cvc_Jacobian, "Jacobian"); f_req_self(f_cvc_Jacobian, f_cvc_inv_gradient); - f_description(f_cvc_scalable, "scalable calculation"); - f_description(f_cvc_scalable_com, "scalable calculation of centers of mass"); + f_description(f_cvc_com_based, "depends on group centers of mass"); + f_description(f_cvc_scalable, "scalable calculation"); f_req_self(f_cvc_scalable, f_cvc_scalable_com); + f_description(f_cvc_scalable_com, "scalable calculation of centers of mass"); + f_req_self(f_cvc_scalable_com, f_cvc_com_based); + + // TODO only enable this when f_ag_scalable can be turned on for a pre-initialized group // f_req_children(f_cvc_scalable, f_ag_scalable); // f_req_children(f_cvc_scalable_com, f_ag_scalable_com); @@ -380,9 +384,9 @@ void cvm::deps::init_cvc_requires() { } // Features that are implemented by all cvcs by default + // Each cvc specifies what other features are available feature_states[f_cvc_active]->available = true; feature_states[f_cvc_gradient]->available = true; - // Each cvc specifies what other features are available feature_states[f_cvc_scalable_com]->available = (proxy->scalable_group_coms() == COLVARS_OK); feature_states[f_cvc_scalable]->available = feature_states[f_cvc_scalable_com]->available; } diff --git a/lib/colvars/colvarmodule.h b/lib/colvars/colvarmodule.h index b398144c4e..de95a8b95a 100644 --- a/lib/colvars/colvarmodule.h +++ b/lib/colvars/colvarmodule.h @@ -4,7 +4,7 @@ #define COLVARMODULE_H #ifndef COLVARS_VERSION -#define COLVARS_VERSION "2016-06-09" +#define COLVARS_VERSION "2016-06-14" #endif #ifndef COLVARS_DEBUG diff --git a/lib/colvars/colvarparse.cpp b/lib/colvars/colvarparse.cpp index 1ff0661ef3..ce87265b86 100644 --- a/lib/colvars/colvarparse.cpp +++ b/lib/colvars/colvarparse.cpp @@ -63,8 +63,8 @@ template bool colvarparse::_get_keyval_scalar_(std::string const } value = def_value; if (parse_mode != parse_silent) { - cvm::log("# "+std::string(key)+" = \""+ - cvm::to_str(def_value)+"\" [default]\n"); + cvm::log("# "+std::string(key)+" = "+ + cvm::to_str(def_value)+" [default]\n"); } } @@ -114,8 +114,8 @@ bool colvarparse::_get_keyval_scalar_string_(std::string const &conf, std::string(key)+"\".\n", INPUT_ERROR); } if (parse_mode != parse_silent) { - cvm::log("# "+std::string(key)+" = "+ - cvm::to_str(value)+"\n"); + cvm::log("# "+std::string(key)+" = \""+ + cvm::to_str(value)+"\"\n"); } } else { @@ -125,8 +125,8 @@ bool colvarparse::_get_keyval_scalar_string_(std::string const &conf, } value = def_value; if (parse_mode != parse_silent) { - cvm::log("# "+std::string(key)+" = "+ - cvm::to_str(def_value)+" [default]\n"); + cvm::log("# "+std::string(key)+" = \""+ + cvm::to_str(def_value)+"\" [default]\n"); } }