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
100 lines
4.1 KiB
C++
100 lines
4.1 KiB
C++
// -*- c++ -*-
|
|
|
|
// This file is part of the Collective Variables module (Colvars).
|
|
// The original version of Colvars and its updates are located at:
|
|
// https://github.com/Colvars/colvars
|
|
// Please update all Colvars source files before making any changes.
|
|
// If you wish to distribute your changes, please submit them to the
|
|
// Colvars repository at GitHub.
|
|
|
|
#ifndef COLVARBIAS_HISTOGRAM_REWEIGHT_AMD
|
|
#define COLVARBIAS_HISTOGRAM_REWEIGHT_AMD
|
|
|
|
#include "colvarbias_histogram.h"
|
|
|
|
/// Reweighted histogram for accelerated molecular dynamics (aMD) or
|
|
/// Gaussian aMD (GaMD)
|
|
class colvarbias_reweightaMD : public colvarbias_histogram {
|
|
public:
|
|
colvarbias_reweightaMD(char const *key);
|
|
virtual ~colvarbias_reweightaMD();
|
|
virtual int init(std::string const &conf) override;
|
|
virtual int update() override;
|
|
virtual int write_output_files() override;
|
|
|
|
/// @brief convert histogram to PMF by taking logarithm and multiplying
|
|
/// it with -1/beta
|
|
/// @param[in,out] hist the origin histogram and also the output PMF
|
|
/// @param[in] hist_count the sampling or biased histogram
|
|
void hist_to_pmf(
|
|
colvar_grid_scalar* hist,
|
|
const colvar_grid_scalar* hist_count) const;
|
|
|
|
/// @brief calculate the cumulant expansion to second order
|
|
/// @param[in] hist_dV the histogram of the boosting potential, ΔV(ξ)
|
|
/// @param[in] hist_dV_square the histogram of the square of boosting
|
|
/// potential
|
|
/// @param[in] hist_count the sampling or biased histogram
|
|
/// @param[out] cumulant_expansion_factor the factor of the cumulant
|
|
/// expansion to second order
|
|
void compute_cumulant_expansion_factor(
|
|
const colvar_grid_scalar* hist_dV,
|
|
const colvar_grid_scalar* hist_dV_square,
|
|
const colvar_grid_scalar* hist_count,
|
|
colvar_grid_scalar* cumulant_expansion_factor) const;
|
|
|
|
/// @brief output the PMF by the exponential average estimator
|
|
/// @param[in] p_output_prefix the prefix of the output file
|
|
/// @param[in] keep_open Allow writing the history of the PMF
|
|
virtual int write_exponential_reweighted_pmf(
|
|
const std::string& p_output_prefix, bool keep_open = false);
|
|
|
|
/// @brief output the PMF by the cumulant expansion estimator
|
|
/// @param[in] p_output_prefix the prefix of the output file
|
|
/// @param[in] keep_open Allow writing the history of the expansion
|
|
virtual int write_cumulant_expansion_pmf(
|
|
const std::string& p_output_prefix, bool keep_open = false);
|
|
|
|
/// @brief output the biased sampling
|
|
/// @param[in] p_output_prefix the prefix of the output file
|
|
/// @param[in] keep_open Allow writing the history of the samples
|
|
virtual int write_count(
|
|
const std::string& p_output_prefix, bool keep_open = false);
|
|
protected:
|
|
/// Current accelMD factor is the from previous frame
|
|
std::vector<int> previous_bin;
|
|
/// Start collecting samples after N steps
|
|
colvarmodule::step_number start_after_steps;
|
|
|
|
/// Use cumulant expansion to second order?
|
|
bool b_use_cumulant_expansion;
|
|
std::shared_ptr<colvar_grid_scalar> grid_count;
|
|
std::unique_ptr<colvar_grid_scalar> grid_dV;
|
|
std::unique_ptr<colvar_grid_scalar> grid_dV_square;
|
|
|
|
/// Number of timesteps between recording data in history files (if non-zero)
|
|
size_t history_freq;
|
|
bool b_history_files;
|
|
|
|
/// Write gradients of the PMF?
|
|
bool b_write_gradients;
|
|
|
|
template <typename OST> OST & write_state_data_template_(OST& os);
|
|
template <typename IST> IST & read_state_data_template_(IST& is);
|
|
|
|
/// save and restore
|
|
virtual std::istream & read_state_data(std::istream &is) override;
|
|
virtual cvm::memory_stream & read_state_data(cvm::memory_stream &is) override;
|
|
virtual std::ostream & write_state_data(std::ostream &os) override;
|
|
virtual cvm::memory_stream & write_state_data(cvm::memory_stream &os) override;
|
|
|
|
private:
|
|
/// temporary grids for evaluating PMFs
|
|
std::unique_ptr<colvar_grid_scalar> pmf_grid_exp_avg;
|
|
std::unique_ptr<colvar_grid_scalar> pmf_grid_cumulant;
|
|
std::unique_ptr<colvar_grid_gradient> grad_grid_exp_avg;
|
|
std::unique_ptr<colvar_grid_gradient> grad_grid_cumulant;
|
|
};
|
|
|
|
#endif // COLVARBIAS_HISTOGRAM_REWEIGHT_AMD
|