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
105 lines
3.9 KiB
C++
105 lines
3.9 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();
|
|
#if (__cplusplus >= 201103L)
|
|
virtual int init(std::string const &conf) override;
|
|
virtual int update() override;
|
|
virtual int write_output_files() override;
|
|
#else
|
|
virtual int init(std::string const &conf);
|
|
virtual int update();
|
|
virtual int write_output_files();
|
|
#endif
|
|
|
|
/// @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] append append the output to a .hist file if true
|
|
virtual int write_exponential_reweighted_pmf(
|
|
const std::string& p_output_prefix, bool append = false);
|
|
|
|
/// @brief output the PMF by the cumulant expansion estimator
|
|
/// @param[in] p_output_prefix the prefix of the output file
|
|
/// @param[in] append append the output to a .hist file if true
|
|
virtual int write_cumulant_expansion_pmf(
|
|
const std::string& p_output_prefix, bool append = false);
|
|
|
|
/// @brief output the biased sampling
|
|
/// @param[in] p_output_prefix the prefix of the output file
|
|
/// @param[in] append append the output to a .hist file if true
|
|
virtual int write_count(
|
|
const std::string& p_output_prefix, bool append = 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;
|
|
colvar_grid_scalar* grid_count;
|
|
colvar_grid_scalar* grid_dV;
|
|
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;
|
|
|
|
/// save and restore
|
|
#if (__cplusplus >= 201103L)
|
|
virtual std::istream & read_state_data(std::istream &is) override;
|
|
virtual std::ostream & write_state_data(std::ostream &os) override;
|
|
#else
|
|
virtual std::istream & read_state_data(std::istream &is);
|
|
virtual std::ostream & write_state_data(std::ostream &os);
|
|
#endif
|
|
private:
|
|
/// temporary grids for evaluating PMFs
|
|
colvar_grid_scalar *pmf_grid_exp_avg;
|
|
colvar_grid_scalar *pmf_grid_cumulant;
|
|
colvar_grid_gradient *grad_grid_exp_avg;
|
|
colvar_grid_gradient *grad_grid_cumulant;
|
|
};
|
|
|
|
#endif // COLVARBIAS_HISTOGRAM_REWEIGHT_AMD
|