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

@ -11,43 +11,9 @@
#include "colvarproxy.h"
#include "colvars_memstream.h"
colvarbias_reweightaMD::colvarbias_reweightaMD(char const *key)
: colvarbias_histogram(key), grid_count(NULL), grid_dV(NULL),
grid_dV_square(NULL), pmf_grid_exp_avg(NULL), pmf_grid_cumulant(NULL),
grad_grid_exp_avg(NULL), grad_grid_cumulant(NULL)
{
}
colvarbias_reweightaMD::colvarbias_reweightaMD(char const *key) : colvarbias_histogram(key) {}
colvarbias_reweightaMD::~colvarbias_reweightaMD() {
if (grid_dV) {
delete grid_dV;
grid_dV = NULL;
}
if (grid_dV_square) {
delete grid_dV_square;
grid_dV_square = NULL;
}
if (grid_count) {
delete grid_count;
grid_count = NULL;
}
if (pmf_grid_exp_avg) {
delete pmf_grid_exp_avg;
pmf_grid_exp_avg = NULL;
}
if (pmf_grid_cumulant) {
delete pmf_grid_cumulant;
pmf_grid_cumulant = NULL;
}
if (grad_grid_exp_avg) {
delete grad_grid_exp_avg;
grad_grid_exp_avg = NULL;
}
if (grad_grid_cumulant) {
delete grad_grid_cumulant;
grad_grid_cumulant = NULL;
}
}
colvarbias_reweightaMD::~colvarbias_reweightaMD() {}
int colvarbias_reweightaMD::init(std::string const &conf) {
if (cvm::proxy->accelMD_enabled() == false) {
@ -60,21 +26,21 @@ int colvarbias_reweightaMD::init(std::string const &conf) {
get_keyval(conf, "WritePMFGradients", b_write_gradients, true);
get_keyval(conf, "historyFreq", history_freq, 0);
b_history_files = (history_freq > 0);
grid_count = new colvar_grid_scalar(colvars);
grid_count.reset(new colvar_grid_scalar(colvars, nullptr, false, grid_conf));
grid_count->request_actual_value();
grid->request_actual_value();
pmf_grid_exp_avg = new colvar_grid_scalar(colvars);
pmf_grid_exp_avg.reset(new colvar_grid_scalar(colvars, grid_count));
if (b_write_gradients) {
grad_grid_exp_avg = new colvar_grid_gradient(colvars);
grad_grid_exp_avg.reset(new colvar_grid_gradient(colvars, nullptr, grid_count));
}
if (b_use_cumulant_expansion) {
grid_dV = new colvar_grid_scalar(colvars);
grid_dV_square = new colvar_grid_scalar(colvars);
pmf_grid_cumulant = new colvar_grid_scalar(colvars);
grid_dV.reset(new colvar_grid_scalar(colvars, grid_count));
grid_dV_square.reset(new colvar_grid_scalar(colvars, grid_count));
pmf_grid_cumulant.reset(new colvar_grid_scalar(colvars, grid_count));
grid_dV->request_actual_value();
grid_dV_square->request_actual_value();
if (b_write_gradients) {
grad_grid_cumulant = new colvar_grid_gradient(colvars);
grad_grid_cumulant.reset(new colvar_grid_gradient(colvars, nullptr, grid_count));
}
}
previous_bin.assign(num_variables(), -1);
@ -193,7 +159,7 @@ int colvarbias_reweightaMD::write_exponential_reweighted_pmf(
pmf_grid_exp_avg->set_value(i, tmp / count);
}
}
hist_to_pmf(pmf_grid_exp_avg, grid_count);
hist_to_pmf(pmf_grid_exp_avg.get(), grid_count.get());
pmf_grid_exp_avg->write_multicol(pmf_grid_os);
if (!keep_open) {
cvm::proxy->close_output_stream(output_pmf);
@ -231,9 +197,9 @@ int colvarbias_reweightaMD::write_cumulant_expansion_pmf(
if (!pmf_grid_cumulant_os) {
return COLVARS_FILE_ERROR;
}
compute_cumulant_expansion_factor(grid_dV, grid_dV_square,
grid_count, pmf_grid_cumulant);
hist_to_pmf(pmf_grid_cumulant, grid_count);
compute_cumulant_expansion_factor(grid_dV.get(), grid_dV_square.get(),
grid_count.get(), pmf_grid_cumulant.get());
hist_to_pmf(pmf_grid_cumulant.get(), grid_count.get());
pmf_grid_cumulant->write_multicol(pmf_grid_cumulant_os);
if (!keep_open) {
cvm::proxy->close_output_stream(output_pmf);