Remove sh_invrc6 from interaction_const_t
authorBerk Hess <hess@kth.se>
Wed, 24 Jul 2019 13:56:24 +0000 (15:56 +0200)
committerSzilárd Páll <pall.szilard@gmail.com>
Fri, 26 Jul 2019 14:17:20 +0000 (16:17 +0200)
Change-Id: Ib903b9b0dc3a85f290e084db87f102b9c05c2f56

src/gromacs/ewald/pme_load_balancing.cpp
src/gromacs/gmxlib/nonbonded/nb_free_energy.cpp
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdtypes/interaction_const.h
src/gromacs/nbnxm/kernels_reference/kernel_gpu_ref.cpp

index 500e351336a39e6af8986464d31a86fd22dd550e..d6b9c1a7179addbd4552f3f3d9da52b520413f37 100644 (file)
@@ -812,7 +812,6 @@ pme_load_balance(pme_load_balancing_t      *pme_lb,
 
             ic->dispersion_shift.cpot = -1.0/gmx::power6(static_cast<double>(ic->rvdw));
             ic->repulsion_shift.cpot  = -1.0/gmx::power12(static_cast<double>(ic->rvdw));
-            ic->sh_invrc6             = -ic->dispersion_shift.cpot;
             crc2                      = gmx::square(ic->ewaldcoeff_lj*ic->rvdw);
             ic->sh_lj_ewald           = (std::exp(-crc2)*(1 + crc2 + 0.5*crc2*crc2) - 1)/gmx::power6(ic->rvdw);
         }
index 314d59460b9880982cfcb65bed5d822fadd76c84..c80462f6d6f79b6f7a5b654e4cf94c347231ad91 100644 (file)
@@ -128,18 +128,15 @@ nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
     real *        fshift;
     const real *  x;
     real *        f;
-    real          facel, krf, crf;
     const real *  chargeA;
     const real *  chargeB;
     real          sigma6_min, sigma6_def, lam_power;
     real          alpha_coul, alpha_vdw, lambda_coul, lambda_vdw;
-    real          sh_lj_ewald;
     const real *  nbfp, *nbfp_grid;
     real *        dvdl;
     real *        Vv;
     real *        Vc;
     gmx_bool      bDoForces, bDoShiftForces, bDoPotential;
-    real          rcoulomb, rvdw, sh_invrc6;
     gmx_bool      bEwald, bEwaldLJ;
     real          rcutoff_max2;
     const real *  tab_ewald_F_lj = nullptr;
@@ -177,9 +174,6 @@ nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
     shiftvec            = fr->shift_vec[0];
     chargeA             = mdatoms->chargeA;
     chargeB             = mdatoms->chargeB;
-    facel               = fr->ic->epsfac;
-    krf                 = ic->k_rf;
-    crf                 = ic->c_rf;
     Vc                  = kernel_data->energygrp_elec;
     typeA               = mdatoms->typeA;
     typeB               = mdatoms->typeB;
@@ -199,10 +193,15 @@ nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
     bDoShiftForces      = ((kernel_data->flags & GMX_NONBONDED_DO_SHIFTFORCE) != 0);
     bDoPotential        = ((kernel_data->flags & GMX_NONBONDED_DO_POTENTIAL) != 0);
 
-    rcoulomb            = ic->rcoulomb;
-    rvdw                = ic->rvdw;
-    sh_invrc6           = ic->sh_invrc6;
-    sh_lj_ewald         = ic->sh_lj_ewald;
+    // Extract data from interaction_const_t
+    const real facel           = ic->epsfac;
+    const real rcoulomb        = ic->rcoulomb;
+    const real krf             = ic->k_rf;
+    const real crf             = ic->c_rf;
+    const real sh_lj_ewald     = ic->sh_lj_ewald;
+    const real rvdw            = ic->rvdw;
+    const real dispersionShift = ic->dispersion_shift.cpot;
+    const real repulsionShift  = ic->repulsion_shift.cpot;
 
     // Note that the nbnxm kernels do not support Coulomb potential switching at all
     GMX_ASSERT(ic->coulomb_modifier != eintmodPOTSWITCH,
@@ -541,8 +540,8 @@ nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
                             Vvdw6            = c6[i]*rinv6;
                             Vvdw12           = c12[i]*rinv6*rinv6;
 
-                            Vvdw[i]          = ( (Vvdw12 - c12[i]*sh_invrc6*sh_invrc6)*onetwelfth
-                                                 - (Vvdw6 - c6[i]*sh_invrc6)*onesixth);
+                            Vvdw[i]          = ( (Vvdw12 + c12[i]*repulsionShift)*onetwelfth
+                                                 - (Vvdw6 + c6[i]*dispersionShift)*onesixth);
                             FscalV[i]        = Vvdw12 - Vvdw6;
 
                             if (bEwaldLJ)
index c6efe698d161232478ffec8a664422deb518131a..81cc44cd825f6b9dedaf19879dd03ec75aee6b01 100644 (file)
@@ -1417,8 +1417,6 @@ init_interaction_const(FILE                       *fp,
             gmx_incons("unimplemented potential modifier");
     }
 
-    ic->sh_invrc6 = -ic->dispersion_shift.cpot;
-
     /* Electrostatics */
     ic->eeltype          = ir->coulombtype;
     ic->coulomb_modifier = ir->coulomb_modifier;
index d93cff6207f1b9762c9dc8eb1abe64be023f3b36..9947e494ddc89d45d1333845bf8af884fe0868bb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017,2018,2019, 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.
@@ -80,10 +80,6 @@ struct interaction_const_t
     struct switch_consts_t vdw_switch;
     gmx_bool               useBuckingham;
     real                   buckinghamBMax;
-    /* TODO: remove this variable, used for not modyfing the group kernels,
-     * it is equal to -dispersion_shift->cpot
-     */
-    real sh_invrc6;
 
     /* type of electrostatics (defined in enums.h) */
     int  eeltype;
index 4520fb190e74047474fbe1b6abfbe95c6662701e..f979472012b0ad3c2eb053ca6ea641aa87568247 100644 (file)
@@ -305,8 +305,8 @@ nbnxn_kernel_gpu_ref(const NbnxnPairlistGpu     *nbl,
                                         vctot   += vcoul;
 
                                         Vvdwtot +=
-                                            (Vvdw_rep - int_bit*c12*iconst->sh_invrc6*iconst->sh_invrc6)/12 -
-                                            (Vvdw_disp - int_bit*c6*iconst->sh_invrc6)/6;
+                                            (Vvdw_rep + int_bit*c12*iconst->repulsion_shift.cpot)/12 -
+                                            (Vvdw_disp + int_bit*c6*iconst->dispersion_shift.cpot)/6;
                                     }
                                 }