Update Colvars to version 2022-05-09
This update includes one new feature (neural-network based collective variables), several small enhancements (including an automatic definition of grid boundaries for angle-based CVs, and a normalization option for eigenvector-based CVs), bugfixes and documentation improvements. Usage information for specific features included in the Colvars library (i.e. not just the library as a whole) is now also reported to the screen or LAMMPS logfile (as is done already in other LAMMPS classes). Notable to LAMMPS code development are the removals of duplicated code and of ambiguously-named preprocessor defines in the Colvars headers. Since the last PR, the existing regression tests have also been running automatically via GitHub Actions. The following pull requests in the Colvars repository are relevant to LAMMPS: - 475 Remove fatal error condition https://github.com/Colvars/colvars/pull/475 (@jhenin, @giacomofiorin) - 474 Allow normalizing eigenvector vector components to deal with unit change https://github.com/Colvars/colvars/pull/474 (@giacomofiorin, @jhenin) - 470 Better error handling in the initialization of NeuralNetwork CV https://github.com/Colvars/colvars/pull/470 (@HanatoK) - 468 Add examples of histogram configuration, with and without explicit grid parameters https://github.com/Colvars/colvars/pull/468 (@giacomofiorin) - 464 Fix #463 using more fine-grained features https://github.com/Colvars/colvars/pull/464 (@jhenin, @giacomofiorin) - 447 [RFC] New option "scaledBiasingForce" for colvarbias https://github.com/Colvars/colvars/pull/447 (@HanatoK, @jhenin) - 444 [RFC] Implementation of dense neural network as CV https://github.com/Colvars/colvars/pull/444 (@HanatoK, @giacomofiorin, @jhenin) - 443 Fix explicit gradient dependency of sub-CVs https://github.com/Colvars/colvars/pull/443 (@HanatoK, @jhenin) - 442 Persistent bias count https://github.com/Colvars/colvars/pull/442 (@jhenin, @giacomofiorin) - 437 Return type of bias from scripting interface https://github.com/Colvars/colvars/pull/437 (@giacomofiorin) - 434 More flexible use of boundaries from colvars by grids https://github.com/Colvars/colvars/pull/434 (@jhenin) - 433 Prevent double-free in linearCombination https://github.com/Colvars/colvars/pull/433 (@HanatoK) - 428 More complete documentation for index file format (NDX) https://github.com/Colvars/colvars/pull/428 (@giacomofiorin) - 426 Integrate functional version of backup_file() into base proxy class https://github.com/Colvars/colvars/pull/426 (@giacomofiorin) - 424 Track CVC inheritance when documenting feature usage https://github.com/Colvars/colvars/pull/424 (@giacomofiorin) - 419 Generate citation report while running computations https://github.com/Colvars/colvars/pull/419 (@giacomofiorin, @jhenin) - 415 Rebin metadynamics bias from explicit hills when available https://github.com/Colvars/colvars/pull/415 (@giacomofiorin) - 312 Ignore a keyword if it has content to the left of it (regardless of braces) https://github.com/Colvars/colvars/pull/312 (@giacomofiorin) Authors: @giacomofiorin, @HanatoK, @jhenin
This commit is contained in:
@ -20,7 +20,7 @@
|
||||
colvar::alch_lambda::alch_lambda(std::string const &conf)
|
||||
: cvc(conf)
|
||||
{
|
||||
function_type = "alch_lambda";
|
||||
set_function_type("alchLambda");
|
||||
|
||||
disable(f_cvc_explicit_gradient);
|
||||
disable(f_cvc_gradient);
|
||||
@ -36,8 +36,12 @@ void colvar::alch_lambda::calc_value()
|
||||
// Special workflow:
|
||||
// at the beginning of the timestep we get a force instead of calculating the value
|
||||
|
||||
cvm::proxy->get_dE_dLambda(&ft.real_value);
|
||||
cvm::proxy->get_dE_dlambda(&ft.real_value);
|
||||
ft.real_value *= -1.0; // Energy derivative to force
|
||||
|
||||
// Include any force due to bias on Flambda
|
||||
ft.real_value += cvm::proxy->indirect_lambda_biasing_force;
|
||||
cvm::proxy->indirect_lambda_biasing_force = 0.0;
|
||||
}
|
||||
|
||||
|
||||
@ -46,11 +50,57 @@ void colvar::alch_lambda::calc_gradients()
|
||||
}
|
||||
|
||||
|
||||
void colvar::alch_lambda::apply_force(colvarvalue const &force)
|
||||
void colvar::alch_lambda::apply_force(colvarvalue const & /* force */)
|
||||
{
|
||||
// Special workflow:
|
||||
// at the end of the time step we send a new value
|
||||
cvm::proxy->set_alch_lambda(&x.real_value);
|
||||
// new value will be cached and sent at end of timestep
|
||||
cvm::proxy->set_alch_lambda(x.real_value);
|
||||
}
|
||||
|
||||
simple_scalar_dist_functions(alch_lambda)
|
||||
|
||||
|
||||
|
||||
colvar::alch_Flambda::alch_Flambda(std::string const &conf)
|
||||
: cvc(conf)
|
||||
{
|
||||
set_function_type("alch_Flambda");
|
||||
|
||||
disable(f_cvc_explicit_gradient);
|
||||
disable(f_cvc_gradient);
|
||||
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
|
||||
|
||||
void colvar::alch_Flambda::calc_value()
|
||||
{
|
||||
// Special workflow:
|
||||
// at the beginning of the timestep we get a force instead of calculating the value
|
||||
|
||||
// Query initial value from back-end
|
||||
cvm::proxy->get_dE_dlambda(&x.real_value);
|
||||
x.real_value *= -1.0; // Energy derivative to force
|
||||
}
|
||||
|
||||
|
||||
void colvar::alch_Flambda::calc_gradients()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void colvar::alch_Flambda::apply_force(colvarvalue const &force)
|
||||
{
|
||||
// Convert force on Flambda to force on dE/dlambda
|
||||
cvm::real f = -1.0 * force.real_value;
|
||||
// Send scalar force to back-end, which will distribute it onto atoms
|
||||
cvm::proxy->apply_force_dE_dlambda(&f);
|
||||
|
||||
// Propagate force on Flambda to lambda internally
|
||||
cvm::real d2E_dlambda2;
|
||||
cvm::proxy->get_d2E_dlambda2(&d2E_dlambda2);
|
||||
|
||||
// This accumulates a force, it needs to be zeroed when taken into account by lambda
|
||||
cvm::proxy->indirect_lambda_biasing_force += d2E_dlambda2 * f;
|
||||
}
|
||||
|
||||
simple_scalar_dist_functions(alch_Flambda)
|
||||
|
||||
Reference in New Issue
Block a user