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
193 lines
6.5 KiB
C++
193 lines
6.5 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 COLVARPROXY_SYSTEM_H
|
|
#define COLVARPROXY_SYSTEM_H
|
|
|
|
|
|
/// Methods for accessing the simulation system (PBCs, integrator, etc)
|
|
class colvarproxy_system {
|
|
|
|
public:
|
|
|
|
/// Constructor
|
|
colvarproxy_system();
|
|
|
|
/// Destructor
|
|
virtual ~colvarproxy_system();
|
|
|
|
/// \brief Name of the unit system used internally by Colvars (by default, that of the back-end).
|
|
/// Supported depending on the back-end: real (A, kcal/mol), metal (A, eV), electron (Bohr, Hartree), gromacs (nm, kJ/mol)
|
|
/// Note: calls to back-end PBC functions assume back-end length unit
|
|
/// We use different unit from back-end in VMD bc using PBC functions from colvarproxy base class
|
|
/// Colvars internal units are user specified, because the module exchanges info in unknown
|
|
/// composite dimensions with user input, while it only exchanges quantities of known
|
|
/// dimension with the back-end (length and forces)
|
|
std::string units;
|
|
|
|
/// \brief Request to set the units used internally by Colvars
|
|
virtual int set_unit_system(std::string const &units, bool check_only);
|
|
|
|
/// \brief Convert a length from Angstrom to internal
|
|
inline cvm::real angstrom_to_internal(cvm::real l) const
|
|
{
|
|
return l * angstrom_value_;
|
|
}
|
|
|
|
/// \brief Convert a length from internal to Angstrom
|
|
inline cvm::real internal_to_angstrom(cvm::real l) const
|
|
{
|
|
return l / angstrom_value_;
|
|
}
|
|
|
|
/// Boltzmann constant, with unit the same as energy / K
|
|
inline cvm::real boltzmann() const
|
|
{
|
|
return boltzmann_;
|
|
}
|
|
|
|
/// Current target temperature of the simulation (K units)
|
|
inline cvm::real target_temperature() const
|
|
{
|
|
return target_temperature_;
|
|
}
|
|
|
|
/// Set the current target temperature of the simulation (K units)
|
|
virtual int set_target_temperature(cvm::real T);
|
|
|
|
/// Time step of the simulation (fs units)
|
|
inline double dt() const
|
|
{
|
|
return timestep_;
|
|
}
|
|
|
|
/// Set the current integration timestep of the simulation (fs units)
|
|
virtual int set_integration_timestep(cvm::real dt);
|
|
|
|
/// \brief Pseudo-random number with Gaussian distribution
|
|
virtual cvm::real rand_gaussian(void);
|
|
|
|
/// Pass restraint energy value for current timestep to MD engine
|
|
virtual void add_energy(cvm::real energy);
|
|
|
|
/// \brief Get the PBC-aware distance vector between two positions
|
|
virtual cvm::rvector position_distance(cvm::atom_pos const &pos1,
|
|
cvm::atom_pos const &pos2) const;
|
|
|
|
/// Recompute PBC reciprocal lattice (assumes XYZ periodicity)
|
|
void update_pbc_lattice();
|
|
|
|
/// Set the lattice vectors to zero
|
|
void reset_pbc_lattice();
|
|
|
|
/// \brief Tell the proxy whether total forces are needed (they may not
|
|
/// always be available)
|
|
virtual void request_total_force(bool yesno);
|
|
|
|
/// Are total forces being used?
|
|
virtual bool total_forces_enabled() const;
|
|
|
|
/// Are total forces from the current step available?
|
|
/// in which case they are really system forces
|
|
virtual bool total_forces_same_step() const;
|
|
|
|
/// Get the molecule ID when called in VMD; raise error otherwise
|
|
/// \param molid Set this argument equal to the current VMD molid
|
|
virtual int get_molid(int &molid);
|
|
|
|
/// Get value of alchemical lambda parameter from back-end (if available)
|
|
virtual int get_alch_lambda(cvm::real* lambda);
|
|
|
|
/// Set value of alchemical lambda parameter to be sent to back-end at end of timestep
|
|
void set_alch_lambda(cvm::real lambda);
|
|
|
|
/// Send cached value of alchemical lambda parameter to back-end (if available)
|
|
virtual int send_alch_lambda();
|
|
|
|
/// Request energy computation every freq steps (necessary for NAMD3, not all back-ends)
|
|
virtual int request_alch_energy_freq(int const freq) {
|
|
return COLVARS_OK;
|
|
}
|
|
|
|
/// Get energy derivative with respect to lambda (if available)
|
|
virtual int get_dE_dlambda(cvm::real* dE_dlambda);
|
|
|
|
/// Apply a scalar force on dE_dlambda (back-end distributes it onto atoms)
|
|
virtual int apply_force_dE_dlambda(cvm::real* force);
|
|
|
|
/// Get energy second derivative with respect to lambda (if available)
|
|
virtual int get_d2E_dlambda2(cvm::real* d2E_dlambda2);
|
|
|
|
/// Force to be applied onto alch. lambda, propagated from biasing forces on dE_dlambda
|
|
cvm::real indirect_lambda_biasing_force;
|
|
|
|
/// Get weight factor from accelMD
|
|
virtual cvm::real get_accelMD_factor() const {
|
|
cvm::error("Error: accessing the reweighting factor of accelerated MD "
|
|
"is not yet implemented in the MD engine.\n",
|
|
COLVARS_NOT_IMPLEMENTED);
|
|
return 1.0;
|
|
}
|
|
virtual bool accelMD_enabled() const {
|
|
return false;
|
|
}
|
|
|
|
protected:
|
|
|
|
/// Next value of lambda to be sent to back-end
|
|
cvm::real cached_alch_lambda;
|
|
|
|
/// Whether lambda has been set and needs to be updated in backend
|
|
bool cached_alch_lambda_changed;
|
|
|
|
/// Boltzmann constant in internal Colvars units
|
|
cvm::real boltzmann_;
|
|
|
|
/// Most up to date target temperature (K units); default to 0.0 if undefined
|
|
cvm::real target_temperature_;
|
|
|
|
/// Current integration timestep (engine units); default to 1.0 if undefined
|
|
double timestep_;
|
|
|
|
/// \brief Value of 1 Angstrom in the internal (front-end) Colvars unit for atomic coordinates
|
|
/// * defaults to 0 in the base class; derived proxy classes must set it
|
|
/// * in VMD proxy, can only be changed when no variables are defined
|
|
/// as user-defined values in composite units must be compatible with that system
|
|
cvm::real angstrom_value_;
|
|
|
|
/// \brief Value of 1 kcal/mol in the internal Colvars unit for energy
|
|
cvm::real kcal_mol_value_;
|
|
|
|
/// Whether the total forces have been requested
|
|
bool total_force_requested;
|
|
|
|
/// \brief Type of boundary conditions
|
|
///
|
|
/// Orthogonal and triclinic cells are made available to objects.
|
|
/// For any other conditions (mixed periodicity, triclinic cells in LAMMPS)
|
|
/// minimum-image distances are computed by the host engine regardless.
|
|
enum Boundaries_type {
|
|
boundaries_non_periodic,
|
|
boundaries_pbc_ortho,
|
|
boundaries_pbc_triclinic,
|
|
boundaries_unsupported
|
|
};
|
|
|
|
/// Type of boundary conditions
|
|
Boundaries_type boundaries_type;
|
|
|
|
/// Bravais lattice vectors
|
|
cvm::rvector unit_cell_x, unit_cell_y, unit_cell_z;
|
|
|
|
/// Reciprocal lattice vectors
|
|
cvm::rvector reciprocal_cell_x, reciprocal_cell_y, reciprocal_cell_z;
|
|
};
|
|
|
|
#endif
|