From 7e1bfb450265724adbe0a0c74b59fc4328ee1771 Mon Sep 17 00:00:00 2001 From: David van der Spoel Date: Tue, 1 Aug 2017 18:09:16 +0200 Subject: [PATCH] Fixed bug in gmx disres indexing arrays. The call to routines in listed-forces/disre.cpp returns values in a different manner than previously. This meant that gmx disre would crash since it expected a value to be non-zero. Change-Id: Ib7008a9655f7e4a8b56ab1319bab9b2104273721 --- src/gromacs/gmxana/gmx_disre.cpp | 10 +++++----- src/gromacs/listed-forces/disre.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gromacs/gmxana/gmx_disre.cpp b/src/gromacs/gmxana/gmx_disre.cpp index 824808f73a..a6a0a316b0 100644 --- a/src/gromacs/gmxana/gmx_disre.cpp +++ b/src/gromacs/gmxana/gmx_disre.cpp @@ -207,17 +207,17 @@ static void check_viol(FILE *log, calc_disres_R_6(nullptr, n, &forceatoms[i], (const rvec*)x, pbc, fcd, nullptr); - if (fcd->disres.Rt_6[0] <= 0) + if (fcd->disres.Rt_6[label] <= 0) { - gmx_fatal(FARGS, "ndr = %d, rt_6 = %f", ndr, fcd->disres.Rt_6[0]); + gmx_fatal(FARGS, "ndr = %d, rt_6 = %f", ndr, fcd->disres.Rt_6[label]); } - rt = gmx::invsixthroot(fcd->disres.Rt_6[0]); + rt = gmx::invsixthroot(fcd->disres.Rt_6[label]); dr[clust_id].aver1[ndr] += rt; dr[clust_id].aver2[ndr] += gmx::square(rt); drt = 1.0/gmx::power3(rt); dr[clust_id].aver_3[ndr] += drt; - dr[clust_id].aver_6[ndr] += fcd->disres.Rt_6[0]; + dr[clust_id].aver_6[ndr] += fcd->disres.Rt_6[label]; snew(fshift, SHIFTS); interaction_function[F_DISRES].ifunc(n, &forceatoms[i], forceparams, @@ -242,7 +242,7 @@ static void check_viol(FILE *log, { if (index[j] == forceparams[type].disres.label) { - vvindex[j] = gmx::invsixthroot(fcd->disres.Rt_6[0]); + vvindex[j] = gmx::invsixthroot(fcd->disres.Rt_6[label]); } } } diff --git a/src/gromacs/listed-forces/disre.cpp b/src/gromacs/listed-forces/disre.cpp index 2a27f7f192..d2c7e42889 100644 --- a/src/gromacs/listed-forces/disre.cpp +++ b/src/gromacs/listed-forces/disre.cpp @@ -132,7 +132,7 @@ void init_disres(FILE *fplog, const gmx_mtop_t *mtop, iloop = gmx_mtop_ilistloop_init(mtop); while (gmx_mtop_ilistloop_next(iloop, &il, &nmol)) { - if (nmol > 1 && ir->eDisre != edrEnsemble) + if (nmol > 1 && il[F_DISRES].nr > 0 && ir->eDisre != edrEnsemble) { gmx_fatal(FARGS, "NMR distance restraints with multiple copies of the same molecule are currently only supported with ensemble averaging. If you just want to restrain distances between atom pairs using a flat-bottomed potential, use a restraint potential (bonds type 10) instead."); } -- 2.11.4.GIT