static void generate_LJCpairsNB(MoleculeInformation* mol, int nb_funct, InteractionsOfType* nbp, warninp* wi)
{
- int n, ntype;
- t_atom* atom;
- t_blocka* excl;
- bool bExcl;
+ int n, ntype;
+ t_atom* atom;
n = mol->atoms.nr;
atom = mol->atoms.atom;
"Number of pairs of generated non-bonded parameters should be a perfect square");
/* Add a pair interaction for all non-excluded atom pairs */
- excl = &mol->excls;
+ const auto& excls = mol->excls;
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
- bExcl = FALSE;
- for (int k = excl->index[i]; k < excl->index[i + 1]; k++)
+ bool pairIsExcluded = false;
+ for (const int atomK : excls[i])
{
- if (excl->a[k] == j)
+ if (atomK == j)
{
- bExcl = TRUE;
+ pairIsExcluded = true;
}
}
- if (!bExcl)
+ if (!pairIsExcluded)
{
if (nb_funct != F_LJ)
{
}
}
-static void set_excl_all(t_blocka* excl)
+static void set_excl_all(gmx::ListOfLists<int>* excl)
{
- int nat, i, j, k;
-
/* Get rid of the current exclusions and exclude all atom pairs */
- nat = excl->nr;
- excl->nra = nat * nat;
- srenew(excl->a, excl->nra);
- k = 0;
- for (i = 0; i < nat; i++)
+ const int numAtoms = excl->ssize();
+ std::vector<int> exclusionsForAtom(numAtoms);
+ for (int i = 0; i < numAtoms; i++)
{
- excl->index[i] = k;
- for (j = 0; j < nat; j++)
- {
- excl->a[k++] = j;
- }
+ exclusionsForAtom[i] = i;
+ }
+ excl->clear();
+ for (int i = 0; i < numAtoms; i++)
+ {
+ excl->pushBack(exclusionsForAtom);
}
- excl->index[nat] = k;
}
static void decouple_atoms(t_atoms* atoms,