2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
37 /* This file is completely threadsafe - keep it that way! */
50 #include "gromacs/fileio/confio.h"
51 #include "gromacs/gmxpreprocess/gpp_nextnb.h"
52 #include "gromacs/gmxpreprocess/notset.h"
53 #include "gromacs/gmxpreprocess/pgutil.h"
54 #include "gromacs/gmxpreprocess/resall.h"
55 #include "gromacs/gmxpreprocess/topio.h"
56 #include "gromacs/gmxpreprocess/toputil.h"
57 #include "gromacs/math/vec.h"
58 #include "gromacs/topology/ifunc.h"
59 #include "gromacs/utility/cstringutil.h"
60 #include "gromacs/utility/fatalerror.h"
61 #include "gromacs/utility/smalloc.h"
63 #define DIHEDRAL_WAS_SET_IN_RTP 0
64 static bool was_dihedral_set_in_rtp(const t_param *dih)
66 return dih->c[MAXFORCEPARAM-1] == DIHEDRAL_WAS_SET_IN_RTP;
69 typedef bool (*peq)(t_param *p1, t_param *p2);
71 static int acomp(const void *a1, const void *a2)
73 const t_param *p1, *p2;
76 p1 = static_cast<const t_param *>(a1);
77 p2 = static_cast<const t_param *>(a2);
78 if ((ac = (p1->aj()-p2->aj())) != 0)
82 else if ((ac = (p1->ai()-p2->ai())) != 0)
88 return (p1->ak()-p2->ak());
92 static int pcomp(const void *a1, const void *a2)
94 const t_param *p1, *p2;
97 p1 = static_cast<const t_param *>(a1);
98 p2 = static_cast<const t_param *>(a2);
99 if ((pc = (p1->ai()-p2->ai())) != 0)
105 return (p1->aj()-p2->aj());
109 static int dcomp(const void *d1, const void *d2)
111 const t_param *p1, *p2;
114 p1 = static_cast<const t_param *>(d1);
115 p2 = static_cast<const t_param *>(d2);
116 /* First sort by J & K (the two central) atoms */
117 if ((dc = (p1->aj()-p2->aj())) != 0)
121 else if ((dc = (p1->ak()-p2->ak())) != 0)
125 /* Then make sure to put rtp dihedrals before generated ones */
126 else if (was_dihedral_set_in_rtp(p1) &&
127 !was_dihedral_set_in_rtp(p2))
131 else if (!was_dihedral_set_in_rtp(p1) &&
132 was_dihedral_set_in_rtp(p2))
136 /* Then sort by I and J (two outer) atoms */
137 else if ((dc = (p1->ai()-p2->ai())) != 0)
141 else if ((dc = (p1->al()-p2->al())) != 0)
147 // AMBER force fields with type 9 dihedrals can reach here, where we sort on
148 // the contents of the string that names the macro for the parameters.
149 return strcmp(p1->s, p2->s);
154 static bool is_dihedral_on_same_bond(t_param *p1, t_param *p2)
156 if (((p1->aj() == p2->aj()) && (p1->ak() == p2->ak())) ||
157 ((p1->aj() == p2->ak()) && (p1->ak() == p2->aj())))
168 static bool preq(t_param *p1, t_param *p2)
170 if ((p1->ai() == p2->ai()) && (p1->aj() == p2->aj()))
180 static void rm2par(t_param p[], int *np, peq eq)
193 for (i = 1; (i < (*np)); i++)
195 if (!eq(&p[i], &p[i-1]))
200 /* Index now holds pointers to all the non-equal params,
201 * this only works when p is sorted of course
203 for (i = 0; (i < nind); i++)
205 for (j = 0; (j < MAXATOMLIST); j++)
207 p[i].a[j] = p[index[i]].a[j];
209 for (j = 0; (j < MAXFORCEPARAM); j++)
211 p[i].c[j] = p[index[i]].c[j];
213 if (p[index[i]].a[0] == p[index[i]].a[1])
218 "Something VERY strange is going on in rm2par (gen_ad.c)\n"
219 "a[0] %d a[1] %d a[2] %d a[3] %d\n",
220 p[i].a[0], p[i].a[1], p[i].a[2], p[i].a[3]);
224 else if (index[i] > i)
226 /* Copy the string only if it comes from somewhere else
227 * otherwise we will end up copying a random (newly freed) pointer.
228 * Since the index is sorted we only have to test for index[i] > i.
230 strcpy(p[i].s, p[index[i]].s);
238 static void cppar(t_param p[], int np, t_params plist[], int ftype)
240 int i, j, nral, nrfp;
249 for (i = 0; (i < np); i++)
251 for (j = 0; (j < nral); j++)
253 ps->param[ps->nr].a[j] = p[i].a[j];
255 for (j = 0; (j < nrfp); j++)
257 ps->param[ps->nr].c[j] = p[i].c[j];
259 for (j = 0; (j < MAXSLEN); j++)
261 ps->param[ps->nr].s[j] = p[i].s[j];
267 static void cpparam(t_param *dest, t_param *src)
271 for (j = 0; (j < MAXATOMLIST); j++)
273 dest->a[j] = src->a[j];
275 for (j = 0; (j < MAXFORCEPARAM); j++)
277 dest->c[j] = src->c[j];
279 for (j = 0; (j < MAXSLEN); j++)
281 dest->s[j] = src->s[j];
285 static void set_p(t_param *p, const int ai[4], const real *c, char *s)
289 for (j = 0; (j < 4); j++)
293 for (j = 0; (j < MAXFORCEPARAM); j++)
308 static int int_comp(const void *a, const void *b)
310 return (*(int *)a) - (*(int *)b);
313 static int idcomp(const void *a, const void *b)
315 const t_param *pa, *pb;
318 pa = static_cast<const t_param *>(a);
319 pb = static_cast<const t_param *>(b);
320 if ((d = (pa->a[0]-pb->a[0])) != 0)
324 else if ((d = (pa->a[3]-pb->a[3])) != 0)
328 else if ((d = (pa->a[1]-pb->a[1])) != 0)
334 return (int) (pa->a[2]-pb->a[2]);
338 static void sort_id(int nr, t_param ps[])
342 /* First swap order of atoms around if necessary */
343 for (i = 0; (i < nr); i++)
345 if (ps[i].a[3] < ps[i].a[0])
347 tmp = ps[i].a[3]; ps[i].a[3] = ps[i].a[0]; ps[i].a[0] = tmp;
348 tmp = ps[i].a[2]; ps[i].a[2] = ps[i].a[1]; ps[i].a[1] = tmp;
354 qsort(ps, nr, (size_t)sizeof(ps[0]), idcomp);
358 static int n_hydro(const int a[], char ***atomname)
363 for (i = 0; (i < 4); i += 3)
365 aname = *atomname[a[i]];
366 c0 = toupper(aname[0]);
371 else if (((int)strlen(aname) > 1) && (c0 >= '0') && (c0 <= '9'))
373 c1 = toupper(aname[1]);
383 /* Clean up the dihedrals (both generated and read from the .rtp
385 static void clean_dih(t_param *dih, int *ndih, t_param improper[], int nimproper,
386 t_atoms *atoms, bool bKeepAllGeneratedDihedrals,
387 bool bRemoveDihedralIfWithImproper)
392 /* Construct the list of the indices of the dihedrals
393 * (i.e. generated or read) that might be kept. */
394 snew(index, *ndih+1);
395 if (bKeepAllGeneratedDihedrals)
397 fprintf(stderr, "Keeping all generated dihedrals\n");
399 for (i = 0; i < nind; i++)
408 /* Check if generated dihedral i should be removed. The
409 * dihedrals have been sorted by dcomp() above, so all those
410 * on the same two central atoms are together, with those from
411 * the .rtp file preceding those that were automatically
412 * generated. We remove the latter if the former exist. */
413 for (i = 0; i < *ndih; i++)
415 /* Keep the dihedrals that were defined in the .rtp file,
416 * and the dihedrals that were generated and different
417 * from the last one (whether it was generated or not). */
418 if (was_dihedral_set_in_rtp(&dih[i]) ||
420 !is_dihedral_on_same_bond(&dih[i], &dih[i-1]))
429 for (i = 0; i < nind; i++)
431 bool bWasSetInRTP = was_dihedral_set_in_rtp(&dih[index[i]]);
433 if (!bWasSetInRTP && bRemoveDihedralIfWithImproper)
435 /* Remove the dihedral if there is an improper on the same
437 for (j = 0; j < nimproper && bKeep; j++)
439 bKeep = !is_dihedral_on_same_bond(&dih[index[i]], &improper[j]);
445 /* If we don't want all dihedrals, we want to select the
446 * ones with the fewest hydrogens. Note that any generated
447 * dihedrals on the same bond as an .rtp dihedral may have
448 * been already pruned above in the construction of
449 * index[]. However, their parameters are still present,
450 * and l is looping over this dihedral and all of its
451 * pruned siblings. */
452 int bestl = index[i];
453 if (!bKeepAllGeneratedDihedrals && !bWasSetInRTP)
455 /* Minimum number of hydrogens for i and l atoms */
459 is_dihedral_on_same_bond(&dih[index[i]], &dih[l]));
462 int nh = n_hydro(dih[l].a, atoms->atomname);
476 cpparam(&dih[k], &dih[bestl]);
482 for (i = k; i < *ndih; i++)
484 strcpy(dih[i].s, "");
491 static int get_impropers(t_atoms *atoms, t_hackblock hb[], t_param **improper,
494 t_rbondeds *impropers;
495 int nimproper, i, j, k, start, ninc, nalloc;
501 snew(*improper, nalloc);
503 /* Add all the impropers from the residue database to the list. */
508 for (i = 0; (i < atoms->nres); i++)
510 impropers = &hb[i].rb[ebtsIDIHS];
511 for (j = 0; (j < impropers->nb); j++)
514 for (k = 0; (k < 4) && !bStop; k++)
516 ai[k] = search_atom(impropers->b[j].a[k], start,
518 "improper", bAllowMissing);
526 if (nimproper == nalloc)
529 srenew(*improper, nalloc);
532 set_p(&((*improper)[nimproper]), ai, nullptr, impropers->b[j].s);
536 while ((start < atoms->nr) && (atoms->atom[start].resind == i))
546 static int nb_dist(t_nextnb *nnb, int ai, int aj)
558 nrexcl = nnb->nrexcl[ai];
559 for (nre = 1; (nre < nnb->nrex); nre++)
562 for (nrx = 0; (nrx < nrexcl[nre]); nrx++)
564 if ((aj == a[nrx]) && (NRE == -1))
573 static bool is_hydro(t_atoms *atoms, int ai)
575 return ((*(atoms->atomname[ai]))[0] == 'H');
578 static void get_atomnames_min(int n, char **anm,
579 int resind, t_atoms *atoms, const int *a)
583 /* Assume ascending residue numbering */
584 for (m = 0; m < n; m++)
586 if (atoms->atom[a[m]].resind < resind)
590 else if (atoms->atom[a[m]].resind > resind)
598 strcat(anm[m], *(atoms->atomname[a[m]]));
602 static void gen_excls(t_atoms *atoms, t_excls *excls, t_hackblock hb[],
606 int a, astart, i1, i2, itmp;
612 for (a = 0; a < atoms->nr; a++)
614 r = atoms->atom[a].resind;
615 if (a == atoms->nr-1 || atoms->atom[a+1].resind != r)
617 hbexcl = &hb[r].rb[ebtsEXCLS];
619 for (e = 0; e < hbexcl->nb; e++)
621 anm = hbexcl->b[e].a[0];
622 i1 = search_atom(anm, astart, atoms,
623 "exclusion", bAllowMissing);
624 anm = hbexcl->b[e].a[1];
625 i2 = search_atom(anm, astart, atoms,
626 "exclusion", bAllowMissing);
627 if (i1 != -1 && i2 != -1)
635 srenew(excls[i1].e, excls[i1].nr+1);
636 excls[i1].e[excls[i1].nr] = i2;
645 for (a = 0; a < atoms->nr; a++)
649 qsort(excls[a].e, excls[a].nr, (size_t)sizeof(int), int_comp);
654 static void remove_excl(t_excls *excls, int remove)
658 for (i = remove+1; i < excls->nr; i++)
660 excls->e[i-1] = excls->e[i];
666 void clean_excls(t_nextnb *nnb, int nrexcl, t_excls excls[])
668 int i, j, j1, k, k1, l, l1, e;
673 /* extract all i-j-k-l neighbours from nnb struct */
674 for (i = 0; (i < nnb->nr); i++)
676 /* For all particles */
679 for (j = 0; (j < nnb->nrexcl[i][1]); j++)
681 /* For all first neighbours */
682 j1 = nnb->a[i][1][j];
684 for (e = 0; e < excl->nr; e++)
686 if (excl->e[e] == j1)
688 remove_excl(excl, e);
694 for (k = 0; (k < nnb->nrexcl[j1][1]); k++)
696 /* For all first neighbours of j1 */
697 k1 = nnb->a[j1][1][k];
699 for (e = 0; e < excl->nr; e++)
701 if (excl->e[e] == k1)
703 remove_excl(excl, e);
709 for (l = 0; (l < nnb->nrexcl[k1][1]); l++)
711 /* For all first neighbours of k1 */
712 l1 = nnb->a[k1][1][l];
714 for (e = 0; e < excl->nr; e++)
716 if (excl->e[e] == l1)
718 remove_excl(excl, e);
730 void generate_excls(t_nextnb *nnb, int nrexcl, t_excls excls[])
735 for (N = 1; (N < std::min(nrexcl, nnb->nrex)); N++)
737 /* extract all i-j-k-l neighbours from nnb struct */
738 for (i = 0; (i < nnb->nr); i++)
740 /* For all particles */
743 excl->nr += nnb->nrexcl[i][N];
744 srenew(excl->e, excl->nr);
745 for (j = 0; (j < nnb->nrexcl[i][N]); j++)
747 /* For all first neighbours */
748 if (nnb->a[i][N][j] != i)
750 excl->e[n++] = nnb->a[i][N][j];
757 /* Generate pairs, angles and dihedrals from .rtp settings */
758 void gen_pad(t_nextnb *nnb, t_atoms *atoms, t_restp rtp[],
759 t_params plist[], t_excls excls[], t_hackblock hb[],
762 t_param *ang, *dih, *pai, *improper;
763 t_rbondeds *hbang, *hbdih;
766 int res, minres, maxres;
767 int i, j, j1, k, k1, l, l1, m, n, i1, i2;
768 int ninc, maxang, maxdih, maxpai;
769 int nang, ndih, npai, nimproper, nbd;
773 /* These are the angles, dihedrals and pairs that we generate
774 * from the bonds. The ones that are already there from the rtp file
781 maxang = maxdih = maxpai = ninc;
787 for (i = 0; i < 4; i++)
794 gen_excls(atoms, excls, hb, bAllowMissing);
795 /* mark all entries as not matched yet */
796 for (i = 0; i < atoms->nres; i++)
798 for (j = 0; j < ebtsNR; j++)
800 for (k = 0; k < hb[i].rb[j].nb; k++)
802 hb[i].rb[j].b[k].match = FALSE;
808 /* Extract all i-j-k-l neighbours from nnb struct to generate all
809 * angles and dihedrals. */
810 for (i = 0; (i < nnb->nr); i++)
812 /* For all particles */
813 for (j = 0; (j < nnb->nrexcl[i][1]); j++)
815 /* For all first neighbours */
816 j1 = nnb->a[i][1][j];
817 for (k = 0; (k < nnb->nrexcl[j1][1]); k++)
819 /* For all first neighbours of j1 */
820 k1 = nnb->a[j1][1][k];
823 /* Generate every angle only once */
834 ang[nang].c0() = NOTSET;
835 ang[nang].c1() = NOTSET;
836 set_p_string(&(ang[nang]), "");
839 minres = atoms->atom[ang[nang].a[0]].resind;
841 for (m = 1; m < 3; m++)
843 minres = std::min(minres, atoms->atom[ang[nang].a[m]].resind);
844 maxres = std::max(maxres, atoms->atom[ang[nang].a[m]].resind);
846 res = 2*minres-maxres;
849 res += maxres-minres;
850 get_atomnames_min(3, anm, res, atoms, ang[nang].a);
851 hbang = &hb[res].rb[ebtsANGLES];
852 for (l = 0; (l < hbang->nb); l++)
854 if (strcmp(anm[1], hbang->b[l].aj()) == 0)
857 for (m = 0; m < 3; m += 2)
860 ((strcmp(anm[m], hbang->b[l].ai()) == 0) &&
861 (strcmp(anm[2-m], hbang->b[l].ak()) == 0)));
865 set_p_string(&(ang[nang]), hbang->b[l].s);
866 /* Mark that we found a match for this entry */
867 hbang->b[l].match = TRUE;
872 while (res < maxres);
876 /* Generate every dihedral, 1-4 exclusion and 1-4 interaction
880 for (l = 0; (l < nnb->nrexcl[k1][1]); l++)
882 /* For all first neighbours of k1 */
883 l1 = nnb->a[k1][1][l];
884 if ((l1 != i) && (l1 != j1))
895 for (m = 0; m < MAXFORCEPARAM; m++)
897 dih[ndih].c[m] = NOTSET;
899 set_p_string(&(dih[ndih]), "");
903 minres = atoms->atom[dih[ndih].a[0]].resind;
905 for (m = 1; m < 4; m++)
907 minres = std::min(minres, atoms->atom[dih[ndih].a[m]].resind);
908 maxres = std::max(maxres, atoms->atom[dih[ndih].a[m]].resind);
910 res = 2*minres-maxres;
913 res += maxres-minres;
914 get_atomnames_min(4, anm, res, atoms, dih[ndih].a);
915 hbdih = &hb[res].rb[ebtsPDIHS];
916 for (n = 0; (n < hbdih->nb); n++)
919 for (m = 0; m < 2; m++)
922 ((strcmp(anm[3*m], hbdih->b[n].ai()) == 0) &&
923 (strcmp(anm[1+m], hbdih->b[n].aj()) == 0) &&
924 (strcmp(anm[2-m], hbdih->b[n].ak()) == 0) &&
925 (strcmp(anm[3-3*m], hbdih->b[n].al()) == 0)));
929 set_p_string(&dih[ndih], hbdih->b[n].s);
930 /* Mark that we found a match for this entry */
931 hbdih->b[n].match = TRUE;
933 /* Set the last parameter to be able to see
934 if the dihedral was in the rtp list.
936 dih[ndih].c[MAXFORCEPARAM-1] = DIHEDRAL_WAS_SET_IN_RTP;
939 /* Set the next direct in case the rtp contains
940 multiple entries for this dihedral.
951 for (m = 0; m < MAXFORCEPARAM; m++)
953 dih[ndih].c[m] = NOTSET;
958 while (res < maxres);
971 for (m = 0; m < MAXFORCEPARAM; m++)
973 dih[ndih].c[m] = NOTSET;
975 set_p_string(&(dih[ndih]), "");
979 nbd = nb_dist(nnb, i, l1);
982 fprintf(debug, "Distance (%d-%d) = %d\n", i+1, l1+1, nbd);
986 i1 = std::min(i, l1);
987 i2 = std::max(i, l1);
989 for (m = 0; m < excls[i1].nr; m++)
991 bExcl = bExcl || excls[i1].e[m] == i2;
995 if (rtp[0].bGenerateHH14Interactions ||
996 !(is_hydro(atoms, i1) && is_hydro(atoms, i2)))
1001 srenew(pai, maxpai);
1003 pai[npai].ai() = i1;
1004 pai[npai].aj() = i2;
1005 pai[npai].c0() = NOTSET;
1006 pai[npai].c1() = NOTSET;
1007 set_p_string(&(pai[npai]), "");
1022 /* The above approach is great in that we double-check that e.g. an angle
1023 * really corresponds to three atoms connected by bonds, but this is not
1024 * generally true. Go through the angle and dihedral hackblocks to add
1025 * entries that we have not yet marked as matched when going through bonds.
1027 for (i = 0; i < atoms->nres; i++)
1029 /* Add remaining angles from hackblock */
1030 hbang = &hb[i].rb[ebtsANGLES];
1031 for (j = 0; j < hbang->nb; j++)
1033 if (hbang->b[j].match == TRUE)
1035 /* We already used this entry, continue to the next */
1038 /* Hm - entry not used, let's see if we can find all atoms */
1042 srenew(ang, maxang);
1045 for (k = 0; k < 3 && bFound; k++)
1047 p = hbang->b[j].a[k];
1054 else if (p[0] == '+')
1059 ang[nang].a[k] = search_res_atom(p, res, atoms, "angle", TRUE);
1060 bFound = (ang[nang].a[k] != -1);
1062 ang[nang].c0() = NOTSET;
1063 ang[nang].c1() = NOTSET;
1067 set_p_string(&(ang[nang]), hbang->b[j].s);
1068 hbang->b[j].match = TRUE;
1069 /* Incrementing nang means we save this angle */
1074 /* Add remaining dihedrals from hackblock */
1075 hbdih = &hb[i].rb[ebtsPDIHS];
1076 for (j = 0; j < hbdih->nb; j++)
1078 if (hbdih->b[j].match == TRUE)
1080 /* We already used this entry, continue to the next */
1083 /* Hm - entry not used, let's see if we can find all atoms */
1087 srenew(dih, maxdih);
1090 for (k = 0; k < 4 && bFound; k++)
1092 p = hbdih->b[j].a[k];
1099 else if (p[0] == '+')
1104 dih[ndih].a[k] = search_res_atom(p, res, atoms, "dihedral", TRUE);
1105 bFound = (dih[ndih].a[k] != -1);
1107 for (m = 0; m < MAXFORCEPARAM; m++)
1109 dih[ndih].c[m] = NOTSET;
1114 set_p_string(&(dih[ndih]), hbdih->b[j].s);
1115 hbdih->b[j].match = TRUE;
1116 /* Incrementing ndih means we save this dihedral */
1123 /* Sort angles with respect to j-i-k (middle atom first) */
1126 qsort(ang, nang, (size_t)sizeof(ang[0]), acomp);
1129 /* Sort dihedrals with respect to j-k-i-l (middle atoms first) */
1132 qsort(dih, ndih, (size_t)sizeof(dih[0]), dcomp);
1135 /* Sort the pairs */
1138 qsort(pai, npai, (size_t)sizeof(pai[0]), pcomp);
1142 /* Remove doubles, could occur in 6-rings, such as phenyls,
1143 maybe one does not want this when fudgeQQ < 1.
1145 fprintf(stderr, "Before cleaning: %d pairs\n", npai);
1146 rm2par(pai, &npai, preq);
1149 /* Get the impropers from the database */
1150 nimproper = get_impropers(atoms, hb, &improper, bAllowMissing);
1152 /* Sort the impropers */
1153 sort_id(nimproper, improper);
1157 fprintf(stderr, "Before cleaning: %d dihedrals\n", ndih);
1158 clean_dih(dih, &ndih, improper, nimproper, atoms,
1159 rtp[0].bKeepAllGeneratedDihedrals,
1160 rtp[0].bRemoveDihedralIfWithImproper);
1163 /* Now we have unique lists of angles and dihedrals
1164 * Copy them into the destination struct
1166 cppar(ang, nang, plist, F_ANGLES);
1167 cppar(dih, ndih, plist, F_PDIHS);
1168 cppar(improper, nimproper, plist, F_IDIHS);
1169 cppar(pai, npai, plist, F_LJ14);
1171 /* Remove all exclusions which are within nrexcl */
1172 clean_excls(nnb, rtp[0].nrexcl, excls);