update colvars library to version 2016-06-14

This commit is contained in:
Axel Kohlmeyer
2016-06-17 08:30:12 -04:00
parent a3f8b258a0
commit da8b07b4f0
7 changed files with 35 additions and 46 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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) );

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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

View File

@ -63,8 +63,8 @@ template<typename TYPE> 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");
}
}