Remove unnecessary config.h includes
[alexxy/gromacs.git] / src / gromacs / mdlib / genborn.c
index 7766dc08b67d34712718c1c32352980384c6a942..f3a8973262879fa4a565647b6a3b699a62402625 100644 (file)
@@ -1,65 +1,65 @@
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+/*
+ * This file is part of the GROMACS molecular simulation package.
  *
- *
- *                This source code is part of
- *
- *                 G   R   O   M   A   C   S
- *
- *          GROningen MAchine for Chemical Simulations
- *
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2008, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
+ * Copyright (c) 2001-2008, The GROMACS development team.
+ * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
  * of the License, or (at your option) any later version.
  *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
  *
- * For more info, check our website at http://www.gromacs.org
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
  *
- * And Hey:
- * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
 
 #include <math.h>
 #include <string.h>
 
-#include "typedefs.h"
-#include "smalloc.h"
-#include "genborn.h"
-#include "vec.h"
-#include "grompp.h"
-#include "pdbio.h"
-#include "names.h"
-#include "physics.h"
-#include "partdec.h"
-#include "domdec.h"
-#include "network.h"
-#include "gmx_fatal.h"
-#include "mtop_util.h"
-#include "pbc.h"
-#include "nrnb.h"
-#include "bondf.h"
-
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/types/commrec.h"
+#include "gromacs/legacyheaders/genborn.h"
+#include "gromacs/fileio/pdbio.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/math/units.h"
+#include "gromacs/legacyheaders/domdec.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/legacyheaders/nrnb.h"
+
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/ishift.h"
+#include "gromacs/pbcutil/mshift.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxmpi.h"
+#include "gromacs/utility/smalloc.h"
 
-#ifdef GMX_X86_SSE2
+#ifdef GMX_SIMD_X86_SSE2_OR_HIGHER
 #  ifdef GMX_DOUBLE
 #    include "genborn_sse2_double.h"
 #    include "genborn_allvsall_sse2_double.h"
@@ -86,7 +86,7 @@ typedef struct gbtmpnbls {
     int         list_nalloc;
 } t_gbtmpnbls;
 
-/* This function is exactly the same as the one in bondfree.c. The reason
+/* This function is exactly the same as the one in bonded/bonded.cpp. The reason
  * it is copied here is that the bonded gb-interactions are evaluated
  * not in calc_bonds, but rather in calc_gb_forces
  */
@@ -103,11 +103,10 @@ static int pbc_rvec_sub(const t_pbc *pbc, const rvec xi, const rvec xj, rvec dx)
     }
 }
 
-int init_gb_nblist(int natoms, t_nblist *nl)
+static int init_gb_nblist(int natoms, t_nblist *nl)
 {
     nl->maxnri      = natoms*4;
     nl->maxnrj      = 0;
-    nl->maxlen      = 0;
     nl->nri         = 0;
     nl->nrj         = 0;
     nl->iinr        = NULL;
@@ -127,47 +126,9 @@ int init_gb_nblist(int natoms, t_nblist *nl)
     return 0;
 }
 
-void gb_pd_send(t_commrec *cr, real *send_data, int nr)
-{
-#ifdef GMX_MPI
-    int  i, cur;
-    int *index, *sendc, *disp;
-
-    snew(sendc, cr->nnodes);
-    snew(disp, cr->nnodes);
-
-    index = pd_index(cr);
-    cur   = cr->nodeid;
-
-    /* Setup count/index arrays */
-    for (i = 0; i < cr->nnodes; i++)
-    {
-        sendc[i]  = index[i+1]-index[i];
-        disp[i]   = index[i];
-    }
-
-    /* Do communication */
-    MPI_Gatherv(send_data+index[cur], sendc[cur], GMX_MPI_REAL, send_data, sendc,
-                disp, GMX_MPI_REAL, 0, cr->mpi_comm_mygroup);
-    MPI_Bcast(send_data, nr, GMX_MPI_REAL, 0, cr->mpi_comm_mygroup);
-
-#endif
-}
-
-
-int init_gb_plist(t_params *p_list)
-{
-    p_list->nr    = 0;
-    p_list->param = NULL;
-
-    return 0;
-}
-
 
-
-int init_gb_still(const t_commrec *cr,
-                  const t_atomtypes *atype, t_idef *idef, t_atoms *atoms,
-                  gmx_genborn_t *born, int natoms)
+static int init_gb_still(const t_atomtypes *atype, t_idef *idef, t_atoms *atoms,
+                         gmx_genborn_t *born, int natoms)
 {
 
     int   i, j, i1, i2, k, m, nbond, nang, ia, ib, ic, id, nb, idx, idx2, at;
@@ -184,28 +145,8 @@ int init_gb_still(const t_commrec *cr,
     snew(gp, natoms);
     snew(born->gpol_still_work, natoms+3);
 
-    if (PAR(cr))
-    {
-        if (PARTDECOMP(cr))
-        {
-            pd_at_range(cr, &at0, &at1);
-
-            for (i = 0; i < natoms; i++)
-            {
-                vsol[i] = gp[i] = 0;
-            }
-        }
-        else
-        {
-            at0 = 0;
-            at1 = natoms;
-        }
-    }
-    else
-    {
-        at0 = 0;
-        at1 = natoms;
-    }
+    at0 = 0;
+    at1 = natoms;
 
     doffset = born->gb_doffset;
 
@@ -243,37 +184,13 @@ int init_gb_still(const t_commrec *cr,
         h      = ri*(1+ratio);
         term   = (M_PI/3.0)*h*h*(3.0*ri-h);
 
-        if (PARTDECOMP(cr))
-        {
-            vsol[ia] += term;
-        }
-        else
-        {
-            born->vsolv_globalindex[ia] -= term;
-        }
+        born->vsolv_globalindex[ia] -= term;
 
         ratio  = (ri2-rj2-r*r)/(2*rj*r);
         h      = rj*(1+ratio);
         term   = (M_PI/3.0)*h*h*(3.0*rj-h);
 
-        if (PARTDECOMP(cr))
-        {
-            vsol[ib] += term;
-        }
-        else
-        {
-            born->vsolv_globalindex[ib] -= term;
-        }
-    }
-
-    if (PARTDECOMP(cr))
-    {
-        gmx_sum(natoms, vsol, cr);
-
-        for (i = 0; i < natoms; i++)
-        {
-            born->vsolv_globalindex[i] = born->vsolv_globalindex[i]-vsol[i];
-        }
+        born->vsolv_globalindex[ib] -= term;
     }
 
     /* Get the self-, 1-2 and 1-3 polarization energies for analytical Still
@@ -299,18 +216,10 @@ int init_gb_still(const t_commrec *cr,
 
         r4 = r*r*r*r;
 
-        if (PARTDECOMP(cr))
-        {
-            gp[ia] += STILL_P2*born->vsolv_globalindex[ib]/r4;
-            gp[ib] += STILL_P2*born->vsolv_globalindex[ia]/r4;
-        }
-        else
-        {
-            born->gpol_globalindex[ia] = born->gpol_globalindex[ia]+
-                STILL_P2*born->vsolv_globalindex[ib]/r4;
-            born->gpol_globalindex[ib] = born->gpol_globalindex[ib]+
-                STILL_P2*born->vsolv_globalindex[ia]/r4;
-        }
+        born->gpol_globalindex[ia] = born->gpol_globalindex[ia]+
+            STILL_P2*born->vsolv_globalindex[ib]/r4;
+        born->gpol_globalindex[ib] = born->gpol_globalindex[ib]+
+            STILL_P2*born->vsolv_globalindex[ia]/r4;
     }
 
     /* 1-3 */
@@ -323,28 +232,10 @@ int init_gb_still(const t_commrec *cr,
         r  = idef->iparams[m].gb.st;
         r4 = r*r*r*r;
 
-        if (PARTDECOMP(cr))
-        {
-            gp[ia] += STILL_P3*born->vsolv[ib]/r4;
-            gp[ib] += STILL_P3*born->vsolv[ia]/r4;
-        }
-        else
-        {
-            born->gpol_globalindex[ia] = born->gpol_globalindex[ia]+
-                STILL_P3*born->vsolv_globalindex[ib]/r4;
-            born->gpol_globalindex[ib] = born->gpol_globalindex[ib]+
-                STILL_P3*born->vsolv_globalindex[ia]/r4;
-        }
-    }
-
-    if (PARTDECOMP(cr))
-    {
-        gmx_sum(natoms, gp, cr);
-
-        for (i = 0; i < natoms; i++)
-        {
-            born->gpol_globalindex[i] = born->gpol_globalindex[i]+gp[i];
-        }
+        born->gpol_globalindex[ia] = born->gpol_globalindex[ia]+
+            STILL_P3*born->vsolv_globalindex[ib]/r4;
+        born->gpol_globalindex[ib] = born->gpol_globalindex[ib]+
+            STILL_P3*born->vsolv_globalindex[ia]/r4;
     }
 
     sfree(vsol);
@@ -355,7 +246,7 @@ int init_gb_still(const t_commrec *cr,
 
 /* Initialize all GB datastructs and compute polarization energies */
 int init_gb(gmx_genborn_t **p_born,
-            const t_commrec *cr, t_forcerec *fr, const t_inputrec *ir,
+            t_forcerec *fr, const t_inputrec *ir,
             const gmx_mtop_t *mtop, int gb_algorithm)
 {
     int             i, j, m, ai, aj, jj, natoms, nalloc;
@@ -438,7 +329,7 @@ int init_gb(gmx_genborn_t **p_born,
     /* If Still model, initialise the polarisation energies */
     if (gb_algorithm == egbSTILL)
     {
-        init_gb_still(cr, &(mtop->atomtypes), &(localtop->idef), &atoms,
+        init_gb_still(&(mtop->atomtypes), &(localtop->idef), &atoms,
                       born, natoms);
     }
 
@@ -480,7 +371,7 @@ int init_gb(gmx_genborn_t **p_born,
 
 
 static int
-calc_gb_rad_still(t_commrec *cr, t_forcerec *fr, int natoms, gmx_localtop_t *top,
+calc_gb_rad_still(t_commrec *cr, t_forcerec *fr, gmx_localtop_t *top,
                   rvec x[], t_nblist *nl,
                   gmx_genborn_t *born, t_mdatoms *md)
 {
@@ -578,11 +469,7 @@ calc_gb_rad_still(t_commrec *cr, t_forcerec *fr, int natoms, gmx_localtop_t *top
     }
 
     /* Parallel summations */
-    if (PARTDECOMP(cr))
-    {
-        gmx_sum(natoms, born->gpol_still_work, cr);
-    }
-    else if (DOMAINDECOMP(cr))
+    if (DOMAINDECOMP(cr))
     {
         dd_atom_sum_real(cr->dd, born->gpol_still_work);
     }
@@ -612,7 +499,7 @@ calc_gb_rad_still(t_commrec *cr, t_forcerec *fr, int natoms, gmx_localtop_t *top
 
 
 static int
-calc_gb_rad_hct(t_commrec *cr, t_forcerec *fr, int natoms, gmx_localtop_t *top,
+calc_gb_rad_hct(t_commrec *cr, t_forcerec *fr, gmx_localtop_t *top,
                 rvec x[], t_nblist *nl,
                 gmx_genborn_t *born, t_mdatoms *md)
 {
@@ -797,11 +684,7 @@ calc_gb_rad_hct(t_commrec *cr, t_forcerec *fr, int natoms, gmx_localtop_t *top,
     }
 
     /* Parallel summations */
-    if (PARTDECOMP(cr))
-    {
-        gmx_sum(natoms, born->gpol_hct_work, cr);
-    }
-    else if (DOMAINDECOMP(cr))
+    if (DOMAINDECOMP(cr))
     {
         dd_atom_sum_real(cr->dd, born->gpol_hct_work);
     }
@@ -832,7 +715,7 @@ calc_gb_rad_hct(t_commrec *cr, t_forcerec *fr, int natoms, gmx_localtop_t *top,
 }
 
 static int
-calc_gb_rad_obc(t_commrec *cr, t_forcerec *fr, int natoms, gmx_localtop_t *top,
+calc_gb_rad_obc(t_commrec *cr, t_forcerec *fr, gmx_localtop_t *top,
                 rvec x[], t_nblist *nl, gmx_genborn_t *born, t_mdatoms *md)
 {
     int   i, k, ai, aj, nj0, nj1, n, at0, at1;
@@ -1012,11 +895,7 @@ calc_gb_rad_obc(t_commrec *cr, t_forcerec *fr, int natoms, gmx_localtop_t *top,
     }
 
     /* Parallel summations */
-    if (PARTDECOMP(cr))
-    {
-        gmx_sum(natoms, born->gpol_hct_work, cr);
-    }
-    else if (DOMAINDECOMP(cr))
+    if (DOMAINDECOMP(cr))
     {
         dd_atom_sum_real(cr->dd, born->gpol_hct_work);
     }
@@ -1099,8 +978,8 @@ int calc_gb_rad(t_commrec *cr, t_forcerec *fr, t_inputrec *ir, gmx_localtop_t *t
 
         if (ir->gb_algorithm == egbSTILL)
         {
-#if 0 && defined (GMX_X86_SSE2)
-            if (fr->use_acceleration)
+#if 0 && defined (GMX_SIMD_X86_SSE2_OR_HIGHER)
+            if (fr->use_simd_kernels)
             {
 #  ifdef GMX_DOUBLE
                 genborn_allvsall_calc_still_radii_sse2_double(fr, md, born, top, x[0], cr, &fr->AllvsAll_workgb);
@@ -1113,15 +992,15 @@ int calc_gb_rad(t_commrec *cr, t_forcerec *fr, t_inputrec *ir, gmx_localtop_t *t
                 genborn_allvsall_calc_still_radii(fr, md, born, top, x[0], cr, &fr->AllvsAll_workgb);
             }
 #else
-            genborn_allvsall_calc_still_radii(fr, md, born, top, x[0], cr, &fr->AllvsAll_workgb);
+            genborn_allvsall_calc_still_radii(fr, md, born, top, x[0], &fr->AllvsAll_workgb);
 #endif
             /* 13 flops in outer loop, 47 flops in inner loop */
             inc_nrnb(nrnb, eNR_BORN_AVA_RADII_STILL, md->homenr*13+cnt*47);
         }
         else if (ir->gb_algorithm == egbHCT || ir->gb_algorithm == egbOBC)
         {
-#if 0 && defined (GMX_X86_SSE2)
-            if (fr->use_acceleration)
+#if 0 && defined (GMX_SIMD_X86_SSE2_OR_HIGHER)
+            if (fr->use_simd_kernels)
             {
 #  ifdef GMX_DOUBLE
                 genborn_allvsall_calc_hct_obc_radii_sse2_double(fr, md, born, ir->gb_algorithm, top, x[0], cr, &fr->AllvsAll_workgb);
@@ -1134,7 +1013,7 @@ int calc_gb_rad(t_commrec *cr, t_forcerec *fr, t_inputrec *ir, gmx_localtop_t *t
                 genborn_allvsall_calc_hct_obc_radii(fr, md, born, ir->gb_algorithm, top, x[0], cr, &fr->AllvsAll_workgb);
             }
 #else
-            genborn_allvsall_calc_hct_obc_radii(fr, md, born, ir->gb_algorithm, top, x[0], cr, &fr->AllvsAll_workgb);
+            genborn_allvsall_calc_hct_obc_radii(fr, md, born, ir->gb_algorithm, top, x[0], &fr->AllvsAll_workgb);
 #endif
             /* 24 flops in outer loop, 183 in inner */
             inc_nrnb(nrnb, eNR_BORN_AVA_RADII_HCT_OBC, md->homenr*24+cnt*183);
@@ -1149,38 +1028,38 @@ int calc_gb_rad(t_commrec *cr, t_forcerec *fr, t_inputrec *ir, gmx_localtop_t *t
     /* Switch for determining which algorithm to use for Born radii calculation */
 #ifdef GMX_DOUBLE
 
-#if 0 && defined (GMX_X86_SSE2)
+#if 0 && defined (GMX_SIMD_X86_SSE2_OR_HIGHER)
     /* x86 or x86-64 with GCC inline assembly and/or SSE intrinsics */
     switch (ir->gb_algorithm)
     {
         case egbSTILL:
-            if (fr->use_acceleration)
+            if (fr->use_simd_kernels)
             {
                 calc_gb_rad_still_sse2_double(cr, fr, born->nr, top, atype, x[0], nl, born);
             }
             else
             {
-                calc_gb_rad_still(cr, fr, born->nr, top, atype, x, nl, born, md);
+                calc_gb_rad_still(cr, fr, top, x, nl, born, md);
             }
             break;
         case egbHCT:
-            if (fr->use_acceleration)
+            if (fr->use_simd_kernels)
             {
                 calc_gb_rad_hct_obc_sse2_double(cr, fr, born->nr, top, atype, x[0], nl, born, md, ir->gb_algorithm);
             }
             else
             {
-                calc_gb_rad_hct(cr, fr, born->nr, top, atype, x, nl, born, md);
+                calc_gb_rad_hct(cr, fr, top, x, nl, born, md);
             }
             break;
         case egbOBC:
-            if (fr->use_acceleration)
+            if (fr->use_simd_kernels)
             {
                 calc_gb_rad_hct_obc_sse2_double(cr, fr, born->nr, top, atype, x[0], nl, born, md, ir->gb_algorithm);
             }
             else
             {
-                calc_gb_rad_obc(cr, fr, born->nr, top, atype, x, nl, born, md);
+                calc_gb_rad_obc(cr, fr, born->nr, top, x, nl, born, md);
             }
             break;
 
@@ -1191,13 +1070,13 @@ int calc_gb_rad(t_commrec *cr, t_forcerec *fr, t_inputrec *ir, gmx_localtop_t *t
     switch (ir->gb_algorithm)
     {
         case egbSTILL:
-            calc_gb_rad_still(cr, fr, born->nr, top, x, nl, born, md);
+            calc_gb_rad_still(cr, fr, top, x, nl, born, md);
             break;
         case egbHCT:
-            calc_gb_rad_hct(cr, fr, born->nr, top, x, nl, born, md);
+            calc_gb_rad_hct(cr, fr, top, x, nl, born, md);
             break;
         case egbOBC:
-            calc_gb_rad_obc(cr, fr, born->nr, top, x, nl, born, md);
+            calc_gb_rad_obc(cr, fr, top, x, nl, born, md);
             break;
 
         default:
@@ -1208,33 +1087,33 @@ int calc_gb_rad(t_commrec *cr, t_forcerec *fr, t_inputrec *ir, gmx_localtop_t *t
 
 #else
 
-#if 0 && defined (GMX_X86_SSE2)
+#if 0 && defined (GMX_SIMD_X86_SSE2_OR_HIGHER)
     /* x86 or x86-64 with GCC inline assembly and/or SSE intrinsics */
     switch (ir->gb_algorithm)
     {
         case egbSTILL:
-            if (fr->use_acceleration)
+            if (fr->use_simd_kernels)
             {
                 calc_gb_rad_still_sse2_single(cr, fr, born->nr, top, x[0], nl, born);
             }
             else
             {
-                calc_gb_rad_still(cr, fr, born->nr, top, x, nl, born, md);
+                calc_gb_rad_still(cr, fr, top, x, nl, born, md);
             }
             break;
         case egbHCT:
-            if (fr->use_acceleration)
+            if (fr->use_simd_kernels)
             {
                 calc_gb_rad_hct_obc_sse2_single(cr, fr, born->nr, top, x[0], nl, born, md, ir->gb_algorithm);
             }
             else
             {
-                calc_gb_rad_hct(cr, fr, born->nr, top, x, nl, born, md);
+                calc_gb_rad_hct(cr, fr, top, x, nl, born, md);
             }
             break;
 
         case egbOBC:
-            if (fr->use_acceleration)
+            if (fr->use_simd_kernels)
             {
                 calc_gb_rad_hct_obc_sse2_single(cr, fr, born->nr, top, x[0], nl, born, md, ir->gb_algorithm);
             }
@@ -1252,13 +1131,13 @@ int calc_gb_rad(t_commrec *cr, t_forcerec *fr, t_inputrec *ir, gmx_localtop_t *t
     switch (ir->gb_algorithm)
     {
         case egbSTILL:
-            calc_gb_rad_still(cr, fr, born->nr, top, x, nl, born, md);
+            calc_gb_rad_still(cr, fr, top, x, nl, born, md);
             break;
         case egbHCT:
-            calc_gb_rad_hct(cr, fr, born->nr, top, x, nl, born, md);
+            calc_gb_rad_hct(cr, fr, top, x, nl, born, md);
             break;
         case egbOBC:
-            calc_gb_rad_obc(cr, fr, born->nr, top, x, nl, born, md);
+            calc_gb_rad_obc(cr, fr, top, x, nl, born, md);
             break;
 
         default:
@@ -1389,11 +1268,7 @@ real calc_gb_selfcorrections(t_commrec *cr, int natoms,
     int  i, ai, at0, at1;
     real rai, e, derb, q, q2, fi, rai_inv, vtot;
 
-    if (PARTDECOMP(cr))
-    {
-        pd_at_range(cr, &at0, &at1);
-    }
-    else if (DOMAINDECOMP(cr))
+    if (DOMAINDECOMP(cr))
     {
         at0 = 0;
         at1 = cr->dd->nat_home;
@@ -1443,11 +1318,7 @@ real calc_gb_nonpolar(t_commrec *cr, t_forcerec *fr, int natoms, gmx_genborn_t *
     /* To keep the compiler happy */
     factor = 0;
 
-    if (PARTDECOMP(cr))
-    {
-        pd_at_range(cr, &at0, &at1);
-    }
-    else if (DOMAINDECOMP(cr))
+    if (DOMAINDECOMP(cr))
     {
         at0 = 0;
         at1 = cr->dd->nat_home;
@@ -1648,14 +1519,10 @@ calc_gb_forces(t_commrec *cr, t_mdatoms *md, gmx_genborn_t *born, gmx_localtop_t
                                                fr->invsqrta, fr->dvda, fr->gbtab.data, idef, born->epsilon_r, born->gb_epsilon_solvent, fr->epsfac, pbc_null, graph);
 
     /* Calculate self corrections to the GB energies - currently only A state used! (FIXME) */
-    enerd->term[F_GBPOL]       += calc_gb_selfcorrections(cr, born->nr, md->chargeA, born, fr->dvda,fr->epsfac);
+    enerd->term[F_GBPOL]       += calc_gb_selfcorrections(cr, born->nr, md->chargeA, born, fr->dvda, fr->epsfac);
 
     /* If parallel, sum the derivative of the potential w.r.t the born radii */
-    if (PARTDECOMP(cr))
-    {
-        gmx_sum(md->nr, fr->dvda, cr);
-    }
-    else if (DOMAINDECOMP(cr))
+    if (DOMAINDECOMP(cr))
     {
         dd_atom_sum_real(cr->dd, fr->dvda);
         dd_atom_spread_real(cr->dd, fr->dvda);
@@ -1663,8 +1530,8 @@ calc_gb_forces(t_commrec *cr, t_mdatoms *md, gmx_genborn_t *born, gmx_localtop_t
 
     if (fr->bAllvsAll)
     {
-#if 0 && defined (GMX_X86_SSE2)
-        if (fr->use_acceleration)
+#if 0 && defined (GMX_SIMD_X86_SSE2_OR_HIGHER)
+        if (fr->use_simd_kernels)
         {
 #  ifdef GMX_DOUBLE
             genborn_allvsall_calc_chainrule_sse2_double(fr, md, born, x[0], f[0], gb_algorithm, fr->AllvsAll_workgb);
@@ -1685,8 +1552,8 @@ calc_gb_forces(t_commrec *cr, t_mdatoms *md, gmx_genborn_t *born, gmx_localtop_t
         return;
     }
 
-#if 0 && defined (GMX_X86_SSE2)
-    if (fr->use_acceleration)
+#if 0 && defined (GMX_SIMD_X86_SSE2_OR_HIGHER)
+    if (fr->use_simd_kernels)
     {
 #  ifdef GMX_DOUBLE
         calc_gb_chainrule_sse2_double(fr->natoms_force, &(fr->gblist), fr->dadx, fr->dvda, x[0],
@@ -1984,7 +1851,7 @@ void make_local_gb(const t_commrec *cr, gmx_genborn_t *born, int gb_algorithm)
     }
     else
     {
-        /* Single node or particle decomp (global==local), just copy pointers and return */
+        /* Single node, just copy pointers and return */
         if (gb_algorithm == egbSTILL)
         {
             born->gpol      = born->gpol_globalindex;