Clean up ekind struct
authorKevin Boyd <kevin.boyd@uconn.edu>
Mon, 31 Dec 2018 20:07:32 +0000 (15:07 -0500)
committerBerk Hess <hess@kth.se>
Mon, 7 Jan 2019 12:36:34 +0000 (13:36 +0100)
Changed to unique_ptr in mdrun, rerun, mimic

Changed pointer arrays to vector where possible

Used ArrayRef to refer to vectors in functions

Freed remaining memory leaks in ekind destructor

Change-Id: Ida1ab594334009a9fe22f4bd8d5bc8d9050811e3

src/gromacs/mdlib/coupling.cpp
src/gromacs/mdlib/tgroup.cpp
src/gromacs/mdlib/update.cpp
src/gromacs/mdlib/update.h
src/gromacs/mdrun/md.cpp
src/gromacs/mdrun/mimic.cpp
src/gromacs/mdrun/rerun.cpp
src/gromacs/mdtypes/group.cpp [new file with mode: 0644]
src/gromacs/mdtypes/group.h

index a4b59020eb5f57420b2ecac3ad1d3eba20813041..538be1dffc65472e15a034db5bba59e0ef7b70e1 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,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.
@@ -111,7 +111,6 @@ static void NHC_trotter(const t_grpopts *opts, int nvar, const gmx_ekindata_t *e
     int           i, j, mi, mj;
     double        Ekin, Efac, reft, kT, nd;
     double        dt;
-    t_grp_tcstat *tcstat;
     double       *ivxi, *ixi;
     double       *GQ;
     gmx_bool      bBarostat;
@@ -149,7 +148,7 @@ static void NHC_trotter(const t_grpopts *opts, int nvar, const gmx_ekindata_t *e
         else
         {
             iQinv  = gmx::arrayRefFromArray(&MassQ->Qinv[i*nh], nh);
-            tcstat = &ekind->tcstat[i];
+            const t_grp_tcstat *tcstat = &ekind->tcstat[i];
             nd     = opts->nrdf[i];
             reft   = std::max<real>(0, opts->ref_t[i]);
             if (bEkinAveVel)
@@ -736,7 +735,7 @@ void berendsen_pscale(const t_inputrec *ir, const matrix mu,
     inc_nrnb(nrnb, eNR_PCOUPL, nr_atoms);
 }
 
-void berendsen_tcoupl(const t_inputrec *ir, const gmx_ekindata_t *ekind, real dt,
+void berendsen_tcoupl(const t_inputrec *ir, gmx_ekindata_t *ekind, real dt,
                       std::vector<double> &therm_integral)
 {
     const t_grpopts *opts = &ir->opts;
@@ -1565,19 +1564,18 @@ void vrescale_tcoupl(const t_inputrec *ir, int64_t step,
 void rescale_velocities(const gmx_ekindata_t *ekind, const t_mdatoms *mdatoms,
                         int start, int end, rvec v[])
 {
-    t_grp_acc      *gstat;
-    t_grp_tcstat   *tcstat;
     unsigned short *cACC, *cTC;
     int             ga, gt, n, d;
     real            lg;
     rvec            vrel;
 
-    tcstat = ekind->tcstat;
     cTC    = mdatoms->cTC;
 
+    gmx::ArrayRef<const t_grp_tcstat> tcstat = ekind->tcstat;
+
     if (ekind->bNEMD)
     {
-        gstat  = ekind->grpstat;
+        gmx::ArrayRef<const t_grp_acc> gstat = ekind->grpstat;
         cACC   = mdatoms->cACC;
 
         ga = 0;
index fdae985a973050a5fc05da4a4d14a423fba75bef..40cf1099533cebd7ab36c22f0a6e2e34e762628f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,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.
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/smalloc.h"
 
-static void init_grptcstat(int ngtc, t_grp_tcstat tcstat[])
-{
-    int i;
-
-    for (i = 0; (i < ngtc); i++)
-    {
-        tcstat[i].T = 0;
-        clear_mat(tcstat[i].ekinh);
-        clear_mat(tcstat[i].ekinh_old);
-        clear_mat(tcstat[i].ekinf);
-    }
-}
-
 static void init_grpstat(const gmx_mtop_t *mtop, int ngacc, t_grp_acc gstat[])
 {
     gmx_mtop_atomloop_all_t aloop;
@@ -108,8 +95,7 @@ void init_ekindata(FILE gmx_unused *log, const gmx_mtop_t *mtop, const t_grpopts
     ekind->bNEMD = (opts->ngacc > 1 || norm2(opts->acc[0]) > 0);
 
     ekind->ngtc = opts->ngtc;
-    snew(ekind->tcstat, opts->ngtc);
-    init_grptcstat(opts->ngtc, ekind->tcstat);
+    ekind->tcstat.resize(opts->ngtc);
     /* Set Berendsen tcoupl lambda's to 1,
      * so runs without Berendsen coupling are not affected.
      */
@@ -121,8 +107,8 @@ void init_ekindata(FILE gmx_unused *log, const gmx_mtop_t *mtop, const t_grpopts
         ekind->tcstat[i].ekinscalef_nhc = 1.0;
     }
 
-    nthread = gmx_omp_nthreads_get(emntUpdate);
-
+    nthread         = gmx_omp_nthreads_get(emntUpdate);
+    ekind->nthreads = nthread;
     snew(ekind->ekin_work_alloc, nthread);
     snew(ekind->ekin_work, nthread);
     snew(ekind->dekindl_work, nthread);
@@ -150,8 +136,8 @@ void init_ekindata(FILE gmx_unused *log, const gmx_mtop_t *mtop, const t_grpopts
     }
 
     ekind->ngacc = opts->ngacc;
-    snew(ekind->grpstat, opts->ngacc);
-    init_grpstat(mtop, opts->ngacc, ekind->grpstat);
+    ekind->grpstat.resize(opts->ngacc);
+    init_grpstat(mtop, opts->ngacc, ekind->grpstat.data());
 }
 
 void accumulate_u(const t_commrec *cr, const t_grpopts *opts, gmx_ekindata_t *ekind)
index 2f6c8aedf45f1b367b34a8eb436d3deaff6e89fc..c34571000f2094eadb316703d0f86844166d3785 100644 (file)
@@ -217,18 +217,18 @@ enum class ApplyParrinelloRahmanVScaling
 template<NumTempScaleValues            numTempScaleValues,
          ApplyParrinelloRahmanVScaling applyPRVScaling>
 static void
-updateMDLeapfrogSimple(int                       start,
-                       int                       nrend,
-                       real                      dt,
-                       real                      dtPressureCouple,
-                       const rvec * gmx_restrict invMassPerDim,
-                       const t_grp_tcstat      * tcstat,
-                       const unsigned short    * cTC,
-                       const rvec                pRVScaleMatrixDiagonal,
-                       const rvec * gmx_restrict x,
-                       rvec       * gmx_restrict xprime,
-                       rvec       * gmx_restrict v,
-                       const rvec * gmx_restrict f)
+updateMDLeapfrogSimple(int                               start,
+                       int                               nrend,
+                       real                              dt,
+                       real                              dtPressureCouple,
+                       const rvec * gmx_restrict         invMassPerDim,
+                       gmx::ArrayRef<const t_grp_tcstat> tcstat,
+                       const unsigned short            * cTC,
+                       const rvec                        pRVScaleMatrixDiagonal,
+                       const rvec * gmx_restrict         x,
+                       rvec       * gmx_restrict         xprime,
+                       rvec       * gmx_restrict         v,
+                       const rvec * gmx_restrict         f)
 {
     real lambdaGroup;
 
@@ -341,15 +341,15 @@ static inline void simdStoreRvecs(rvec     *r,
  * \param[in]    f                      Forces
  */
 static void
-updateMDLeapfrogSimpleSimd(int                       start,
-                           int                       nrend,
-                           real                      dt,
-                           const real * gmx_restrict invMass,
-                           const t_grp_tcstat      * tcstat,
-                           const rvec * gmx_restrict x,
-                           rvec       * gmx_restrict xprime,
-                           rvec       * gmx_restrict v,
-                           const rvec * gmx_restrict f)
+updateMDLeapfrogSimpleSimd(int                               start,
+                           int                               nrend,
+                           real                              dt,
+                           const real * gmx_restrict         invMass,
+                           gmx::ArrayRef<const t_grp_tcstat> tcstat,
+                           const rvec * gmx_restrict         x,
+                           rvec       * gmx_restrict         xprime,
+                           rvec       * gmx_restrict         v,
+                           const rvec * gmx_restrict         f)
 {
     SimdReal                  timestep(dt);
     SimdReal                  lambdaSystem(tcstat[0].lambda);
@@ -438,14 +438,13 @@ updateMDLeapfrogGeneral(int                         start,
      * Holian et al. Phys Rev E 52(3) : 2338, 1995
      */
 
-    const unsigned short    * cTC           = md->cTC;
-    const t_grp_tcstat      * tcstat        = ekind->tcstat;
+    gmx::ArrayRef<const t_grp_tcstat> tcstat        = ekind->tcstat;
+    gmx::ArrayRef<const t_grp_acc>    grpstat       = ekind->grpstat;
+    const unsigned short            * cTC           = md->cTC;
+    const unsigned short            * cACC          = md->cACC;
+    const rvec                      * accel         = ir->opts.acc;
 
-    const unsigned short    * cACC          = md->cACC;
-    const rvec              * accel         = ir->opts.acc;
-    const t_grp_acc         * grpstat       = ekind->grpstat;
-
-    const rvec * gmx_restrict invMassPerDim = md->invMassPerDim;
+    const rvec * gmx_restrict         invMassPerDim = md->invMassPerDim;
 
     /* Initialize group values, changed later when multiple groups are used */
     int  ga       = 0;
@@ -608,9 +607,9 @@ static void do_update_md(int                         start,
         bool haveSingleTempScaleValue = (!doTempCouple || ekind->ngtc == 1);
 
         /* Extract some pointers needed by all cases */
-        const unsigned short *cTC           = md->cTC;
-        const t_grp_tcstat   *tcstat        = ekind->tcstat;
-        const rvec           *invMassPerDim = md->invMassPerDim;
+        const unsigned short             *cTC           = md->cTC;
+        gmx::ArrayRef<const t_grp_tcstat> tcstat        = ekind->tcstat;
+        const rvec                       *invMassPerDim = md->invMassPerDim;
 
         if (doParrinelloRahman)
         {
@@ -1054,10 +1053,10 @@ static void do_update_bd(int start, int nrend, real dt,
 static void calc_ke_part_normal(const rvec v[], const t_grpopts *opts, const t_mdatoms *md,
                                 gmx_ekindata_t *ekind, t_nrnb *nrnb, gmx_bool bEkinAveVel)
 {
-    int           g;
-    t_grp_tcstat *tcstat  = ekind->tcstat;
-    t_grp_acc    *grpstat = ekind->grpstat;
-    int           nthread, thread;
+    int                         g;
+    gmx::ArrayRef<t_grp_tcstat> tcstat  = ekind->tcstat;
+    gmx::ArrayRef<t_grp_acc>    grpstat = ekind->grpstat;
+    int                         nthread, thread;
 
     /* three main: VV with AveVel, vv with AveEkin, leap with AveEkin.  Leap with AveVel is also
        an option, but not supported now.
@@ -1172,15 +1171,15 @@ static void calc_ke_part_visc(const matrix box, const rvec x[], const rvec v[],
                               gmx_ekindata_t *ekind,
                               t_nrnb *nrnb, gmx_bool bEkinAveVel)
 {
-    int           start = 0, homenr = md->homenr;
-    int           g, d, n, m, gt = 0;
-    rvec          v_corrt;
-    real          hm;
-    t_grp_tcstat *tcstat = ekind->tcstat;
-    t_cos_acc    *cosacc = &(ekind->cosacc);
-    real          dekindl;
-    real          fac, cosz;
-    double        mvcos;
+    int                         start = 0, homenr = md->homenr;
+    int                         g, d, n, m, gt = 0;
+    rvec                        v_corrt;
+    real                        hm;
+    gmx::ArrayRef<t_grp_tcstat> tcstat = ekind->tcstat;
+    t_cos_acc                  *cosacc = &(ekind->cosacc);
+    real                        dekindl;
+    real                        fac, cosz;
+    double                      mvcos;
 
     for (g = 0; g < opts->ngtc; g++)
     {
index da2a9b765b839c1e28d6f71e79984c7bc82dd16f..366d0621f687d377914f50f74b9e170fcbe3b911 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,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.
@@ -215,7 +215,7 @@ void
 restore_ekinstate_from_state(const t_commrec *cr,
                              gmx_ekindata_t *ekind, const ekinstate_t *ekinstate);
 
-void berendsen_tcoupl(const t_inputrec *ir, const gmx_ekindata_t *ekind, real dt,
+void berendsen_tcoupl(const t_inputrec *ir, gmx_ekindata_t *ekind, real dt,
                       std::vector<double> &therm_integral); //NOLINT(google-runtime-references)
 
 void andersen_tcoupl(const t_inputrec *ir, int64_t step,
index 1d108d726f2045da1cde2261b3aff6063cdcac5d..702bb9e0e51ebe5b2c42e85cc256ecc57f2c2de4 100644 (file)
@@ -176,7 +176,6 @@ void gmx::Integrator::do_md()
     gmx_update_t           *upd   = nullptr;
     t_graph                *graph = nullptr;
     gmx_groups_t           *groups;
-    gmx_ekindata_t         *ekind;
     gmx_shellfc_t          *shellfc;
     gmx_bool                bSumEkinhOld, bDoReplEx, bExchanged, bNeedRepartition;
     gmx_bool                bTemp, bPres, bTrotter;
@@ -263,7 +262,8 @@ void gmx::Integrator::do_md()
                   enerd);
 
     /* Kinetic energy data */
-    snew(ekind, 1);
+    std::unique_ptr<gmx_ekindata_t> eKinData = compat::make_unique<gmx_ekindata_t>();
+    gmx_ekindata_t                 *ekind    = eKinData.get();
     init_ekindata(fplog, top_global, &(ir->opts), ekind);
     /* Copy the cos acceleration to the groups struct */
     ekind->cosacc.cos_accel = ir->cos_accel;
index dd40607099f1eabaacd0b42b29102bb603763ccb..50efa0c440411e7f5035e4ea7e3b295cdf6c1f32 100644 (file)
@@ -157,7 +157,6 @@ void gmx::Integrator::do_mimic()
     gmx_global_stat_t        gstat;
     t_graph                 *graph = nullptr;
     gmx_groups_t            *groups;
-    gmx_ekindata_t          *ekind;
     gmx_shellfc_t           *shellfc;
 
     double                   cycles;
@@ -240,7 +239,8 @@ void gmx::Integrator::do_mimic()
                   enerd);
 
     /* Kinetic energy data */
-    snew(ekind, 1);
+    std::unique_ptr<gmx_ekindata_t> eKinData = compat::make_unique<gmx_ekindata_t>();
+    gmx_ekindata_t                 *ekind    = eKinData.get();
     init_ekindata(fplog, top_global, &(ir->opts), ekind);
     /* Copy the cos acceleration to the groups struct */
     ekind->cosacc.cos_accel = ir->cos_accel;
index ae2e3fd2ecf35b4fa912c037d42721d62efb3c81..a1af5fefefb2b92d0cc79b13d7c78bef25edcf66 100644 (file)
@@ -212,7 +212,6 @@ void gmx::Integrator::do_rerun()
     gmx_global_stat_t       gstat;
     t_graph                *graph = nullptr;
     gmx_groups_t           *groups;
-    gmx_ekindata_t         *ekind;
     gmx_shellfc_t          *shellfc;
 
     double                  cycles;
@@ -306,7 +305,8 @@ void gmx::Integrator::do_rerun()
                   enerd);
 
     /* Kinetic energy data */
-    snew(ekind, 1);
+    std::unique_ptr<gmx_ekindata_t> eKinData = compat::make_unique<gmx_ekindata_t>();
+    gmx_ekindata_t                 *ekind    = eKinData.get();
     init_ekindata(fplog, top_global, &(ir->opts), ekind);
     /* Copy the cos acceleration to the groups struct */
     ekind->cosacc.cos_accel = ir->cos_accel;
diff --git a/src/gromacs/mdtypes/group.cpp b/src/gromacs/mdtypes/group.cpp
new file mode 100644 (file)
index 0000000..b0c15ca
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Implements classes from group.h.
+ *
+ * \author Kevin Boyd <kevin.boyd@uconn.edu>
+ * \ingroup module_mdtypes
+ */
+#include "gmxpre.h"
+
+#include "group.h"
+
+gmx_ekindata_t::~gmx_ekindata_t()
+{
+    for (int i = 0; i < nthreads; i++)
+    {
+        sfree(ekin_work_alloc[i]);
+    }
+    sfree(ekin_work_alloc);
+    sfree(ekin_work);
+    sfree(dekindl_work);
+}
index fe27a71fa77c24658e4165dc4f2a615be06d19c6..0dcd497ac16931855a7d7f5981af083205868acb 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2018, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,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.
 #ifndef GMX_MDTYPES_GROUP_H
 #define GMX_MDTYPES_GROUP_H
 
+#include <vector>
+
 #include "gromacs/math/vectypes.h"
 #include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/real.h"
+#include "gromacs/utility/smalloc.h"
 
-typedef struct {
-    real    Th;             /* Temperature at half step        */
-    real    T;              /* Temperature at full step        */
-    tensor  ekinh;          /* Kinetic energy at half step     */
-    tensor  ekinh_old;      /* Kinetic energy at old half step */
-    tensor  ekinf;          /* Kinetic energy at full step     */
-    real    lambda;         /* Berendsen coupling lambda       */
-    double  ekinscalef_nhc; /* Scaling factor for NHC- full step */
-    double  ekinscaleh_nhc; /* Scaling factor for NHC- half step */
-    double  vscale_nhc;     /* Scaling factor for NHC- velocity */
-} t_grp_tcstat;
+struct t_grp_tcstat{
+    real    Th             = 0;     /* Temperature at half step        */
+    real    T              = 0;     /* Temperature at full step        */
+    tensor  ekinh          = {{0}}; /* Kinetic energy at half step     */
+    tensor  ekinh_old      = {{0}}; /* Kinetic energy at old half step */
+    tensor  ekinf          = {{0}}; /* Kinetic energy at full step     */
+    real    lambda         = 0;     /* Berendsen coupling lambda       */
+    double  ekinscalef_nhc = 0;     /* Scaling factor for NHC- full step */
+    double  ekinscaleh_nhc = 0;     /* Scaling factor for NHC- half step */
+    double  vscale_nhc     = 0;     /* Scaling factor for NHC- velocity */
+};
 
-typedef struct {
+struct t_grp_acc {
     int     nat;    /* Number of atoms in this group           */
     rvec    u;      /* Mean velocities of home particles        */
     rvec    uold;   /* Previous mean velocities of home particles   */
     double  mA;     /* Mass for topology A                             */
     double  mB;     /* Mass for topology B                             */
-} t_grp_acc;
+};
 
-typedef struct {
+struct t_cos_acc{
     real    cos_accel;  /* The acceleration for the cosine profile      */
     real    mvcos;      /* The cos momenta of home particles            */
     real    vcos;       /* The velocity of the cosine profile           */
-} t_cos_acc;
+};
+
+struct gmx_ekindata_t {
+    gmx_bool                  bNEMD;
+    int                       ngtc;            /* The number of T-coupling groups      */
+    int                       nthreads;        /* For size of ekin_work */
+    std::vector<t_grp_tcstat> tcstat;          /* T-coupling data            */
+    tensor                  **ekin_work_alloc; /* Allocated locations for *_work members */
+    tensor                  **ekin_work;       /* Work arrays for tcstat per thread    */
+    real                    **dekindl_work;    /* Work location for dekindl per thread */
+    int                       ngacc;           /* The number of acceleration groups    */
+    std::vector<t_grp_acc>    grpstat;         /* Acceleration data                    */
+    tensor                    ekin;            /* overall kinetic energy               */
+    tensor                    ekinh;           /* overall 1/2 step kinetic energy      */
+    real                      dekindl;         /* dEkin/dlambda at half step           */
+    real                      dekindl_old;     /* dEkin/dlambda at old half step       */
+    t_cos_acc                 cosacc;          /* Cosine acceleration data             */
 
-typedef struct gmx_ekindata_t {
-    gmx_bool         bNEMD;
-    int              ngtc;            /* The number of T-coupling groups      */
-    t_grp_tcstat    *tcstat;          /* T-coupling data            */
-    tensor         **ekin_work_alloc; /* Allocated locations for *_work members */
-    tensor         **ekin_work;       /* Work arrays for tcstat per thread    */
-    real           **dekindl_work;    /* Work location for dekindl per thread */
-    int              ngacc;           /* The number of acceleration groups    */
-    t_grp_acc       *grpstat;         /* Acceleration data                     */
-    tensor           ekin;            /* overall kinetic energy               */
-    tensor           ekinh;           /* overall 1/2 step kinetic energy      */
-    real             dekindl;         /* dEkin/dlambda at half step           */
-    real             dekindl_old;     /* dEkin/dlambda at old half step       */
-    t_cos_acc        cosacc;          /* Cosine acceleration data             */
-} gmx_ekindata_t;
+    ~gmx_ekindata_t();
+};
 
 #define GID(igid, jgid, gnr) (((igid) < (jgid)) ? ((igid)*(gnr)+(jgid)) : ((jgid)*(gnr)+(igid)))