From d3e2d78f5c42e4ad8c3d6dabf7a6d909b2a9c280 Mon Sep 17 00:00:00 2001 From: Berk Hess Date: Fri, 26 Sep 2014 20:47:47 +0200 Subject: [PATCH 1/1] Avoid PME tuning decreasing rcoulomb With mdrun input with the grid much finer than fourier-spacing, PME tuning could reduce rcoulomb below the starting value. Fixes #1606. Change-Id: I3ae7fe38a4240251aadb96336199b306fc7dce40 --- src/programs/mdrun/pme_loadbal.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/programs/mdrun/pme_loadbal.c b/src/programs/mdrun/pme_loadbal.c index 1c12f86435..d6fd68f372 100644 --- a/src/programs/mdrun/pme_loadbal.c +++ b/src/programs/mdrun/pme_loadbal.c @@ -261,6 +261,15 @@ static gmx_bool pme_loadbal_increase_cutoff(pme_load_balancing_t pme_lb, while (sp <= 1.001*pme_lb->setup[pme_lb->cur].spacing || !grid_ok); set->rcut_coulomb = pme_lb->cut_spacing*sp; + if (set->rcut_coulomb < pme_lb->rcut_coulomb_start) + { + /* This is unlikely, but can happen when e.g. continuing from + * a checkpoint after equilibration where the box shrank a lot. + * We want to avoid rcoulomb getting smaller than rvdw + * and there might be more issues with decreasing rcoulomb. + */ + set->rcut_coulomb = pme_lb->rcut_coulomb_start; + } if (pme_lb->cutoff_scheme == ecutsVERLET) { -- 2.22.0