static int enter_params(gmx_ffparams_t *ffparams, t_functype ftype, real forceparams[MAXFORCEPARAM], int comb, real reppow, int start, gmx_bool bAppend) { t_iparams newparam; int type; int rc; if ( (rc = assign_param(ftype, &newparam, forceparams, comb, reppow)) < 0) { /* -1 means this interaction is all-zero and should not be added */ return rc; } if (!bAppend) { for (type = start; (type < ffparams->ntypes); type++) { if (ffparams->functype[type] == ftype) { if (F_GB13 == ftype) { /* Occasionally, the way the 1-3 reference distance is * computed can lead to non-binary-identical results, but I * don't know why. */ if ((gmx_within_tol(newparam.gb.sar, ffparams->iparams[type].gb.sar, 1e-6)) && (gmx_within_tol(newparam.gb.st, ffparams->iparams[type].gb.st, 1e-6)) && (gmx_within_tol(newparam.gb.pi, ffparams->iparams[type].gb.pi, 1e-6)) && (gmx_within_tol(newparam.gb.gbr, ffparams->iparams[type].gb.gbr, 1e-6)) && (gmx_within_tol(newparam.gb.bmlt, ffparams->iparams[type].gb.bmlt, 1e-6))) { return type; } } else { if (memcmp(&newparam, &ffparams->iparams[type], (size_t)sizeof(newparam)) == 0) { return type; } } } } } else { type = ffparams->ntypes; } if (debug) { fprintf(debug, "copying newparam to ffparams->iparams[%d] (ntypes=%d)\n", type, ffparams->ntypes); } memcpy(&ffparams->iparams[type], &newparam, (size_t)sizeof(newparam)); ffparams->ntypes++; ffparams->functype[type] = ftype; return type; }
void recursive_assign_test_params(uint32_t *max, uint32_t depth, test_options **tops, uint32_t max_depth) { for (uint32_t i = 0; i < max[depth]; i++) { assign_param(i, depth, *tops); if (depth == max_depth - 1) { memcpy((*tops) + 1, *tops, sizeof(test_options)); (*tops)++; // cout << "another " << gen_tests++ << ", total: " << m_nTests << // endl; } else { recursive_assign_test_params(max, depth + 1, tops, max_depth); } } }
static int enter_params(gmx_ffparams_t *ffparams, t_functype ftype, real forceparams[MAXFORCEPARAM], int comb, real reppow, int start, bool bAppend) { t_iparams newparam; int type; int rc; if ( (rc = assign_param(ftype, &newparam, forceparams, comb, reppow)) < 0) { /* -1 means this interaction is all-zero and should not be added */ return rc; } if (!bAppend) { for (type = start; (type < ffparams->numTypes()); type++) { if (ffparams->functype[type] == ftype) { if (memcmp(&newparam, &ffparams->iparams[type], static_cast<size_t>(sizeof(newparam))) == 0) { return type; } } } } else { type = ffparams->numTypes(); } ffparams->iparams.push_back(newparam); ffparams->functype.push_back(ftype); GMX_ASSERT(ffparams->iparams.size() == ffparams->functype.size(), "sizes should match"); return type; }