Update Colvars library to version 2016-12-22

Significant code cleanup and several fixes (walls + extended Lagrangian)

New harmonicWalls bias to apply confining boundaries with time-dependent force
constant & integration
This commit is contained in:
Giacomo Fiorin
2016-12-27 13:17:34 -05:00
parent 6ab716164b
commit f553e230db
49 changed files with 2489 additions and 1358 deletions

View File

@ -1,5 +1,12 @@
// -*- 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.
#include <cmath>
#include "colvarmodule.h"
@ -13,10 +20,10 @@
template<bool calculate_gradients>
cvm::real colvar::coordnum::switching_function(cvm::real const &r0,
int const &en,
int const &ed,
cvm::atom &A1,
cvm::atom &A2)
int const &en,
int const &ed,
cvm::atom &A1,
cvm::atom &A2)
{
cvm::rvector const diff = cvm::position_distance(A1.pos, A2.pos);
cvm::real const l2 = diff.norm2()/(r0*r0);
@ -42,10 +49,10 @@ cvm::real colvar::coordnum::switching_function(cvm::real const &r0,
template<bool calculate_gradients>
cvm::real colvar::coordnum::switching_function(cvm::rvector const &r0_vec,
int const &en,
int const &ed,
cvm::atom &A1,
cvm::atom &A2)
int const &en,
int const &ed,
cvm::atom &A1,
cvm::atom &A2)
{
cvm::rvector const diff = cvm::position_distance(A1.pos, A2.pos);
cvm::rvector const scal_diff(diff.x/r0_vec.x, diff.y/r0_vec.y, diff.z/r0_vec.z);
@ -190,6 +197,7 @@ void colvar::coordnum::calc_gradients()
}
}
void colvar::coordnum::apply_force(colvarvalue const &force)
{
if (!group1->noforce)
@ -200,6 +208,9 @@ void colvar::coordnum::apply_force(colvarvalue const &force)
}
simple_scalar_dist_functions(coordnum)
// h_bond member functions
@ -252,6 +263,7 @@ colvar::h_bond::h_bond(cvm::atom const &acceptor,
atom_groups[0]->add_atom(donor);
}
colvar::h_bond::h_bond()
: cvc()
{
@ -284,6 +296,8 @@ void colvar::h_bond::apply_force(colvarvalue const &force)
}
simple_scalar_dist_functions(h_bond)
colvar::selfcoordnum::selfcoordnum(std::string const &conf)
@ -339,6 +353,9 @@ void colvar::selfcoordnum::apply_force(colvarvalue const &force)
}
simple_scalar_dist_functions(selfcoordnum)
// groupcoordnum member functions
colvar::groupcoordnum::groupcoordnum(std::string const &conf)
: distance(conf), b_anisotropic(false)
@ -448,7 +465,6 @@ cvm::real colvar::groupcoordnum::switching_function(cvm::rvector const &r0_vec,
#endif
void colvar::groupcoordnum::calc_value()
{
@ -460,7 +476,6 @@ void colvar::groupcoordnum::calc_value()
x.real_value = coordnum::switching_function<false>(r0, en, ed,
group1_com_atom, group2_com_atom);
}
@ -486,3 +501,6 @@ void colvar::groupcoordnum::apply_force(colvarvalue const &force)
if (!group2->noforce)
group2->apply_colvar_force(force.real_value);
}
simple_scalar_dist_functions(groupcoordnum)