From 49773f60060ecc4c9194fd65810982d25aea3d0f Mon Sep 17 00:00:00 2001 From: Carsten Kutzner Date: Tue, 21 May 2013 16:31:46 +0200 Subject: [PATCH] Fixed calculation of slab buffer size for flexible potentials. The slab buffer size is difference in slabs between the reference and the current positions of the rotation group. This was originally calculated once in the init_rot_group() routine. However, it needs to be calculated at every step since it changes when the rotation group expands or contracts along the rotation vector. Change-Id: I3b1fac41f88744e14e712454ae546c94f9b26750 --- src/mdlib/pull_rotation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mdlib/pull_rotation.c b/src/mdlib/pull_rotation.c index e51d4d0871..1039daaeb1 100644 --- a/src/mdlib/pull_rotation.c +++ b/src/mdlib/pull_rotation.c @@ -2492,6 +2492,9 @@ static void get_firstlast_slab_check( erg->slab_first = get_first_slab(rotg, erg->max_beta, firstatom); erg->slab_last = get_last_slab(rotg, erg->max_beta, lastatom); + /* Calculate the slab buffer size, which changes when slab_first changes */ + erg->slab_buffer = erg->slab_first - erg->slab_first_ref; + /* Check whether we have reference data to compare against */ if (erg->slab_first < erg->slab_first_ref) { @@ -3320,14 +3323,13 @@ static void allocate_slabs( static void get_firstlast_slab_ref(t_rotgrp *rotg, real mc[], int ref_firstindex, int ref_lastindex) { gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */ - int first, last, firststart; + int first, last; rvec dummy; erg = rotg->enfrotgrp; first = get_first_slab(rotg, erg->max_beta, rotg->x_ref[ref_firstindex]); last = get_last_slab( rotg, erg->max_beta, rotg->x_ref[ref_lastindex ]); - firststart = first; while (get_slab_weight(first, rotg, rotg->x_ref, mc, &dummy) > WEIGHT_MIN) { @@ -3339,8 +3341,6 @@ static void get_firstlast_slab_ref(t_rotgrp *rotg, real mc[], int ref_firstindex last++; } erg->slab_last_ref = last-1; - - erg->slab_buffer = firststart - erg->slab_first_ref; } -- 2.22.0