Update Colvars library to version 2025-04-18

The following is a list of pull requests relevant to LAMMPS in the Colvars repository since 2024-08-06:

- 752 New tool poisson_integrator_conv
  https://github.com/Colvars/colvars/pull/752 (@jhenin)

- 733 Custom grids for all biases
  https://github.com/Colvars/colvars/pull/733 (@giacomofiorin, @jhenin)

- 776 Avoid error in acos and asin with fast-math
  https://github.com/Colvars/colvars/pull/776 (@jhenin)

- 773 fix: fix the clang build test failure of OPES
  https://github.com/Colvars/colvars/pull/773 (@HanatoK)

- 768 fix: clamp the input values of asin and acos in case of fast math on aarch64
  https://github.com/Colvars/colvars/pull/768 (@HanatoK)

- 761 Add debug code for the Jacobi failure
  https://github.com/Colvars/colvars/pull/761 (@HanatoK)

- 759 min_image fix; Saves long runs from crashes;
  https://github.com/Colvars/colvars/pull/759 (@PolyachenkoYA)

- 757 Fix MSVC OpenMP issue
  https://github.com/Colvars/colvars/pull/757 (@HanatoK)

- 755 Fix indentation of 'Init CVC' message in standard output
  https://github.com/Colvars/colvars/pull/755 (@jhenin)

- 750 Optimize and simplify the calculation of dihedral gradients
  https://github.com/Colvars/colvars/pull/750 (@HanatoK)

- 749 Add references to new Colvars paper
  https://github.com/Colvars/colvars/pull/749 (@jhenin, @giacomofiorin)

- 740 Report the specific C++ standard at init time, stop warning about C++97/03
  https://github.com/Colvars/colvars/pull/740 (@giacomofiorin)

- 731 Improve detection of hard/mathematical boundaries
  https://github.com/Colvars/colvars/pull/731 (@giacomofiorin)

- 729 Optimize the fit gradients
  https://github.com/Colvars/colvars/pull/729 (@HanatoK, @jhenin)

- 728 Fix undefined behavior when getting the current working directory from std::filesystem
  https://github.com/Colvars/colvars/pull/728 (@giacomofiorin)

- 727 Add patchversion scripting command
  https://github.com/Colvars/colvars/pull/727 (@giacomofiorin)

- 724 Fix gradients and metric functions of distanceDir
  https://github.com/Colvars/colvars/pull/724 (@giacomofiorin)

- 715 Add missing rotation in orientation component
  https://github.com/Colvars/colvars/pull/715 (@giacomofiorin)

- 713 fix: try to solve #87 for non-scala components
  https://github.com/Colvars/colvars/pull/713 (@HanatoK)

- 709 Implementation of OPES in Colvars
  https://github.com/Colvars/colvars/pull/709 (@HanatoK, @giacomofiorin, @jhenin)

- 706 BUGFIX for Segmentation fault in colvarbias_meta::calc_energy() with useGrids off
  https://github.com/Colvars/colvars/pull/706 (@alphataubio)

- 570 enable use of CVs defined by PyTorch neural network models
  https://github.com/Colvars/colvars/pull/570 (@zwpku, @giacomofiorin, @HanatoK, @jhenin)

Authors: @alphataubio, @EzryStIago, @giacomofiorin, @HanatoK, @jhenin, @PolyachenkoYA, @zwpku
This commit is contained in:
Giacomo Fiorin
2025-04-08 12:18:07 -04:00
parent 440e24c60e
commit cba479bf6e
57 changed files with 4346 additions and 1199 deletions

View File

@ -20,22 +20,46 @@ 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
// 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)
// 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;
}
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
// (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;
@ -43,19 +67,24 @@ 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;
}
void colvar::alch_lambda::apply_force(colvarvalue const & /* force */)
{
// new value will be cached and sent at end of timestep
cvm::proxy->set_alch_lambda(x.real_value);
// Forces, if any, are applied in colvar::update_extended_Lagrangian()
}
colvar::alch_Flambda::alch_Flambda()
{
set_function_type("alch_Flambda");