update colvars to version 2016-08-10
(cherry picked from commit eba3ad9abb)
This commit is contained in:
@ -374,10 +374,19 @@ colvar::colvar(std::string const &conf)
|
||||
}
|
||||
|
||||
{
|
||||
bool b_output_system_force;
|
||||
get_keyval(conf, "outputSystemForce", b_output_system_force, false);
|
||||
if (b_output_system_force) {
|
||||
enable(f_cv_output_system_force);
|
||||
bool temp;
|
||||
if (get_keyval(conf, "outputSystemForce", temp, false)) {
|
||||
cvm::error("Colvar option outputSystemForce is deprecated.\n"
|
||||
"Please use outputTotalForce, or outputSystemForce within an ABF bias.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
bool b_output_total_force;
|
||||
get_keyval(conf, "outputTotalForce", b_output_total_force, false);
|
||||
if (b_output_total_force) {
|
||||
enable(f_cv_output_total_force);
|
||||
}
|
||||
}
|
||||
|
||||
@ -555,8 +564,8 @@ int colvar::init_components(std::string const &conf)
|
||||
int colvar::refresh_deps()
|
||||
{
|
||||
// If enabled features are changed upstream, the features below should be refreshed
|
||||
if (is_enabled(f_cv_system_force_calc)) {
|
||||
cvm::request_system_force();
|
||||
if (is_enabled(f_cv_total_force_calc)) {
|
||||
cvm::request_total_force();
|
||||
}
|
||||
if (is_enabled(f_cv_collect_gradient) && atom_ids.size() == 0) {
|
||||
build_atom_list();
|
||||
@ -972,17 +981,17 @@ int colvar::calc_cvc_sys_forces(int first_cvc, size_t num_cvcs)
|
||||
size_t const cvc_max_count = num_cvcs ? num_cvcs : num_active_cvcs();
|
||||
size_t i, cvc_count;
|
||||
|
||||
if (is_enabled(f_cv_system_force_calc)) {
|
||||
if (is_enabled(f_cv_total_force_calc)) {
|
||||
if (cvm::debug())
|
||||
cvm::log("Calculating system force of colvar \""+this->name+"\".\n");
|
||||
cvm::log("Calculating total force of colvar \""+this->name+"\".\n");
|
||||
|
||||
// if (!tasks[task_extended_lagrangian] && (cvm::step_relative() > 0)) {
|
||||
// Disabled check to allow for explicit system force calculation
|
||||
// Disabled check to allow for explicit total force calculation
|
||||
// even with extended Lagrangian
|
||||
|
||||
if (cvm::step_relative() > 0) {
|
||||
cvm::increase_depth();
|
||||
// get from the cvcs the system forces from the PREVIOUS step
|
||||
// get from the cvcs the total forces from the PREVIOUS step
|
||||
for (i = first_cvc, cvc_count = 0;
|
||||
(i < cvcs.size()) && (cvc_count < cvc_max_count);
|
||||
i++) {
|
||||
@ -994,7 +1003,7 @@ int colvar::calc_cvc_sys_forces(int first_cvc, size_t num_cvcs)
|
||||
}
|
||||
|
||||
if (cvm::debug())
|
||||
cvm::log("Done calculating system force of colvar \""+this->name+"\".\n");
|
||||
cvm::log("Done calculating total force of colvar \""+this->name+"\".\n");
|
||||
}
|
||||
|
||||
return COLVARS_OK;
|
||||
@ -1003,20 +1012,20 @@ int colvar::calc_cvc_sys_forces(int first_cvc, size_t num_cvcs)
|
||||
|
||||
int colvar::collect_cvc_sys_forces()
|
||||
{
|
||||
if (is_enabled(f_cv_system_force_calc)) {
|
||||
if (is_enabled(f_cv_total_force_calc)) {
|
||||
ft.reset();
|
||||
|
||||
if (cvm::step_relative() > 0) {
|
||||
// get from the cvcs the system forces from the PREVIOUS step
|
||||
// get from the cvcs the total forces from the PREVIOUS step
|
||||
for (size_t i = 0; i < cvcs.size(); i++) {
|
||||
if (!cvcs[i]->is_enabled()) continue;
|
||||
// linear combination is assumed
|
||||
ft += (cvcs[i])->system_force() * (cvcs[i])->sup_coeff / active_cvc_square_norm;
|
||||
ft += (cvcs[i])->total_force() * (cvcs[i])->sup_coeff / active_cvc_square_norm;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_enabled(f_cv_hide_Jacobian)) {
|
||||
// add the Jacobian force to the system force, and don't apply any silent
|
||||
// add the Jacobian force to the total force, and don't apply any silent
|
||||
// correction internally: biases such as colvarbias_abf will handle it
|
||||
ft += fj;
|
||||
}
|
||||
@ -1088,7 +1097,7 @@ int colvar::calc_colvar_properties()
|
||||
// report the restraint center as "value"
|
||||
x_reported = xr;
|
||||
v_reported = vr;
|
||||
// the "system force" with the extended Lagrangian is just the
|
||||
// the "total force" with the extended Lagrangian is just the
|
||||
// harmonic term acting on the extended coordinate
|
||||
// Note: this is the force for current timestep
|
||||
ft_reported = (-0.5 * ext_force_k) * this->dist2_lgrad(xr, x);
|
||||
@ -1117,7 +1126,7 @@ cvm::real colvar::update_forces_energy()
|
||||
f += fb;
|
||||
|
||||
if (is_enabled(f_cv_Jacobian)) {
|
||||
// the instantaneous Jacobian force was not included in the reported system force;
|
||||
// the instantaneous Jacobian force was not included in the reported total force;
|
||||
// instead, it is subtracted from the applied force (silent Jacobian correction)
|
||||
if (is_enabled(f_cv_hide_Jacobian))
|
||||
f -= fj;
|
||||
@ -1482,7 +1491,7 @@ std::istream & colvar::read_traj(std::istream &is)
|
||||
}
|
||||
}
|
||||
|
||||
if (is_enabled(f_cv_output_system_force)) {
|
||||
if (is_enabled(f_cv_output_total_force)) {
|
||||
is >> ft;
|
||||
ft_reported = ft;
|
||||
}
|
||||
@ -1567,8 +1576,8 @@ std::ostream & colvar::write_traj_label(std::ostream & os)
|
||||
<< cvm::wrap_string(this->name, this_cv_width-3);
|
||||
}
|
||||
|
||||
if (is_enabled(f_cv_output_system_force)) {
|
||||
os << " fs_"
|
||||
if (is_enabled(f_cv_output_total_force)) {
|
||||
os << " ft_"
|
||||
<< cvm::wrap_string(this->name, this_cv_width-3);
|
||||
}
|
||||
|
||||
@ -1620,7 +1629,7 @@ std::ostream & colvar::write_traj(std::ostream &os)
|
||||
}
|
||||
|
||||
|
||||
if (is_enabled(f_cv_output_system_force)) {
|
||||
if (is_enabled(f_cv_output_total_force)) {
|
||||
os << " "
|
||||
<< std::setprecision(cvm::cv_prec) << std::setw(cvm::cv_width)
|
||||
<< ft_reported;
|
||||
|
||||
@ -54,7 +54,7 @@ public:
|
||||
/// \brief Current velocity (previously set by calc() or by read_traj())
|
||||
colvarvalue const & velocity() const;
|
||||
|
||||
/// \brief Current system force (previously obtained from calc() or
|
||||
/// \brief Current total force (previously obtained from calc() or
|
||||
/// read_traj()). Note: this is calculated using the atomic forces
|
||||
/// from the last simulation step.
|
||||
///
|
||||
@ -62,7 +62,7 @@ public:
|
||||
/// acting on the collective variable is calculated summing those
|
||||
/// from all colvar components, the bias and walls forces are
|
||||
/// subtracted.
|
||||
colvarvalue const & system_force() const;
|
||||
colvarvalue const & total_force() const;
|
||||
|
||||
/// \brief Typical fluctuation amplitude for this collective
|
||||
/// variable (e.g. local width of a free energy basin)
|
||||
@ -160,7 +160,7 @@ protected:
|
||||
/// \brief Jacobian force, when Jacobian_force is enabled
|
||||
colvarvalue fj;
|
||||
|
||||
/// Cached reported system force
|
||||
/// Cached reported total force
|
||||
colvarvalue ft_reported;
|
||||
|
||||
public:
|
||||
@ -176,7 +176,7 @@ public:
|
||||
colvarvalue f;
|
||||
|
||||
/// \brief Total force, as derived from the atomic trajectory;
|
||||
/// should equal the total system force plus \link f \endlink
|
||||
/// should equal the system force plus \link f \endlink
|
||||
colvarvalue ft;
|
||||
|
||||
|
||||
@ -253,7 +253,7 @@ public:
|
||||
int calc_cvc_values(int first, size_t num_cvcs);
|
||||
/// \brief Same as \link colvar::calc_cvc_values \endlink but for gradients
|
||||
int calc_cvc_gradients(int first, size_t num_cvcs);
|
||||
/// \brief Same as \link colvar::calc_cvc_values \endlink but for system forces
|
||||
/// \brief Same as \link colvar::calc_cvc_values \endlink but for total forces
|
||||
int calc_cvc_sys_forces(int first, size_t num_cvcs);
|
||||
/// \brief Same as \link colvar::calc_cvc_values \endlink but for Jacobian derivatives/forces
|
||||
int calc_cvc_Jacobians(int first, size_t num_cvcs);
|
||||
@ -265,7 +265,7 @@ public:
|
||||
int collect_cvc_values();
|
||||
/// \brief Same as \link colvar::collect_cvc_values \endlink but for gradients
|
||||
int collect_cvc_gradients();
|
||||
/// \brief Same as \link colvar::collect_cvc_values \endlink but for system forces
|
||||
/// \brief Same as \link colvar::collect_cvc_values \endlink but for total forces
|
||||
int collect_cvc_sys_forces();
|
||||
/// \brief Same as \link colvar::collect_cvc_values \endlink but for Jacobian derivatives/forces
|
||||
int collect_cvc_Jacobians();
|
||||
@ -555,7 +555,7 @@ inline colvarvalue const & colvar::velocity() const
|
||||
}
|
||||
|
||||
|
||||
inline colvarvalue const & colvar::system_force() const
|
||||
inline colvarvalue const & colvar::total_force() const
|
||||
{
|
||||
return ft_reported;
|
||||
}
|
||||
|
||||
@ -870,21 +870,21 @@ void cvm::atom_group::read_velocities()
|
||||
|
||||
|
||||
// TODO make this a calc function
|
||||
void cvm::atom_group::read_system_forces()
|
||||
void cvm::atom_group::read_total_forces()
|
||||
{
|
||||
if (b_dummy) return;
|
||||
|
||||
if (b_rotate) {
|
||||
|
||||
for (cvm::atom_iter ai = this->begin(); ai != this->end(); ai++) {
|
||||
ai->read_system_force();
|
||||
ai->system_force = rot.rotate(ai->system_force);
|
||||
ai->read_total_force();
|
||||
ai->total_force = rot.rotate(ai->total_force);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for (cvm::atom_iter ai = this->begin(); ai != this->end(); ai++) {
|
||||
ai->read_system_force();
|
||||
ai->read_total_force();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1070,15 +1070,15 @@ std::vector<cvm::rvector> cvm::atom_group::velocities() const
|
||||
return v;
|
||||
}
|
||||
|
||||
std::vector<cvm::rvector> cvm::atom_group::system_forces() const
|
||||
std::vector<cvm::rvector> cvm::atom_group::total_forces() const
|
||||
{
|
||||
if (b_dummy) {
|
||||
cvm::error("Error: system forces are not available "
|
||||
cvm::error("Error: total forces are not available "
|
||||
"from a dummy atom group.\n", INPUT_ERROR);
|
||||
}
|
||||
|
||||
if (is_enabled(f_ag_scalable)) {
|
||||
cvm::error("Error: atomic system forces are not available "
|
||||
cvm::error("Error: atomic total forces are not available "
|
||||
"from a scalable atom group.\n", INPUT_ERROR);
|
||||
}
|
||||
|
||||
@ -1086,27 +1086,27 @@ std::vector<cvm::rvector> cvm::atom_group::system_forces() const
|
||||
cvm::atom_const_iter ai = this->begin();
|
||||
std::vector<cvm::atom_pos>::iterator fi = f.begin();
|
||||
for ( ; ai != this->end(); ++fi, ++ai) {
|
||||
*fi = ai->system_force;
|
||||
*fi = ai->total_force;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
// TODO make this an accessor
|
||||
cvm::rvector cvm::atom_group::system_force() const
|
||||
cvm::rvector cvm::atom_group::total_force() const
|
||||
{
|
||||
if (b_dummy) {
|
||||
cvm::error("Error: total system forces are not available "
|
||||
cvm::error("Error: total total forces are not available "
|
||||
"from a dummy atom group.\n", INPUT_ERROR);
|
||||
}
|
||||
|
||||
if (is_enabled(f_ag_scalable)) {
|
||||
return (cvm::proxy)->get_atom_group_system_force(index);
|
||||
return (cvm::proxy)->get_atom_group_total_force(index);
|
||||
}
|
||||
|
||||
cvm::rvector f(0.0);
|
||||
for (cvm::atom_const_iter ai = this->begin(); ai != this->end(); ai++) {
|
||||
f += ai->system_force;
|
||||
f += ai->total_force;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ public:
|
||||
|
||||
/// \brief System force at the previous step (copied from the
|
||||
/// program, can be modified if necessary)
|
||||
cvm::rvector system_force;
|
||||
cvm::rvector total_force;
|
||||
|
||||
/// \brief Gradient of a scalar collective variable with respect
|
||||
/// to this atom
|
||||
@ -86,7 +86,7 @@ public:
|
||||
inline void reset_data()
|
||||
{
|
||||
pos = cvm::atom_pos(0.0);
|
||||
vel = grad = system_force = cvm::rvector(0.0);
|
||||
vel = grad = total_force = cvm::rvector(0.0);
|
||||
}
|
||||
|
||||
/// Get the latest value of the mass
|
||||
@ -113,10 +113,10 @@ public:
|
||||
vel = (cvm::proxy)->get_atom_velocity(index);
|
||||
}
|
||||
|
||||
/// Get the system force
|
||||
inline void read_system_force()
|
||||
/// Get the total force
|
||||
inline void read_total_force()
|
||||
{
|
||||
system_force = (cvm::proxy)->get_atom_system_force(index);
|
||||
total_force = (cvm::proxy)->get_atom_total_force(index);
|
||||
}
|
||||
|
||||
/// \brief Apply a force to the atom
|
||||
@ -336,10 +336,10 @@ public:
|
||||
/// rotation applied to the coordinates will be used
|
||||
void read_velocities();
|
||||
|
||||
/// \brief Get the current system_forces; this must be called always
|
||||
/// \brief Get the current total_forces; this must be called always
|
||||
/// *after* read_positions(); if b_rotate is defined, the same
|
||||
/// rotation applied to the coordinates will be used
|
||||
void read_system_forces();
|
||||
void read_total_forces();
|
||||
|
||||
/// Call reset_data() for each atom
|
||||
inline void reset_atoms_data()
|
||||
@ -410,11 +410,11 @@ public:
|
||||
return dip;
|
||||
}
|
||||
|
||||
/// \brief Return a copy of the system forces
|
||||
std::vector<cvm::rvector> system_forces() const;
|
||||
/// \brief Return a copy of the total forces
|
||||
std::vector<cvm::rvector> total_forces() const;
|
||||
|
||||
/// \brief Return a copy of the aggregated total force on the group
|
||||
cvm::rvector system_force() const;
|
||||
cvm::rvector total_force() const;
|
||||
|
||||
|
||||
/// \brief Shorthand: save the specified gradient on each atom,
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
colvarbias_abf::colvarbias_abf(char const *key)
|
||||
: colvarbias(key),
|
||||
force(NULL),
|
||||
system_force(NULL),
|
||||
gradients(NULL),
|
||||
samples(NULL),
|
||||
z_gradients(NULL),
|
||||
@ -81,8 +81,8 @@ int colvarbias_abf::init(std::string const &conf)
|
||||
}
|
||||
|
||||
if (update_bias) {
|
||||
// Request calculation of system force (which also checks for availability)
|
||||
if(enable(f_cvb_get_system_force)) return cvm::get_error();
|
||||
// Request calculation of total force (which also checks for availability)
|
||||
if(enable(f_cvb_get_total_force)) return cvm::get_error();
|
||||
}
|
||||
if (apply_bias) {
|
||||
if(enable(f_cvb_apply_force)) return cvm::get_error();
|
||||
@ -112,7 +112,7 @@ int colvarbias_abf::init(std::string const &conf)
|
||||
if (max_force.size() != colvars.size()) {
|
||||
cvm::error("Error: Number of parameters to maxForce does not match number of colvars.");
|
||||
}
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
if (max_force[i] < 0.0) {
|
||||
cvm::error("Error: maxForce should be non-negative.");
|
||||
}
|
||||
@ -124,7 +124,7 @@ int colvarbias_abf::init(std::string const &conf)
|
||||
|
||||
bin.assign(colvars.size(), 0);
|
||||
force_bin.assign(colvars.size(), 0);
|
||||
force = new cvm::real [colvars.size()];
|
||||
system_force = new cvm::real [colvars.size()];
|
||||
|
||||
// Construct empty grids based on the colvars
|
||||
if (cvm::debug()) {
|
||||
@ -208,9 +208,9 @@ colvarbias_abf::~colvarbias_abf()
|
||||
last_gradients = NULL;
|
||||
}
|
||||
|
||||
if (force) {
|
||||
delete [] force;
|
||||
force = NULL;
|
||||
if (system_force) {
|
||||
delete [] system_force;
|
||||
system_force = NULL;
|
||||
}
|
||||
|
||||
if (cvm::n_abf_biases > 0)
|
||||
@ -231,35 +231,39 @@ int colvarbias_abf::update()
|
||||
// initialization stuff (file operations relying on n_abf_biases
|
||||
// compute current value of colvars
|
||||
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
bin[i] = samples->current_bin_scalar(i);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
bin[i] = samples->current_bin_scalar(i);
|
||||
}
|
||||
|
||||
if ( update_bias && samples->index_ok(force_bin) ) {
|
||||
// Only if requested and within bounds of the grid...
|
||||
|
||||
for (size_t i=0; i<colvars.size(); i++) { // get forces(lagging by 1 timestep) from colvars
|
||||
force[i] = colvars[i]->system_force();
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
// get total forces (lagging by 1 timestep) from colvars
|
||||
// and subtract previous ABF force
|
||||
system_force[i] = colvars[i]->total_force().real_value
|
||||
- colvar_forces[i].real_value;
|
||||
}
|
||||
gradients->acc_force(force_bin, force);
|
||||
gradients->acc_force(force_bin, system_force);
|
||||
}
|
||||
if ( z_gradients && update_bias ) {
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
z_bin[i] = z_samples->current_bin_scalar(i);
|
||||
}
|
||||
if ( z_samples->index_ok(z_bin) ) {
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
// If we are outside the range of xi, the force has not been obtained above
|
||||
// the function is just an accessor, so cheap to call again anyway
|
||||
force[i] = colvars[i]->system_force();
|
||||
system_force[i] = colvars[i]->total_force().real_value
|
||||
- colvar_forces[i].real_value;
|
||||
}
|
||||
z_gradients->acc_force(z_bin, force);
|
||||
z_gradients->acc_force(z_bin, system_force);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -268,7 +272,7 @@ int colvarbias_abf::update()
|
||||
force_bin = bin;
|
||||
|
||||
// Reset biasing forces from previous timestep
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
colvar_forces[i].reset();
|
||||
}
|
||||
|
||||
@ -292,13 +296,13 @@ int colvarbias_abf::update()
|
||||
// in other words: boundary condition is that the biasing potential is periodic
|
||||
colvar_forces[0].real_value = fact * (grad[0] / cvm::real(count) - gradients->average());
|
||||
} else {
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
// subtracting the mean force (opposite of the FE gradient) means adding the gradient
|
||||
colvar_forces[i].real_value = fact * grad[i] / cvm::real(count);
|
||||
}
|
||||
}
|
||||
if (cap_force) {
|
||||
for (size_t i=0; i<colvars.size(); i++) {
|
||||
for (size_t i = 0; i < colvars.size(); i++) {
|
||||
if ( colvar_forces[i].real_value * colvar_forces[i].real_value > max_force[i] * max_force[i] ) {
|
||||
colvar_forces[i].real_value = (colvar_forces[i].real_value > 0 ? max_force[i] : -1.0 * max_force[i]);
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ public:
|
||||
private:
|
||||
|
||||
/// Filename prefix for human-readable gradient/sample count output
|
||||
std::string output_prefix;
|
||||
std::string output_prefix;
|
||||
|
||||
/// Base filename(s) for reading previous gradient data (replaces data from restart file)
|
||||
std::vector<std::string> input_prefix;
|
||||
@ -50,7 +50,7 @@ private:
|
||||
// Internal data and methods
|
||||
|
||||
std::vector<int> bin, force_bin, z_bin;
|
||||
gradient_t force;
|
||||
gradient_t system_force, applied_force;
|
||||
|
||||
/// n-dim grid of free energy gradients
|
||||
colvar_grid_gradient *gradients;
|
||||
|
||||
@ -153,8 +153,8 @@ public:
|
||||
// /// \brief Return const pointer to the previously calculated value
|
||||
// virtual const colvarvalue *p_value() const;
|
||||
|
||||
/// \brief Return the previously calculated system force
|
||||
virtual colvarvalue const & system_force() const;
|
||||
/// \brief Return the previously calculated total force
|
||||
virtual colvarvalue const & total_force() const;
|
||||
|
||||
/// \brief Return the previously calculated divergence of the
|
||||
/// inverse atomic gradients
|
||||
@ -232,7 +232,7 @@ protected:
|
||||
/// \brief Value at the previous step
|
||||
colvarvalue x_old;
|
||||
|
||||
/// \brief Calculated system force (\b Note: this is calculated from
|
||||
/// \brief Calculated total force (\b Note: this is calculated from
|
||||
/// the total atomic forces read from the program, subtracting fromt
|
||||
/// the "internal" forces of the system the "external" forces from
|
||||
/// the colvar biases)
|
||||
@ -256,7 +256,7 @@ inline colvarvalue const & colvar::cvc::value() const
|
||||
// return &x;
|
||||
// }
|
||||
|
||||
inline colvarvalue const & colvar::cvc::system_force() const
|
||||
inline colvarvalue const & colvar::cvc::total_force() const
|
||||
{
|
||||
return ft;
|
||||
}
|
||||
@ -306,7 +306,7 @@ protected:
|
||||
cvm::rvector dist_v;
|
||||
/// Use absolute positions, ignoring PBCs when present
|
||||
bool b_no_PBC;
|
||||
/// Compute system force on first site only to avoid unwanted
|
||||
/// Compute total force on first site only to avoid unwanted
|
||||
/// coupling to other colvars (see e.g. Ciccotti et al., 2005)
|
||||
bool b_1site_force;
|
||||
public:
|
||||
@ -388,7 +388,7 @@ protected:
|
||||
cvm::atom_group *ref2;
|
||||
/// Use absolute positions, ignoring PBCs when present
|
||||
bool b_no_PBC;
|
||||
/// Compute system force on one site only to avoid unwanted
|
||||
/// Compute total force on one site only to avoid unwanted
|
||||
/// coupling to other colvars (see e.g. Ciccotti et al., 2005)
|
||||
bool b_1site_force;
|
||||
/// Vector on which the distance vector is projected
|
||||
@ -637,7 +637,7 @@ protected:
|
||||
/// Derivatives wrt group centers of mass
|
||||
cvm::rvector dxdr1, dxdr3;
|
||||
|
||||
/// Compute system force on first site only to avoid unwanted
|
||||
/// Compute total force on first site only to avoid unwanted
|
||||
/// coupling to other colvars (see e.g. Ciccotti et al., 2005)
|
||||
/// (or to allow dummy atoms)
|
||||
bool b_1site_force;
|
||||
@ -683,7 +683,7 @@ protected:
|
||||
/// Derivatives wrt group centers of mass
|
||||
cvm::rvector dxdr1, dxdr3;
|
||||
|
||||
/// Compute system force on first site only to avoid unwanted
|
||||
/// Compute total force on first site only to avoid unwanted
|
||||
/// coupling to other colvars (see e.g. Ciccotti et al., 2005)
|
||||
/// (or to allow dummy atoms)
|
||||
bool b_1site_force;
|
||||
@ -724,7 +724,7 @@ protected:
|
||||
/// Inter site vectors
|
||||
cvm::rvector r12, r23, r34;
|
||||
|
||||
/// \brief Compute system force on first site only to avoid unwanted
|
||||
/// \brief Compute total force on first site only to avoid unwanted
|
||||
/// coupling to other colvars (see e.g. Ciccotti et al., 2005)
|
||||
bool b_1site_force;
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ colvar::angle::angle(std::string const &conf)
|
||||
group2 = parse_group(conf, "group2");
|
||||
group3 = parse_group(conf, "group3");
|
||||
if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) {
|
||||
cvm::log("Computing system force on group 1 only");
|
||||
cvm::log("Computing total force on group 1 only");
|
||||
}
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
@ -95,15 +95,15 @@ void colvar::angle::calc_force_invgrads()
|
||||
// when propagating changes in the angle)
|
||||
|
||||
if (b_1site_force) {
|
||||
group1->read_system_forces();
|
||||
group1->read_total_forces();
|
||||
cvm::real norm_fact = 1.0 / dxdr1.norm2();
|
||||
ft.real_value = norm_fact * dxdr1 * group1->system_force();
|
||||
ft.real_value = norm_fact * dxdr1 * group1->total_force();
|
||||
} else {
|
||||
group1->read_system_forces();
|
||||
group3->read_system_forces();
|
||||
group1->read_total_forces();
|
||||
group3->read_total_forces();
|
||||
cvm::real norm_fact = 1.0 / (dxdr1.norm2() + dxdr3.norm2());
|
||||
ft.real_value = norm_fact * ( dxdr1 * group1->system_force()
|
||||
+ dxdr3 * group3->system_force());
|
||||
ft.real_value = norm_fact * ( dxdr1 * group1->total_force()
|
||||
+ dxdr3 * group3->total_force());
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -141,7 +141,7 @@ colvar::dipole_angle::dipole_angle(std::string const &conf)
|
||||
group3 = parse_group(conf, "group3");
|
||||
|
||||
if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) {
|
||||
cvm::log("Computing system force on group 1 only");
|
||||
cvm::log("Computing total force on group 1 only");
|
||||
}
|
||||
x.type(colvarvalue::type_scalar);
|
||||
}
|
||||
@ -251,7 +251,7 @@ colvar::dihedral::dihedral(std::string const &conf)
|
||||
provide(f_cvc_com_based);
|
||||
|
||||
if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) {
|
||||
cvm::log("Computing system force on group 1 only");
|
||||
cvm::log("Computing total force on group 1 only");
|
||||
}
|
||||
group1 = parse_group(conf, "group1");
|
||||
group2 = parse_group(conf, "group2");
|
||||
@ -421,15 +421,15 @@ void colvar::dihedral::calc_force_invgrads()
|
||||
cvm::real const fact1 = d12 * std::sqrt(1.0 - dot1 * dot1);
|
||||
cvm::real const fact4 = d34 * std::sqrt(1.0 - dot4 * dot4);
|
||||
|
||||
group1->read_system_forces();
|
||||
group1->read_total_forces();
|
||||
if ( b_1site_force ) {
|
||||
// This is only measuring the force on group 1
|
||||
ft.real_value = PI/180.0 * fact1 * (cross1 * group1->system_force());
|
||||
ft.real_value = PI/180.0 * fact1 * (cross1 * group1->total_force());
|
||||
} else {
|
||||
// Default case: use groups 1 and 4
|
||||
group4->read_system_forces();
|
||||
ft.real_value = PI/180.0 * 0.5 * (fact1 * (cross1 * group1->system_force())
|
||||
+ fact4 * (cross4 * group4->system_force()));
|
||||
group4->read_total_forces();
|
||||
ft.real_value = PI/180.0 * 0.5 * (fact1 * (cross1 * group1->total_force())
|
||||
+ fact4 * (cross4 * group4->total_force()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ colvar::distance::distance(std::string const &conf)
|
||||
cvm::log("Computing distance using absolute positions (not minimal-image)");
|
||||
}
|
||||
if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) {
|
||||
cvm::log("Computing system force on group 1 only");
|
||||
cvm::log("Computing total force on group 1 only");
|
||||
}
|
||||
group1 = parse_group(conf, "group1");
|
||||
group2 = parse_group(conf, "group2");
|
||||
@ -66,12 +66,12 @@ void colvar::distance::calc_gradients()
|
||||
|
||||
void colvar::distance::calc_force_invgrads()
|
||||
{
|
||||
group1->read_system_forces();
|
||||
group1->read_total_forces();
|
||||
if ( b_1site_force ) {
|
||||
ft.real_value = -1.0 * (group1->system_force() * dist_v.unit());
|
||||
ft.real_value = -1.0 * (group1->total_force() * dist_v.unit());
|
||||
} else {
|
||||
group2->read_system_forces();
|
||||
ft.real_value = 0.5 * ((group2->system_force() - group1->system_force()) * dist_v.unit());
|
||||
group2->read_total_forces();
|
||||
ft.real_value = 0.5 * ((group2->total_force() - group1->total_force()) * dist_v.unit());
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ colvar::distance_z::distance_z(std::string const &conf)
|
||||
cvm::log("Computing distance using absolute positions (not minimal-image)");
|
||||
}
|
||||
if (get_keyval(conf, "oneSiteSystemForce", b_1site_force, false)) {
|
||||
cvm::log("Computing system force on group \"main\" only");
|
||||
cvm::log("Computing total force on group \"main\" only");
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,13 +249,13 @@ void colvar::distance_z::calc_gradients()
|
||||
|
||||
void colvar::distance_z::calc_force_invgrads()
|
||||
{
|
||||
main->read_system_forces();
|
||||
main->read_total_forces();
|
||||
|
||||
if (fixed_axis && !b_1site_force) {
|
||||
ref1->read_system_forces();
|
||||
ft.real_value = 0.5 * ((main->system_force() - ref1->system_force()) * axis);
|
||||
ref1->read_total_forces();
|
||||
ft.real_value = 0.5 * ((main->total_force() - ref1->total_force()) * axis);
|
||||
} else {
|
||||
ft.real_value = main->system_force() * axis;
|
||||
ft.real_value = main->total_force() * axis;
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,13 +349,13 @@ void colvar::distance_xy::calc_gradients()
|
||||
|
||||
void colvar::distance_xy::calc_force_invgrads()
|
||||
{
|
||||
main->read_system_forces();
|
||||
main->read_total_forces();
|
||||
|
||||
if (fixed_axis && !b_1site_force) {
|
||||
ref1->read_system_forces();
|
||||
ft.real_value = 0.5 / x.real_value * ((main->system_force() - ref1->system_force()) * dist_v_ortho);
|
||||
ref1->read_total_forces();
|
||||
ft.real_value = 0.5 / x.real_value * ((main->total_force() - ref1->total_force()) * dist_v_ortho);
|
||||
} else {
|
||||
ft.real_value = 1.0 / x.real_value * main->system_force() * dist_v_ortho;
|
||||
ft.real_value = 1.0 / x.real_value * main->total_force() * dist_v_ortho;
|
||||
}
|
||||
}
|
||||
|
||||
@ -655,13 +655,13 @@ void colvar::gyration::calc_gradients()
|
||||
|
||||
void colvar::gyration::calc_force_invgrads()
|
||||
{
|
||||
atoms->read_system_forces();
|
||||
atoms->read_total_forces();
|
||||
|
||||
cvm::real const dxdr = 1.0/x.real_value;
|
||||
ft.real_value = 0.0;
|
||||
|
||||
for (cvm::atom_iter ai = atoms->begin(); ai != atoms->end(); ai++) {
|
||||
ft.real_value += dxdr * ai->pos * ai->system_force;
|
||||
ft.real_value += dxdr * ai->pos * ai->total_force;
|
||||
}
|
||||
}
|
||||
|
||||
@ -903,13 +903,13 @@ void colvar::rmsd::apply_force(colvarvalue const &force)
|
||||
|
||||
void colvar::rmsd::calc_force_invgrads()
|
||||
{
|
||||
atoms->read_system_forces();
|
||||
atoms->read_total_forces();
|
||||
ft.real_value = 0.0;
|
||||
|
||||
// Note: gradient square norm is 1/N_atoms
|
||||
|
||||
for (size_t ia = 0; ia < atoms->size(); ia++) {
|
||||
ft.real_value += (*atoms)[ia].grad * (*atoms)[ia].system_force;
|
||||
ft.real_value += (*atoms)[ia].grad * (*atoms)[ia].total_force;
|
||||
}
|
||||
ft.real_value *= atoms->size();
|
||||
}
|
||||
@ -1191,12 +1191,12 @@ void colvar::eigenvector::apply_force(colvarvalue const &force)
|
||||
|
||||
void colvar::eigenvector::calc_force_invgrads()
|
||||
{
|
||||
atoms->read_system_forces();
|
||||
atoms->read_total_forces();
|
||||
ft.real_value = 0.0;
|
||||
|
||||
for (size_t ia = 0; ia < atoms->size(); ia++) {
|
||||
ft.real_value += eigenvec_invnorm2 * (*atoms)[ia].grad *
|
||||
(*atoms)[ia].system_force;
|
||||
(*atoms)[ia].total_force;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -207,8 +207,8 @@ void colvardeps::init_cvb_requires() {
|
||||
f_description(f_cvb_apply_force, "apply force");
|
||||
f_req_children(f_cvb_apply_force, f_cv_gradient);
|
||||
|
||||
f_description(f_cvb_get_system_force, "obtain system force");
|
||||
f_req_children(f_cvb_get_system_force, f_cv_system_force);
|
||||
f_description(f_cvb_get_total_force, "obtain total force");
|
||||
f_req_children(f_cvb_get_total_force, f_cv_total_force);
|
||||
|
||||
f_description(f_cvb_history_dependent, "history-dependent");
|
||||
|
||||
@ -247,15 +247,15 @@ void colvardeps::init_cv_requires() {
|
||||
f_description(f_cv_fdiff_velocity, "fdiff_velocity");
|
||||
|
||||
// System force: either trivial (spring force); through extended Lagrangian, or calculated explicitly
|
||||
f_description(f_cv_system_force, "system force");
|
||||
f_req_alt2(f_cv_system_force, f_cv_extended_Lagrangian, f_cv_system_force_calc);
|
||||
f_description(f_cv_total_force, "total force");
|
||||
f_req_alt2(f_cv_total_force, f_cv_extended_Lagrangian, f_cv_total_force_calc);
|
||||
|
||||
// Deps for explicit system force calculation
|
||||
f_description(f_cv_system_force_calc, "system force calculation");
|
||||
f_req_self(f_cv_system_force_calc, f_cv_scalar);
|
||||
f_req_self(f_cv_system_force_calc, f_cv_linear);
|
||||
f_req_children(f_cv_system_force_calc, f_cvc_inv_gradient);
|
||||
f_req_self(f_cv_system_force_calc, f_cv_Jacobian);
|
||||
// Deps for explicit total force calculation
|
||||
f_description(f_cv_total_force_calc, "total force calculation");
|
||||
f_req_self(f_cv_total_force_calc, f_cv_scalar);
|
||||
f_req_self(f_cv_total_force_calc, f_cv_linear);
|
||||
f_req_children(f_cv_total_force_calc, f_cvc_inv_gradient);
|
||||
f_req_self(f_cv_total_force_calc, f_cv_Jacobian);
|
||||
|
||||
f_description(f_cv_Jacobian, "Jacobian derivative");
|
||||
f_req_self(f_cv_Jacobian, f_cv_scalar);
|
||||
@ -283,8 +283,8 @@ void colvardeps::init_cv_requires() {
|
||||
|
||||
f_description(f_cv_output_applied_force, "output applied force");
|
||||
|
||||
f_description(f_cv_output_system_force, "output system force");
|
||||
f_req_self(f_cv_output_system_force, f_cv_system_force);
|
||||
f_description(f_cv_output_total_force, "output total force");
|
||||
f_req_self(f_cv_output_total_force, f_cv_total_force);
|
||||
|
||||
f_description(f_cv_lower_boundary, "lower boundary");
|
||||
f_req_self(f_cv_lower_boundary, f_cv_scalar);
|
||||
|
||||
@ -161,7 +161,7 @@ public:
|
||||
/// \brief Bias is active
|
||||
f_cvb_active,
|
||||
f_cvb_apply_force, // will apply forces
|
||||
f_cvb_get_system_force, // requires system forces
|
||||
f_cvb_get_total_force, // requires total forces
|
||||
f_cvb_history_dependent, // depends on simulation history
|
||||
f_cvb_ntot
|
||||
};
|
||||
@ -177,14 +177,14 @@ public:
|
||||
f_cv_collect_gradient,
|
||||
/// \brief Calculate the velocity with finite differences
|
||||
f_cv_fdiff_velocity,
|
||||
/// \brief The system force is calculated, projecting the atomic
|
||||
/// \brief The total force is calculated, projecting the atomic
|
||||
/// forces on the inverse gradient
|
||||
f_cv_system_force,
|
||||
/// \brief Calculate system force from atomic forces
|
||||
f_cv_system_force_calc,
|
||||
f_cv_total_force,
|
||||
/// \brief Calculate total force from atomic forces
|
||||
f_cv_total_force_calc,
|
||||
/// \brief Estimate Jacobian derivative
|
||||
f_cv_Jacobian,
|
||||
/// \brief Do not report the Jacobian force as part of the system force
|
||||
/// \brief Do not report the Jacobian force as part of the total force
|
||||
/// instead, apply a correction internally to cancel it
|
||||
f_cv_hide_Jacobian,
|
||||
/// \brief The variable has a harmonic restraint around a moving
|
||||
@ -202,8 +202,8 @@ public:
|
||||
f_cv_output_velocity,
|
||||
/// \brief Output the applied force to the trajectory file
|
||||
f_cv_output_applied_force,
|
||||
/// \brief Output the system force to the trajectory file
|
||||
f_cv_output_system_force,
|
||||
/// \brief Output the total force to the trajectory file
|
||||
f_cv_output_total_force,
|
||||
/// \brief A lower boundary is defined
|
||||
f_cv_lower_boundary,
|
||||
/// \brief An upper boundary is defined
|
||||
|
||||
@ -384,8 +384,8 @@ public:
|
||||
/// \brief Time step of MD integrator (fs)
|
||||
static real dt();
|
||||
|
||||
/// Request calculation of system force from MD engine
|
||||
static void request_system_force();
|
||||
/// Request calculation of total force from MD engine
|
||||
static void request_total_force();
|
||||
|
||||
/// Print a message to the main log
|
||||
static void log(std::string const &message);
|
||||
@ -634,9 +634,9 @@ inline int cvm::replica_comm_send(char* msg_data, int msg_len, int dest_rep) {
|
||||
}
|
||||
|
||||
|
||||
inline void cvm::request_system_force()
|
||||
inline void cvm::request_total_force()
|
||||
{
|
||||
proxy->request_system_force(true);
|
||||
proxy->request_total_force(true);
|
||||
}
|
||||
|
||||
inline void cvm::select_closest_image(atom_pos &pos,
|
||||
|
||||
@ -295,11 +295,11 @@ public:
|
||||
/// Pass restraint energy value for current timestep to MD engine
|
||||
virtual void add_energy(cvm::real energy) = 0;
|
||||
|
||||
/// Tell the proxy whether system forces are needed (may not always be available)
|
||||
virtual void request_system_force(bool yesno)
|
||||
/// Tell the proxy whether total forces are needed (may not always be available)
|
||||
virtual void request_total_force(bool yesno)
|
||||
{
|
||||
if (yesno == true)
|
||||
cvm::error("Error: system forces are currently not implemented.\n",
|
||||
cvm::error("Error: total forces are currently not implemented.\n",
|
||||
COLVARS_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
||||
@ -354,8 +354,6 @@ protected:
|
||||
std::vector<cvm::rvector> atoms_positions;
|
||||
/// \brief Most recent total forces on each atom
|
||||
std::vector<cvm::rvector> atoms_total_forces;
|
||||
/// \brief Most recent forces applied by external potentials onto each atom
|
||||
std::vector<cvm::rvector> atoms_applied_forces;
|
||||
/// \brief Forces applied from colvars, to be communicated to the MD integrator
|
||||
std::vector<cvm::rvector> atoms_new_colvar_forces;
|
||||
|
||||
@ -368,7 +366,6 @@ protected:
|
||||
atoms_charges.push_back(0.0);
|
||||
atoms_positions.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atoms_total_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atoms_applied_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atoms_new_colvar_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
return (atoms_ids.size() - 1);
|
||||
}
|
||||
@ -439,10 +436,10 @@ public:
|
||||
return atoms_positions[index];
|
||||
}
|
||||
|
||||
/// Read the current total system force of the given atom
|
||||
inline cvm::rvector get_atom_system_force(int index) const
|
||||
/// Read the current total force of the given atom
|
||||
inline cvm::rvector get_atom_total_force(int index) const
|
||||
{
|
||||
return atoms_total_forces[index] - atoms_applied_forces[index];
|
||||
return atoms_total_forces[index];
|
||||
}
|
||||
|
||||
/// Request that this force is applied to the given atom
|
||||
@ -465,7 +462,6 @@ public:
|
||||
inline std::vector<cvm::real> *modify_atom_charges() { return &atoms_charges; }
|
||||
inline std::vector<cvm::rvector> *modify_atom_positions() { return &atoms_positions; }
|
||||
inline std::vector<cvm::rvector> *modify_atom_total_forces() { return &atoms_total_forces; }
|
||||
inline std::vector<cvm::rvector> *modify_atom_applied_forces() { return &atoms_applied_forces; }
|
||||
inline std::vector<cvm::rvector> *modify_atom_new_colvar_forces() { return &atoms_new_colvar_forces; }
|
||||
|
||||
/// \brief Read atom identifiers from a file \param filename name of
|
||||
@ -513,8 +509,6 @@ protected:
|
||||
std::vector<cvm::rvector> atom_groups_coms;
|
||||
/// \brief Most recently updated total forces on the com of each group
|
||||
std::vector<cvm::rvector> atom_groups_total_forces;
|
||||
/// \brief Most recent forces applied by external potentials onto each group
|
||||
std::vector<cvm::rvector> atom_groups_applied_forces;
|
||||
/// \brief Forces applied from colvars, to be communicated to the MD integrator
|
||||
std::vector<cvm::rvector> atom_groups_new_colvar_forces;
|
||||
|
||||
@ -538,7 +532,6 @@ public:
|
||||
atom_groups_charges.push_back(0.0);
|
||||
atom_groups_coms.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atom_groups_total_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atom_groups_applied_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
atom_groups_new_colvar_forces.push_back(cvm::rvector(0.0, 0.0, 0.0));
|
||||
return (atom_groups_ids.size() - 1);
|
||||
}
|
||||
@ -592,10 +585,10 @@ public:
|
||||
return atom_groups_coms[index];
|
||||
}
|
||||
|
||||
/// Read the current total system force of the given atom group
|
||||
inline cvm::rvector get_atom_group_system_force(int index) const
|
||||
/// Read the current total force of the given atom group
|
||||
inline cvm::rvector get_atom_group_total_force(int index) const
|
||||
{
|
||||
return atom_groups_total_forces[index] - atom_groups_applied_forces[index];
|
||||
return atom_groups_total_forces[index];
|
||||
}
|
||||
|
||||
/// Request that this force is applied to the given atom group
|
||||
|
||||
@ -248,7 +248,7 @@ int colvarscript::proc_colvar(int argc, char const *argv[]) {
|
||||
}
|
||||
|
||||
if (subcmd == "getsystemforce") {
|
||||
result = (cv->system_force()).to_simple_string();
|
||||
result = (cv->total_force()).to_simple_string();
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@ colvarproxy_lammps::colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp,
|
||||
_random = new LAMMPS_NS::RanPark(lmp,seed);
|
||||
|
||||
first_timestep=true;
|
||||
system_force_requested=false;
|
||||
total_force_requested=false;
|
||||
previous_step=-1;
|
||||
t_target=temp;
|
||||
do_exit=false;
|
||||
@ -154,7 +154,6 @@ void colvarproxy_lammps::init(const char *conf_file)
|
||||
log("atoms_ids = "+cvm::to_str(atoms_ids)+"\n");
|
||||
log("atoms_ncopies = "+cvm::to_str(atoms_ncopies)+"\n");
|
||||
log("atoms_positions = "+cvm::to_str(atoms_positions)+"\n");
|
||||
log("atoms_applied_forces = "+cvm::to_str(atoms_applied_forces)+"\n");
|
||||
log(cvm::line_marker);
|
||||
log("Info: done initializing the colvars proxy object.\n");
|
||||
}
|
||||
@ -199,13 +198,8 @@ double colvarproxy_lammps::compute()
|
||||
"Updating internal data.\n");
|
||||
}
|
||||
|
||||
// backup applied forces if necessary to calculate system forces
|
||||
if (system_force_requested) {
|
||||
atoms_applied_forces = atoms_new_colvar_forces;
|
||||
}
|
||||
|
||||
// zero the forces on the atoms, so that they can be accumulated by the colvars
|
||||
for (size_t i = 0; i < atoms_applied_forces.size(); i++) {
|
||||
for (size_t i = 0; i < atoms_new_colvar_forces.size(); i++) {
|
||||
atoms_new_colvar_forces[i].reset();
|
||||
}
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ class colvarproxy_lammps : public colvarproxy {
|
||||
int previous_step;
|
||||
|
||||
bool first_timestep;
|
||||
bool system_force_requested;
|
||||
bool total_force_requested;
|
||||
bool do_exit;
|
||||
|
||||
// std::vector<int> colvars_atoms;
|
||||
@ -86,7 +86,7 @@ class colvarproxy_lammps : public colvarproxy {
|
||||
// methods for lammps to move data or trigger actions in the proxy
|
||||
public:
|
||||
void set_temperature(double t) { t_target = t; };
|
||||
bool need_system_forces() const { return system_force_requested; };
|
||||
bool need_total_forces() const { return total_force_requested; };
|
||||
bool want_exit() const { return do_exit; };
|
||||
|
||||
// perform colvars computation. returns biasing energy
|
||||
@ -109,7 +109,7 @@ class colvarproxy_lammps : public colvarproxy {
|
||||
inline size_t restart_frequency() { return restart_every; };
|
||||
|
||||
void add_energy(cvm::real energy) { bias_energy += energy; };
|
||||
void request_system_force(bool yesno) { system_force_requested = yesno; };
|
||||
void request_total_force(bool yesno) { total_force_requested = yesno; };
|
||||
|
||||
void log(std::string const &message);
|
||||
void error(std::string const &message);
|
||||
|
||||
@ -766,7 +766,7 @@ void FixColvars::post_force(int vflag)
|
||||
// call our workhorse and retrieve additional information.
|
||||
if (me == 0) {
|
||||
energy = proxy->compute();
|
||||
store_forces = proxy->need_system_forces();
|
||||
store_forces = proxy->need_total_forces();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user