From 94fdd3103c1a8d8a59e4d8437c22eaf36cf0a728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Fri, 2 Dec 2022 11:03:30 +0100 Subject: [PATCH 01/13] First version of NAMD lambda-dynamics Save pointer to NAMD Controller in proxy this is necessary for accessing the Controller from threads other than 0 Simplify accelMD call Use alch lambda value from state file Dependencies updates and fixes - distinguish f_cv_gradient and f_cv_apply_force - rename external cvs "driven" - fix bug where error messages were not informative for complex dependency resolution failures Lambda-dynamics improvements - add total_force_current_step feature - follow lambda value from back-end Remove unused variables Enable scriptedColvarforces in ABMD script Allow scripted forces on external param Print unscaled biasing force in MTS --- colvartools/abmd.tcl | 2 +- namd/src/colvarproxy_namd.C | 57 +++++++++++++++++++---- namd/src/colvarproxy_namd.h | 15 ++++++ src/colvar.cpp | 75 ++++++++++++++++++++---------- src/colvar.h | 2 +- src/colvarbias.cpp | 11 +++-- src/colvarbias_abf.cpp | 41 ++++++++-------- src/colvarcomp.cpp | 3 +- src/colvarcomp.h | 3 +- src/colvarcomp_alchlambda.cpp | 32 ++++++++++--- src/colvardeps.cpp | 34 ++++++++------ src/colvardeps.h | 20 ++++++-- src/colvarmodule.cpp | 2 +- src/colvarproxy_system.h | 5 ++ src/colvarscript_commands.h | 2 +- src/colvarscript_commands_colvar.h | 1 + 16 files changed, 216 insertions(+), 89 deletions(-) diff --git a/colvartools/abmd.tcl b/colvartools/abmd.tcl index 17fb4453e..3bca4d6d0 100644 --- a/colvartools/abmd.tcl +++ b/colvartools/abmd.tcl @@ -53,7 +53,7 @@ proc calc_z_max_gradient { args } { return 0 } proc calc_z_min_gradient { args } { return 0 } proc setup_ABMD { colvar force_k z_stop {direction up} } { - # cv config "scriptedColvarForces on" + cv config "scriptedColvarForces on" namespace eval ::ABMD {} set ::ABMD::cvname $colvar diff --git a/namd/src/colvarproxy_namd.C b/namd/src/colvarproxy_namd.C index 4e44f63a3..41a32ae70 100644 --- a/namd/src/colvarproxy_namd.C +++ b/namd/src/colvarproxy_namd.C @@ -345,6 +345,8 @@ void colvarproxy_namd::calculate() colvars->update_engine_parameters(); colvars->setup_input(); colvars->setup_output(); + // Controller is only available after full startup phase, so now + controller = &Node::Object()->state->getController(); first_timestep = false; @@ -373,7 +375,7 @@ void colvarproxy_namd::calculate() } previous_NAMD_step = step; - update_accelMD_info(); + if (accelMDOn) update_accelMD_info(); { Vector const a = lattice->a(); @@ -605,14 +607,8 @@ void colvarproxy_namd::calculate() } void colvarproxy_namd::update_accelMD_info() { - if (accelMDOn == false) { - return; - } - const Controller& c = Node::Object()->state->getController(); // This aMD factor is from previous step! - amd_weight_factor = std::exp(c.accelMDdV / - (target_temperature() * boltzmann())); -// std::cout << "Step: " << cvm::to_str(colvars->it) << " accelMD dV in colvars: " << c.accelMDdV << std::endl; + amd_weight_factor = std::exp(controller->accelMDdV / (target_temperature() * boltzmann())); } @@ -1651,3 +1647,48 @@ int colvarproxy_namd::replica_comm_send(char* msg_data, int msg_len, replica_send(msg_data, msg_len, dest_rep, CkMyPe()); return msg_len; } + + +/// Request energy computation every freq steps +int colvarproxy_namd::request_alch_energy_freq(int const freq) { + // This test is only valid for NAMD3 + if (freq % simparams->computeEnergies) { + cvm::error("computeEnergies must be a divisor of lambda-dynamics period (" + cvm::to_str(freq) + ").\n"); + return COLVARS_INPUT_ERROR; + } + if (!simparams->alchOn) { + cvm::error("alch must be enabled for lambda-dynamics.\n"); + return COLVARS_INPUT_ERROR; + } + if (!simparams->alchThermIntOn) { + cvm::error("alchType must be set to TI for lambda-dynamics.\n"); + return COLVARS_INPUT_ERROR; + } + return COLVARS_OK; +} + + +/// Get value of alchemical lambda parameter from back-end +int colvarproxy_namd::get_alch_lambda(cvm::real* lambda) { + *lambda = simparams->alchLambda; + return COLVARS_OK; +} + + +/// Set value of alchemical lambda parameter in back-end +int colvarproxy_namd::send_alch_lambda(void) { + simparams->alchLambda = cached_alch_lambda; + return COLVARS_OK; +} + + +/// Get energy derivative with respect to lambda +int colvarproxy_namd::get_dE_dlambda(cvm::real* dE_dlambda) { + // Force data at step zero is garbage in NAMD3, zero in NAMD2 + if (cvm::step_relative() > 0) { + *dE_dlambda = controller->getTIderivative(); + } else { + *dE_dlambda = 0.0; + } + return COLVARS_OK; +} diff --git a/namd/src/colvarproxy_namd.h b/namd/src/colvarproxy_namd.h index 3aff50295..85986dc01 100644 --- a/namd/src/colvarproxy_namd.h +++ b/namd/src/colvarproxy_namd.h @@ -46,6 +46,9 @@ class colvarproxy_namd : public colvarproxy, public GlobalMaster { /// Pointer to the NAMD simulation input object SimParameters *simparams; + /// Pointer to Controller object + Controller const *controller; + /// NAMD-style PRNG object Random random; @@ -266,6 +269,18 @@ class colvarproxy_namd : public colvarproxy, public GlobalMaster { int backup_file(char const *filename) override; + /// Get value of alchemical lambda parameter from back-end + int get_alch_lambda(cvm::real* lambda); + + /// Set value of alchemical lambda parameter in back-end + int send_alch_lambda(void); + + /// Request energy computation every freq steps + int request_alch_energy_freq(int const freq); + + /// Get energy derivative with respect to lambda + int get_dE_dlambda(cvm::real* dE_dlambda); + }; diff --git a/src/colvar.cpp b/src/colvar.cpp index 7e85eeb3b..e670e0adc 100644 --- a/src/colvar.cpp +++ b/src/colvar.cpp @@ -182,12 +182,6 @@ int colvar::init(std::string const &conf) set_enabled(f_cv_scalar, (value().type() == colvarvalue::type_scalar)); - // If using scripted biases, any colvar may receive bias forces - // and will need its gradient - if (cvm::scripted_forces()) { - enable(f_cv_gradient); - } - // check for linear combinations { bool lin = !(is_enabled(f_cv_scripted) || is_enabled(f_cv_custom_function)); @@ -320,6 +314,11 @@ int colvar::init(std::string const &conf) enable(f_cv_external); } + // If using scripted biases, any colvar may receive bias forces + if (cvm::scripted_forces()) { + enable(f_cv_apply_force); + } + error_code |= init_extended_Lagrangian(conf); error_code |= init_output_flags(conf); @@ -693,14 +692,15 @@ int colvar::init_extended_Lagrangian(std::string const &conf) x_ext.type(colvarvalue::type_notset); v_ext.type(value()); fr.type(value()); - const bool temp_provided = get_keyval(conf, "extendedTemp", temp, - proxy->target_temperature()); + const bool temp_provided = get_keyval(conf, "extendedTemp", temp, proxy->target_temperature()); if (is_enabled(f_cv_external)) { - // In the case of an "external" coordinate, there is no coupling potential: + // In the case of a driven external parameter in the back-end, there is no coupling potential: // only the fictitious mass is meaningful get_keyval(conf, "extendedMass", ext_mass); // Ensure that the computed restraint energy term is zero ext_force_k = 0.0; + // Then we need forces from the back-end + enable(f_cv_total_force_calc); } else { // Standard case of coupling to a geometric colvar if (temp <= 0.0) { // Then a finite temperature is required @@ -1135,6 +1135,9 @@ int colvar::init_dependencies() { init_feature(f_cv_gradient, "gradient", f_type_dynamic); require_feature_children(f_cv_gradient, f_cvc_gradient); + init_feature(f_cv_apply_force, "apply_force", f_type_dynamic); + require_feature_alt(f_cv_apply_force, f_cv_gradient, f_cv_external); + init_feature(f_cv_collect_gradient, "collect_gradient", f_type_dynamic); require_feature_self(f_cv_collect_gradient, f_cv_gradient); require_feature_self(f_cv_collect_gradient, f_cv_scalar); @@ -1153,6 +1156,8 @@ int colvar::init_dependencies() { init_feature(f_cv_total_force, "total_force", f_type_dynamic); require_feature_alt(f_cv_total_force, f_cv_extended_Lagrangian, f_cv_total_force_calc); + init_feature(f_cv_total_force_current_step, "total_force_current_step", f_type_dynamic); + // Deps for explicit total force calculation init_feature(f_cv_total_force_calc, "total_force_calculation", f_type_dynamic); require_feature_self(f_cv_total_force_calc, f_cv_scalar); @@ -1171,13 +1176,15 @@ int colvar::init_dependencies() { init_feature(f_cv_extended_Lagrangian, "extended_Lagrangian", f_type_user); require_feature_self(f_cv_extended_Lagrangian, f_cv_scalar); - require_feature_self(f_cv_extended_Lagrangian, f_cv_gradient); + require_feature_self(f_cv_extended_Lagrangian, f_cv_apply_force); init_feature(f_cv_Langevin, "Langevin_dynamics", f_type_user); require_feature_self(f_cv_Langevin, f_cv_extended_Lagrangian); - init_feature(f_cv_external, "external", f_type_user); + init_feature(f_cv_external, "external_parameter", f_type_static); require_feature_self(f_cv_external, f_cv_single_cvc); + // External parameters always report the total force for current step + require_feature_self(f_cv_external, f_cv_total_force_current_step); init_feature(f_cv_single_cvc, "single_component", f_type_static); @@ -1238,10 +1245,16 @@ int colvar::init_dependencies() { init_feature(f_cv_linear, "linear", f_type_static); init_feature(f_cv_homogeneous, "homogeneous", f_type_static); - // because total forces are obtained from the previous time step, - // we cannot (currently) have colvar values and total forces for the same timestep init_feature(f_cv_multiple_ts, "multiple_timestep", f_type_static); - exclude_feature_self(f_cv_multiple_ts, f_cv_total_force_calc); + + // when total atomic forces are obtained from the previous time step, + // we cannot (currently) have colvar values and projected total forces for the same timestep + // TODO this will need refining for driven alchemical parameters + // ie. the combination of f_cv_total_force_calc and f_cv_multiple_ts requires f_cv_total_force_current_step + // or we need to anticipate the total force request by one timestep + if (!cvm::main()->proxy->total_forces_same_step()) { + exclude_feature_self(f_cv_multiple_ts, f_cv_total_force_calc); + } // check that everything is initialized for (i = 0; i < colvardeps::f_cv_ntot; i++) { @@ -1262,6 +1275,10 @@ int colvar::init_dependencies() { feature_states[f_cv_fdiff_velocity].available = cvm::main()->proxy->simulation_running(); + // Some back-ends report current total forces for all colvars + if (cvm::main()->proxy->total_forces_same_step()) + enable(f_cv_total_force_current_step); + return COLVARS_OK; } @@ -1388,7 +1405,6 @@ int colvar::calc_cvcs(int first_cvc, size_t num_cvcs) cvm::log("Calculating colvar \""+this->name+"\", components "+ cvm::to_str(first_cvc)+" through "+cvm::to_str(first_cvc+num_cvcs)+".\n"); - colvarproxy *proxy = cvm::main()->proxy; int error_code = COLVARS_OK; error_code |= check_cvc_range(first_cvc, num_cvcs); @@ -1396,7 +1412,7 @@ int colvar::calc_cvcs(int first_cvc, size_t num_cvcs) return error_code; } - if ((cvm::step_relative() > 0) && (!proxy->total_forces_same_step())){ + if ((cvm::step_relative() > 0) && (!is_enabled(f_cv_total_force_current_step))){ // Use Jacobian derivative from previous timestep error_code |= calc_cvc_total_force(first_cvc, num_cvcs); } @@ -1404,7 +1420,7 @@ int colvar::calc_cvcs(int first_cvc, size_t num_cvcs) error_code |= calc_cvc_values(first_cvc, num_cvcs); error_code |= calc_cvc_gradients(first_cvc, num_cvcs); error_code |= calc_cvc_Jacobians(first_cvc, num_cvcs); - if (proxy->total_forces_same_step()){ + if (is_enabled(f_cv_total_force_current_step)){ // Use Jacobian derivative from this timestep error_code |= calc_cvc_total_force(first_cvc, num_cvcs); } @@ -1421,10 +1437,9 @@ int colvar::collect_cvc_data() if (cvm::debug()) cvm::log("Calculating colvar \""+this->name+"\"'s properties.\n"); - colvarproxy *proxy = cvm::main()->proxy; int error_code = COLVARS_OK; - if ((cvm::step_relative() > 0) && (!proxy->total_forces_same_step())){ + if ((cvm::step_relative() > 0) && (!is_enabled(f_cv_total_force_current_step))){ // Total force depends on Jacobian derivative from previous timestep // collect_cvc_total_forces() uses the previous value of jd error_code |= collect_cvc_total_forces(); @@ -1432,7 +1447,7 @@ int colvar::collect_cvc_data() error_code |= collect_cvc_values(); error_code |= collect_cvc_gradients(); error_code |= collect_cvc_Jacobians(); - if (proxy->total_forces_same_step()){ + if (is_enabled(f_cv_total_force_current_step)){ // Use Jacobian derivative from this timestep error_code |= collect_cvc_total_forces(); } @@ -1871,13 +1886,13 @@ void colvar::update_extended_Lagrangian() f += fb_actual; } - // fr: bias force on extended variable (without harmonic spring), for output in trajectory - fr = f; - // External force has been scaled for an inner-timestep impulse (for the back-end integrator) // here we scale it back because this integrator uses only the outer (long) timestep f_ext = f / cvm::real(time_step_factor); + // fr: bias force on extended variable (without harmonic spring), for output in trajectory + fr = f_ext; + colvarvalue f_system(fr.type()); // force exterted by the system on the extended DOF if (is_enabled(f_cv_external)) { @@ -2382,6 +2397,10 @@ int colvar::set_state_params(std::string const &conf) cvm::to_str(x)+"\n"); x_restart = x; after_restart = true; + // Externally driven cv (e.g. alchemical lambda) is imposed by restart value + if (is_enabled(f_cv_external) && is_enabled(f_cv_extended_Lagrangian)) { + cvcs[0]->set_value(x); + } } if (is_enabled(f_cv_extended_Lagrangian)) { @@ -2524,8 +2543,14 @@ std::string const colvar::get_state_params() const os << " name " << name << "\n" << " x " << std::setprecision(cvm::cv_prec) - << std::setw(cvm::cv_width) - << x << "\n"; + << std::setw(cvm::cv_width); + if (is_enabled(f_cv_external)) { + // For an external colvar, x is one timestep in the future after integration + // write x at beginning of timestep + os << x_reported << "\n"; + } else { + os << x << "\n"; + } if (is_enabled(f_cv_output_velocity)) { os << " v " diff --git a/src/colvar.h b/src/colvar.h index 3c08b5cc5..1db313f41 100644 --- a/src/colvar.h +++ b/src/colvar.h @@ -760,7 +760,7 @@ inline colvarvalue const & colvar::total_force() const inline void colvar::add_bias_force(colvarvalue const &force) { - check_enabled(f_cv_gradient, + check_enabled(f_cv_apply_force, std::string("applying a force to the variable \""+name+"\"")); if (cvm::debug()) { cvm::log("Adding biasing force "+cvm::to_str(force)+" to colvar \""+name+"\".\n"); diff --git a/src/colvarbias.cpp b/src/colvarbias.cpp index be3e3f37d..606c772b6 100644 --- a/src/colvarbias.cpp +++ b/src/colvarbias.cpp @@ -93,11 +93,18 @@ int colvarbias::init(std::string const &conf) cvm::log("Reinitializing bias \""+name+"\".\n"); } + feature_states[f_cvb_step_zero_data].available = true; + colvar_values.resize(num_variables()); for (i = 0; i < num_variables(); i++) { colvar_values[i].type(colvars[i]->value().type()); colvar_forces[i].type(colvar_values[i].type()); previous_colvar_forces[i].type(colvar_values[i].type()); + if (!colvars[i]->is_enabled(f_cv_total_force_current_step)) { + // If any colvar does not have current-step total force, then + // we can't do step 0 data + feature_states[f_cvb_step_zero_data].available = false; + } } output_prefix = cvm::output_prefix(); @@ -157,7 +164,7 @@ int colvarbias::init_dependencies() { init_feature(f_cvb_step_zero_data, "step_zero_data", f_type_user); init_feature(f_cvb_apply_force, "apply_force", f_type_user); - require_feature_children(f_cvb_apply_force, f_cv_gradient); + require_feature_children(f_cvb_apply_force, f_cv_apply_force); init_feature(f_cvb_bypass_ext_lagrangian, "bypass_extended_Lagrangian_coordinates", f_type_user); @@ -221,8 +228,6 @@ int colvarbias::init_dependencies() { // The feature f_cvb_bypass_ext_lagrangian is only implemented by some derived classes // (initially, harmonicWalls) feature_states[f_cvb_bypass_ext_lagrangian].available = false; - // disabled by default; can be changed by derived classes that implement it - feature_states[f_cvb_bypass_ext_lagrangian].enabled = false; return COLVARS_OK; } diff --git a/src/colvarbias_abf.cpp b/src/colvarbias_abf.cpp index db6ee6d57..7f4fd2e09 100644 --- a/src/colvarbias_abf.cpp +++ b/src/colvarbias_abf.cpp @@ -130,10 +130,11 @@ int colvarbias_abf::init(std::string const &conf) colvars[i]->enable(f_cv_hide_Jacobian); } - // If any colvar is extended-system, we need to collect the extended - // system gradient - if (colvars[i]->is_enabled(f_cv_extended_Lagrangian)) + // If any colvar is extended-system (restrained, not driven external param), we are running eABF + if (colvars[i]->is_enabled(f_cv_extended_Lagrangian) + && !colvars[i]->is_enabled(f_cv_external)) { enable(f_cvb_extended); + } // Cannot mix and match coarse time steps with ABF because it gives // wrong total force averages - total force needs to be averaged over @@ -321,17 +322,25 @@ int colvarbias_abf::update() size_t i; for (i = 0; i < num_variables(); i++) { bin[i] = samples->current_bin_scalar(i); + if (colvars[i]->is_enabled(f_cv_total_force_current_step)) { + force_bin[i] = bin[i]; + } } - // *********************************************************** // ****** ABF Part I: update the FE gradient estimate ****** // *********************************************************** - if (cvm::proxy->total_forces_same_step()) { - // e.g. in LAMMPS, total forces are current - force_bin = bin; + // Share data first, so that 2d/3d PMF is refreshed using new data for mw-pABF. + // shared_on can be true with shared_freq 0 if we are sharing via script + if (shared_on && shared_freq && + shared_last_step >= 0 && // we have already collected some data + cvm::step_absolute() > shared_last_step && // time has passed since the last sharing timestep + // (avoid re-sharing at last and first ts of successive run statements) + cvm::step_absolute() % shared_freq == 0) { + // Share gradients and samples for shared ABF. + replica_share(); } if (can_accumulate_data() && is_enabled(f_cvb_history_dependent)) { @@ -374,21 +383,11 @@ int colvarbias_abf::update() } } - if (!(cvm::proxy->total_forces_same_step())) { - // e.g. in NAMD, total forces will be available for next timestep - // hence we store the current colvar bin - force_bin = bin; - } + // In some cases, total forces are stored for next timestep + // hence we store the current colvar bin - this is overwritten on a per-colvar basis + // at the top of update() + force_bin = bin; - // Share data after force sample is collected for this time step - // shared_on can be true with shared_freq 0 if we are sharing via script - if (shared_on && shared_freq && - cvm::step_absolute() > shared_last_step && // time has passed since the last sharing timestep - // (avoid re-sharing at last and first ts of successive run statements) - cvm::step_absolute() % shared_freq == 0) { - // Share gradients and samples for shared ABF. - replica_share(); - } // ****************************************************************** // ****** ABF Part II: calculate and apply the biasing force ****** diff --git a/src/colvarcomp.cpp b/src/colvarcomp.cpp index 024c00e50..9a056f7dd 100644 --- a/src/colvarcomp.cpp +++ b/src/colvarcomp.cpp @@ -261,7 +261,6 @@ int colvar::cvc::init_dependencies() { require_feature_children(f_cvc_explicit_gradient, f_ag_explicit_gradient); init_feature(f_cvc_inv_gradient, "inverse_gradient", f_type_dynamic); - require_feature_self(f_cvc_inv_gradient, f_cvc_gradient); init_feature(f_cvc_debug_gradient, "debug_gradient", f_type_user); require_feature_self(f_cvc_debug_gradient, f_cvc_gradient); @@ -525,7 +524,7 @@ void colvar::cvc::calc_force_invgrads() void colvar::cvc::calc_Jacobian_derivative() { - cvm::error("Error: calculation of inverse gradients is not implemented " + cvm::error("Error: calculation of Jacobian derivatives is not implemented " "for colvar components of type \""+function_type()+"\".\n", COLVARS_NOT_IMPLEMENTED); } diff --git a/src/colvarcomp.h b/src/colvarcomp.h index 334fdc1f6..e47a2a76d 100644 --- a/src/colvarcomp.h +++ b/src/colvarcomp.h @@ -1214,7 +1214,8 @@ class colvar::alch_lambda alch_lambda(); virtual ~alch_lambda() {} virtual void calc_value(); - virtual void calc_gradients(); + virtual void calc_force_invgrads(); + virtual void calc_Jacobian_derivative(); virtual void apply_force(colvarvalue const &force); }; diff --git a/src/colvarcomp_alchlambda.cpp b/src/colvarcomp_alchlambda.cpp index a175ea43e..d9d08df5c 100644 --- a/src/colvarcomp_alchlambda.cpp +++ b/src/colvarcomp_alchlambda.cpp @@ -20,19 +20,32 @@ colvar::alch_lambda::alch_lambda() { set_function_type("alchLambda"); - disable(f_cvc_explicit_gradient); - disable(f_cvc_gradient); + provide(f_cvc_explicit_gradient, false); + provide(f_cvc_gradient, false); // Cannot apply forces on this CVC + provide(f_cvc_collect_atom_ids, false); + + provide(f_cvc_inv_gradient); // Projected force is TI derivative + provide(f_cvc_Jacobian); // Zero x.type(colvarvalue::type_scalar); - // Query initial value from back-end + + // We need calculation every time step + // default in Tinker-HP and NAMD2, must be enforced in NAMD3 + // Also checks back-end settings, ie. that alchemy is enabled + // (in NAMD3: alchType TI, computeEnergies at the right frequency) + cvm::proxy->request_alch_energy_freq(1); + // TODO examine how this breaks everything - whereas alchOutFreq seems to work + + // Query initial value from back-end; will be overwritten if restarting from a state file cvm::proxy->get_alch_lambda(&x.real_value); } void colvar::alch_lambda::calc_value() { - // Special workflow: - // at the beginning of the timestep we get a force instead of calculating the value + // By default, follow external parameter + // This might get overwritten by driving extended dynamics + cvm::proxy->get_alch_lambda(&x.real_value); cvm::proxy->get_dE_dlambda(&ft.real_value); ft.real_value *= -1.0; // Energy derivative to force @@ -43,8 +56,15 @@ void colvar::alch_lambda::calc_value() } -void colvar::alch_lambda::calc_gradients() +void colvar::alch_lambda::calc_force_invgrads() +{ + // All the work is done in calc_value() +} + + +void colvar::alch_lambda::calc_Jacobian_derivative() { + jd = 0.0; } diff --git a/src/colvardeps.cpp b/src/colvardeps.cpp index 46b791756..56d285a21 100644 --- a/src/colvardeps.cpp +++ b/src/colvardeps.cpp @@ -92,6 +92,8 @@ void colvardeps::restore_children_deps() { void colvardeps::provide(int feature_id, bool truefalse) { feature_states[feature_id].available = truefalse; + // Make sure that we don't leave this feature enabled + if (!truefalse) disable(feature_id); } @@ -123,8 +125,9 @@ bool colvardeps::get_keyval_feature(colvarparse *cvp, int colvardeps::enable(int feature_id, - bool dry_run /* default: false */, - bool toplevel /* default: true */) + bool dry_run /* default: false */, + bool toplevel /* default: true */, + bool error /*default: false */) { int res; size_t i, j; @@ -137,9 +140,12 @@ int colvardeps::enable(int feature_id, feature *f = features()[feature_id]; feature_state *fs = &feature_states[feature_id]; + // dry_run can be true because parent object is not active, yet we are displaying an error message + // then error is set to true + if (cvm::debug()) { cvm::log("DEPS: " + description + - (dry_run ? " testing " : " enabling ") + + (dry_run ? " testing " : " enabling ") + (error ? " [error] " : "") + "\"" + f->description +"\"\n"); } @@ -159,7 +165,7 @@ int colvardeps::enable(int feature_id, (is_dynamic(feature_id) ? "Dynamic" : "User-controlled"); if (!fs->available) { - if (!dry_run) { + if (!dry_run || error) { if (toplevel) { cvm::error("Error: " + feature_type_descr + " feature unavailable: \"" + f->description + "\" in " + description + ".\n"); @@ -172,7 +178,7 @@ int colvardeps::enable(int feature_id, } if (!toplevel && !is_dynamic(feature_id)) { - if (!dry_run) { + if (!dry_run || error) { cvm::log(feature_type_descr + " feature \"" + f->description + "\" cannot be enabled automatically in " + description + ".\n"); if (is_user(feature_id)) { @@ -189,7 +195,7 @@ int colvardeps::enable(int feature_id, if (cvm::debug()) cvm::log(f->description + " requires exclude " + g->description + "\n"); if (is_enabled(f->requires_exclude[i])) { - if (!dry_run) { + if (!dry_run || error) { cvm::log("Feature \"" + f->description + "\" is incompatible with \"" + g->description + "\" in " + description + ".\n"); if (toplevel) { @@ -204,9 +210,9 @@ int colvardeps::enable(int feature_id, for (i=0; irequires_self.size(); i++) { if (cvm::debug()) cvm::log(f->description + " requires self " + features()[f->requires_self[i]]->description + "\n"); - res = enable(f->requires_self[i], dry_run, false); + res = enable(f->requires_self[i], dry_run, false, error); if (res != COLVARS_OK) { - if (!dry_run) { + if (!dry_run || error) { cvm::log("...required by \"" + f->description + "\" in " + description + "\n"); if (toplevel) { cvm::error("Error: Failed dependency in " + description + ".\n"); @@ -225,11 +231,11 @@ int colvardeps::enable(int feature_id, int g = f->requires_alt[i][j]; if (cvm::debug()) cvm::log(f->description + " requires alt " + features()[g]->description + "\n"); - res = enable(g, true, false); // see if available + res = enable(g, true, false, error); // see if available if (res == COLVARS_OK) { ok = true; - if (!dry_run) { - enable(g, false, false); // Require again, for real + if (!dry_run || error) { + enable(g, false, false, error); // Require again, for real fs->alternate_refs.push_back(g); // We remember we enabled this // so we can free it if this feature gets disabled } @@ -245,7 +251,7 @@ int colvardeps::enable(int feature_id, for (j=0; jrequires_alt[i].size(); j++) { int g = f->requires_alt[i][j]; cvm::log(cvm::to_str(j+1) + ". " + features()[g]->description + "\n"); - enable(g, false, false); // Just for printing error output + enable(g, false, false, true); // Just for printing error output } cvm::decrease_depth(); cvm::log("-----------------------------------------\n"); @@ -264,9 +270,9 @@ int colvardeps::enable(int feature_id, for (i=0; irequires_children.size(); i++) { int g = f->requires_children[i]; for (j=0; jenable(g, dry_run || !is_enabled(), false); + res = children[j]->enable(g, dry_run || !is_enabled(), false, error); if (res != COLVARS_OK) { - if (!dry_run) { + if (!dry_run || error) { cvm::log("...required by \"" + f->description + "\" in " + description + "\n"); if (toplevel) { cvm::error("Error: Failed dependency in " + description + ".\n"); diff --git a/src/colvardeps.h b/src/colvardeps.h index 1bd304b54..3878e54ec 100644 --- a/src/colvardeps.h +++ b/src/colvardeps.h @@ -198,7 +198,9 @@ class colvardeps { /// \param toplevel False if this is called as part of a chain of dependency resolution. /// This is used to diagnose failed dependencies by displaying the full stack: /// only the toplevel dependency will throw a fatal error. - int enable(int f, bool dry_run = false, bool toplevel = true); + /// \param error Recursively enable, printing error messages along the way + /// Necessary when propagating errors across alternate dependencies + int enable(int f, bool dry_run = false, bool toplevel = true, bool error = false); /// Disable a feature, decrease the reference count of its dependencies /// and recursively disable them as applicable @@ -263,8 +265,11 @@ class colvardeps { f_cv_active, /// \brief Colvar is awake (active on its own accord) this timestep f_cv_awake, - /// \brief Gradients are calculated and temporarily stored, so - /// that external forces can be applied + /// \brief External force can be applied, either to atoms or to an + /// extended DOF + f_cv_apply_force, + /// \brief Gradients are calculated and temporarily stored, + /// so that external forces can be propagated to atoms f_cv_gradient, /// \brief Collect atomic gradient data from all cvcs into vector /// atomic_gradient @@ -277,7 +282,10 @@ class colvardeps { /// forces on the inverse gradient f_cv_total_force, /// \brief Calculate total force from atomic forces + /// or get it from the back-end for an external parameter f_cv_total_force_calc, + /// \brief Total force is that of current time step + f_cv_total_force_current_step, /// \brief Subtract the applied force from the total force f_cv_subtract_applied_force, /// \brief Estimate Jacobian derivative @@ -289,8 +297,10 @@ class colvardeps { /// center with fictitious mass; bias forces will be applied to /// the center f_cv_extended_Lagrangian, - /// \brief An extended variable that sets an external variable in the - /// back-end (eg. an alchemical coupling parameter for lambda-dynamics) + /// \brief A variable that constrains or follows an external parameter + /// in the back-end (eg. an alchemical coupling parameter for lambda-dynamics) + /// If extended Lagrangian, then we drive the external parameter + /// Otherwise we follow it /// Can have a single component f_cv_external, /// \brief The extended system coordinate undergoes Langevin dynamics diff --git a/src/colvarmodule.cpp b/src/colvarmodule.cpp index 4a52017b7..256ed1a5a 100644 --- a/src/colvarmodule.cpp +++ b/src/colvarmodule.cpp @@ -1111,7 +1111,7 @@ int colvarmodule::update_colvar_forces() cvm::log("Communicating forces from the colvars to the atoms.\n"); cvm::increase_depth(); for (cvi = variables_active()->begin(); cvi != variables_active()->end(); cvi++) { - if ((*cvi)->is_enabled(colvardeps::f_cv_gradient)) { + if ((*cvi)->is_enabled(colvardeps::f_cv_apply_force)) { (*cvi)->communicate_forces(); if (cvm::get_error()) { return COLVARS_ERROR; diff --git a/src/colvarproxy_system.h b/src/colvarproxy_system.h index 67d0938e5..6caf9473e 100644 --- a/src/colvarproxy_system.h +++ b/src/colvarproxy_system.h @@ -109,6 +109,11 @@ class colvarproxy_system { /// Send cached value of alchemical lambda parameter to back-end (if available) virtual int send_alch_lambda(); + /// Request energy computation every freq steps (necessary for NAMD3, not all back-ends) + virtual int request_alch_energy_freq(int const freq) { + return COLVARS_OK; + } + /// Get energy derivative with respect to lambda (if available) virtual int get_dE_dlambda(cvm::real* dE_dlambda); diff --git a/src/colvarscript_commands.h b/src/colvarscript_commands.h index f873f7793..191724dd0 100644 --- a/src/colvarscript_commands.h +++ b/src/colvarscript_commands.h @@ -674,7 +674,7 @@ CVSCRIPT(cv_version, ) // This guard allows compiling colvar and bias function bodies in their -// respecitve files instead of colvarscript_commands.o +// respective files instead of colvarscript_commands.o #ifndef COLVARSCRIPT_COMMANDS_GLOBAL #include "colvarscript_commands_colvar.h" #include "colvarscript_commands_bias.h" diff --git a/src/colvarscript_commands_colvar.h b/src/colvarscript_commands_colvar.h index f6bb6b8c9..c641b321d 100644 --- a/src/colvarscript_commands_colvar.h +++ b/src/colvarscript_commands_colvar.h @@ -23,6 +23,7 @@ CVSCRIPT(colvar_addforce, script->add_error_msg("addforce : error parsing force value"); return COLVARSCRIPT_ERROR; } + this_colvar->enable(colvardeps::f_cv_apply_force); this_colvar->add_bias_force(force); script->set_result_colvarvalue(force); return COLVARS_OK; From 8cc7672f129ed774ab14895d1d55f5baa8503583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Fri, 1 Mar 2024 18:31:40 +0100 Subject: [PATCH 02/13] Better dependency failure messages for toplevel --- src/colvardeps.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/colvardeps.cpp b/src/colvardeps.cpp index 56d285a21..3ba320900 100644 --- a/src/colvardeps.cpp +++ b/src/colvardeps.cpp @@ -213,7 +213,11 @@ int colvardeps::enable(int feature_id, res = enable(f->requires_self[i], dry_run, false, error); if (res != COLVARS_OK) { if (!dry_run || error) { - cvm::log("...required by \"" + f->description + "\" in " + description + "\n"); + if (toplevel) { + cvm::log("Cannot enable \"" + f->description + "\" in " + description + "\n"); + } else { + cvm::log("...required by \"" + f->description + "\" in " + description + "\n"); + } if (toplevel) { cvm::error("Error: Failed dependency in " + description + ".\n"); } @@ -273,7 +277,11 @@ int colvardeps::enable(int feature_id, res = children[j]->enable(g, dry_run || !is_enabled(), false, error); if (res != COLVARS_OK) { if (!dry_run || error) { - cvm::log("...required by \"" + f->description + "\" in " + description + "\n"); + if (toplevel) { + cvm::log("Cannot enable \"" + f->description + "\" in " + description + "\n"); + } else { + cvm::log("...required by \"" + f->description + "\" in " + description + "\n"); + } if (toplevel) { cvm::error("Error: Failed dependency in " + description + ".\n"); } From d3c34e0ed7fe860390ddd1355a6a93dbe05ce78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Wed, 13 Mar 2024 14:33:51 +0100 Subject: [PATCH 03/13] Fix classic ABF in Tinker-HP --- src/colvar.cpp | 5 +++-- src/colvarbias.cpp | 3 ++- src/colvarbias_abf.cpp | 6 +++++- src/colvarcomp_alchlambda.cpp | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/colvar.cpp b/src/colvar.cpp index e670e0adc..4cb34206b 100644 --- a/src/colvar.cpp +++ b/src/colvar.cpp @@ -1790,7 +1790,7 @@ int colvar::calc_colvar_properties() } else { - if (is_enabled(f_cv_subtract_applied_force)) { + if (is_enabled(f_cv_subtract_applied_force) && !cvm::proxy->total_forces_same_step()) { // correct the total force only if it has been measured // TODO add a specific test instead of relying on sq norm if (ft.norm2() > 0.0) { @@ -1877,7 +1877,8 @@ void colvar::update_extended_Lagrangian() // Integrate with slow timestep (if time_step_factor != 1) cvm::real dt = cvm::dt() * cvm::real(time_step_factor); - colvarvalue f_ext(fr.type()); // force acting on the extended variable + // Force acting on the extended variable + colvarvalue f_ext(fr.type()); f_ext.reset(); if (is_enabled(f_cv_external)) { diff --git a/src/colvarbias.cpp b/src/colvarbias.cpp index 606c772b6..b30bdb181 100644 --- a/src/colvarbias.cpp +++ b/src/colvarbias.cpp @@ -899,8 +899,9 @@ int colvarbias_ti::update_system_forces(std::vector const if ((cvm::step_relative() > 0) || proxy->total_forces_same_step()) { if (ti_avg_forces->index_ok(ti_bin)) { for (i = 0; i < num_variables(); i++) { - if (variables(i)->is_enabled(f_cv_subtract_applied_force)) { + if (variables(i)->is_enabled(f_cv_subtract_applied_force) || proxy->total_forces_same_step()) { // this colvar is already subtracting all applied forces + // or the "total force" is really a system force at current step ti_system_forces[i] = variables(i)->total_force(); } else { ti_system_forces[i] = variables(i)->total_force() - diff --git a/src/colvarbias_abf.cpp b/src/colvarbias_abf.cpp index 7f4fd2e09..5beb24a67 100644 --- a/src/colvarbias_abf.cpp +++ b/src/colvarbias_abf.cpp @@ -457,8 +457,12 @@ int colvarbias_abf::update_system_force() // System force from atomic forces (or extended Lagrangian if applicable) for (i = 0; i < num_variables(); i++) { - if (colvars[i]->is_enabled(f_cv_subtract_applied_force)) { + if (colvars[i]->is_enabled(f_cv_subtract_applied_force) || + (cvm::proxy->total_forces_same_step() && !colvars[i]->is_enabled(f_cv_external))) { // this colvar is already subtracting the ABF force + // or the "total force" is really a system force at current step + // (For external parameters, the total force contains biasing forces + // unless f_cv_subtract_applied_force is enabled) system_force[i] = colvars[i]->total_force().real_value; } else { system_force[i] = colvars[i]->total_force().real_value diff --git a/src/colvarcomp_alchlambda.cpp b/src/colvarcomp_alchlambda.cpp index d9d08df5c..cd928e823 100644 --- a/src/colvarcomp_alchlambda.cpp +++ b/src/colvarcomp_alchlambda.cpp @@ -45,10 +45,11 @@ void colvar::alch_lambda::calc_value() { // By default, follow external parameter // This might get overwritten by driving extended dynamics + // (in apply_force() below) cvm::proxy->get_alch_lambda(&x.real_value); cvm::proxy->get_dE_dlambda(&ft.real_value); - ft.real_value *= -1.0; // Energy derivative to force + ft.real_value *= -1.0; // Convert energy derivative to force // Include any force due to bias on Flambda ft.real_value += cvm::proxy->indirect_lambda_biasing_force; @@ -75,7 +76,6 @@ void colvar::alch_lambda::apply_force(colvarvalue const & /* force */) } - colvar::alch_Flambda::alch_Flambda() { set_function_type("alch_Flambda"); From a31fd8e89e0aa25ee2e58cea9895518613284f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Thu, 14 Mar 2024 23:10:56 +0100 Subject: [PATCH 04/13] Port ABF fix to TI bias Select correct force bin on a per-colvar basis --- src/colvarbias.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/colvarbias.cpp b/src/colvarbias.cpp index b30bdb181..490a07811 100644 --- a/src/colvarbias.cpp +++ b/src/colvarbias.cpp @@ -889,8 +889,8 @@ int colvarbias_ti::update_system_forces(std::vector const size_t i; - if (proxy->total_forces_same_step()) { - for (i = 0; i < num_variables(); i++) { + for (i = 0; i < num_variables(); i++) { + if (variables(i)->is_enabled(f_cv_total_force_current_step)) { ti_bin[i] = ti_avg_forces->current_bin_scalar(i); } } @@ -899,7 +899,8 @@ int colvarbias_ti::update_system_forces(std::vector const if ((cvm::step_relative() > 0) || proxy->total_forces_same_step()) { if (ti_avg_forces->index_ok(ti_bin)) { for (i = 0; i < num_variables(); i++) { - if (variables(i)->is_enabled(f_cv_subtract_applied_force) || proxy->total_forces_same_step()) { + if (variables(i)->is_enabled(f_cv_subtract_applied_force) || + (cvm::proxy->total_forces_same_step() && !variables(i)->is_enabled(f_cv_external))) { // this colvar is already subtracting all applied forces // or the "total force" is really a system force at current step ti_system_forces[i] = variables(i)->total_force(); @@ -915,9 +916,9 @@ int colvarbias_ti::update_system_forces(std::vector const } } - if (!proxy->total_forces_same_step()) { - // Set the index for use in the next iteration, when total forces come in - for (i = 0; i < num_variables(); i++) { + for (i = 0; i < num_variables(); i++) { + if (!variables(i)->is_enabled(f_cv_total_force_current_step)) { + // Set the index for use in the next iteration, when total forces come in ti_bin[i] = ti_avg_forces->current_bin_scalar(i); } } From 1b103129dda665b2f7c5c14a11ecb42d0af044bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Thu, 28 Mar 2024 14:18:53 +0100 Subject: [PATCH 05/13] Fix total_forces_same_step flag for LAMMPS So far is was erroneously set to true, but its effects were not fully implemented in ABF. --- lammps/src/COLVARS/colvarproxy_lammps.h | 3 ++- src/colvarproxy_system.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lammps/src/COLVARS/colvarproxy_lammps.h b/lammps/src/COLVARS/colvarproxy_lammps.h index 7ed469baa..e9571bd65 100644 --- a/lammps/src/COLVARS/colvarproxy_lammps.h +++ b/lammps/src/COLVARS/colvarproxy_lammps.h @@ -64,7 +64,8 @@ class colvarproxy_lammps : public colvarproxy { public: bool total_forces_enabled() const override { return total_force_requested; }; - bool total_forces_same_step() const override { return true; }; + // Total forces are saved at end of step, only processed at the next step + bool total_forces_same_step() const override { return false; }; bool want_exit() const { return do_exit; }; // perform colvars computation. returns biasing energy diff --git a/src/colvarproxy_system.h b/src/colvarproxy_system.h index 6caf9473e..bf2ad2ea8 100644 --- a/src/colvarproxy_system.h +++ b/src/colvarproxy_system.h @@ -94,6 +94,7 @@ class colvarproxy_system { virtual bool total_forces_enabled() const; /// Are total forces from the current step available? + /// in which case they are really system forces virtual bool total_forces_same_step() const; /// Get the molecule ID when called in VMD; raise error otherwise From 5d1544fbd63b8184b93ea21b5de4e006d95140f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Wed, 10 Apr 2024 16:35:59 +0200 Subject: [PATCH 06/13] Update LAMMPS regression tests for TI/ABF fix --- .../AutoDiff/test.colvars.out | 39 +++++++-------- .../AutoDiff/test.colvars.state.stripped | 12 ++--- .../AutoDiff/test.colvars.traj | 30 ++++++------ .../000_distance-grid_abf/AutoDiff/test.grad | 2 +- .../000_distance-grid_abf/AutoDiff/test.pmf | 14 +++--- .../AutoDiff/test.restart.colvars.out | 48 ++++++++++--------- .../test.restart.colvars.state.stripped | 12 ++--- .../AutoDiff/test.restart.colvars.traj | 42 ++++++++-------- .../AutoDiff/test.restart.grad | 2 +- .../AutoDiff/test.restart.pmf | 14 +++--- .../000_distance-grid_abf/lammps-version.txt | 2 +- .../AutoDiff/test.colvars.out | 37 +++++++------- .../AutoDiff/test.colvars.state.stripped | 14 +++--- .../AutoDiff/test.restart.colvars.out | 44 +++++++++-------- .../test.restart.colvars.state.stripped | 14 +++--- .../AutoDiff/test.restart.colvars.traj | 6 +-- .../lammps-version.txt | 2 +- .../AutoDiff/test.colvars.out | 36 +++++++------- .../AutoDiff/test.colvars.state.stripped | 8 ++-- .../AutoDiff/test.restart.colvars.out | 43 +++++++++-------- .../test.restart.colvars.state.stripped | 8 ++-- .../AutoDiff/test.restart.colvars.traj | 6 +-- .../lammps-version.txt | 2 +- .../AutoDiff/test.colvars.out | 35 +++++++------- .../AutoDiff/test.colvars.state.stripped | 34 ++++++------- .../AutoDiff/test.colvars.traj | 22 ++++----- .../AutoDiff/test.restart.colvars.out | 44 +++++++++-------- .../test.restart.colvars.state.stripped | 32 +++++++------ .../AutoDiff/test.restart.colvars.traj | 24 +++++----- .../lammps-version.txt | 2 +- lammps/tests/library/run_tests.sh | 4 +- 31 files changed, 329 insertions(+), 305 deletions(-) diff --git a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.out b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.out index ccb1dec72..502a4cd97 100644 --- a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.out +++ b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.out @@ -1,10 +1,12 @@ -colvars: Creating proxy instance colvars: ---------------------------------------------------------------------- colvars: Please cite Fiorin et al, Mol Phys 2013: -colvars: https://dx.doi.org/10.1080/00268976.2013.813594 -colvars: in any publication based on this calculation. +colvars: https://doi.org/10.1080/00268976.2013.813594 +colvars: as well as all other papers listed below for individual features used. colvars: This version was built with the C++11 standard or higher. -colvars: Using LAMMPS interface, version "2020-04-07". +colvars: Summary of compile-time features available in this build: +colvars: - SMP parallelism: enabled (num. threads = 2) +colvars: - Lepton custom functions: available +colvars: - Tcl interpreter: not available colvars: ---------------------------------------------------------------------- colvars: Reading new configuration from file "test.in": colvars: # units = "" [default] @@ -56,27 +58,27 @@ colvars: # forceNoPBC = off [default] colvars: # scalable = on [default] colvars: Initializing atom group "group1". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group1" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group1" defined with 4 atoms requested. colvars: Initializing atom group "group2". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group2" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group2" defined with 4 atoms requested. @@ -104,19 +106,20 @@ colvars: ---------------------------------------------------------------------- colvars: Initializing a new "abf" instance. colvars: # name = "abf1" [default] colvars: # colvars = { one } -colvars: # zeroStepData = off [default] +colvars: # stepZeroData = off [default] colvars: # outputEnergy = off [default] colvars: # outputFreq = 10 [default] colvars: # timeStepFactor = 1 [default] colvars: WARNING: ABF should not be run without a thermostat or at 0 Kelvin! colvars: # applyBias = on [default] -colvars: # updateBias = on [default] colvars: # hideJacobian = off [default] colvars: Jacobian (geometric) forces will be included in reported free energy gradients. colvars: # fullSamples = 10 +colvars: # minSamples = 5 [default] colvars: # inputPrefix = [default] colvars: # historyFreq = 0 [default] colvars: # shared = off [default] +colvars: # updateBias = on [default] colvars: # maxForce = [default] colvars: # integrate = on [default] colvars: Finished ABF setup. @@ -125,16 +128,14 @@ colvars: Collective variables biases initialized, 1 in total. colvars: ---------------------------------------------------------------------- colvars: Collective variables module (re)initialized. colvars: ---------------------------------------------------------------------- -colvars: The restart output state file will be "rest.colvars.state". -colvars: The final output state file will be "test.colvars.state". -colvars: Opening trajectory file "test.colvars.traj". +colvars: Current simulation parameters: initial step = 0, integration timestep = 1 +colvars: Updating atomic parameters (masses, charges, etc). colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. -colvars: Prepared sample and gradient buffers at step 0. +colvars: The final output state file will be "test.colvars.state". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.colvars.state". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". colvars: Saving collective variables state to "test.colvars.state". -colvars: Resetting the Collective Variables module. +colvars: Saving collective variables state to "test.colvars.state". diff --git a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.state.stripped b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.state.stripped index 814e325f5..7c60a0d34 100644 --- a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.state.stripped +++ b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.state.stripped @@ -5,13 +5,13 @@ configuration { colvar { name one - x 3.20036069218762e+00 + x 3.2003843562355 } abf { configuration { - step 20 - name abf1 +step 20 +name abf1 } samples @@ -20,8 +20,8 @@ samples 0 0 0 0 gradient - 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 -1.12776581376024e-01 0.00000000000000e+00 - 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 + 0 0 0 0 0 0 -0.10385485654788 0 + 0 0 0 0 0 0 0 0 + 0 0 0 0 } diff --git a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.traj b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.traj index 31bc87f2f..1c9b3d776 100644 --- a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.traj +++ b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.colvars.traj @@ -5,18 +5,18 @@ 3 3.20405779931486e+00 0.00000000000000e+00 4 3.20488715757478e+00 0.00000000000000e+00 5 3.20630753860023e+00 0.00000000000000e+00 - 6 3.20822521484009e+00 -6.61626791923408e+00 - 7 3.21041717634450e+00 -1.27156541500808e+01 - 8 3.21265147474750e+00 -1.78199101059935e+01 - 9 3.21470018041825e+00 -2.15984911523814e+01 - 10 3.21635524474136e+00 -2.38649655797079e+01 - 11 3.21744175542164e+00 -2.04771085292232e+01 - 12 3.21789227153408e+00 -1.70074606132688e+01 - 13 3.21766748124389e+00 -1.36104049871579e+01 - 14 3.21676135390922e+00 -1.04308363259766e+01 - 15 3.21520071953742e+00 -7.58252414070870e+00 - 16 3.21304286766655e+00 -5.14775867496289e+00 - 17 3.21037093904356e+00 -3.17629358378122e+00 - 18 3.20728794724505e+00 -1.68764750172374e+00 - 19 3.20391020908566e+00 -6.75514681148352e-01 - 20 3.20036069218762e+00 -1.12776581376024e-01 + 6 3.20822521484009e+00 -6.61157190854750e+00 + 7 3.21041724907750e+00 -1.27050301328157e+01 + 8 3.21265178240395e+00 -1.78028628544160e+01 + 9 3.21470098068744e+00 -2.15753129933168e+01 + 10 3.21635688320852e+00 -2.38366465889628e+01 + 11 3.21744464629897e+00 -2.04504671342194e+01 + 12 3.21789678756116e+00 -1.69832533952049e+01 + 13 3.21767393972780e+00 -1.35890910889714e+01 + 14 3.21677000635471e+00 -1.04125653142527e+01 + 15 3.21521174831218e+00 -7.56715843574337e+00 + 16 3.21305638863422e+00 -5.13491652636543e+00 + 17 3.21038700938995e+00 -3.16541313007834e+00 + 18 3.20730657726304e+00 -1.67806747099744e+00 + 19 3.20393137633088e+00 -6.66563054214209e-01 + 20 3.20038435623547e+00 -1.03854856547883e-01 diff --git a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.grad b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.grad index b29f49b8a..2291bdea6 100644 --- a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.grad +++ b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.grad @@ -7,7 +7,7 @@ 1.75000000000000e+00 0.00000000000000e+00 2.25000000000000e+00 0.00000000000000e+00 2.75000000000000e+00 0.00000000000000e+00 - 3.25000000000000e+00 -1.12776581375979e-01 + 3.25000000000000e+00 -1.03854856547883e-01 3.75000000000000e+00 0.00000000000000e+00 4.25000000000000e+00 0.00000000000000e+00 4.75000000000000e+00 0.00000000000000e+00 diff --git a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.pmf b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.pmf index 2b0f3c6f5..8dd132ee4 100644 --- a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.pmf +++ b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.pmf @@ -1,13 +1,13 @@ # 1 # -2.50000000000000e-01 5.00000000000000e-01 21 0 - 0.00000000000000e+00 5.63882906879895e-02 - 5.00000000000000e-01 5.63882906879895e-02 - 1.00000000000000e+00 5.63882906879895e-02 - 1.50000000000000e+00 5.63882906879895e-02 - 2.00000000000000e+00 5.63882906879895e-02 - 2.50000000000000e+00 5.63882906879895e-02 - 3.00000000000000e+00 5.63882906879895e-02 + 0.00000000000000e+00 5.19274282739416e-02 + 5.00000000000000e-01 5.19274282739416e-02 + 1.00000000000000e+00 5.19274282739416e-02 + 1.50000000000000e+00 5.19274282739416e-02 + 2.00000000000000e+00 5.19274282739416e-02 + 2.50000000000000e+00 5.19274282739416e-02 + 3.00000000000000e+00 5.19274282739416e-02 3.50000000000000e+00 0.00000000000000e+00 4.00000000000000e+00 0.00000000000000e+00 4.50000000000000e+00 0.00000000000000e+00 diff --git a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.out b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.out index f235c1e6b..62b5a9a56 100644 --- a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.out +++ b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.out @@ -1,10 +1,13 @@ -colvars: Creating proxy instance colvars: ---------------------------------------------------------------------- colvars: Please cite Fiorin et al, Mol Phys 2013: -colvars: https://dx.doi.org/10.1080/00268976.2013.813594 -colvars: in any publication based on this calculation. +colvars: https://doi.org/10.1080/00268976.2013.813594 +colvars: as well as all other papers listed below for individual features used. colvars: This version was built with the C++11 standard or higher. -colvars: Using LAMMPS interface, version "2020-04-07". +colvars: Summary of compile-time features available in this build: +colvars: - SMP parallelism: enabled (num. threads = 2) +colvars: - Lepton custom functions: available +colvars: - Tcl interpreter: not available +colvars: Will read input state from file "test.colvars.state" colvars: ---------------------------------------------------------------------- colvars: Reading new configuration from file "test.in": colvars: # units = "" [default] @@ -56,27 +59,27 @@ colvars: # forceNoPBC = off [default] colvars: # scalable = on [default] colvars: Initializing atom group "group1". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group1" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group1" defined with 4 atoms requested. colvars: Initializing atom group "group2". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group2" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group2" defined with 4 atoms requested. @@ -104,19 +107,20 @@ colvars: ---------------------------------------------------------------------- colvars: Initializing a new "abf" instance. colvars: # name = "abf1" [default] colvars: # colvars = { one } -colvars: # zeroStepData = off [default] +colvars: # stepZeroData = off [default] colvars: # outputEnergy = off [default] colvars: # outputFreq = 10 [default] colvars: # timeStepFactor = 1 [default] colvars: WARNING: ABF should not be run without a thermostat or at 0 Kelvin! colvars: # applyBias = on [default] -colvars: # updateBias = on [default] colvars: # hideJacobian = off [default] colvars: Jacobian (geometric) forces will be included in reported free energy gradients. colvars: # fullSamples = 10 +colvars: # minSamples = 5 [default] colvars: # inputPrefix = [default] colvars: # historyFreq = 0 [default] colvars: # shared = off [default] +colvars: # updateBias = on [default] colvars: # maxForce = [default] colvars: # integrate = on [default] colvars: Finished ABF setup. @@ -125,21 +129,19 @@ colvars: Collective variables biases initialized, 1 in total. colvars: ---------------------------------------------------------------------- colvars: Collective variables module (re)initialized. colvars: ---------------------------------------------------------------------- +colvars: Current simulation parameters: initial step = 0, integration timestep = 1 +colvars: Updating atomic parameters (masses, charges, etc). +colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. +colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. colvars: ---------------------------------------------------------------------- -colvars: Restarting from file "test.colvars.state". -colvars: Restarting collective variable "one" from value: 3.20036 -colvars: Restarting abf bias "abf1" from step number 20. +colvars: Loading state from text file "test.colvars.state". +colvars: Restarting collective variable "one" from value: 3.20038 +colvars: Restarted abf bias "abf1" with step number 20. colvars: ---------------------------------------------------------------------- -colvars: The restart output state file will be "rest.colvars.state". colvars: The final output state file will be "test.restart.colvars.state". -colvars: Opening trajectory file "test.restart.colvars.traj". -colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. -colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. -colvars: Prepared sample and gradient buffers at step 20. colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.restart.colvars.state". colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". colvars: Saving collective variables state to "test.restart.colvars.state". -colvars: Resetting the Collective Variables module. +colvars: Saving collective variables state to "test.restart.colvars.state". diff --git a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.state.stripped b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.state.stripped index 59f390b59..b9f26a9c1 100644 --- a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.state.stripped +++ b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.state.stripped @@ -5,13 +5,13 @@ configuration { colvar { name one - x 3.17582252688381e+00 + x 3.1758939206034 } abf { configuration { - step 40 - name abf1 +step 40 +name abf1 } samples @@ -20,8 +20,8 @@ samples 0 0 0 0 gradient - 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 -8.67716293178495e+00 0.00000000000000e+00 - 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 + 0 0 0 0 0 0 -8.6637911275798 0 + 0 0 0 0 0 0 0 0 + 0 0 0 0 } diff --git a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.traj b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.traj index 82200b242..ced9762f9 100644 --- a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.traj +++ b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.colvars.traj @@ -1,22 +1,22 @@ # step one fa_one - 20 3.20036076583879e+00 -1.12776581376024e-01 - 21 3.19676250595523e+00 -1.12776581376024e-01 - 22 3.19323015858381e+00 -2.99226657105897e-01 - 23 3.18986878033029e+00 -7.71570670388436e-01 - 24 3.18676635816465e+00 -1.45966444381162e+00 - 25 3.18399012323985e+00 -2.29255009605800e+00 - 26 3.18158461659959e+00 -3.20291155852885e+00 - 27 3.17957172980453e+00 -4.13119762789999e+00 - 28 3.17795242533882e+00 -5.02830487271041e+00 - 29 3.17670962516017e+00 -5.85665418044438e+00 - 30 3.17581173522468e+00 -6.58995308174671e+00 - 31 3.17521643416185e+00 -7.21224165778954e+00 - 32 3.17487456266985e+00 -7.71677976467746e+00 - 33 3.17473400751618e+00 -8.10491399457095e+00 - 34 3.17474340422162e+00 -8.38478985628265e+00 - 35 3.17485538125568e+00 -8.56974337269324e+00 - 36 3.17502906896877e+00 -8.67642273989548e+00 - 37 3.17523173654562e+00 -8.72292739505557e+00 - 38 3.17543964478384e+00 -8.72734418672621e+00 - 39 3.17563832893481e+00 -8.70683028310459e+00 - 40 3.17582252688381e+00 -8.67716293178495e+00 + 20 3.20038442890979e+00 -1.03854856547880e-01 + 21 3.19678862154174e+00 -1.03854856547880e-01 + 22 3.19325868201096e+00 -2.89577637067747e-01 + 23 3.18989968114783e+00 -7.61101440554271e-01 + 24 3.18679962469704e+00 -1.44844736047144e+00 + 25 3.18402576202599e+00 -2.28077446479501e+00 + 26 3.18162264923830e+00 -3.19083007934240e+00 + 27 3.17961218770411e+00 -4.11907208902965e+00 + 28 3.17799534343587e+00 -5.01636137209204e+00 + 29 3.17675503558160e+00 -5.84505314310151e+00 + 30 3.17585966166561e+00 -6.57877537042113e+00 + 31 3.17526688749274e+00 -7.20148861595175e+00 + 32 3.17492753806785e+00 -7.70638297502586e+00 + 33 3.17478948326253e+00 -8.09475011416048e+00 + 34 3.17480134217557e+00 -8.37469681855967e+00 + 35 3.17491572893043e+00 -8.55953599790606e+00 + 36 3.17509176298755e+00 -8.66590727775137e+00 + 37 3.17529670713715e+00 -8.71191545508902e+00 + 38 3.17550682085422e+00 -8.71566657237990e+00 + 39 3.17570764320513e+00 -8.69435074482412e+00 + 40 3.17589392060342e+00 -8.66379112757977e+00 diff --git a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.grad b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.grad index ec20a8621..7d7f6dc06 100644 --- a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.grad +++ b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.grad @@ -7,7 +7,7 @@ 1.75000000000000e+00 0.00000000000000e+00 2.25000000000000e+00 0.00000000000000e+00 2.75000000000000e+00 0.00000000000000e+00 - 3.25000000000000e+00 -8.67716293178499e+00 + 3.25000000000000e+00 -8.66379112757977e+00 3.75000000000000e+00 0.00000000000000e+00 4.25000000000000e+00 0.00000000000000e+00 4.75000000000000e+00 0.00000000000000e+00 diff --git a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.pmf b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.pmf index 980be4de1..18c4a1926 100644 --- a/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.pmf +++ b/lammps/tests/library/000_distance-grid_abf/AutoDiff/test.restart.pmf @@ -1,13 +1,13 @@ # 1 # -2.50000000000000e-01 5.00000000000000e-01 21 0 - 0.00000000000000e+00 4.33858146589250e+00 - 5.00000000000000e-01 4.33858146589250e+00 - 1.00000000000000e+00 4.33858146589250e+00 - 1.50000000000000e+00 4.33858146589250e+00 - 2.00000000000000e+00 4.33858146589250e+00 - 2.50000000000000e+00 4.33858146589250e+00 - 3.00000000000000e+00 4.33858146589250e+00 + 0.00000000000000e+00 4.33189556378988e+00 + 5.00000000000000e-01 4.33189556378988e+00 + 1.00000000000000e+00 4.33189556378988e+00 + 1.50000000000000e+00 4.33189556378988e+00 + 2.00000000000000e+00 4.33189556378988e+00 + 2.50000000000000e+00 4.33189556378988e+00 + 3.00000000000000e+00 4.33189556378988e+00 3.50000000000000e+00 0.00000000000000e+00 4.00000000000000e+00 0.00000000000000e+00 4.50000000000000e+00 0.00000000000000e+00 diff --git a/lammps/tests/library/000_distance-grid_abf/lammps-version.txt b/lammps/tests/library/000_distance-grid_abf/lammps-version.txt index 308cf25eb..8b1378917 100644 --- a/lammps/tests/library/000_distance-grid_abf/lammps-version.txt +++ b/lammps/tests/library/000_distance-grid_abf/lammps-version.txt @@ -1 +1 @@ -LAMMPS (19 Mar 2020) + diff --git a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.colvars.out b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.colvars.out index 6cdfac061..60f8d8ab5 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.colvars.out +++ b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.colvars.out @@ -1,10 +1,12 @@ -colvars: Creating proxy instance colvars: ---------------------------------------------------------------------- colvars: Please cite Fiorin et al, Mol Phys 2013: -colvars: https://dx.doi.org/10.1080/00268976.2013.813594 -colvars: in any publication based on this calculation. +colvars: https://doi.org/10.1080/00268976.2013.813594 +colvars: as well as all other papers listed below for individual features used. colvars: This version was built with the C++11 standard or higher. -colvars: Using LAMMPS interface, version "2020-04-07". +colvars: Summary of compile-time features available in this build: +colvars: - SMP parallelism: enabled (num. threads = 2) +colvars: - Lepton custom functions: available +colvars: - Tcl interpreter: not available colvars: ---------------------------------------------------------------------- colvars: Reading new configuration from file "test.in": colvars: # units = "" [default] @@ -56,27 +58,27 @@ colvars: # forceNoPBC = off [default] colvars: # scalable = on [default] colvars: Initializing atom group "group1". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group1" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group1" defined with 4 atoms requested. colvars: Initializing atom group "group2". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group2" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group2" defined with 4 atoms requested. @@ -104,7 +106,7 @@ colvars: ---------------------------------------------------------------------- colvars: Initializing a new "harmonic" instance. colvars: # name = "harmonic1" [default] colvars: # colvars = { one } -colvars: # zeroStepData = off [default] +colvars: # stepZeroData = off [default] colvars: # outputEnergy = on colvars: # outputFreq = 10 [default] colvars: # timeStepFactor = 1 [default] @@ -112,11 +114,13 @@ colvars: # writeTISamples = off [default] colvars: # writeTIPMF = on colvars: # centers = { 0.1 } colvars: # targetCenters = { 0.2 } +colvars: Initial step for restraint change: 0 colvars: # targetNumSteps = 10 colvars: # targetNumStages = 0 [default] colvars: # outputAccumulatedWork = on colvars: # outputCenters = on colvars: # forceConstant = 0.001 +colvars: # decoupling = off [default] colvars: # targetForceConstant = -1 [default] colvars: The force constant for colvar "one" will be rescaled to 0.004 according to the specified width (0.5). colvars: ---------------------------------------------------------------------- @@ -124,17 +128,16 @@ colvars: Collective variables biases initialized, 1 in total. colvars: ---------------------------------------------------------------------- colvars: Collective variables module (re)initialized. colvars: ---------------------------------------------------------------------- -colvars: The restart output state file will be "rest.colvars.state". -colvars: The final output state file will be "test.colvars.state". -colvars: Opening trajectory file "test.colvars.traj". +colvars: Current simulation parameters: initial step = 0, integration timestep = 1 +colvars: Updating atomic parameters (masses, charges, etc). colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. +colvars: The final output state file will be "test.colvars.state". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.colvars.state". colvars: Writing TI PMF to file "test.harmonic1.ti.pmf". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.colvars.state". colvars: Writing TI PMF to file "test.harmonic1.ti.pmf". colvars: Saving collective variables state to "test.colvars.state". -colvars: Resetting the Collective Variables module. diff --git a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.colvars.state.stripped b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.colvars.state.stripped index 02bd32580..95b778174 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.colvars.state.stripped +++ b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.colvars.state.stripped @@ -5,16 +5,16 @@ configuration { colvar { name one - x 3.21927610288861e+00 + x 3.2192761028886 } restraint { configuration { - step 20 - name harmonic1 - firstStep 0 - centers 2.00000000000000e-01 - accumulatedWork -1.22156562115015e-03 +step 20 +name harmonic1 +firstStep 0 +centers 2.00000000000000e-01 +accumulatedWork -1.22156562115015e-03 } histogram @@ -29,7 +29,7 @@ histogram system_forces 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - -2.90562076256866e+00 0.00000000000000e+00 0.00000000000000e+00 + -2.91094223405173e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 diff --git a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.out b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.out index 8f922dcfa..69bb3a784 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.out +++ b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.out @@ -1,10 +1,13 @@ -colvars: Creating proxy instance colvars: ---------------------------------------------------------------------- colvars: Please cite Fiorin et al, Mol Phys 2013: -colvars: https://dx.doi.org/10.1080/00268976.2013.813594 -colvars: in any publication based on this calculation. +colvars: https://doi.org/10.1080/00268976.2013.813594 +colvars: as well as all other papers listed below for individual features used. colvars: This version was built with the C++11 standard or higher. -colvars: Using LAMMPS interface, version "2020-04-07". +colvars: Summary of compile-time features available in this build: +colvars: - SMP parallelism: enabled (num. threads = 2) +colvars: - Lepton custom functions: available +colvars: - Tcl interpreter: not available +colvars: Will read input state from file "test.colvars.state" colvars: ---------------------------------------------------------------------- colvars: Reading new configuration from file "test.in": colvars: # units = "" [default] @@ -56,27 +59,27 @@ colvars: # forceNoPBC = off [default] colvars: # scalable = on [default] colvars: Initializing atom group "group1". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group1" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group1" defined with 4 atoms requested. colvars: Initializing atom group "group2". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group2" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group2" defined with 4 atoms requested. @@ -104,7 +107,7 @@ colvars: ---------------------------------------------------------------------- colvars: Initializing a new "harmonic" instance. colvars: # name = "harmonic1" [default] colvars: # colvars = { one } -colvars: # zeroStepData = off [default] +colvars: # stepZeroData = off [default] colvars: # outputEnergy = on colvars: # outputFreq = 10 [default] colvars: # timeStepFactor = 1 [default] @@ -112,11 +115,13 @@ colvars: # writeTISamples = off [default] colvars: # writeTIPMF = on colvars: # centers = { 0.1 } colvars: # targetCenters = { 0.2 } +colvars: Initial step for restraint change: 0 colvars: # targetNumSteps = 10 colvars: # targetNumStages = 0 [default] colvars: # outputAccumulatedWork = on colvars: # outputCenters = on colvars: # forceConstant = 0.001 +colvars: # decoupling = off [default] colvars: # targetForceConstant = -1 [default] colvars: The force constant for colvar "one" will be rescaled to 0.004 according to the specified width (0.5). colvars: ---------------------------------------------------------------------- @@ -124,22 +129,21 @@ colvars: Collective variables biases initialized, 1 in total. colvars: ---------------------------------------------------------------------- colvars: Collective variables module (re)initialized. colvars: ---------------------------------------------------------------------- +colvars: Current simulation parameters: initial step = 0, integration timestep = 1 +colvars: Updating atomic parameters (masses, charges, etc). +colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. +colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. colvars: ---------------------------------------------------------------------- -colvars: Restarting from file "test.colvars.state". +colvars: Loading state from text file "test.colvars.state". colvars: Restarting collective variable "one" from value: 3.21928 -colvars: Restarting harmonic bias "harmonic1" from step number 20. +colvars: Restarted harmonic bias "harmonic1" with step number 20. colvars: ---------------------------------------------------------------------- -colvars: The restart output state file will be "rest.colvars.state". colvars: The final output state file will be "test.restart.colvars.state". -colvars: Opening trajectory file "test.restart.colvars.traj". -colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. -colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.restart.colvars.state". colvars: Writing TI PMF to file "test.restart.harmonic1.ti.pmf". colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.restart.colvars.state". colvars: Writing TI PMF to file "test.restart.harmonic1.ti.pmf". colvars: Saving collective variables state to "test.restart.colvars.state". -colvars: Resetting the Collective Variables module. diff --git a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.state.stripped b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.state.stripped index 072172249..bfe487f97 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.state.stripped +++ b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.state.stripped @@ -5,16 +5,16 @@ configuration { colvar { name one - x 3.21816782210277e+00 + x 3.2181678221028 } restraint { configuration { - step 40 - name harmonic1 - firstStep 0 - centers 2.00000000000000e-01 - accumulatedWork -1.22156562115015e-03 +step 40 +name harmonic1 +firstStep 0 +centers 2.00000000000000e-01 +accumulatedWork -1.22156562115015e-03 } histogram @@ -29,7 +29,7 @@ histogram system_forces 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - 4.14032182279623e+00 0.00000000000000e+00 0.00000000000000e+00 + 4.13477803678241e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 diff --git a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.traj b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.traj index 92ad6def5..cf945fde8 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.traj +++ b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/AutoDiff/test.restart.colvars.traj @@ -1,5 +1,5 @@ # step one fa_one E_harmonic1 x0_one W_harmonic1 - 20 3.21927610420272e+00 -1.20771044168109e-02 1.82320563868192e-02 2.00000000000000e-01 -1.22156562115015e-03 + 20 3.21927610420273e+00 -1.20771044168109e-02 1.82320563868192e-02 2.00000000000000e-01 -1.22156562115015e-03 21 3.21712493217757e+00 -1.20684997287103e-02 1.82060857127351e-02 2.00000000000000e-01 -1.22156562115015e-03 22 3.21491957781060e+00 -1.20596783112424e-02 1.81794801213313e-02 2.00000000000000e-01 -1.22156562115015e-03 23 3.21277838638075e+00 -1.20511135455230e-02 1.81536672108860e-02 2.00000000000000e-01 -1.22156562115015e-03 @@ -8,12 +8,12 @@ 26 3.20772353744991e+00 -1.20308941497996e-02 1.80928017554604e-02 2.00000000000000e-01 -1.22156562115015e-03 27 3.20672256044185e+00 -1.20268902417674e-02 1.80807611109400e-02 2.00000000000000e-01 -1.22156562115015e-03 28 3.20611979984341e+00 -1.20244791993736e-02 1.80735125020211e-02 2.00000000000000e-01 -1.22156562115015e-03 - 29 3.20591518168161e+00 -1.20236607267264e-02 1.80710521589280e-02 2.00000000000000e-01 -1.22156562115015e-03 + 29 3.20591518168161e+00 -1.20236607267264e-02 1.80710521589279e-02 2.00000000000000e-01 -1.22156562115015e-03 30 3.20608917462516e+00 -1.20243566985006e-02 1.80731442515971e-02 2.00000000000000e-01 -1.22156562115015e-03 31 3.20660613772624e+00 -1.20264245509050e-02 1.80793609348262e-02 2.00000000000000e-01 -1.22156562115015e-03 32 3.20741824461812e+00 -1.20296729784725e-02 1.80891289961239e-02 2.00000000000000e-01 -1.22156562115015e-03 33 3.20846986624845e+00 -1.20338794649938e-02 1.81017818722499e-02 2.00000000000000e-01 -1.22156562115015e-03 - 34 3.20970218001743e+00 -1.20388087200697e-02 1.81166144248033e-02 2.00000000000000e-01 -1.22156562115015e-03 + 34 3.20970218001742e+00 -1.20388087200697e-02 1.81166144248033e-02 2.00000000000000e-01 -1.22156562115015e-03 35 3.21105763094978e+00 -1.20442305237991e-02 1.81329361138018e-02 2.00000000000000e-01 -1.22156562115015e-03 36 3.21248380017773e+00 -1.20499352007109e-02 1.81501172926665e-02 2.00000000000000e-01 -1.22156562115015e-03 37 3.21393637834814e+00 -1.20557455133925e-02 1.81676249854606e-02 2.00000000000000e-01 -1.22156562115015e-03 diff --git a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/lammps-version.txt b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/lammps-version.txt index 308cf25eb..8b1378917 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/lammps-version.txt +++ b/lammps/tests/library/000_distance-grid_harmonic-centers-moving-ti/lammps-version.txt @@ -1 +1 @@ -LAMMPS (19 Mar 2020) + diff --git a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.colvars.out b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.colvars.out index 7b1e4f787..b07731c0f 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.colvars.out +++ b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.colvars.out @@ -1,10 +1,12 @@ -colvars: Creating proxy instance colvars: ---------------------------------------------------------------------- colvars: Please cite Fiorin et al, Mol Phys 2013: -colvars: https://dx.doi.org/10.1080/00268976.2013.813594 -colvars: in any publication based on this calculation. +colvars: https://doi.org/10.1080/00268976.2013.813594 +colvars: as well as all other papers listed below for individual features used. colvars: This version was built with the C++11 standard or higher. -colvars: Using LAMMPS interface, version "2020-04-07". +colvars: Summary of compile-time features available in this build: +colvars: - SMP parallelism: enabled (num. threads = 2) +colvars: - Lepton custom functions: available +colvars: - Tcl interpreter: not available colvars: ---------------------------------------------------------------------- colvars: Reading new configuration from file "test.in": colvars: # units = "" [default] @@ -56,27 +58,27 @@ colvars: # forceNoPBC = off [default] colvars: # scalable = on [default] colvars: Initializing atom group "group1". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group1" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group1" defined with 4 atoms requested. colvars: Initializing atom group "group2". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group2" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group2" defined with 4 atoms requested. @@ -104,7 +106,7 @@ colvars: ---------------------------------------------------------------------- colvars: Initializing a new "harmonic" instance. colvars: # name = "harmonic1" [default] colvars: # colvars = { one } -colvars: # zeroStepData = off [default] +colvars: # stepZeroData = off [default] colvars: # outputEnergy = off [default] colvars: # outputFreq = 10 [default] colvars: # timeStepFactor = 1 [default] @@ -114,6 +116,7 @@ colvars: # centers = { 0.1 } colvars: # targetCenters = { 0.1 } [default] colvars: # outputCenters = off [default] colvars: # forceConstant = 0.001 +colvars: # decoupling = off [default] colvars: # targetForceConstant = -1 [default] colvars: The force constant for colvar "one" will be rescaled to 0.004 according to the specified width (0.5). colvars: ---------------------------------------------------------------------- @@ -121,17 +124,16 @@ colvars: Collective variables biases initialized, 1 in total. colvars: ---------------------------------------------------------------------- colvars: Collective variables module (re)initialized. colvars: ---------------------------------------------------------------------- -colvars: The restart output state file will be "rest.colvars.state". -colvars: The final output state file will be "test.colvars.state". -colvars: Opening trajectory file "test.colvars.traj". +colvars: Current simulation parameters: initial step = 0, integration timestep = 1 +colvars: Updating atomic parameters (masses, charges, etc). colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. +colvars: The final output state file will be "test.colvars.state". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.colvars.state". colvars: Writing TI PMF to file "test.harmonic1.ti.pmf". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.colvars.state". colvars: Writing TI PMF to file "test.harmonic1.ti.pmf". colvars: Saving collective variables state to "test.colvars.state". -colvars: Resetting the Collective Variables module. diff --git a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.colvars.state.stripped b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.colvars.state.stripped index a35c8ee23..cd1638600 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.colvars.state.stripped +++ b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.colvars.state.stripped @@ -5,13 +5,13 @@ configuration { colvar { name one - x 3.21927552466352e+00 + x 3.2192755246635 } restraint { configuration { - step 20 - name harmonic1 +step 20 +name harmonic1 } histogram @@ -26,7 +26,7 @@ histogram system_forces 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - -2.90553316335430e+00 0.00000000000000e+00 0.00000000000000e+00 + -2.91085463660568e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 diff --git a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.out b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.out index 513279fe8..fe531fd6e 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.out +++ b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.out @@ -1,10 +1,13 @@ -colvars: Creating proxy instance colvars: ---------------------------------------------------------------------- colvars: Please cite Fiorin et al, Mol Phys 2013: -colvars: https://dx.doi.org/10.1080/00268976.2013.813594 -colvars: in any publication based on this calculation. +colvars: https://doi.org/10.1080/00268976.2013.813594 +colvars: as well as all other papers listed below for individual features used. colvars: This version was built with the C++11 standard or higher. -colvars: Using LAMMPS interface, version "2020-04-07". +colvars: Summary of compile-time features available in this build: +colvars: - SMP parallelism: enabled (num. threads = 2) +colvars: - Lepton custom functions: available +colvars: - Tcl interpreter: not available +colvars: Will read input state from file "test.colvars.state" colvars: ---------------------------------------------------------------------- colvars: Reading new configuration from file "test.in": colvars: # units = "" [default] @@ -56,27 +59,27 @@ colvars: # forceNoPBC = off [default] colvars: # scalable = on [default] colvars: Initializing atom group "group1". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group1" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group1" defined with 4 atoms requested. colvars: Initializing atom group "group2". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group2" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group2" defined with 4 atoms requested. @@ -104,7 +107,7 @@ colvars: ---------------------------------------------------------------------- colvars: Initializing a new "harmonic" instance. colvars: # name = "harmonic1" [default] colvars: # colvars = { one } -colvars: # zeroStepData = off [default] +colvars: # stepZeroData = off [default] colvars: # outputEnergy = off [default] colvars: # outputFreq = 10 [default] colvars: # timeStepFactor = 1 [default] @@ -114,6 +117,7 @@ colvars: # centers = { 0.1 } colvars: # targetCenters = { 0.1 } [default] colvars: # outputCenters = off [default] colvars: # forceConstant = 0.001 +colvars: # decoupling = off [default] colvars: # targetForceConstant = -1 [default] colvars: The force constant for colvar "one" will be rescaled to 0.004 according to the specified width (0.5). colvars: ---------------------------------------------------------------------- @@ -121,22 +125,21 @@ colvars: Collective variables biases initialized, 1 in total. colvars: ---------------------------------------------------------------------- colvars: Collective variables module (re)initialized. colvars: ---------------------------------------------------------------------- +colvars: Current simulation parameters: initial step = 0, integration timestep = 1 +colvars: Updating atomic parameters (masses, charges, etc). +colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. +colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. colvars: ---------------------------------------------------------------------- -colvars: Restarting from file "test.colvars.state". +colvars: Loading state from text file "test.colvars.state". colvars: Restarting collective variable "one" from value: 3.21928 -colvars: Restarting harmonic bias "harmonic1" from step number 20. +colvars: Restarted harmonic bias "harmonic1" with step number 20. colvars: ---------------------------------------------------------------------- -colvars: The restart output state file will be "rest.colvars.state". colvars: The final output state file will be "test.restart.colvars.state". -colvars: Opening trajectory file "test.restart.colvars.traj". -colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. -colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.restart.colvars.state". colvars: Writing TI PMF to file "test.restart.harmonic1.ti.pmf". colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.restart.colvars.state". colvars: Writing TI PMF to file "test.restart.harmonic1.ti.pmf". colvars: Saving collective variables state to "test.restart.colvars.state". -colvars: Resetting the Collective Variables module. diff --git a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.state.stripped b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.state.stripped index ffe43b4e0..0f6d646be 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.state.stripped +++ b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.state.stripped @@ -5,13 +5,13 @@ configuration { colvar { name one - x 3.21816571931147e+00 + x 3.2181657193115 } restraint { configuration { - step 40 - name harmonic1 +step 40 +name harmonic1 } histogram @@ -26,7 +26,7 @@ histogram system_forces 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - 4.14054595271419e+00 0.00000000000000e+00 0.00000000000000e+00 + 4.13500215076519e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 diff --git a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.traj b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.traj index d6db29cb9..fde91a8ee 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.traj +++ b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/AutoDiff/test.restart.colvars.traj @@ -9,13 +9,13 @@ 27 3.20672148778391e+00 -1.24268859511357e-02 28 3.20611865018057e+00 -1.24244746007223e-02 29 3.20591395386379e+00 -1.24236558154552e-02 - 30 3.20608786769079e+00 -1.24243514707632e-02 + 30 3.20608786769079e+00 -1.24243514707631e-02 31 3.20660475092205e+00 -1.24264190036882e-02 32 3.20741677741603e+00 -1.24296671096641e-02 33 3.20846831835692e+00 -1.24338732734277e-02 34 3.20970055138465e+00 -1.24388022055386e-02 - 35 3.21105592175671e+00 -1.24442236870269e-02 - 36 3.21248201082058e+00 -1.24499280432823e-02 + 35 3.21105592175671e+00 -1.24442236870268e-02 + 36 3.21248201082057e+00 -1.24499280432823e-02 37 3.21393450941138e+00 -1.24557380376455e-02 38 3.21537923153366e+00 -1.24615169261346e-02 39 3.21679330254328e+00 -1.24671732101731e-02 diff --git a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/lammps-version.txt b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/lammps-version.txt index 308cf25eb..8b1378917 100644 --- a/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/lammps-version.txt +++ b/lammps/tests/library/000_distance-grid_harmonic-fixed-ti/lammps-version.txt @@ -1 +1 @@ -LAMMPS (19 Mar 2020) + diff --git a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.out b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.out index 9f67f0dfd..f7d142022 100644 --- a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.out +++ b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.out @@ -1,10 +1,12 @@ -colvars: Creating proxy instance colvars: ---------------------------------------------------------------------- colvars: Please cite Fiorin et al, Mol Phys 2013: -colvars: https://dx.doi.org/10.1080/00268976.2013.813594 -colvars: in any publication based on this calculation. +colvars: https://doi.org/10.1080/00268976.2013.813594 +colvars: as well as all other papers listed below for individual features used. colvars: This version was built with the C++11 standard or higher. -colvars: Using LAMMPS interface, version "2020-04-07". +colvars: Summary of compile-time features available in this build: +colvars: - SMP parallelism: enabled (num. threads = 2) +colvars: - Lepton custom functions: available +colvars: - Tcl interpreter: not available colvars: ---------------------------------------------------------------------- colvars: Reading new configuration from file "test.in": colvars: # units = "" [default] @@ -56,27 +58,27 @@ colvars: # forceNoPBC = off [default] colvars: # scalable = on [default] colvars: Initializing atom group "group1". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group1" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group1" defined with 4 atoms requested. colvars: Initializing atom group "group2". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group2" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group2" defined with 4 atoms requested. @@ -104,7 +106,7 @@ colvars: ---------------------------------------------------------------------- colvars: Initializing a new "metadynamics" instance. colvars: # name = "metadynamics1" [default] colvars: # colvars = { one } -colvars: # zeroStepData = off [default] +colvars: # stepZeroData = off [default] colvars: # outputEnergy = off [default] colvars: # outputFreq = 10 [default] colvars: # timeStepFactor = 1 [default] @@ -132,17 +134,16 @@ colvars: Collective variables biases initialized, 1 in total. colvars: ---------------------------------------------------------------------- colvars: Collective variables module (re)initialized. colvars: ---------------------------------------------------------------------- -colvars: The restart output state file will be "rest.colvars.state". -colvars: The final output state file will be "test.colvars.state". -colvars: Opening trajectory file "test.colvars.traj". +colvars: Current simulation parameters: initial step = 0, integration timestep = 1 +colvars: Updating atomic parameters (masses, charges, etc). colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. +colvars: The final output state file will be "test.colvars.state". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.colvars.state". colvars: Writing TI PMF to file "test.metadynamics1.ti.pmf". colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.colvars.state". colvars: Writing TI PMF to file "test.metadynamics1.ti.pmf". colvars: Saving collective variables state to "test.colvars.state". -colvars: Resetting the Collective Variables module. diff --git a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.state.stripped b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.state.stripped index 43a9f1078..9cf83ad73 100644 --- a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.state.stripped +++ b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.state.stripped @@ -5,40 +5,42 @@ configuration { colvar { name one - x 3.21930432522528e+00 + x 3.2193043252253 } metadynamics { configuration { - step 20 - name metadynamics1 +step 20 +name metadynamics1 } - hills_energy + +hills_energy grid_parameters { n_colvars 1 - lower_boundaries 0.00000000000000e+00 - upper_boundaries 1.00000000000000e+01 - widths 5.00000000000000e-01 + lower_boundaries 0 + upper_boundaries 10 + widths 0.5 sizes 20 } 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - 3.38514518045129e-08 1.67980873239227e-05 6.53166613975910e-04 - 1.99007630938374e-03 4.75113192446023e-04 8.88804117170131e-06 + 3.38514518045131e-08 1.67980873239228e-05 6.53166613975911e-04 + 1.99007630938374e-03 4.75113192446022e-04 8.88804117170127e-06 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - hills_energy_gradients + +hills_energy_gradients grid_parameters { n_colvars 1 - lower_boundaries 0.00000000000000e+00 - upper_boundaries 1.00000000000000e+01 - widths 5.00000000000000e-01 + lower_boundaries 0 + upper_boundaries 10 + widths 0.5 sizes 20 } 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - 5.06436271151796e-07 1.65756901208920e-04 3.11865061690916e-03 - -6.33399841494236e-04 -2.57094275931607e-03 -9.33614419730819e-05 + 5.06436271151799e-07 1.65756901208920e-04 3.11865061690917e-03 + -6.33399841494245e-04 -2.57094275931606e-03 -9.33614419730815e-05 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 @@ -56,7 +58,7 @@ histogram system_forces 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - -2.91090719796639e+00 0.00000000000000e+00 0.00000000000000e+00 + -2.91622858016849e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 diff --git a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.traj b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.traj index 2a6b58e0b..29c7da327 100644 --- a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.traj +++ b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.colvars.traj @@ -9,14 +9,14 @@ 7 3.21051965076451e+00 0.00000000000000e+00 8 3.21305004618829e+00 0.00000000000000e+00 9 3.21566301892414e+00 0.00000000000000e+00 - 10 3.21820151179421e+00 3.22233053233233e-04 - 11 3.22051469810240e+00 3.22233053233233e-04 - 12 3.22246811428391e+00 3.22233053233233e-04 - 13 3.22395287819937e+00 3.22233053233233e-04 - 14 3.22489272676255e+00 3.22233053233233e-04 - 15 3.22524801388741e+00 3.22233053233233e-04 - 16 3.22501642539137e+00 3.22233053233233e-04 - 17 3.22423078880002e+00 3.22233053233233e-04 - 18 3.22295471902996e+00 3.22233053233233e-04 - 19 3.22127686703542e+00 3.22233053233233e-04 - 20 3.21930432522528e+00 6.33399841494236e-04 + 10 3.21820151179421e+00 3.22233053233242e-04 + 11 3.22051469810240e+00 3.22233053233242e-04 + 12 3.22246811428391e+00 3.22233053233242e-04 + 13 3.22395287819937e+00 3.22233053233242e-04 + 14 3.22489272676255e+00 3.22233053233242e-04 + 15 3.22524801388741e+00 3.22233053233242e-04 + 16 3.22501642539137e+00 3.22233053233242e-04 + 17 3.22423078880002e+00 3.22233053233242e-04 + 18 3.22295471902996e+00 3.22233053233242e-04 + 19 3.22127686703542e+00 3.22233053233242e-04 + 20 3.21930432522528e+00 6.33399841494245e-04 diff --git a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.out b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.out index e96e7f4a8..0b3b2c692 100644 --- a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.out +++ b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.out @@ -1,10 +1,13 @@ -colvars: Creating proxy instance colvars: ---------------------------------------------------------------------- colvars: Please cite Fiorin et al, Mol Phys 2013: -colvars: https://dx.doi.org/10.1080/00268976.2013.813594 -colvars: in any publication based on this calculation. +colvars: https://doi.org/10.1080/00268976.2013.813594 +colvars: as well as all other papers listed below for individual features used. colvars: This version was built with the C++11 standard or higher. -colvars: Using LAMMPS interface, version "2020-04-07". +colvars: Summary of compile-time features available in this build: +colvars: - SMP parallelism: enabled (num. threads = 2) +colvars: - Lepton custom functions: available +colvars: - Tcl interpreter: not available +colvars: Will read input state from file "test.colvars.state" colvars: ---------------------------------------------------------------------- colvars: Reading new configuration from file "test.in": colvars: # units = "" [default] @@ -56,27 +59,27 @@ colvars: # forceNoPBC = off [default] colvars: # scalable = on [default] colvars: Initializing atom group "group1". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group1" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group1" defined with 4 atoms requested. colvars: Initializing atom group "group2". colvars: # name = "" [default] -colvars: # centerReference = off [default] -colvars: # rotateReference = off [default] +colvars: # centerToOrigin = off [default] +colvars: # centerToReference = off [default] +colvars: # rotateToReference = off [default] colvars: # atomsOfGroup = "" [default] colvars: # indexGroup = "group2" colvars: # psfSegID = [default] colvars: # atomsFile = "" [default] colvars: # dummyAtom = ( 0 , 0 , 0 ) [default] -colvars: # enableForces = on [default] colvars: # enableFitGradients = on [default] colvars: # printAtomIDs = off [default] colvars: Atom group "group2" defined with 4 atoms requested. @@ -104,7 +107,7 @@ colvars: ---------------------------------------------------------------------- colvars: Initializing a new "metadynamics" instance. colvars: # name = "metadynamics1" [default] colvars: # colvars = { one } -colvars: # zeroStepData = off [default] +colvars: # stepZeroData = off [default] colvars: # outputEnergy = off [default] colvars: # outputFreq = 10 [default] colvars: # timeStepFactor = 1 [default] @@ -132,22 +135,23 @@ colvars: Collective variables biases initialized, 1 in total. colvars: ---------------------------------------------------------------------- colvars: Collective variables module (re)initialized. colvars: ---------------------------------------------------------------------- +colvars: Current simulation parameters: initial step = 0, integration timestep = 1 +colvars: Updating atomic parameters (masses, charges, etc). +colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. +colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. colvars: ---------------------------------------------------------------------- -colvars: Restarting from file "test.colvars.state". +colvars: Loading state from text file "test.colvars.state". colvars: Restarting collective variable "one" from value: 3.2193 -colvars: Restarting metadynamics bias "metadynamics1" from step number 20. +colvars: successfully read the biasing potential and its gradients from grids. +colvars: successfully read 0 explicit hills from state. +colvars: Restarted metadynamics bias "metadynamics1" with step number 20. colvars: ---------------------------------------------------------------------- -colvars: The restart output state file will be "rest.colvars.state". colvars: The final output state file will be "test.restart.colvars.state". -colvars: Opening trajectory file "test.restart.colvars.traj". -colvars: Re-initialized atom group for variable "one":0/0. 4 atoms: total mass = 54.028, total charge = -0.72. -colvars: Re-initialized atom group for variable "one":0/1. 4 atoms: total mass = 54.028, total charge = -0.4. colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.restart.colvars.state". colvars: Writing TI PMF to file "test.restart.metadynamics1.ti.pmf". colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". -colvars: Saving collective variables state to "rest.colvars.state". +colvars: Saving collective variables state to "test.restart.colvars.state". colvars: Writing TI PMF to file "test.restart.metadynamics1.ti.pmf". colvars: Saving collective variables state to "test.restart.colvars.state". -colvars: Resetting the Collective Variables module. diff --git a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.state.stripped b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.state.stripped index b2e45880d..8fd94ae17 100644 --- a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.state.stripped +++ b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.state.stripped @@ -5,39 +5,41 @@ configuration { colvar { name one - x 3.21824609730369e+00 + x 3.2182460973037 } metadynamics { configuration { - step 40 - name metadynamics1 +step 40 +name metadynamics1 } - hills_energy + +hills_energy grid_parameters { n_colvars 1 - lower_boundaries 0.00000000000000e+00 - upper_boundaries 1.00000000000000e+01 - widths 5.00000000000000e-01 + lower_boundaries 0 + upper_boundaries 10 + widths 0.5 sizes 20 } 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - 7.13281977740248e-08 3.47432719684774e-05 1.32710969531751e-03 - 3.97520584607863e-03 9.33724923614962e-04 1.71978626509194e-05 + 7.13281977740245e-08 3.47432719684773e-05 1.32710969531751e-03 + 3.97520584607863e-03 9.33724923614963e-04 1.71978626509194e-05 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - hills_energy_gradients + +hills_energy_gradients grid_parameters { n_colvars 1 - lower_boundaries 0.00000000000000e+00 - upper_boundaries 1.00000000000000e+01 - widths 5.00000000000000e-01 + lower_boundaries 0 + upper_boundaries 10 + widths 0.5 sizes 20 } 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - 1.06439936442365e-06 3.41569090091749e-04 6.29030566258467e-03 + 1.06439936442365e-06 3.41569090091748e-04 6.29030566258467e-03 -1.39755890530190e-03 -5.08230090961957e-03 -1.81171853765071e-04 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 @@ -56,7 +58,7 @@ histogram system_forces 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 - 4.13122374770899e+00 0.00000000000000e+00 0.00000000000000e+00 + 4.12568041118547e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 0.00000000000000e+00 diff --git a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.traj b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.traj index eb3fc8a80..1fe1c9d89 100644 --- a/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.traj +++ b/lammps/tests/library/000_distance-grid_metadynamics-ti/AutoDiff/test.restart.colvars.traj @@ -1,22 +1,22 @@ # step one fa_one - 20 3.21930432520045e+00 6.33399841494236e-04 - 21 3.21715548774701e+00 6.33399841494236e-04 - 22 3.21495252438721e+00 6.33399841494236e-04 - 23 3.21281377542992e+00 6.33399841494236e-04 - 24 3.21084656658218e+00 6.33399841494236e-04 - 25 3.20914116190983e+00 6.33399841494236e-04 - 26 3.20776651114698e+00 6.33399841494236e-04 - 27 3.20676812466764e+00 6.33399841494236e-04 - 28 3.20616797192082e+00 6.33399841494236e-04 - 29 3.20596596977028e+00 6.33399841494236e-04 + 20 3.21930432520045e+00 6.33399841494245e-04 + 21 3.21715548774701e+00 6.33399841494245e-04 + 22 3.21495252438721e+00 6.33399841494245e-04 + 23 3.21281377542992e+00 6.33399841494245e-04 + 24 3.21084656658218e+00 6.33399841494245e-04 + 25 3.20914116190983e+00 6.33399841494245e-04 + 26 3.20776651114698e+00 6.33399841494245e-04 + 27 3.20676812466765e+00 6.33399841494245e-04 + 28 3.20616797192082e+00 6.33399841494245e-04 + 29 3.20596596977028e+00 6.33399841494245e-04 30 3.20614257752035e+00 1.07577301998646e-03 31 3.20666215184123e+00 1.07577301998646e-03 32 3.20747685740396e+00 1.07577301998646e-03 33 3.20853105712263e+00 1.07577301998646e-03 34 3.20976592143065e+00 1.07577301998646e-03 - 35 3.21112388983557e+00 1.07577301998646e-03 + 35 3.21112388983558e+00 1.07577301998646e-03 36 3.21255253963151e+00 1.07577301998646e-03 - 37 3.21400755940122e+00 1.07577301998646e-03 + 37 3.21400755940123e+00 1.07577301998646e-03 38 3.21545476262327e+00 1.07577301998646e-03 39 3.21687127560958e+00 1.07577301998646e-03 40 3.21824609730369e+00 1.39755890530190e-03 diff --git a/lammps/tests/library/000_distance-grid_metadynamics-ti/lammps-version.txt b/lammps/tests/library/000_distance-grid_metadynamics-ti/lammps-version.txt index 308cf25eb..8b1378917 100644 --- a/lammps/tests/library/000_distance-grid_metadynamics-ti/lammps-version.txt +++ b/lammps/tests/library/000_distance-grid_metadynamics-ti/lammps-version.txt @@ -1 +1 @@ -LAMMPS (19 Mar 2020) + diff --git a/lammps/tests/library/run_tests.sh b/lammps/tests/library/run_tests.sh index ad2e15311..b772766f6 100755 --- a/lammps/tests/library/run_tests.sh +++ b/lammps/tests/library/run_tests.sh @@ -293,11 +293,11 @@ else echo "$(${TPUT_RED})There were failed tests.$(${TPUT_CLEAR})" if [ ${#failed_tests[@]} -gt 0 ]; then echo "The following tests are failed:" - printf "%s\n" "${failed_tests[@]}" + printf "%s\n" "${failed_tests[@]}" | sort -u fi if [ ${#failed_tests_low_prec[@]} -gt 0 ]; then echo "The following tests are failed, but passed at low precisions:" - printf "%s\n" "${failed_tests_low_prec[@]}" + printf "%s\n" "${failed_tests_low_prec[@]}" | sort -u fi exit 1 fi From b99011a70e7500521ab558f83d86a9967a9146a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Tue, 16 Apr 2024 16:24:20 +0200 Subject: [PATCH 07/13] Fix parsing of white-space only blocks --- src/colvarparse.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/colvarparse.cpp b/src/colvarparse.cpp index 76b5c694c..cf3096ba5 100644 --- a/src/colvarparse.cpp +++ b/src/colvarparse.cpp @@ -592,7 +592,7 @@ int colvarparse::check_keywords(std::string &conf, char const *key) { if (cvm::debug()) cvm::log("Configuration string for \""+std::string(key)+ - "\": \"\n"+conf+"\".\n"); + "\":\n\""+conf+"\".\n"); strip_values(conf); // after stripping, the config string has either empty lines, or @@ -833,7 +833,8 @@ bool colvarparse::key_lookup(std::string const &conf, data_end) + 1; } - if (data != NULL) { + // data_end < data_begin means that the data or block contains only whitespace + if (data != NULL && data_end > data_begin) { data->append(line, data_begin, (data_end-data_begin)); if (cvm::debug()) { From 299dbf0272c92127d920160fcfe30207d159f58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Tue, 16 Apr 2024 16:43:02 +0200 Subject: [PATCH 08/13] NAMD doc for lambda-dynamics [update-doc] --- doc/colvars-code-refs.bib | 13 ++++++++++++ doc/colvars-refman-main.tex | 40 +++++++++++++++++++++++++------------ doc/colvars-refman-namd.tex | 2 +- src/colvarmodule_refs.h | 23 +++++++++++++++++++++ 4 files changed, 64 insertions(+), 14 deletions(-) diff --git a/doc/colvars-code-refs.bib b/doc/colvars-code-refs.bib index 84cfa1be8..8e2570f0e 100644 --- a/doc/colvars-code-refs.bib +++ b/doc/colvars-code-refs.bib @@ -255,6 +255,19 @@ @article{Humphrey1996 url = {https://doi.org/10.1016/0263-7855(96)00018-5} } +% alchLambda colvar component +% alchFLambda colvar component +% Tinker-HP interface +@misc{Lagardere2023, + title={Lambda-ABF: Simplified, Accurate and Cost-effective Alchemical Free Energy Computations}, + author={Louis Lagard\`ere and Lise Maurin and Olivier Adjoua and Krystel El Hage and Pierre Monmarch\'e and Jean-Philip Piquemal and J\'er\^ome H\'enin}, + year={2023}, + eprint={2307.08006}, + archivePrefix={arXiv}, + primaryClass={physics.chem-ph}, + url = {https://arxiv.org/abs/2307.08006} +} + % eABF implementation % CZAR eABF estimator @article{Lesage2017, diff --git a/doc/colvars-refman-main.tex b/doc/colvars-refman-main.tex index 0e510c5db..f4224497c 100644 --- a/doc/colvars-refman-main.tex +++ b/doc/colvars-refman-main.tex @@ -3042,32 +3042,46 @@ \cvsubsubsec{\texttt{alchLambda}: alchemical lambda parameter.}{sec:cvc_alchlambda} \labelkey{colvar|alchLambda} -The \texttt{alchLambda~\{\}} block defines a component returning the alchemical lambda parameter -of the back-end simulation in \MDENGINE{}, provided that it is enabled using the appropriate options -of \MDENGINE{}. This coordinate is obtained from the back-end at the beginning of a simulation, and -synchronized from Colvars to \MDENGINE{} at every time step. This enables lambda-dynamics simulations. -The \texttt{alchLambda} block itself takes no parameters, it should be left empty. -In contrast, the \texttt{colvar} block containing it should define the relevant extended-system parameters -to enable lambda dynamics, primarily \refkey{extendedMass}{colvar|extendedMass}: +The \texttt{alchLambda} block defines a component returning the alchemical lambda parameter +of the back-end simulation in \MDENGINE{}, provided that it is enabled within that software. +\cvnamdonly{Specifically, the flag \texttt{alchOn} should be enabled, and \texttt{alchType} +should be set to \texttt{TI}.} +The current lambda value is obtained from the back-end at the beginning of a simulation, and +synchronized from Colvars to \MDENGINE{} at every following time step. +This enables lambda-dynamics simulations as documented in detail in \cite{Lagardere2023}. +The \texttt{alchLambda} keyword itself takes no parameters. + +To run lambda-dynamics, the enclosing \texttt{colvar} block should contain extended-system +parameters (\ref{sec:colvar_extended}) as in the following example: \begin{cvexampleinput} \-colvar~\{\\ \-~~name~lambda\\ \-~~extendedLagrangian~on\\ -\-~~extendedMass~400\\ -\-\\ -\-~~alchLambda~\{~\#~Keep~the~line~break\\ -\-~~\}\\ +\-~~extendedMass~150000\\ +\-~~extendedLangevinDamping~1000\\ +\\ +\-~~lowerBoundary~0\\ +\-~~upperBoundary~1\\ +\-~~reflectingLowerBoundary\\ +\-~~reflectingUpperBoundary\\ +\\ +\-~~alchLambda\\ \-\} \end{cvexampleinput} +These parameter values have been found to give stable dynamics for a wide range of applications\cite{Lagardere2023}. +Reflecting boundary conditions are recommended for lambda-dynamics to ensure that the alchemical +variable remains precisely within its physical range. + + \cvsubsubsec{\texttt{alchFlambda}: Force on the alchemical lambda parameter.}{sec:cvc_alchFlambda} \labelkey{colvar|alchFlambda} The \texttt{alchFlambda~\{\}} block defines a component returning the force exterted on the alchemical lambda parameter of the back-end simulation in \MDENGINE{}, provided that it is enabled using the appropriate options of \MDENGINE{}. This coordinate is obtained from the back-end at each time step of a simulation. -The \texttt{alchfLambda} block itself takes no parameters, it should be left empty. +The \texttt{alchFlambda} block itself takes no parameters, it should be left empty. } % end of \cvalchlambdaonly \cvsubsec{Raw data: building blocks for custom functions}{sec:cvc_raw} @@ -4508,7 +4522,7 @@ positive decimal}{% This parameter specifies the fictitious mass in the case of an alchemical variable used in lambda-dynamics (\refkey{alchLambda}{colvar|alchLambda}). - Note that the dimension is not that of a usual mass. Its unit is the energy unit + Note that the dimension is not that of a usual mass: its unit is the energy unit (\ref{sec:units}) times fs$^2$. } } diff --git a/doc/colvars-refman-namd.tex b/doc/colvars-refman-namd.tex index 6e30e6861..c1b56c631 100644 --- a/doc/colvars-refman-namd.tex +++ b/doc/colvars-refman-namd.tex @@ -32,7 +32,7 @@ \newcommand{\cvnamebasedonly}[1]{#1} % only in programs were the alchemical coordinate (alchLambda) is available -\newcommand{\cvalchlambdaonly}[1]{} +\newcommand{\cvalchlambdaonly}[1]{#1} % File output prefixes \newcommand{\outputName}{\emph{outputName}} diff --git a/src/colvarmodule_refs.h b/src/colvarmodule_refs.h index 7af4656e6..031756750 100644 --- a/src/colvarmodule_refs.h +++ b/src/colvarmodule_refs.h @@ -244,6 +244,20 @@ " url = {https://doi.org/10.1016/0263-7855(96)00018-5}\n" "}\n"; + paper_count_[std::string("Lagardere2023")] = 0; + paper_url_[std::string("Lagardere2023")] = "https://arxiv.org/abs/2307.08006"; + paper_bibtex_[std::string("Lagardere2023")] = + "\n" + "@misc{Lagardere2023,\n" + " title={Lambda-ABF: Simplified, Accurate and Cost-effective Alchemical Free Energy Computations},\n" + " author={Louis Lagard\\`ere and Lise Maurin and Olivier Adjoua and Krystel El Hage and Pierre Monmarch\\'e and Jean-Philip Piquemal and J\\'er\\^ome H\\'enin},\n" + " year={2023},\n" + " eprint={2307.08006},\n" + " archivePrefix={arXiv},\n" + " primaryClass={physics.chem-ph},\n" + " url = {https://arxiv.org/abs/2307.08006}\n" + "}\n"; + paper_count_[std::string("Lesage2017")] = 0; paper_url_[std::string("Lesage2017")] = "https://doi.org/10.1021/acs.jpcb.6b10055"; paper_bibtex_[std::string("Lesage2017")] = @@ -617,6 +631,15 @@ feature_count_[std::string("VMD engine")] = 0; feature_paper_map_[std::string("VMD engine")] = "Humphrey1996"; + feature_count_[std::string("alchLambda colvar component")] = 0; + feature_paper_map_[std::string("alchLambda colvar component")] = "Lagardere2023"; + + feature_count_[std::string("alchFLambda colvar component")] = 0; + feature_paper_map_[std::string("alchFLambda colvar component")] = "Lagardere2023"; + + feature_count_[std::string("Tinker-HP interface")] = 0; + feature_paper_map_[std::string("Tinker-HP interface")] = "Lagardere2023"; + feature_count_[std::string("eABF implementation")] = 0; feature_paper_map_[std::string("eABF implementation")] = "Lesage2017"; From c01fb5d6ff7a95c27b2aabeb9ccf454426d4b9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Fri, 7 Jun 2024 11:37:55 +0200 Subject: [PATCH 09/13] Finer choice of files to update in regtest script removes spurious error messages --- namd/tests/library/run_tests.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/namd/tests/library/run_tests.sh b/namd/tests/library/run_tests.sh index 95f64c676..3136239e2 100755 --- a/namd/tests/library/run_tests.sh +++ b/namd/tests/library/run_tests.sh @@ -102,7 +102,7 @@ cleanup_files() { fi for f in ${script%.namd}.*diff; do if [ ! -s $f ]; then rm -f $f; fi; done # remove empty diffs only rm -f ${script%.namd}.*{BAK,old,backup} - for f in ${script%.namd}.*{state,state.stripped,out,traj,coor,vel,xsc,dcd,pmf,hills,grad,force,count,histogram?.dat,hist.dat,corrfunc.dat,histogram?.dx,count.dx,pmf.dx,output.dat,kernels.dat} + for f in ${script%.namd}.*{state,state.stripped,out,traj,coor,vel,xsc,dcd,pmf,hills,grad,force,count,histogram?.dat,hist.dat,corrfunc.dat,histogram?.dx,count.dx,pmf.dx,output.dat,ti,kernels.dat} do if [ ! -f "$f.diff" ]; then rm -f $f; fi # keep files that have a non-empty diff done @@ -230,8 +230,11 @@ for dir in ${DIRLIST} ; do fi # Update any additional files with current versions - for file in AutoDiff/*; do - cp -uf `basename ${file}` AutoDiff/ + for file in AutoDiff/${basename}*; do + source=`basename ${file}` + if [ -f ${source} ] ; then + cp -uf ${source} AutoDiff/ + fi done fi From 9ab0c43b51d07e10be22892f3a1f240a149af505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Mon, 10 Jun 2024 13:53:31 +0200 Subject: [PATCH 10/13] First step towards MTS support in lambda-dynamics --- namd/src/colvarproxy_namd.C | 4 +- namd/tests/library/Common/da.pdb | 22 ++++----- src/colvar.cpp | 79 +++++++++++++++++++------------- src/colvarbias_abf.cpp | 14 +++--- src/colvarcomp.h | 1 + src/colvarcomp_alchlambda.cpp | 18 ++++++-- 6 files changed, 82 insertions(+), 56 deletions(-) diff --git a/namd/src/colvarproxy_namd.C b/namd/src/colvarproxy_namd.C index 41a32ae70..e0c2cf389 100644 --- a/namd/src/colvarproxy_namd.C +++ b/namd/src/colvarproxy_namd.C @@ -1649,7 +1649,7 @@ int colvarproxy_namd::replica_comm_send(char* msg_data, int msg_len, } -/// Request energy computation every freq steps +/// Request alchemical energy computation every freq steps int colvarproxy_namd::request_alch_energy_freq(int const freq) { // This test is only valid for NAMD3 if (freq % simparams->computeEnergies) { @@ -1657,7 +1657,7 @@ int colvarproxy_namd::request_alch_energy_freq(int const freq) { return COLVARS_INPUT_ERROR; } if (!simparams->alchOn) { - cvm::error("alch must be enabled for lambda-dynamics.\n"); + cvm::error("alchOn must be enabled for lambda-dynamics.\n"); return COLVARS_INPUT_ERROR; } if (!simparams->alchThermIntOn) { diff --git a/namd/tests/library/Common/da.pdb b/namd/tests/library/Common/da.pdb index 368cc7619..64a49cb27 100644 --- a/namd/tests/library/Common/da.pdb +++ b/namd/tests/library/Common/da.pdb @@ -1,15 +1,15 @@ CRYST1 0.000 0.000 0.000 90.00 90.00 90.00 P 1 1 -ATOM 1 N ALA B 1 6.652 -0.764 -1.333 1.00 0.00 BH -ATOM 2 HT2 ALA B 1 5.760 -0.450 -1.766 1.00 0.00 BH -ATOM 3 HT3 ALA B 1 7.342 -1.305 -1.892 1.00 0.00 BH -ATOM 4 CA ALA B 1 7.306 0.408 -0.585 1.00 0.00 BH -ATOM 5 HA ALA B 1 8.253 -0.035 -0.313 1.00 0.00 BH -ATOM 6 CB ALA B 1 7.329 1.530 -1.594 1.00 0.00 BH -ATOM 7 HB1 ALA B 1 7.786 2.446 -1.164 1.00 0.00 BH -ATOM 8 HB2 ALA B 1 7.862 1.113 -2.475 1.00 0.00 BH -ATOM 9 HB3 ALA B 1 6.363 1.945 -1.952 1.00 0.00 BH -ATOM 10 C ALA B 1 6.475 0.890 0.649 1.00 0.00 BH -ATOM 11 O ALA B 1 5.256 1.022 0.506 1.00 0.00 BH +ATOM 1 N ALA B 1 6.652 -0.764 -1.333 1.00 -1.00 BH +ATOM 2 HT2 ALA B 1 5.760 -0.450 -1.766 1.00 -1.00 BH +ATOM 3 HT3 ALA B 1 7.342 -1.305 -1.892 1.00 -1.00 BH +ATOM 4 CA ALA B 1 7.306 0.408 -0.585 1.00 -1.00 BH +ATOM 5 HA ALA B 1 8.253 -0.035 -0.313 1.00 -1.00 BH +ATOM 6 CB ALA B 1 7.329 1.530 -1.594 1.00 -1.00 BH +ATOM 7 HB1 ALA B 1 7.786 2.446 -1.164 1.00 -1.00 BH +ATOM 8 HB2 ALA B 1 7.862 1.113 -2.475 1.00 -1.00 BH +ATOM 9 HB3 ALA B 1 6.363 1.945 -1.952 1.00 -1.00 BH +ATOM 10 C ALA B 1 6.475 0.890 0.649 1.00 -1.00 BH +ATOM 11 O ALA B 1 5.256 1.022 0.506 1.00 -1.00 BH ATOM 12 N ALA B 2 7.106 1.140 1.813 1.00 0.00 BH ATOM 13 HN ALA B 2 8.097 1.077 1.900 1.00 0.00 BH ATOM 14 CA ALA B 2 6.403 1.216 3.045 1.00 0.00 BH diff --git a/src/colvar.cpp b/src/colvar.cpp index 4cb34206b..62c156765 100644 --- a/src/colvar.cpp +++ b/src/colvar.cpp @@ -312,6 +312,8 @@ int colvar::init(std::string const &conf) // Detect if we have a single component that is an alchemical lambda if (is_enabled(f_cv_single_cvc) && cvcs[0]->function_type() == "alchLambda") { enable(f_cv_external); + + static_cast(cvcs[0].get())->init_alchemy(time_step_factor); } // If using scripted biases, any colvar may receive bias forces @@ -320,6 +322,17 @@ int colvar::init(std::string const &conf) } error_code |= init_extended_Lagrangian(conf); + + // when total atomic forces are obtained from the previous time step, + // we cannot (currently) have colvar values and projected total forces for the same timestep + // (that would require anticipating the total force request by one timestep) + // i.e. the combination of f_cv_total_force_calc and f_cv_multiple_ts requires f_cv_total_force_current_step + // Because f_cv_total_force_current_step is static, we can hard-code this, once other features are set + // that is f_cv_external and f_cv_extended_Lagrangian + if (!is_enabled(f_cv_total_force_current_step)) { + exclude_feature_self(f_cv_multiple_ts, f_cv_total_force_calc); + } + error_code |= init_output_flags(conf); // Now that the children are defined we can solve dependencies @@ -1156,6 +1169,8 @@ int colvar::init_dependencies() { init_feature(f_cv_total_force, "total_force", f_type_dynamic); require_feature_alt(f_cv_total_force, f_cv_extended_Lagrangian, f_cv_total_force_calc); + // If this is active, the total force reported to biases (ABF / TI) is from the current step + // therefore it does not include Colvars biases -> it is a "system force" init_feature(f_cv_total_force_current_step, "total_force_current_step", f_type_dynamic); // Deps for explicit total force calculation @@ -1247,15 +1262,6 @@ int colvar::init_dependencies() { init_feature(f_cv_multiple_ts, "multiple_timestep", f_type_static); - // when total atomic forces are obtained from the previous time step, - // we cannot (currently) have colvar values and projected total forces for the same timestep - // TODO this will need refining for driven alchemical parameters - // ie. the combination of f_cv_total_force_calc and f_cv_multiple_ts requires f_cv_total_force_current_step - // or we need to anticipate the total force request by one timestep - if (!cvm::main()->proxy->total_forces_same_step()) { - exclude_feature_self(f_cv_multiple_ts, f_cv_total_force_calc); - } - // check that everything is initialized for (i = 0; i < colvardeps::f_cv_ntot; i++) { if (is_not_set(i)) { @@ -1661,22 +1667,20 @@ int colvar::collect_cvc_total_forces() if (is_enabled(f_cv_total_force_calc)) { ft.reset(); - if (cvm::step_relative() > 0) { - // get from the cvcs the total forces from the PREVIOUS step - for (size_t i = 0; i < cvcs.size(); i++) { - if (!cvcs[i]->is_enabled()) continue; - if (cvm::debug()) - cvm::log("Colvar component no. "+cvm::to_str(i+1)+ - " within colvar \""+this->name+"\" has total force "+ - cvm::to_str((cvcs[i])->total_force(), - cvm::cv_width, cvm::cv_prec)+".\n"); - // linear combination is assumed - ft += (cvcs[i])->total_force() * (cvcs[i])->sup_coeff / active_cvc_square_norm; - } + for (size_t i = 0; i < cvcs.size(); i++) { + if (!cvcs[i]->is_enabled()) continue; + if (cvm::debug()) + cvm::log("Colvar component no. "+cvm::to_str(i+1)+ + " within colvar \""+this->name+"\" has total force "+ + cvm::to_str((cvcs[i])->total_force(), + cvm::cv_width, cvm::cv_prec)+".\n"); + // linear combination is assumed + ft += (cvcs[i])->total_force() * (cvcs[i])->sup_coeff / active_cvc_square_norm; } if (!(is_enabled(f_cv_hide_Jacobian) && is_enabled(f_cv_subtract_applied_force))) { - // add the Jacobian force to the total force, and don't apply any silent + // This is by far the most common case + // Add the Jacobian force to the total force, and don't apply any silent // correction internally: biases such as colvarbias_abf will handle it // If f_cv_hide_Jacobian is enabled, a force of -fj is present in ft due to the // Jacobian-compensating force @@ -1684,6 +1688,10 @@ int colvar::collect_cvc_total_forces() } } + if (is_enabled(f_cv_total_force_current_step)) { + // Report total force value without waiting for calc_colvar_properties() + ft_reported = ft; + } return COLVARS_OK; } @@ -1785,9 +1793,12 @@ int colvar::calc_colvar_properties() // But we report values at the beginning of the timestep (value at t=0 on the first timestep) x_reported = x_ext; v_reported = v_ext; - // the "total force" with the extended Lagrangian is - // calculated in update_forces_energy() below + // the "total force" for the extended Lagrangian is calculated in update_forces_energy() below + // A future improvement could compute a "system force" here, borrowing a part of update_extended_Lagrangian() + // this would change the behavior of eABF with respect to other biases + // by enabling f_cv_total_force_current_step, and reducing the total force to a system force + // giving the behavior of f_cv_subtract_applied_force - this is correct for WTM-eABF etc. } else { if (is_enabled(f_cv_subtract_applied_force) && !cvm::proxy->total_forces_same_step()) { @@ -1916,14 +1927,18 @@ void colvar::update_extended_Lagrangian() } f_ext += f_system; - if (is_enabled(f_cv_subtract_applied_force)) { - // Report a "system" force without the biases on this colvar - // that is, just the spring force (or alchemical force) - ft_reported = f_system; - } else { - // The total force acting on the extended variable is f_ext - // This will be used in the next timestep - ft_reported = f_ext; + if ( ! is_enabled(f_cv_total_force_current_step)) { + if (is_enabled(f_cv_subtract_applied_force)) { + // Report a "system" force without the biases on this colvar + // that is, just the spring force (or alchemical force) + ft_reported = f_system; + } else { + // The total force acting on the extended variable is f_ext + // This will be used in the next timestep + ft_reported = f_ext; + } + // Since biases have already been updated, this ft_reported will only be + // communicated to biases at the next timestep } // backup in case we need to revert this integration timestep diff --git a/src/colvarbias_abf.cpp b/src/colvarbias_abf.cpp index 5beb24a67..ae598ce39 100644 --- a/src/colvarbias_abf.cpp +++ b/src/colvarbias_abf.cpp @@ -346,11 +346,12 @@ int colvarbias_abf::update() if (can_accumulate_data() && is_enabled(f_cvb_history_dependent)) { if (cvm::step_relative() > 0 || cvm::proxy->total_forces_same_step()) { + // Note: this will skip step 0 data when available in some cases (extended system), + // but not doing so would make the code more complex if (samples->index_ok(force_bin)) { // Only if requested and within bounds of the grid... - // get total forces (lagging by 1 timestep) from colvars - // and subtract previous ABF force if necessary + // get total force and subtract previous ABF force if necessary update_system_force(); gradients->acc_force(force_bin, system_force); @@ -457,14 +458,13 @@ int colvarbias_abf::update_system_force() // System force from atomic forces (or extended Lagrangian if applicable) for (i = 0; i < num_variables(); i++) { - if (colvars[i]->is_enabled(f_cv_subtract_applied_force) || - (cvm::proxy->total_forces_same_step() && !colvars[i]->is_enabled(f_cv_external))) { + if (colvars[i]->is_enabled(f_cv_subtract_applied_force) + || colvars[i]->is_enabled(f_cv_total_force_current_step)) { // this colvar is already subtracting the ABF force - // or the "total force" is really a system force at current step - // (For external parameters, the total force contains biasing forces - // unless f_cv_subtract_applied_force is enabled) + // or the "total force" is from current step and cannot possibly contain Colvars biases system_force[i] = colvars[i]->total_force().real_value; } else { + // Subtract previous step's bias force from previous step's total force system_force[i] = colvars[i]->total_force().real_value - colvar_forces[i].real_value; } diff --git a/src/colvarcomp.h b/src/colvarcomp.h index e47a2a76d..9d6887666 100644 --- a/src/colvarcomp.h +++ b/src/colvarcomp.h @@ -1212,6 +1212,7 @@ class colvar::alch_lambda // No atom groups needed public: alch_lambda(); + int init_alchemy(int time_step_factor); virtual ~alch_lambda() {} virtual void calc_value(); virtual void calc_force_invgrads(); diff --git a/src/colvarcomp_alchlambda.cpp b/src/colvarcomp_alchlambda.cpp index cd928e823..dad3a1cd1 100644 --- a/src/colvarcomp_alchlambda.cpp +++ b/src/colvarcomp_alchlambda.cpp @@ -29,15 +29,25 @@ colvar::alch_lambda::alch_lambda() x.type(colvarvalue::type_scalar); + // Query initial value from back-end; will be overwritten if restarting from a state file + cvm::proxy->get_alch_lambda(&x.real_value); +} + + +int colvar::alch_lambda::init_alchemy(int factor) +{ // We need calculation every time step // default in Tinker-HP and NAMD2, must be enforced in NAMD3 // Also checks back-end settings, ie. that alchemy is enabled // (in NAMD3: alchType TI, computeEnergies at the right frequency) - cvm::proxy->request_alch_energy_freq(1); - // TODO examine how this breaks everything - whereas alchOutFreq seems to work - // Query initial value from back-end; will be overwritten if restarting from a state file - cvm::proxy->get_alch_lambda(&x.real_value); + // Forbid MTS until fully implemented + if (factor != 1) { + return cvm::error("Error: timeStepFactor > 1 is not yet supported for alchemical variables."); + } + cvm::proxy->request_alch_energy_freq(factor); + + return COLVARS_OK; } From 875ea4fac9a449766e90f4c4aee8cb5d56fe5278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Fri, 30 Aug 2024 19:05:03 +0200 Subject: [PATCH 11/13] Regression test for lambda-ABF in NAMD Had to force single-thread calculation to work around unreliable results on the singel timestep level --- .../AutoDiff/test.colvars.out | 122 +++++++++++++++++ .../AutoDiff/test.colvars.state.stripped | 25 ++++ .../AutoDiff/test.colvars.traj | 22 +++ .../009_lambda_dynamics/AutoDiff/test.count | 4 + .../009_lambda_dynamics/AutoDiff/test.grad | 4 + .../009_lambda_dynamics/AutoDiff/test.pmf | 5 + .../AutoDiff/test.restart.colvars.out | 126 ++++++++++++++++++ .../test.restart.colvars.state.stripped | 25 ++++ .../AutoDiff/test.restart.colvars.traj | 22 +++ .../AutoDiff/test.restart.count | 4 + .../AutoDiff/test.restart.grad | 4 + .../AutoDiff/test.restart.pmf | 5 + .../interface/009_lambda_dynamics/alchemy.tcl | 11 ++ .../009_lambda_dynamics/namd-version.txt | 3 + .../interface/009_lambda_dynamics/no_smp | 0 .../interface/009_lambda_dynamics/test.in | 22 +++ .../interface/009_lambda_dynamics/test.namd | 22 +++ .../009_lambda_dynamics/test.restart.namd | 30 +++++ namd/tests/library/run_tests.sh | 15 ++- 19 files changed, 466 insertions(+), 5 deletions(-) create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.out create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.state.stripped create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.traj create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.count create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.grad create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.pmf create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.out create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.state.stripped create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.traj create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.count create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.grad create mode 100644 namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.pmf create mode 100644 namd/tests/interface/009_lambda_dynamics/alchemy.tcl create mode 100644 namd/tests/interface/009_lambda_dynamics/namd-version.txt create mode 100644 namd/tests/interface/009_lambda_dynamics/no_smp create mode 100644 namd/tests/interface/009_lambda_dynamics/test.in create mode 100644 namd/tests/interface/009_lambda_dynamics/test.namd create mode 100644 namd/tests/interface/009_lambda_dynamics/test.restart.namd diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.out b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.out new file mode 100644 index 000000000..e4dc33a7b --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.out @@ -0,0 +1,122 @@ +colvars: ---------------------------------------------------------------------- +colvars: Please cite Fiorin et al, Mol Phys 2013: +colvars: https://doi.org/10.1080/00268976.2013.813594 +colvars: as well as all other papers listed below for individual features used. +colvars: This version was built with the C++11 standard or higher. +colvars: Summary of compile-time features available in this build: +colvars: - SMP parallelism: enabled (num. threads = 1) +colvars: - Lepton custom functions: available +colvars: - Tcl interpreter: available +colvars: Redefining the Tcl "cv" command to the new script interface. +colvars: The restart output state file will be "test.tmp.colvars.state". +colvars: The final output state file will be "test.colvars.state". +colvars: ---------------------------------------------------------------------- +colvars: Reading new configuration from file "test.in": +colvars: # units = "" [default] +colvars: # smp = on [default] +colvars: # colvarsTrajFrequency = 1 +colvars: # colvarsRestartFrequency = 10 +colvars: # scriptedColvarForces = off [default] +colvars: # scriptingAfterBiases = off [default] +colvars: # sourceTclFile = "" [default] +colvars: ---------------------------------------------------------------------- +colvars: Initializing a new collective variable. +colvars: # name = "lambda" +colvars: Initializing a new "alchLambda" component. +colvars: # name = "" [default] +colvars: # componentCoeff = 1 [default] +colvars: # componentExp = 1 [default] +colvars: # period = 0 [default] +colvars: # wrapAround = 0 [default] +colvars: # forceNoPBC = off [default] +colvars: # scalable = on [default] +colvars: All components initialized. +colvars: # timeStepFactor = 1 [default] +colvars: # width = 1 [default] +colvars: # lowerBoundary = 0 +colvars: # upperBoundary = 1 +colvars: # hardLowerBoundary = off [default] +colvars: # hardUpperBoundary = off [default] +colvars: # expandBoundaries = off [default] +colvars: # extendedLagrangian = on +colvars: Enabling the extended Lagrangian term for colvar "lambda". +colvars: # extendedTemp = 300 [default] +colvars: # extendedMass = 150000 +colvars: # outputEnergy = off [default] +colvars: # extendedLangevinDamping = 1 [default] +colvars: # reflectingLowerBoundary = on +colvars: # reflectingUpperBoundary = on +colvars: # outputValue = on [default] +colvars: # outputVelocity = off [default] +colvars: # outputTotalForce = on +colvars: # outputAppliedForce = on +colvars: # subtractAppliedForce = off [default] +colvars: # runAve = off [default] +colvars: # corrFunc = off [default] +colvars: ---------------------------------------------------------------------- +colvars: Collective variables initialized, 1 in total. +colvars: ---------------------------------------------------------------------- +colvars: Initializing a new "abf" instance. +colvars: # name = "abf1" [default] +colvars: # colvars = { lambda } +colvars: # stepZeroData = off [default] +colvars: # outputEnergy = off [default] +colvars: # outputFreq = 10 [default] +colvars: # timeStepFactor = 1 [default] +colvars: # applyBias = on [default] +colvars: # hideJacobian = off [default] +colvars: Jacobian (geometric) forces will be included in reported free energy gradients. +colvars: # fullSamples = 0 +colvars: # minSamples = 0 [default] +colvars: # inputPrefix = [default] +colvars: # historyFreq = 0 [default] +colvars: # shared = off [default] +colvars: # updateBias = on [default] +colvars: # maxForce = [default] +colvars: # integrate = on [default] +colvars: Finished ABF setup. +colvars: ---------------------------------------------------------------------- +colvars: Collective variables biases initialized, 1 in total. +colvars: ---------------------------------------------------------------------- +colvars: Collective variables module (re)initialized. +colvars: ---------------------------------------------------------------------- +colvars: Updating NAMD interface: +colvars: updating atomic data (0 atoms). +colvars: updating group data (0 scalable groups, 0 atoms in total). +colvars: updating grid object data (0 grid objects in total). +colvars: +colvars: SUMMARY OF COLVARS FEATURES USED SO FAR AND THEIR CITATIONS: +colvars: +colvars: - BAOA integrator: +colvars: BouRabee2010 https://doi.org/10.1137/090758842 +colvars: +colvars: - Colvars module: +colvars: - Colvars-NAMD interface: +colvars: Fiorin2013 https://doi.org/10.1080/00268976.2013.813594 +colvars: +colvars: - ABF colvar bias implementation: +colvars: - Internal-forces free energy estimator: +colvars: Henin2010 https://doi.org/10.1021/ct9004432 +colvars: +colvars: - alchLambda colvar component: +colvars: Lagardere2023 https://arxiv.org/abs/2307.08006 +colvars: +colvars: - NAMD engine: +colvars: Phillips2020 https://doi.org/10.1063/5.0014475 +colvars: +colvars: updating target temperature (T = 300 K). +colvars: Updating NAMD interface: +colvars: updating atomic data (0 atoms). +colvars: updating group data (0 scalable groups, 0 atoms in total). +colvars: updating grid object data (0 grid objects in total). +colvars: updating target temperature (T = 300 K). +colvars: Current simulation parameters: initial step = 0, integration timestep = 1 +colvars: Updating atomic parameters (masses, charges, etc). +colvars: The restart output state file will be "test.tmp.colvars.state". +colvars: Initializing extended coordinate to colvar value. +colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". +colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". +colvars: Saving collective variables state to "test.tmp.colvars.state". +colvars: Synchronizing (emptying the buffer of) trajectory file "test.colvars.traj". +colvars: Saving collective variables state to "test.tmp.colvars.state". +colvars: Saving collective variables state to "test.colvars.state". diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.state.stripped b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.state.stripped new file mode 100644 index 000000000..dd42615aa --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.state.stripped @@ -0,0 +1,25 @@ +configuration { + step 20 + dt 1.000000e+00 +} + +colvar { + name lambda + x 0.20245122980265 + extended_x 0.20245122980265 + extended_v 0.00015391572142221 +} + +abf { + configuration { + step 20 + name abf1 + } + +samples + 20 + +gradient + -8.0141711538951 +} + diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.traj b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.traj new file mode 100644 index 000000000..2cce7e646 --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.colvars.traj @@ -0,0 +1,22 @@ +# step lambda ft_lambda fa_lambda + 0 2.00000000000000e-01 0.00000000000000e+00 0.00000000000000e+00 + 1 1.99992395820152e-01 7.96684221784716e+00 -7.96684221784716e+00 + 2 1.99901022015639e-01 7.88324824580072e+00 -7.92504523182394e+00 + 3 1.99800875537990e-01 7.80665457013810e+00 -7.88558167792866e+00 + 4 1.99762218563404e-01 7.73048537492151e+00 -7.84680760217688e+00 + 5 1.99769367689661e-01 7.65449840553533e+00 -7.80834576284857e+00 + 6 1.99807952653923e-01 7.58324655116611e+00 -7.77082922756816e+00 + 7 1.99845484395962e-01 7.52736002846028e+00 -7.73604791340989e+00 + 8 1.99869775547569e-01 7.50005661145498e+00 -7.70654900066553e+00 + 9 1.99836075126736e-01 7.51578941134210e+00 -7.68535349074070e+00 + 10 1.99812694785606e-01 7.57995782043818e+00 -7.67481392371045e+00 + 11 1.99873218443446e-01 7.69049228724148e+00 -7.67623922948600e+00 + 12 2.00011013975393e-01 7.84032662263539e+00 -7.68991317891511e+00 + 13 2.00168434974116e-01 8.01767282114353e+00 -7.71512545908653e+00 + 14 2.00359096146772e-01 8.20385566003222e+00 -7.75003475915408e+00 + 15 2.00679173048730e-01 8.37628507963051e+00 -7.79178478051917e+00 + 16 2.01074279279389e-01 8.52227734901836e+00 -7.83744056605037e+00 + 17 2.01467672933468e-01 8.63554749590671e+00 -7.88438803251251e+00 + 18 2.01869356438853e-01 8.71184768812576e+00 -7.93035801337991e+00 + 19 2.02221179933948e-01 8.75639425563999e+00 -7.97383360507781e+00 + 20 2.02451229802647e-01 8.78058458142414e+00 -8.01417115389513e+00 diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.count b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.count new file mode 100644 index 000000000..5a113f218 --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.count @@ -0,0 +1,4 @@ +# 1 +# 0.00000000000000e+00 1.00000000000000e+00 1 0 + + 5.00000000000000e-01 20 diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.grad b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.grad new file mode 100644 index 000000000..f82f75df5 --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.grad @@ -0,0 +1,4 @@ +# 1 +# 0.00000000000000e+00 1.00000000000000e+00 1 0 + + 5.00000000000000e-01 -8.01417115389513e+00 diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.pmf b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.pmf new file mode 100644 index 000000000..607462679 --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.pmf @@ -0,0 +1,5 @@ +# 1 +# -5.00000000000000e-01 1.00000000000000e+00 2 0 + + 0.00000000000000e+00 8.01417115389513e+00 + 1.00000000000000e+00 0.00000000000000e+00 diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.out b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.out new file mode 100644 index 000000000..0dc63e526 --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.out @@ -0,0 +1,126 @@ +colvars: ---------------------------------------------------------------------- +colvars: Please cite Fiorin et al, Mol Phys 2013: +colvars: https://doi.org/10.1080/00268976.2013.813594 +colvars: as well as all other papers listed below for individual features used. +colvars: This version was built with the C++11 standard or higher. +colvars: Summary of compile-time features available in this build: +colvars: - SMP parallelism: enabled (num. threads = 1) +colvars: - Lepton custom functions: available +colvars: - Tcl interpreter: available +colvars: Redefining the Tcl "cv" command to the new script interface. +colvars: The restart output state file will be "test.restart.tmp.colvars.state". +colvars: The final output state file will be "test.restart.colvars.state". +colvars: ---------------------------------------------------------------------- +colvars: Reading new configuration from file "test.in": +colvars: # units = "" [default] +colvars: # smp = on [default] +colvars: # colvarsTrajFrequency = 1 +colvars: # colvarsRestartFrequency = 10 +colvars: # scriptedColvarForces = off [default] +colvars: # scriptingAfterBiases = off [default] +colvars: # sourceTclFile = "" [default] +colvars: ---------------------------------------------------------------------- +colvars: Initializing a new collective variable. +colvars: # name = "lambda" +colvars: Initializing a new "alchLambda" component. +colvars: # name = "" [default] +colvars: # componentCoeff = 1 [default] +colvars: # componentExp = 1 [default] +colvars: # period = 0 [default] +colvars: # wrapAround = 0 [default] +colvars: # forceNoPBC = off [default] +colvars: # scalable = on [default] +colvars: All components initialized. +colvars: # timeStepFactor = 1 [default] +colvars: # width = 1 [default] +colvars: # lowerBoundary = 0 +colvars: # upperBoundary = 1 +colvars: # hardLowerBoundary = off [default] +colvars: # hardUpperBoundary = off [default] +colvars: # expandBoundaries = off [default] +colvars: # extendedLagrangian = on +colvars: Enabling the extended Lagrangian term for colvar "lambda". +colvars: # extendedTemp = 300 [default] +colvars: # extendedMass = 150000 +colvars: # outputEnergy = off [default] +colvars: # extendedLangevinDamping = 1 [default] +colvars: # reflectingLowerBoundary = on +colvars: # reflectingUpperBoundary = on +colvars: # outputValue = on [default] +colvars: # outputVelocity = off [default] +colvars: # outputTotalForce = on +colvars: # outputAppliedForce = on +colvars: # subtractAppliedForce = off [default] +colvars: # runAve = off [default] +colvars: # corrFunc = off [default] +colvars: ---------------------------------------------------------------------- +colvars: Collective variables initialized, 1 in total. +colvars: ---------------------------------------------------------------------- +colvars: Initializing a new "abf" instance. +colvars: # name = "abf1" [default] +colvars: # colvars = { lambda } +colvars: # stepZeroData = off [default] +colvars: # outputEnergy = off [default] +colvars: # outputFreq = 10 [default] +colvars: # timeStepFactor = 1 [default] +colvars: # applyBias = on [default] +colvars: # hideJacobian = off [default] +colvars: Jacobian (geometric) forces will be included in reported free energy gradients. +colvars: # fullSamples = 0 +colvars: # minSamples = 0 [default] +colvars: # inputPrefix = [default] +colvars: # historyFreq = 0 [default] +colvars: # shared = off [default] +colvars: # updateBias = on [default] +colvars: # maxForce = [default] +colvars: # integrate = on [default] +colvars: Finished ABF setup. +colvars: ---------------------------------------------------------------------- +colvars: Collective variables biases initialized, 1 in total. +colvars: ---------------------------------------------------------------------- +colvars: Collective variables module (re)initialized. +colvars: ---------------------------------------------------------------------- +colvars: Updating NAMD interface: +colvars: updating atomic data (0 atoms). +colvars: updating group data (0 scalable groups, 0 atoms in total). +colvars: updating grid object data (0 grid objects in total). +colvars: +colvars: SUMMARY OF COLVARS FEATURES USED SO FAR AND THEIR CITATIONS: +colvars: +colvars: - BAOA integrator: +colvars: BouRabee2010 https://doi.org/10.1137/090758842 +colvars: +colvars: - Colvars module: +colvars: - Colvars-NAMD interface: +colvars: Fiorin2013 https://doi.org/10.1080/00268976.2013.813594 +colvars: +colvars: - ABF colvar bias implementation: +colvars: - Internal-forces free energy estimator: +colvars: Henin2010 https://doi.org/10.1021/ct9004432 +colvars: +colvars: - alchLambda colvar component: +colvars: Lagardere2023 https://arxiv.org/abs/2307.08006 +colvars: +colvars: - NAMD engine: +colvars: Phillips2020 https://doi.org/10.1063/5.0014475 +colvars: +colvars: updating target temperature (T = 300 K). +colvars: ---------------------------------------------------------------------- +colvars: Loading state from text file "test.colvars.state". +colvars: Restarting collective variable "lambda" from value: 0.202451 +colvars: Restarted abf bias "abf1" with step number 20. +colvars: ---------------------------------------------------------------------- +colvars: Updating NAMD interface: +colvars: updating atomic data (0 atoms). +colvars: updating group data (0 scalable groups, 0 atoms in total). +colvars: updating grid object data (0 grid objects in total). +colvars: updating target temperature (T = 300 K). +colvars: Current simulation parameters: initial step = 20, integration timestep = 1 +colvars: Updating atomic parameters (masses, charges, etc). +colvars: The restart output state file will be "test.restart.tmp.colvars.state". +colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". +colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". +colvars: Saving collective variables state to "test.restart.tmp.colvars.state". +colvars: Synchronizing (emptying the buffer of) trajectory file "test.restart.colvars.traj". +colvars: Saving collective variables state to "test.restart.tmp.colvars.state". +colvars: Saving collective variables state to "test.restart.colvars.state". diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.state.stripped b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.state.stripped new file mode 100644 index 000000000..bbd7a6f52 --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.state.stripped @@ -0,0 +1,25 @@ +configuration { + step 40 + dt 1.000000e+00 +} + +colvar { + name lambda + x 0.20836051020006 + extended_x 0.20836051020006 + extended_v 0.0004528018356754 +} + +abf { + configuration { + step 40 + name abf1 + } + +samples + 40 + +gradient + -9.1800383003581 +} + diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.traj b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.traj new file mode 100644 index 000000000..2c8ac13ef --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.colvars.traj @@ -0,0 +1,22 @@ +# step lambda ft_lambda fa_lambda + 20 2.02451229802650e-01 0.00000000000000e+00 -8.01417115389510e+00 + 21 2.02544063317688e-01 8.79677173742116e+00 -8.05143784834872e+00 + 22 2.02557993229958e-01 8.81441210482505e+00 -8.08611849637037e+00 + 23 2.02568176589621e-01 8.83952439255414e+00 -8.11887527446532e+00 + 24 2.02645067021906e-01 8.87347035441114e+00 -8.15031673612973e+00 + 25 2.02773241774165e-01 8.91763592471448e+00 -8.18100950367312e+00 + 26 2.02938664924388e-01 8.97161705686943e+00 -8.21141748648836e+00 + 27 2.03109223468217e-01 9.03911380941207e+00 -8.24207290585590e+00 + 28 2.03273109969140e-01 9.13005964298271e+00 -8.27378671789615e+00 + 29 2.03385946933364e-01 9.26505411891078e+00 -8.30796835241389e+00 + 30 2.03516464758499e-01 9.46339797126387e+00 -8.34648267304223e+00 + 31 2.03738807200153e-01 9.74220853201881e+00 -8.39150608784792e+00 + 32 2.04047164987984e-01 1.01132685590046e+01 -8.44531116507157e+00 + 33 2.04385089669305e-01 1.05741725498844e+01 -8.50982211612650e+00 + 34 2.04767813595167e-01 1.10964359033778e+01 -8.58589899222213e+00 + 35 2.05293465871353e-01 1.16275890959526e+01 -8.67280442375728e+00 + 36 2.05909736002440e-01 1.21203178221254e+01 -8.76856868482306e+00 + 37 2.06541843034024e-01 1.25351891085928e+01 -8.87036923681684e+00 + 38 2.07201416018228e-01 1.28409084557337e+01 -8.97485711099886e+00 + 39 2.07831424699300e-01 1.30323135766731e+01 -9.07889445627256e+00 + 40 2.08360510200055e-01 1.31246482196932e+01 -9.18003830035808e+00 diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.count b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.count new file mode 100644 index 000000000..04982258b --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.count @@ -0,0 +1,4 @@ +# 1 +# 0.00000000000000e+00 1.00000000000000e+00 1 0 + + 5.00000000000000e-01 40 diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.grad b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.grad new file mode 100644 index 000000000..511481847 --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.grad @@ -0,0 +1,4 @@ +# 1 +# 0.00000000000000e+00 1.00000000000000e+00 1 0 + + 5.00000000000000e-01 -9.18003830035807e+00 diff --git a/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.pmf b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.pmf new file mode 100644 index 000000000..01192537c --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/AutoDiff/test.restart.pmf @@ -0,0 +1,5 @@ +# 1 +# -5.00000000000000e-01 1.00000000000000e+00 2 0 + + 0.00000000000000e+00 9.18003830035808e+00 + 1.00000000000000e+00 0.00000000000000e+00 diff --git a/namd/tests/interface/009_lambda_dynamics/alchemy.tcl b/namd/tests/interface/009_lambda_dynamics/alchemy.tcl new file mode 100644 index 000000000..2016c8fe4 --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/alchemy.tcl @@ -0,0 +1,11 @@ + +langevin on +langevinTemp 300.0 +langevinDamping 0.000000001 + +alch on +alchType TI +alchFile ../Common/da.pdb +alchCol B +alchLambda 0.2 + diff --git a/namd/tests/interface/009_lambda_dynamics/namd-version.txt b/namd/tests/interface/009_lambda_dynamics/namd-version.txt new file mode 100644 index 000000000..e1d311c69 --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/namd-version.txt @@ -0,0 +1,3 @@ +Info: NAMD 3.1alpha2 for Linux-x86_64-multicore +colvars: Initializing the collective variables module, version 2024-06-04. +colvars: Using NAMD interface, version "2023-12-05". diff --git a/namd/tests/interface/009_lambda_dynamics/no_smp b/namd/tests/interface/009_lambda_dynamics/no_smp new file mode 100644 index 000000000..e69de29bb diff --git a/namd/tests/interface/009_lambda_dynamics/test.in b/namd/tests/interface/009_lambda_dynamics/test.in new file mode 100644 index 000000000..00f9a1906 --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/test.in @@ -0,0 +1,22 @@ +colvarsTrajFrequency 1 +colvarsRestartFrequency 10 + +colvar { + name lambda + extendedLagrangian on + extendedMass 150000 + + lowerBoundary 0 + upperBoundary 1 + reflectingLowerBoundary + reflectingUpperBoundary + + alchLambda + outputTotalForce + outputAppliedForce +} + +abf { + colvars lambda + fullSamples 0 +} diff --git a/namd/tests/interface/009_lambda_dynamics/test.namd b/namd/tests/interface/009_lambda_dynamics/test.namd new file mode 100644 index 000000000..7e8b1149f --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/test.namd @@ -0,0 +1,22 @@ +# -*- tcl -*- + +# Note: see also test.restart.namd, test.legacy.namd, test.restart.legacy.namd + +source ../Common/common.namd +source alchemy.tcl + +colvars on + +cv configfile test.in + +if { [file exists test.prerun.tcl] > 0 } { + source test.prerun.tcl +} + +run ${numsteps} + +if { [file exists test.postprocess.tcl] > 0 } { + source test.postprocess.tcl +} + +source ../Common/delete_tmp_files.tcl diff --git a/namd/tests/interface/009_lambda_dynamics/test.restart.namd b/namd/tests/interface/009_lambda_dynamics/test.restart.namd new file mode 100644 index 000000000..4a1e140ff --- /dev/null +++ b/namd/tests/interface/009_lambda_dynamics/test.restart.namd @@ -0,0 +1,30 @@ +# -*- tcl -*- + +# Note: see also test.restart.namd, test.legacy.namd, test.restart.legacy.namd + +set output_name "test.restart" +set coor_bin_file "test.coor" +set vel_bin_file "test.vel" + +source ../Common/common.namd +source alchemy.tcl + +# Enforce GPU resident to avoid synchronization issues in parallel +#GPUresident on + +colvars on + +cv configfile test.in +cv load test.colvars.state + +if { [file exists test.restart.prerun.tcl] > 0 } { + source test.restart.prerun.tcl +} + +run ${numsteps} + +if { [file exists test.restart.postprocess.tcl] > 0 } { + source test.restart.postprocess.tcl +} + +source ../Common/delete_tmp_files.tcl diff --git a/namd/tests/library/run_tests.sh b/namd/tests/library/run_tests.sh index 3136239e2..b26de8b6c 100755 --- a/namd/tests/library/run_tests.sh +++ b/namd/tests/library/run_tests.sh @@ -69,12 +69,12 @@ CHARM_ARCH=$(${BINARY} 2>&1 | grep 'Info: Based on Charm++/Converse' | cut -d' ' if [ "x${CHARM_ARCH}" == "xmpi-linux-x86_64" ] && source ${TOPDIR}/devel-tools/load-openmpi.sh ; then NUM_TASKS=${NUM_THREADS} NUM_THREADS=1 - BINARY="mpirun -n ${NUM_TASKS} -oversubscribe $BINARY" + CMD="mpirun -n ${NUM_TASKS} -oversubscribe $BINARY" else - BINARY="$BINARY +p ${NUM_THREADS}" + CMD="$BINARY +p ${NUM_THREADS}" fi -echo "Running NAMD as: $BINARY" +echo "Running NAMD as: $CMD" TPUT_RED='true' TPUT_GREEN='true' @@ -188,8 +188,13 @@ for dir in ${DIRLIST} ; do fi fi - # Run the test (use a subshell to avoid cluttering stdout) - NAMD_CUDASOA=$CUDASOA $BINARY $script > ${basename}.out + if [ -f no_smp ]; then + # Force the test to run serially + NAMD_CUDASOA=$CUDASOA $BINARY +p1 $script > ${basename}.out + else + # Run the test (use a subshell to avoid cluttering stdout) + NAMD_CUDASOA=$CUDASOA $CMD $script > ${basename}.out + fi # Output of Colvars module, minus the version numbers grep "^colvars:" ${basename}.out | grep -v 'Initializing the collective variables module' \ From 5e37f65d764c38eec892fadd753095747eeb37d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Fri, 18 Oct 2024 16:54:35 +0200 Subject: [PATCH 12/13] Doc improvements for NAMD/lambda-dyn --- doc/colvars-refman-main.tex | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/doc/colvars-refman-main.tex b/doc/colvars-refman-main.tex index f4224497c..c529f0818 100644 --- a/doc/colvars-refman-main.tex +++ b/doc/colvars-refman-main.tex @@ -3074,6 +3074,36 @@ Reflecting boundary conditions are recommended for lambda-dynamics to ensure that the alchemical variable remains precisely within its physical range. +\cvnamdonly{ +The NAMD configuration file should also contain the parameters for setting up the alchemical simulation, for example: +\begin{cvexampleinput} +computeEnergies~~~~~~~~~1\\ +\\ +alch~~~~~~~~~~~~~~~~~~~~on\\ +alchType~~~~~~~~~~~~~~~~TI\\ +alchFile~~~~~~~~~~~~~~~~\$\{alchFile\}.pdb\\ +alchCol~~~~~~~~~~~~~~~~~B\\ +alchOutFile~~~~~~~~~~~~~\$\{outName\}.fepout\\ +alchOutFreq~~~~~~~~~~~~~100\\ +alchVdwLambdaEnd~~~~~~~~0.5\\ +alchElecLambdaStart~~~~~0.5\\ +alchVdWShiftCoeff~~~~~~~6.0\\ +alchlambda~~~~~~~~~~~~~~0\\ +\end{cvexampleinput} + +Here, the value of 1 for \texttt{computeEnergies} and TI for \texttt{alchType} are mandatory. +All other parameters can be chosen freely as documented in the NAMD User's Guide. + +\paragraph{Special considerations for running lambda-dynamics in NAMD/Colvars.} +As of NAMD 3.0, lambda-dynamics is not compatible with multiple timestepping. We recommend applying +hydrogen mass repartitioning (HMR) to the topology and increasing the base timestep to 2~fs +to limit the performance impact of disabling multiple timestepping. +When running in parallel on CPUs, synchronization issues prevent lambda-dynamics trajectories from being +fully reproducible. +This can be circumvented by running NAMD in GPU-resident mode. +} % end of \cvnamdonly + + \cvsubsubsec{\texttt{alchFlambda}: Force on the alchemical lambda parameter.}{sec:cvc_alchFlambda} \labelkey{colvar|alchFlambda} @@ -3082,8 +3112,12 @@ lambda parameter of the back-end simulation in \MDENGINE{}, provided that it is enabled using the appropriate options of \MDENGINE{}. This coordinate is obtained from the back-end at each time step of a simulation. The \texttt{alchFlambda} block itself takes no parameters, it should be left empty. + + } % end of \cvalchlambdaonly + + \cvsubsec{Raw data: building blocks for custom functions}{sec:cvc_raw} \cvsubsubsec{\texttt{cartesian}: vector of atomic Cartesian coordinates.}{sec:cvc_cartesian} From d6fc186ed678c85b93304ba987f76d5ff1367e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20H=C3=A9nin?= Date: Tue, 17 Dec 2024 00:03:19 +0100 Subject: [PATCH 13/13] Feature fixes after PR review - move step zero data test from colvarbias.cpp to ABF - properly test for driven external parameter --- src/colvar.cpp | 2 +- src/colvarbias.cpp | 5 ----- src/colvarbias_abf.cpp | 6 ++++++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/colvar.cpp b/src/colvar.cpp index 62c156765..be623a5a0 100644 --- a/src/colvar.cpp +++ b/src/colvar.cpp @@ -2560,7 +2560,7 @@ std::string const colvar::get_state_params() const << " x " << std::setprecision(cvm::cv_prec) << std::setw(cvm::cv_width); - if (is_enabled(f_cv_external)) { + if (is_enabled(f_cv_external) && is_enabled(f_cv_extended_Lagrangian)) { // For an external colvar, x is one timestep in the future after integration // write x at beginning of timestep os << x_reported << "\n"; diff --git a/src/colvarbias.cpp b/src/colvarbias.cpp index 490a07811..7de84e0d5 100644 --- a/src/colvarbias.cpp +++ b/src/colvarbias.cpp @@ -100,11 +100,6 @@ int colvarbias::init(std::string const &conf) colvar_values[i].type(colvars[i]->value().type()); colvar_forces[i].type(colvar_values[i].type()); previous_colvar_forces[i].type(colvar_values[i].type()); - if (!colvars[i]->is_enabled(f_cv_total_force_current_step)) { - // If any colvar does not have current-step total force, then - // we can't do step 0 data - feature_states[f_cvb_step_zero_data].available = false; - } } output_prefix = cvm::output_prefix(); diff --git a/src/colvarbias_abf.cpp b/src/colvarbias_abf.cpp index ae598ce39..db140181a 100644 --- a/src/colvarbias_abf.cpp +++ b/src/colvarbias_abf.cpp @@ -136,6 +136,12 @@ int colvarbias_abf::init(std::string const &conf) enable(f_cvb_extended); } + if (!colvars[i]->is_enabled(f_cv_total_force_current_step)) { + // If any colvar does not have current-step total force, then + // we can't do step 0 data + provide(f_cvb_step_zero_data, false); + } + // Cannot mix and match coarse time steps with ABF because it gives // wrong total force averages - total force needs to be averaged over // every time step