Fixed calculation of slab buffer size for flexible potentials.
authorCarsten Kutzner <ckutzne@gwdg.de>
Tue, 21 May 2013 14:31:46 +0000 (16:31 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 28 May 2013 19:58:42 +0000 (21:58 +0200)
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

index e51d4d0871e018197ea9fb0492aaa38b94fa3edc..1039daaeb1ade0426680a2cf56163f7439937859 100644 (file)
@@ -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;
 }