Remove mdatoms from expanded
authorejjordan <ejjordan@kth.se>
Wed, 28 Apr 2021 14:16:59 +0000 (16:16 +0200)
committerArtem Zhmurov <zhmurov@gmail.com>
Mon, 3 May 2021 17:17:11 +0000 (17:17 +0000)
Also removed most of the included in expanded.cpp, all of which
were unused.

src/gromacs/mdlib/expanded.cpp
src/gromacs/mdlib/expanded.h
src/gromacs/mdrun/md.cpp

index 2a6837f6bdf790128c1be1e94f4c5b68b6211af5..025cdac6573216f416f977d3c0cf022259a703ff 100644 (file)
 #include <cmath>
 #include <cstdio>
 
-#include <algorithm>
-
-#include "gromacs/domdec/domdec.h"
-#include "gromacs/fileio/confio.h"
-#include "gromacs/fileio/gmxfio.h"
-#include "gromacs/fileio/xtcio.h"
-#include "gromacs/gmxlib/network.h"
-#include "gromacs/gmxlib/nrnb.h"
-#include "gromacs/listed_forces/disre.h"
-#include "gromacs/listed_forces/orires.h"
-#include "gromacs/math/functions.h"
 #include "gromacs/math/units.h"
 #include "gromacs/math/utilities.h"
-#include "gromacs/math/vec.h"
-#include "gromacs/mdlib/calcmu.h"
-#include "gromacs/mdlib/constr.h"
-#include "gromacs/mdlib/force.h"
-#include "gromacs/mdlib/update.h"
 #include "gromacs/mdtypes/enerdata.h"
 #include "gromacs/mdtypes/forcerec.h"
 #include "gromacs/mdtypes/inputrec.h"
 #include "gromacs/mdtypes/md_enums.h"
-#include "gromacs/mdtypes/mdatom.h"
 #include "gromacs/mdtypes/state.h"
 #include "gromacs/random/threefry.h"
 #include "gromacs/random/uniformrealdistribution.h"
-#include "gromacs/timing/wallcycle.h"
 #include "gromacs/utility/enumerationhelpers.h"
 #include "gromacs/utility/fatalerror.h"
-#include "gromacs/utility/gmxmpi.h"
 #include "gromacs/utility/smalloc.h"
 
 #include "expanded_internal.h"
@@ -1348,16 +1329,17 @@ void PrintFreeEnergyInfoToFile(FILE*               outfile,
     }
 }
 
-int ExpandedEnsembleDynamics(FILE*                 log,
-                             t_inputrec*           ir,
-                             const gmx_enerdata_t* enerd,
-                             t_state*              state,
-                             t_extmass*            MassQ,
-                             int                   fep_state,
-                             df_history_t*         dfhist,
-                             int64_t               step,
-                             rvec*                 v,
-                             const t_mdatoms*      mdatoms)
+int ExpandedEnsembleDynamics(FILE*                               log,
+                             t_inputrec*                         ir,
+                             const gmx_enerdata_t*               enerd,
+                             t_state*                            state,
+                             t_extmass*                          MassQ,
+                             int                                 fep_state,
+                             df_history_t*                       dfhist,
+                             int64_t                             step,
+                             rvec*                               v,
+                             const int                           homenr,
+                             gmx::ArrayRef<const unsigned short> cTC)
 /* Note that the state variable is only needed for simulated tempering, not
    Hamiltonian expanded ensemble.  May be able to remove it after integrator refactoring. */
 {
@@ -1504,13 +1486,13 @@ int ExpandedEnsembleDynamics(FILE*                 log,
         /* we don't need to manipulate the ekind information, as it isn't due to be reset until the next step anyway */
 
         nstart = 0;
-        nend   = mdatoms->homenr;
+        nend   = homenr;
         for (n = nstart; n < nend; n++)
         {
             gt = 0;
-            if (mdatoms->cTC)
+            if (!cTC.empty())
             {
-                gt = mdatoms->cTC[n];
+                gt = cTC[n];
             }
             for (d = 0; d < DIM; d++)
             {
index 289d0b9f46572ae1486c535fa058d2eeb8e1ca72..1c227e0ea3ef1496c2666487868fead9470f9595 100644 (file)
@@ -38,7 +38,6 @@
 #include <stdio.h>
 
 #include "gromacs/math/vectypes.h"
-#include "gromacs/utility/basedefinitions.h"
 
 struct df_history_t;
 struct gmx_enerdata_t;
@@ -46,24 +45,30 @@ struct t_expanded;
 struct t_extmass;
 struct t_inputrec;
 struct t_lambda;
-struct t_mdatoms;
 struct t_simtemp;
 class t_state;
 
-void init_npt_masses(const t_inputrec* ir, t_state* state, t_extmass* MassQ, gmx_bool bInit);
+namespace gmx
+{
+template<typename>
+class ArrayRef;
+}
 
-void init_expanded_ensemble(gmx_bool bStateFromCP, const t_inputrec* ir, df_history_t* dfhist);
+void init_npt_masses(const t_inputrec* ir, t_state* state, t_extmass* MassQ, bool bInit);
 
-int ExpandedEnsembleDynamics(FILE*                 log,
-                             t_inputrec*           ir,
-                             const gmx_enerdata_t* enerd,
-                             t_state*              state,
-                             t_extmass*            MassQ,
-                             int                   fep_state,
-                             df_history_t*         dfhist,
-                             int64_t               step,
-                             rvec*                 v,
-                             const t_mdatoms*      mdatoms);
+void init_expanded_ensemble(bool bStateFromCP, const t_inputrec* ir, df_history_t* dfhist);
+
+int ExpandedEnsembleDynamics(FILE*                               log,
+                             t_inputrec*                         ir,
+                             const gmx_enerdata_t*               enerd,
+                             t_state*                            state,
+                             t_extmass*                          MassQ,
+                             int                                 fep_state,
+                             df_history_t*                       dfhist,
+                             int64_t                             step,
+                             rvec*                               v,
+                             int                                 homenr,
+                             gmx::ArrayRef<const unsigned short> cTC);
 
 void PrintFreeEnergyInfoToFile(FILE*               outfile,
                                const t_lambda*     fep,
index ea5494534c9d0739200115c71420be08a644f726..a2226a8c854779f35f8ccdca4059faa0a4c35fcd 100644 (file)
@@ -1296,7 +1296,9 @@ void gmx::LegacySimulator::do_md()
                                               state->dfhist,
                                               step,
                                               state->v.rvec_array(),
-                                              md);
+                                              md->homenr,
+                                              md->cTC ? gmx::arrayRefFromArray(md->cTC, md->nr)
+                                                      : gmx::ArrayRef<const unsigned short>());
             /* history is maintained in state->dfhist, but state_global is what is sent to trajectory and log output */
             if (MASTER(cr))
             {