Enable splitting of listed interaction calculation
[alexxy/gromacs.git] / src / gromacs / mdlib / forcerec.cpp
index 7e7ab9702d55f10dfefa515616443c6feffce856..54446643e3454171724a363db248fc381750dbd8 100644 (file)
@@ -1259,18 +1259,16 @@ void init_forcerec(FILE*                            fp,
         make_wall_tables(fp, ir, tabfn, &mtop->groups, fr);
     }
 
-    /* Initialize the thread working data for bonded interactions */
-    fr->listedForces = std::make_unique<ListedForces>(
-            mtop->groups.groups[SimulationAtomGroupType::EnergyOutput].size(),
-            gmx_omp_nthreads_get(emntBonded), fp);
+    fr->fcdata = std::make_unique<t_fcdata>();
 
     if (!tabbfnm.empty())
     {
-        t_fcdata& fcdata = fr->listedForces->fcdata();
+        t_fcdata& fcdata = *fr->fcdata;
         // Need to catch std::bad_alloc
         // TODO Don't need to catch this here, when merging with master branch
         try
         {
+            //! \todo move these tables into a separate struct and store reference in ListedForces
             fcdata.bondtab  = make_bonded_tables(fp, F_TABBONDS, F_TABBONDSNC, mtop, tabbfnm, "b");
             fcdata.angletab = make_bonded_tables(fp, F_TABANGLES, -1, mtop, tabbfnm, "a");
             fcdata.dihtab   = make_bonded_tables(fp, F_TABDIHS, -1, mtop, tabbfnm, "d");
@@ -1287,6 +1285,11 @@ void init_forcerec(FILE*                            fp,
         }
     }
 
+    /* Initialize the thread working data for bonded interactions */
+    fr->listedForces.emplace_back(
+            mtop->ffparams, mtop->groups.groups[SimulationAtomGroupType::EnergyOutput].size(),
+            gmx_omp_nthreads_get(emntBonded), ListedForces::interactionSelectionAll(), fp);
+
     // QM/MM initialization if requested
     if (ir->bQMMM)
     {