#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.h"
-void generate_nbparams(int comb, int ftype, t_params *plist, gpp_atomtype *atype,
+void generate_nbparams(int comb, int ftype, InteractionTypeParameters *plist, gpp_atomtype *atype,
warninp *wi)
{
int i, j, k = -1, nf;
}
/*! \brief Used to temporarily store the explicit non-bonded parameter
- * combinations, which will be copied to t_params. */
+ * combinations, which will be copied to InteractionTypeParameters. */
struct t_nbparam
{
//! Has this combination been set.
}
}
-int copy_nbparams(t_nbparam **param, int ftype, t_params *plist, int nr)
+int copy_nbparams(t_nbparam **param, int ftype, InteractionTypeParameters *plist, int nr)
{
int i, j, f;
int nrfp, ncopy;
std::equal(a.begin(), a.end(), b.rbegin()));
}
-static void push_bondtype(t_params * bt,
- const t_param * b,
- int nral,
- int ftype,
- bool bAllowRepeat,
- const char * line,
- warninp *wi)
+static void push_bondtype(InteractionTypeParameters * bt,
+ const t_param * b,
+ int nral,
+ int ftype,
+ bool bAllowRepeat,
+ const char * line,
+ warninp *wi)
{
int nr = bt->nr;
int nrfp = NRFP(ftype);
}
}
-void push_bt(Directive d, t_params bt[], int nral,
+void push_bt(Directive d, gmx::ArrayRef<InteractionTypeParameters> bt, int nral,
gpp_atomtype *at,
gpp_bond_atomtype *bat, char *line,
warninp *wi)
}
-void push_dihedraltype(Directive d, t_params bt[],
+void push_dihedraltype(Directive d, gmx::ArrayRef<InteractionTypeParameters> bt,
gpp_bond_atomtype *bat, char *line,
warninp *wi)
{
}
void
-push_cmaptype(Directive d, t_params bt[], int nral, gpp_atomtype *at,
+push_cmaptype(Directive d, gmx::ArrayRef<InteractionTypeParameters> bt, int nral, gpp_atomtype *at,
gpp_bond_atomtype *bat, char *line,
warninp *wi)
{
nrfpB = strtol(alc[7], nullptr, 10)*strtol(alc[7], nullptr, 10);
nrfp = nrfpA+nrfpB;
- /* Allocate memory for the CMAP grid */
- bt[F_CMAP].ncmap += nrfp;
- srenew(bt[F_CMAP].cmap, bt[F_CMAP].ncmap);
-
/* Read in CMAP parameters */
sl = 0;
for (i = 0; i < ncmap; i++)
}
nn = sscanf(line+start+sl, " %s ", s);
sl += strlen(s);
- bt[F_CMAP].cmap[i+(bt[F_CMAP].ncmap)-nrfp] = strtod(s, nullptr);
+ bt[F_CMAP].cmap.emplace_back(strtod(s, nullptr));
if (nn == 1)
{
{
for (i = 0; i < ncmap; i++)
{
- bt[F_CMAP].cmap[i+ncmap] = bt[F_CMAP].cmap[i];
+ bt[F_CMAP].cmap.emplace_back(bt[F_CMAP].cmap[i]);
}
}
else
/* Set grid spacing and the number of grids (we assume these numbers to be the same for all grids
* so we can safely assign them each time
*/
- bt[F_CMAP].grid_spacing = nxcmap; /* Or nycmap, they need to be equal */
- bt[F_CMAP].nc = bt[F_CMAP].nc + 1; /* Since we are incrementing here, we need to subtract later, see (*****) */
- nct = (nral+1) * bt[F_CMAP].nc;
-
- /* Allocate memory for the cmap_types information */
- srenew(bt[F_CMAP].cmap_types, nct);
+ bt[F_CMAP].cmakeGridSpacing = nxcmap; /* Or nycmap, they need to be equal */
+ bt[F_CMAP].cmapAngles++; /* Since we are incrementing here, we need to subtract later, see (*****) */
+ nct = (nral+1) * bt[F_CMAP].cmapAngles;
for (i = 0; (i < nral); i++)
{
}
/* Assign a grid number to each cmap_type */
- bt[F_CMAP].cmap_types[bt[F_CMAP].nct++] = get_bond_atomtype_type(alc[i], bat);
+ bt[F_CMAP].cmapAtomTypes.emplace_back(get_bond_atomtype_type(alc[i], bat));
}
/* Assign a type number to this cmap */
- bt[F_CMAP].cmap_types[bt[F_CMAP].nct++] = bt[F_CMAP].nc-1; /* Since we inremented earlier, we need to subtrac here, to get the types right (****) */
+ bt[F_CMAP].cmapAtomTypes.emplace_back(bt[F_CMAP].cmapAngles-1); /* Since we inremented earlier, we need to subtrac here, to get the types right (****) */
/* Check for the correct number of atoms (again) */
- if (bt[F_CMAP].nct != nct)
+ if (bt[F_CMAP].nct() != nct)
{
- auto message = gmx::formatString("Incorrect number of atom types (%d) in cmap type %d\n", nct, bt[F_CMAP].nc);
+ auto message = gmx::formatString("Incorrect number of atom types (%d) in cmap type %d\n", nct, bt[F_CMAP].cmapAngles);
warning_error(wi, message);
}
mol->back().excl_set = false;
}
-static bool default_nb_params(int ftype, t_params bt[], t_atoms *at,
+static bool default_nb_params(int ftype, gmx::ArrayRef<InteractionTypeParameters> bt, t_atoms *at,
t_param *p, int c_start, bool bB, bool bGenPairs)
{
int i, j, ti, tj, ntype;
return bFound;
}
-static bool default_cmap_params(t_params bondtype[],
+static bool default_cmap_params(gmx::ArrayRef<InteractionTypeParameters> bondtype,
t_atoms *at, gpp_atomtype *atype,
t_param *p, bool bB,
int *cmap_type, int *nparam_def,
ct = 0;
/* Match the current cmap angle against the list of cmap_types */
- for (i = 0; i < bondtype[F_CMAP].nct && !bFound; i += 6)
+ for (i = 0; i < bondtype[F_CMAP].nct() && !bFound; i += 6)
{
if (bB)
{
else
{
if (
- (get_atomtype_batype(at->atom[p->a[0]].type, atype) == bondtype[F_CMAP].cmap_types[i]) &&
- (get_atomtype_batype(at->atom[p->a[1]].type, atype) == bondtype[F_CMAP].cmap_types[i+1]) &&
- (get_atomtype_batype(at->atom[p->a[2]].type, atype) == bondtype[F_CMAP].cmap_types[i+2]) &&
- (get_atomtype_batype(at->atom[p->a[3]].type, atype) == bondtype[F_CMAP].cmap_types[i+3]) &&
- (get_atomtype_batype(at->atom[p->a[4]].type, atype) == bondtype[F_CMAP].cmap_types[i+4]))
+ (get_atomtype_batype(at->atom[p->a[0]].type, atype) == bondtype[F_CMAP].cmapAtomTypes[i]) &&
+ (get_atomtype_batype(at->atom[p->a[1]].type, atype) == bondtype[F_CMAP].cmapAtomTypes[i+1]) &&
+ (get_atomtype_batype(at->atom[p->a[2]].type, atype) == bondtype[F_CMAP].cmapAtomTypes[i+2]) &&
+ (get_atomtype_batype(at->atom[p->a[3]].type, atype) == bondtype[F_CMAP].cmapAtomTypes[i+3]) &&
+ (get_atomtype_batype(at->atom[p->a[4]].type, atype) == bondtype[F_CMAP].cmapAtomTypes[i+4]))
{
/* Found cmap torsion */
bFound = TRUE;
- ct = bondtype[F_CMAP].cmap_types[i+5];
+ ct = bondtype[F_CMAP].cmapAtomTypes[i+5];
nparam_found = 1;
}
}
}
}
-static bool default_params(int ftype, t_params bt[],
- t_atoms *at, gpp_atomtype *atype,
- t_param *p, bool bB,
- t_param **param_def,
- int *nparam_def)
+static bool defaultInteractionTypeParameters(int ftype, gmx::ArrayRef<InteractionTypeParameters> bt,
+ t_atoms *at, gpp_atomtype *atype,
+ t_param *p, bool bB,
+ t_param **param_def,
+ int *nparam_def)
{
int nparam_found;
bool bFound, bSame;
-void push_bond(Directive d, t_params bondtype[], t_params bond[],
+void push_bond(Directive d, gmx::ArrayRef<InteractionTypeParameters> bondtype,
+ gmx::ArrayRef<InteractionTypeParameters> bond,
t_atoms *at, gpp_atomtype *atype, char *line,
bool bBonded, bool bGenPairs, real fudgeQQ,
bool bZero, bool *bWarn_copy_A_B,
if (bBonded)
{
- bFoundA = default_params(ftype, bondtype, at, atype, ¶m, FALSE, ¶m_defA, &nparam_defA);
+ bFoundA = defaultInteractionTypeParameters(ftype, bondtype, at, atype, ¶m, FALSE, ¶m_defA, &nparam_defA);
if (bFoundA)
{
/* Copy the A-state and B-state default parameters. */
param.c[j] = param_defA->c[j];
}
}
- bFoundB = default_params(ftype, bondtype, at, atype, ¶m, TRUE, ¶m_defB, &nparam_defB);
+ bFoundB = defaultInteractionTypeParameters(ftype, bondtype, at, atype, ¶m, TRUE, ¶m_defB, &nparam_defB);
if (bFoundB)
{
/* Copy only the B-state default parameters */
}
}
-void push_cmap(Directive d, t_params bondtype[], t_params bond[],
+void push_cmap(Directive d, gmx::ArrayRef<InteractionTypeParameters> bondtype,
+ gmx::ArrayRef<InteractionTypeParameters> bond,
t_atoms *at, gpp_atomtype *atype, char *line,
warninp *wi)
{
-void push_vsitesn(Directive d, t_params bond[],
+void push_vsitesn(Directive d, gmx::ArrayRef<InteractionTypeParameters> bond,
t_atoms *at, char *line,
warninp *wi)
{
return nr;
}
-static void convert_pairs_to_pairsQ(t_params *plist,
+static void convert_pairs_to_pairsQ(gmx::ArrayRef<InteractionTypeParameters> plist,
real fudgeQQ, t_atoms *atoms)
{
t_param *paramp1, *paramp2, *paramnew;
plist[F_LJ14].param = nullptr;
}
-static void generate_LJCpairsNB(MoleculeInformation *mol, int nb_funct, t_params *nbp, warninp *wi)
+static void generate_LJCpairsNB(MoleculeInformation *mol, int nb_funct, InteractionTypeParameters *nbp, warninp *wi)
{
int n, ntype, i, j, k;
t_atom *atom;
void convert_moltype_couple(MoleculeInformation *mol, int atomtype_decouple, real fudgeQQ,
int couple_lam0, int couple_lam1,
- bool bCoupleIntra, int nb_funct, t_params *nbp,
+ bool bCoupleIntra, int nb_funct, InteractionTypeParameters *nbp,
warninp *wi)
{
convert_pairs_to_pairsQ(mol->plist, fudgeQQ, &mol->atoms);