Convert gmx_ffparams_t to C++
[alexxy/gromacs.git] / src / gromacs / topology / mtop_util.cpp
index 45f8ba94d711533dfdde624550e21e6b4a868fb0..c53de35bc2d56fce5786db10eae81009ab0da816 100644 (file)
@@ -871,26 +871,26 @@ static void gen_local_top(const gmx_mtop_t *mtop,
     ffp = &mtop->ffparams;
 
     idef                          = &top->idef;
-    idef->ntypes                  = ffp->ntypes;
+    idef->ntypes                  = ffp->numTypes();
     idef->atnr                    = ffp->atnr;
     /* we can no longer copy the pointers to the mtop members,
      * because they will become invalid as soon as mtop gets free'd.
      * We also need to make sure to only operate on valid data!
      */
 
-    if (ffp->functype)
+    if (!ffp->functype.empty())
     {
-        snew(idef->functype, ffp->ntypes);
-        std::copy(ffp->functype, ffp->functype + ffp->ntypes, idef->functype);
+        snew(idef->functype, ffp->functype.size());
+        std::copy(ffp->functype.data(), ffp->functype.data() + ffp->functype.size(), idef->functype);
     }
     else
     {
         idef->functype = nullptr;
     }
-    if (ffp->iparams)
+    if (!ffp->iparams.empty())
     {
-        snew(idef->iparams, ffp->ntypes);
-        std::copy(ffp->iparams, ffp->iparams + ffp->ntypes, idef->iparams);
+        snew(idef->iparams, ffp->iparams.size());
+        std::copy(ffp->iparams.data(), ffp->iparams.data() + ffp->iparams.size(), idef->iparams);
     }
     else
     {