}
}
-void cp_param(t_param *dest, t_param *src)
+void cp_param(t_param *dest, const t_param *src)
{
int j;
void add_param_to_list(InteractionTypeParameters *list, t_param *b)
{
- int j;
-
/* allocate one position extra */
pr_alloc (1, list);
/* fill the arrays */
- for (j = 0; (j < MAXFORCEPARAM); j++)
+ for (int j = 0; (j < MAXFORCEPARAM); j++)
{
list->param[list->nr].c[j] = b->c[j];
}
- for (j = 0; (j < MAXATOMLIST); j++)
+ for (int j = 0; (j < MAXATOMLIST); j++)
{
list->param[list->nr].a[j] = b->a[j];
}
/* PRINTING STRUCTURES */
-static void print_bt(FILE *out, Directive d, gpp_atomtype *at,
+static void print_bt(FILE *out, Directive d, PreprocessingAtomTypes *at,
int ftype, int fsubtype, gmx::ArrayRef<const InteractionTypeParameters> plist,
bool bFullDih)
{
* all four atoms to determine the type.
*/
const int dihp[2][2] = { { 1, 2 }, { 0, 3 } };
- int i, j, f, nral, nrfp;
- bool bDih = FALSE, bSwapParity;
+ int nral, nrfp;
+ bool bDih = false, bSwapParity;
const InteractionTypeParameters *bt = &(plist[ftype]);
- if (!bt->nr)
+ if (bt->nr == 0)
{
return;
}
- f = 0;
+ int f = 0;
switch (ftype)
{
case F_G96ANGLES:
if (!bDih)
{
fprintf (out, "%3s %4s", "ai", "aj");
- for (j = 2; (j < nral); j++)
+ for (int j = 2; (j < nral); j++)
{
fprintf (out, " %3c%c", 'a', 'i'+j);
}
}
else
{
- for (j = 0; (j < 2); j++)
+ for (int j = 0; (j < 2); j++)
{
fprintf (out, "%3c%c", 'a', 'i'+dihp[f][j]);
}
}
fprintf (out, " funct");
- for (j = 0; (j < nrfp); j++)
+ for (int j = 0; (j < nrfp); j++)
{
fprintf (out, " %12c%1d", 'c', j);
}
fprintf (out, "\n");
/* print bondtypes */
- for (i = 0; (i < bt->nr); i++)
+ for (int i = 0; (i < bt->nr); i++)
{
bSwapParity = (bt->param[i].c0() == NOTSET) && (bt->param[i].c1() == -1);
if (!bDih)
{
- for (j = 0; (j < nral); j++)
+ for (int j = 0; (j < nral); j++)
{
- fprintf (out, "%5s ", get_atomtype_name(bt->param[i].a[j], at));
+ fprintf (out, "%5s ", at->atomNameFromAtomType(bt->param[i].a[j]));
}
}
else
{
- for (j = 0; (j < 2); j++)
+ for (int j = 0; (j < 2); j++)
{
- fprintf (out, "%5s ", get_atomtype_name(bt->param[i].a[dihp[f][j]], at));
+ fprintf (out, "%5s ", at->atomNameFromAtomType(bt->param[i].a[dihp[f][j]]));
}
}
fprintf (out, "%5d ", bSwapParity ? -f-1 : f+1);
}
else
{
- for (j = 0; (j < nrfp && (bt->param[i].c[j] != NOTSET)); j++)
+ for (int j = 0; (j < nrfp && (bt->param[i].c[j] != NOTSET)); j++)
{
fprintf (out, "%13.6e ", bt->param[i].c[j]);
}
return q;
}
-void print_atoms(FILE *out, gpp_atomtype *atype, t_atoms *at, int *cgnr,
+void print_atoms(FILE *out, PreprocessingAtomTypes *atype, t_atoms *at, int *cgnr,
bool bRTPresname)
{
- int i, ri;
- int tpA, tpB;
- const char *as;
- char *tpnmA, *tpnmB;
- double qres, qtot;
+ int i, ri;
+ int tpA, tpB;
+ const char *as;
+ const char *tpnmA, *tpnmB;
+ double qres, qtot;
as = dir2str(Directive::d_atoms);
fprintf(out, "[ %s ]\n", as);
fprintf(out, "\n");
}
tpA = at->atom[i].type;
- if ((tpnmA = get_atomtype_name(tpA, atype)) == nullptr)
+ if ((tpnmA = atype->atomNameFromAtomType(tpA)) == nullptr)
{
gmx_fatal(FARGS, "tpA = %d, i= %d in print_atoms", tpA, i);
}
if (PERTURBED(at->atom[i]))
{
tpB = at->atom[i].typeB;
- if ((tpnmB = get_atomtype_name(tpB, atype)) == nullptr)
+ if ((tpnmB = atype->atomNameFromAtomType(tpB)) == nullptr)
{
gmx_fatal(FARGS, "tpB = %d, i= %d in print_atoms", tpB, i);
}
void print_bondeds(FILE *out, int natoms, Directive d,
int ftype, int fsubtype, gmx::ArrayRef<const InteractionTypeParameters> plist)
{
- t_symtab stab;
- gpp_atomtype *atype;
- t_param *param;
- t_atom *a;
- int i;
+ t_symtab stab;
+ t_param *param;
+ t_atom *a;
- atype = init_atomtype();
+ PreprocessingAtomTypes atype;
snew(a, 1);
snew(param, 1);
open_symtab(&stab);
- for (i = 0; (i < natoms); i++)
+ for (int i = 0; (i < natoms); i++)
{
char buf[12];
sprintf(buf, "%4d", (i+1));
- add_atomtype(atype, &stab, a, buf, param, 0, 0);
+ atype.addType(&stab, *a, buf, param, 0, 0);
}
- print_bt(out, d, atype, ftype, fsubtype, plist, TRUE);
+ print_bt(out, d, &atype, ftype, fsubtype, plist, TRUE);
done_symtab(&stab);
sfree(a);
sfree(param);
- done_atomtype(atype);
}