Small fixes to Colvars library

Primarily a list of small fixes, combined with cosmetic changes and cleanups
in several files.

6d0c917 2018-04-29 Fix missing deallocation of output stream object (reported by HanatoK) [Giacomo Fiorin]
c92d369 2018-04-17 Do not test for atom group size [Jérôme Hénin]
431e52a 2018-04-06 Allow scripted/custom colvars to be periodic [Jérôme Hénin]
81d391f 2018-04-05 Split colvarcomp constructor into POD constructor + init() function [Giacomo Fiorin]
9b85d5f 2018-03-13 Fix issue with out-of-order atom selections; clarify format for ref positions [Giacomo Fiorin]
0e0ed37 2018-03-07 Support triclinic unit cells in VMD, clean up PBC functions [Giacomo Fiorin]
eed97c9 2018-02-24 Obtain integer version number from version string [Giacomo Fiorin]
c17f3cd 2018-02-23 Write trajectory labels only when needed [Giacomo Fiorin]
This commit is contained in:
Giacomo Fiorin
2018-05-02 14:57:41 -04:00
parent d5ec76290b
commit 0c005f5cb0
21 changed files with 605 additions and 452 deletions

View File

@ -329,7 +329,6 @@ void integrate_potential::update_div_local(const std::vector<int> &ix0)
const int linear_index = address(ix0);
int i, j, k;
std::vector<int> ix = ix0;
const cvm::real * g;
if (nd == 2) {
// gradients at grid points surrounding the current scalar grid point
@ -783,7 +782,7 @@ void integrate_potential::atimes(const std::vector<cvm::real> &A, std::vector<cv
/// Inversion of preconditioner matrix (e.g. diagonal of the Laplacian)
void integrate_potential::asolve(const std::vector<cvm::real> &b, std::vector<cvm::real> &x)
{
for (size_t i=0; i<nt; i++) {
for (size_t i=0; i<int(nt); i++) {
x[i] = b[i] * inv_lap_diag[i]; // Jacobi preconditioner - little benefit in tests so far
}
return;
@ -803,7 +802,7 @@ void integrate_potential::nr_linbcg_sym(const std::vector<cvm::real> &b, std::ve
iter=0;
atimes(x,r);
for (j=0;j<nt;j++) {
for (j=0;j<int(nt);j++) {
r[j]=b[j]-r[j];
}
bnrm=l2norm(b);
@ -814,26 +813,26 @@ void integrate_potential::nr_linbcg_sym(const std::vector<cvm::real> &b, std::ve
bkden = 1.0;
while (iter < itmax) {
++iter;
for (bknum=0.0,j=0;j<nt;j++) {
for (bknum=0.0,j=0;j<int(nt);j++) {
bknum += r[j]*r[j]; // precon: z[j]*r[j]
}
if (iter == 1) {
for (j=0;j<nt;j++) {
for (j=0;j<int(nt);j++) {
p[j] = r[j]; // precon: p[j] = z[j]
}
} else {
bk=bknum/bkden;
for (j=0;j<nt;j++) {
for (j=0;j<int(nt);j++) {
p[j] = bk*p[j] + r[j]; // precon: bk*p[j] + z[j]
}
}
bkden = bknum;
atimes(p,z);
for (akden=0.0,j=0;j<nt;j++) {
for (akden=0.0,j=0;j<int(nt);j++) {
akden += z[j]*p[j];
}
ak = bknum/akden;
for (j=0;j<nt;j++) {
for (j=0;j<int(nt);j++) {
x[j] += ak*p[j];
r[j] -= ak*z[j];
}