Use better data structures in gmx chi
[alexxy/gromacs.git] / src / gromacs / gmxana / dlist.cpp
index 6d9fbacc8e3b85e4e45aedd0f684fa7426783a46..c21f89fb443096f7a2fc61306d48c41c79ec50b1 100644 (file)
@@ -227,18 +227,18 @@ std::vector<t_dlist> mk_dlist(FILE*          log,
             {
                 nc[6]++;
             }
-            dl[nl].index = rt->indexFromResidueName(thisres);
 
             /* Prevent use of unknown residues. If one adds a custom residue to
              * residuetypes.dat but somehow loses it, changes it, or does analysis on
              * another machine, the residue type will be unknown. */
-            if (dl[nl].index == -1)
+            if (!rt->nameIndexedInResidueTypes(thisres))
             {
                 gmx_fatal(FARGS,
                           "Unknown residue %s when searching for residue type.\n"
                           "Maybe you need to add a custom residue in residuetypes.dat.",
                           thisres);
             }
+            dl[nl].residueName = thisres;
 
             sprintf(dl[nl].name, "%s%d", thisres, ires + r0);
             nl++;