update colvars library to version 2016-07-05
This commit is contained in:
Binary file not shown.
@ -172,6 +172,7 @@ int colvarbias::add_colvar(std::string const &cv_name)
|
||||
int colvarbias::update()
|
||||
{
|
||||
// Note: if anything is added here, it should be added also in the SMP block of calc_biases()
|
||||
// TODO move here debug msg of bias update
|
||||
has_data = true;
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
@ -20,6 +20,8 @@ int colvarbias_abf::init(std::string const &conf)
|
||||
{
|
||||
colvarbias::init(conf);
|
||||
|
||||
provide(f_cvb_history_dependent);
|
||||
|
||||
// TODO relax this in case of VMD plugin
|
||||
if (cvm::temperature() == 0.0)
|
||||
cvm::log("WARNING: ABF should not be run without a thermostat or at 0 Kelvin!\n");
|
||||
@ -27,10 +29,18 @@ int colvarbias_abf::init(std::string const &conf)
|
||||
// ************* parsing general ABF options ***********************
|
||||
|
||||
get_keyval(conf, "applyBias", apply_bias, true);
|
||||
if (!apply_bias) cvm::log("WARNING: ABF biases will *not* be applied!\n");
|
||||
if (apply_bias) {
|
||||
enable(f_cvb_apply_force);
|
||||
} else {
|
||||
cvm::log("WARNING: ABF biases will *not* be applied!\n");
|
||||
}
|
||||
|
||||
get_keyval(conf, "updateBias", update_bias, true);
|
||||
if (!update_bias) cvm::log("WARNING: ABF biases will *not* be updated!\n");
|
||||
if (update_bias) {
|
||||
enable(f_cvb_history_dependent);
|
||||
} else {
|
||||
cvm::log("WARNING: ABF biases will *not* be updated!\n");
|
||||
}
|
||||
|
||||
get_keyval(conf, "hideJacobian", hide_Jacobian, false);
|
||||
if (hide_Jacobian) {
|
||||
@ -44,7 +54,7 @@ int colvarbias_abf::init(std::string const &conf)
|
||||
min_samples = full_samples / 2;
|
||||
// full_samples - min_samples >= 1 is guaranteed
|
||||
|
||||
get_keyval(conf, "inputPrefix", input_prefix, std::vector<std::string> ());
|
||||
get_keyval(conf, "inputPrefix", input_prefix, std::vector<std::string>());
|
||||
get_keyval(conf, "outputFreq", output_freq, cvm::restart_out_freq);
|
||||
get_keyval(conf, "historyFreq", history_freq, 0);
|
||||
b_history_files = (history_freq > 0);
|
||||
|
||||
@ -33,6 +33,8 @@ int colvarbias_alb::init(std::string const &conf)
|
||||
{
|
||||
colvarbias::init(conf);
|
||||
|
||||
provide(f_cvb_history_dependent);
|
||||
|
||||
size_t i;
|
||||
|
||||
// get the initial restraint centers
|
||||
@ -82,6 +84,8 @@ int colvarbias_alb::init(std::string const &conf)
|
||||
if (update_freq == 0)
|
||||
cvm::fatal_error("Error: must set updateFrequency to greater than 2.\n");
|
||||
|
||||
enable(f_cvb_history_dependent);
|
||||
|
||||
get_keyval(conf, "outputCenters", b_output_centers, false);
|
||||
get_keyval(conf, "outputGradient", b_output_grad, false);
|
||||
get_keyval(conf, "outputCoupling", b_output_coupling, true);
|
||||
|
||||
@ -17,6 +17,9 @@ int colvarbias_histogram::init(std::string const &conf)
|
||||
{
|
||||
colvarbias::init(conf);
|
||||
|
||||
provide(f_cvb_history_dependent);
|
||||
enable(f_cvb_history_dependent);
|
||||
|
||||
size_t i;
|
||||
|
||||
get_keyval(conf, "outputFile", out_name, std::string(""));
|
||||
@ -82,7 +85,6 @@ int colvarbias_histogram::init(std::string const &conf)
|
||||
}
|
||||
}
|
||||
|
||||
cvm::log("Finished histogram setup.\n");
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
@ -132,7 +134,7 @@ int colvarbias_histogram::update()
|
||||
// update indices for scalar values
|
||||
size_t i;
|
||||
for (i = 0; i < colvars.size(); i++) {
|
||||
bin[i] = grid->value_to_bin_scalar(colvars[i]->value(), i);
|
||||
bin[i] = grid->current_bin_scalar(i);
|
||||
}
|
||||
|
||||
if (grid->index_ok(bin)) {
|
||||
@ -143,7 +145,7 @@ int colvarbias_histogram::update()
|
||||
size_t iv, i;
|
||||
for (iv = 0; iv < colvar_array_size; iv++) {
|
||||
for (i = 0; i < colvars.size(); i++) {
|
||||
bin[i] = grid->value_to_bin_scalar(colvars[i]->value().vector1d_value[iv], i);
|
||||
bin[i] = grid->current_bin_scalar(i, iv);
|
||||
}
|
||||
|
||||
if (grid->index_ok(bin)) {
|
||||
|
||||
@ -37,18 +37,26 @@ int colvarbias_meta::init(std::string const &conf)
|
||||
{
|
||||
colvarbias::init(conf);
|
||||
|
||||
// TODO this relies on having initialized biases in alphabetical order
|
||||
if (cvm::n_abf_biases > 0)
|
||||
cvm::log("Warning: running ABF and metadynamics together is not recommended unless applyBias is off for ABF.\n");
|
||||
provide(f_cvb_history_dependent);
|
||||
|
||||
get_keyval(conf, "hillWeight", hill_weight, 0.0);
|
||||
if (hill_weight <= 0.0) {
|
||||
if (hill_weight > 0.0) {
|
||||
enable(f_cvb_apply_force);
|
||||
} else {
|
||||
cvm::error("Error: hillWeight must be provided, and a positive number.\n", INPUT_ERROR);
|
||||
}
|
||||
|
||||
get_keyval(conf, "newHillFrequency", new_hill_freq, 1000);
|
||||
if (new_hill_freq > 0) {
|
||||
enable(f_cvb_history_dependent);
|
||||
}
|
||||
|
||||
get_keyval(conf, "hillWidth", hill_width, std::sqrt(2.0 * PI) / 2.0);
|
||||
cvm::log("Half-widths of the Gaussian hills (sigma's):\n");
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
cvm::log(colvars[i]->name+std::string(": ")+
|
||||
cvm::to_str(0.5 * colvars[i]->width * hill_width));
|
||||
}
|
||||
|
||||
{
|
||||
bool b_replicas = false;
|
||||
|
||||
@ -563,6 +563,7 @@ cvm::real colvarbias_restraint_harmonic::restraint_convert_k(cvm::real k,
|
||||
}
|
||||
|
||||
|
||||
|
||||
colvarbias_restraint_linear::colvarbias_restraint_linear(char const *key)
|
||||
: colvarbias_restraint(key)
|
||||
{
|
||||
|
||||
@ -210,6 +210,8 @@ void cvm::deps::init_cvb_requires() {
|
||||
f_description(f_cvb_get_system_force, "obtain system force");
|
||||
f_req_children(f_cvb_get_system_force, f_cv_system_force);
|
||||
|
||||
f_description(f_cvb_history_dependent, "history-dependent");
|
||||
|
||||
// Initialize feature_states for each instance
|
||||
feature_states.reserve(f_cvb_ntot);
|
||||
for (i = 0; i < f_cvb_ntot; i++) {
|
||||
@ -217,6 +219,9 @@ void cvm::deps::init_cvb_requires() {
|
||||
// Most features are available, so we set them so
|
||||
// and list exceptions below
|
||||
}
|
||||
|
||||
// some biases are not history-dependent
|
||||
feature_states[f_cvb_history_dependent]->available = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -147,8 +147,9 @@ public:
|
||||
enum features_biases {
|
||||
/// \brief Bias is active
|
||||
f_cvb_active,
|
||||
f_cvb_apply_force,
|
||||
f_cvb_get_system_force,
|
||||
f_cvb_apply_force, // will apply forces
|
||||
f_cvb_get_system_force, // requires system forces
|
||||
f_cvb_history_dependent, // depends on simulation history
|
||||
f_cvb_ntot
|
||||
};
|
||||
|
||||
|
||||
@ -368,6 +368,14 @@ public:
|
||||
return value_to_bin_scalar(actual_value[i] ? cv[i]->actual_value() : cv[i]->value(), i);
|
||||
}
|
||||
|
||||
/// \brief Report the bin corresponding to the current value of item iv in variable i
|
||||
inline int current_bin_scalar(int const i, int const iv) const
|
||||
{
|
||||
return value_to_bin_scalar(actual_value[i] ?
|
||||
cv[i]->actual_value().vector1d_value[iv] :
|
||||
cv[i]->value().vector1d_value[iv], i);
|
||||
}
|
||||
|
||||
/// \brief Use the lower boundary and the width to report which bin
|
||||
/// the provided value is in
|
||||
inline int value_to_bin_scalar(colvarvalue const &value, const int i) const
|
||||
|
||||
@ -299,12 +299,27 @@ int colvarmodule::parse_biases(std::string const &conf)
|
||||
cvm::decrease_depth();
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < biases.size(); i++) {
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < biases.size(); i++) {
|
||||
biases[i]->enable(cvm::deps::f_cvb_active);
|
||||
if (cvm::debug())
|
||||
biases[i]->print_state();
|
||||
}
|
||||
|
||||
size_t n_hist_dep_biases = 0;
|
||||
for (i = 0; i < biases.size(); i++) {
|
||||
if (biases[i]->is_enabled(cvm::deps::f_cvb_apply_force) &&
|
||||
biases[i]->is_enabled(cvm::deps::f_cvb_history_dependent)) {
|
||||
n_hist_dep_biases++;
|
||||
}
|
||||
}
|
||||
if (n_hist_dep_biases) {
|
||||
cvm::log("WARNING: there are "+cvm::to_str(n_hist_dep_biases)+
|
||||
" history-dependent biases with non-zero force parameters; "
|
||||
"please make sure that their forces do not counteract each other.\n");
|
||||
}
|
||||
|
||||
if (biases.size() || use_scripted_forces) {
|
||||
cvm::log(cvm::line_marker);
|
||||
cvm::log("Collective variables biases initialized, "+
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#define COLVARMODULE_H
|
||||
|
||||
#ifndef COLVARS_VERSION
|
||||
#define COLVARS_VERSION "2016-06-23"
|
||||
#define COLVARS_VERSION "2016-07-05"
|
||||
#endif
|
||||
|
||||
#ifndef COLVARS_DEBUG
|
||||
|
||||
Reference in New Issue
Block a user