#include "resall.h"
/* this must correspond to enum in pdb2top.h */
-const char *hh[ehisNR] = { "HISD", "HISE", "HISH", "HIS1" };
+const char* hh[ehisNR] = { "HISD", "HISE", "HISH", "HIS1" };
-static int missing_atoms(const PreprocessResidue *rp, int resind, t_atoms *at, int i0, int i)
+static int missing_atoms(const PreprocessResidue* rp, int resind, t_atoms* at, int i0, int i)
{
int nmiss = 0;
for (int j = 0; j < rp->natom(); j++)
{
- const char *name = *(rp->atomname[j]);
+ const char* name = *(rp->atomname[j]);
bool bFound = false;
for (int k = i0; k < i; k++)
{
if (!bFound)
{
nmiss++;
- fprintf(stderr, "\nWARNING: "
+ fprintf(stderr,
+ "\nWARNING: "
"atom %s is missing in residue %s %d in the pdb file\n",
name, *(at->resinfo[resind].name), at->resinfo[resind].nr);
if (name[0] == 'H' || name[0] == 'h')
{
- fprintf(stderr, " You might need to add atom %s to the hydrogen database of building block %s\n"
+ fprintf(stderr,
+ " You might need to add atom %s to the hydrogen database of "
+ "building block %s\n"
" in the file %s.hdb (see the manual)\n",
name, *(at->resinfo[resind].rtp), rp->filebase.c_str());
}
}
ix = gmx::roundToInt(x);
- return (fabs(x-ix) < tol);
+ return (fabs(x - ix) < tol);
}
-static void
-choose_ff_impl(const char *ffsel,
- char *forcefield, int ff_maxlen,
- char *ffdir, int ffdir_maxlen)
+static void choose_ff_impl(const char* ffsel, char* forcefield, int ff_maxlen, char* ffdir, int ffdir_maxlen)
{
std::vector<gmx::DataFileInfo> ffdirs = fflib_enumerate_forcefields();
- const int nff = ssize(ffdirs);
+ const int nff = ssize(ffdirs);
/* Replace with unix path separators */
#if DIR_SEPARATOR != '/'
ffs.reserve(ffdirs.size());
for (int i = 0; i < nff; ++i)
{
- ffs.push_back(gmx::stripSuffixIfPresent(ffdirs[i].name,
- fflib_forcefield_dir_ext()));
+ ffs.push_back(gmx::stripSuffixIfPresent(ffdirs[i].name, fflib_forcefield_dir_ext()));
}
int sel;
if (ffsel != nullptr)
{
- sel = -1;
- int cwdsel = -1;
- int nfound = 0;
+ sel = -1;
+ int cwdsel = -1;
+ int nfound = 0;
for (int i = 0; i < nff; ++i)
{
if (ffs[i] == ffsel)
fprintf(stderr,
"Force field '%s' occurs in %d places. pdb2gmx is using the one in the\n"
"current directory. Use interactive selection (not the -ff option) if\n"
- "you would prefer a different one.\n", ffsel, nfound);
+ "you would prefer a different one.\n",
+ ffsel, nfound);
}
else
{
std::string message = gmx::formatString(
- "Force field '%s' occurs in %d places, but not in "
- "the current directory.\n"
- "Run without the -ff switch and select the force "
- "field interactively.", ffsel, nfound);
+ "Force field '%s' occurs in %d places, but not in "
+ "the current directory.\n"
+ "Run without the -ff switch and select the force "
+ "field interactively.",
+ ffsel, nfound);
GMX_THROW(gmx::InconsistentInputError(message));
}
}
else if (nfound == 0)
{
std::string message = gmx::formatString(
- "Could not find force field '%s' in current directory, "
- "install tree or GMXLIB path.", ffsel);
+ "Could not find force field '%s' in current directory, "
+ "install tree or GMXLIB path.",
+ ffsel);
GMX_THROW(gmx::InconsistentInputError(message));
}
}
desc.reserve(ffdirs.size());
for (int i = 0; i < nff; ++i)
{
- std::string docFileName(
- gmx::Path::join(ffdirs[i].dir, ffdirs[i].name,
- fflib_forcefield_doc()));
+ std::string docFileName(gmx::Path::join(ffdirs[i].dir, ffdirs[i].name, fflib_forcefield_doc()));
// TODO: Just try to open the file with a method that does not
// throw/bail out with a fatal error instead of multiple checks.
if (gmx::File::exists(docFileName, gmx::File::returnFalseOnError))
{
// TODO: Use a C++ API without such an intermediate/fixed-length buffer.
- char buf[STRLEN];
+ char buf[STRLEN];
/* We don't use fflib_open, because we don't want printf's */
- FILE *fp = gmx_ffopen(docFileName, "r");
+ FILE* fp = gmx_ffopen(docFileName, "r");
get_a_line(fp, buf, STRLEN);
gmx_ffclose(fp);
desc.emplace_back(buf);
{
for (int j = i + 1; j < nff; ++j)
{
- if (ffdirs[i].dir == ffdirs[j].dir &&
- ((desc[i][0] == '[' && desc[j][0] != '[') ||
- ((desc[i][0] == '[' || desc[j][0] != '[') &&
- gmx_strcasecmp(desc[i].c_str(), desc[j].c_str()) > 0)))
+ if (ffdirs[i].dir == ffdirs[j].dir
+ && ((desc[i][0] == '[' && desc[j][0] != '[')
+ || ((desc[i][0] == '[' || desc[j][0] != '[')
+ && gmx_strcasecmp(desc[i].c_str(), desc[j].c_str()) > 0)))
{
std::swap(ffdirs[i].name, ffdirs[j].name);
std::swap(ffs[i], ffs[j]);
printf("\nSelect the Force Field:\n");
for (int i = 0; i < nff; ++i)
{
- if (i == 0 || ffdirs[i-1].dir != ffdirs[i].dir)
+ if (i == 0 || ffdirs[i - 1].dir != ffdirs[i].dir)
{
if (ffdirs[i].dir == ".")
{
printf("From '%s':\n", ffdirs[i].dir.c_str());
}
}
- printf("%2d: %s\n", i+1, desc[i].c_str());
+ printf("%2d: %s\n", i + 1, desc[i].c_str());
}
sel = -1;
// TODO: Add a C++ API for this.
- char buf[STRLEN];
- char *pret;
+ char buf[STRLEN];
+ char* pret;
do
{
pret = fgets(buf, STRLEN, stdin);
sel = strtol(buf, nullptr, 10);
sel--;
}
- }
- while (pret == nullptr || (sel < 0) || (sel >= nff));
+ } while (pret == nullptr || (sel < 0) || (sel >= nff));
/* Check for a current limitation of the fflib code.
* It will always read from the first ff directory in the list.
if (ffs[i] == ffs[sel])
{
std::string message = gmx::formatString(
- "Can only select the first of multiple force "
- "field entries with directory name '%s%s' in "
- "the list. If you want to use the next entry, "
- "run pdb2gmx in a different directory, set GMXLIB "
- "to point to the desired force field first, and/or "
- "rename or move the force field directory present "
- "in the current working directory.",
- ffs[sel].c_str(), fflib_forcefield_dir_ext());
+ "Can only select the first of multiple force "
+ "field entries with directory name '%s%s' in "
+ "the list. If you want to use the next entry, "
+ "run pdb2gmx in a different directory, set GMXLIB "
+ "to point to the desired force field first, and/or "
+ "rename or move the force field directory present "
+ "in the current working directory.",
+ ffs[sel].c_str(), fflib_forcefield_dir_ext());
GMX_THROW(gmx::NotImplementedError(message));
}
}
if (ffs[sel].length() >= static_cast<size_t>(ff_maxlen))
{
- std::string message = gmx::formatString(
- "Length of force field name (%d) >= maxlen (%d)",
- static_cast<int>(ffs[sel].length()), ff_maxlen);
+ std::string message = gmx::formatString("Length of force field name (%d) >= maxlen (%d)",
+ static_cast<int>(ffs[sel].length()), ff_maxlen);
GMX_THROW(gmx::InvalidInputError(message));
}
strcpy(forcefield, ffs[sel].c_str());
}
if (ffpath.length() >= static_cast<size_t>(ffdir_maxlen))
{
- std::string message = gmx::formatString(
- "Length of force field dir (%d) >= maxlen (%d)",
- static_cast<int>(ffpath.length()), ffdir_maxlen);
+ std::string message = gmx::formatString("Length of force field dir (%d) >= maxlen (%d)",
+ static_cast<int>(ffpath.length()), ffdir_maxlen);
GMX_THROW(gmx::InvalidInputError(message));
}
strcpy(ffdir, ffpath.c_str());
}
-void
-choose_ff(const char *ffsel,
- char *forcefield, int ff_maxlen,
- char *ffdir, int ffdir_maxlen)
+void choose_ff(const char* ffsel, char* forcefield, int ff_maxlen, char* ffdir, int ffdir_maxlen)
{
try
{
choose_ff_impl(ffsel, forcefield, ff_maxlen, ffdir, ffdir_maxlen);
}
- GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
+ GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
}
-void choose_watermodel(const char *wmsel, const char *ffdir,
- char **watermodel)
+void choose_watermodel(const char* wmsel, const char* ffdir, char** watermodel)
{
- const char *fn_watermodels = "watermodels.dat";
- FILE *fp;
+ const char* fn_watermodels = "watermodels.dat";
+ FILE* fp;
char buf[STRLEN];
int nwm, sel, i;
- char **model;
- char *pret;
+ char** model;
+ char* pret;
if (strcmp(wmsel, "none") == 0)
{
std::string filename = gmx::Path::join(ffdir, fn_watermodels);
if (!fflib_fexist(filename))
{
- fprintf(stderr, "No file '%s' found, will not include a water model\n",
- fn_watermodels);
+ fprintf(stderr, "No file '%s' found, will not include a water model\n", fn_watermodels);
*watermodel = nullptr;
return;
model = nullptr;
while (get_a_line(fp, buf, STRLEN))
{
- srenew(model, nwm+1);
+ srenew(model, nwm + 1);
snew(model[nwm], STRLEN);
sscanf(buf, "%s%n", model[nwm], &i);
if (i > 0)
{
- ltrim(buf+i);
- fprintf(stderr, "%2d: %s\n", nwm+1, buf+i);
+ ltrim(buf + i);
+ fprintf(stderr, "%2d: %s\n", nwm + 1, buf + i);
nwm++;
}
else
}
}
gmx_ffclose(fp);
- fprintf(stderr, "%2d: %s\n", nwm+1, "None");
+ fprintf(stderr, "%2d: %s\n", nwm + 1, "None");
sel = -1;
do
sel = strtol(buf, nullptr, 10);
sel--;
}
- }
- while (pret == nullptr || sel < 0 || sel > nwm);
+ } while (pret == nullptr || sel < 0 || sel > nwm);
if (sel == nwm)
{
sfree(model);
}
-static int name2type(t_atoms *at, int **cgnr,
- gmx::ArrayRef<const PreprocessResidue> usedPpResidues, ResidueType *rt)
+static int name2type(t_atoms* at, int** cgnr, gmx::ArrayRef<const PreprocessResidue> usedPpResidues, ResidueType* rt)
{
- int i, j, prevresind, i0, prevcg, cg, curcg;
- char *name;
- bool bNterm;
- double qt;
- int nmissat;
+ int i, j, prevresind, i0, prevcg, cg, curcg;
+ char* name;
+ bool bNterm;
+ double qt;
+ int nmissat;
nmissat = 0;
int resind = -1;
- bNterm = false;
- i0 = 0;
+ bNterm = false;
+ i0 = 0;
snew(*cgnr, at->nr);
- qt = 0;
- curcg = 0;
- cg = -1;
+ qt = 0;
+ curcg = 0;
+ cg = -1;
for (i = 0; (i < at->nr); i++)
{
prevresind = resind;
if (at->atom[i].resind != resind)
{
- resind = at->atom[i].resind;
- bool bProt = rt->namedResidueHasType(*(at->resinfo[resind].name), "Protein");
- bNterm = bProt && (resind == 0);
+ resind = at->atom[i].resind;
+ bool bProt = rt->namedResidueHasType(*(at->resinfo[resind].name), "Protein");
+ bNterm = bProt && (resind == 0);
if (resind > 0)
{
nmissat += missing_atoms(&usedPpResidues[prevresind], prevresind, at, i0, i);
/* A charge group number -1 signals a separate charge group
* for this atom.
*/
- if ( (cg == -1) || (cg != prevcg) || (resind != prevresind) )
+ if ((cg == -1) || (cg != prevcg) || (resind != prevresind))
{
curcg++;
}
return nmissat;
}
-static void print_top_heavy_H(FILE *out, real mHmult)
+static void print_top_heavy_H(FILE* out, real mHmult)
{
if (mHmult == 2.0)
{
}
else if (mHmult != 1.0)
{
- fprintf(stderr, "WARNING: unsupported proton mass multiplier (%g) "
- "in pdb2top\n", mHmult);
+ fprintf(stderr,
+ "WARNING: unsupported proton mass multiplier (%g) "
+ "in pdb2top\n",
+ mHmult);
}
}
-void print_top_comment(FILE *out,
- const char *filename,
- const char *ffdir,
- bool bITP)
+void print_top_comment(FILE* out, const char* filename, const char* ffdir, bool bITP)
{
char ffdir_parent[STRLEN];
- char *p;
+ char* p;
try
{
settings.linePrefix(";\t");
gmx::printBinaryInformation(&writer, gmx::getProgramContext(), settings);
}
- GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
+ GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
if (strchr(ffdir, '/') == nullptr)
{
}
else if (ffdir[0] == '.')
{
- fprintf(out, ";\tForce field was read from current directory or a relative path - path added.\n;\n\n");
+ fprintf(out,
+ ";\tForce field was read from current directory or a relative path - path "
+ "added.\n;\n\n");
}
else
{
- strncpy(ffdir_parent, ffdir, STRLEN-1);
- ffdir_parent[STRLEN-1] = '\0'; /*make sure it is 0-terminated even for long string*/
- p = strrchr(ffdir_parent, '/');
+ strncpy(ffdir_parent, ffdir, STRLEN - 1);
+ ffdir_parent[STRLEN - 1] = '\0'; /*make sure it is 0-terminated even for long string*/
+ p = strrchr(ffdir_parent, '/');
*p = '\0';
";\t%s\n"
";\n"
";\tNote:\n"
- ";\tThis might be a non-standard force field location. When you use this topology, the\n"
+ ";\tThis might be a non-standard force field location. When you use this topology, "
+ "the\n"
";\tforce field must either be present in the current directory, or the location\n"
- ";\tspecified in the GMXLIB path variable or with the 'include' mdp file option.\n;\n\n",
+ ";\tspecified in the GMXLIB path variable or with the 'include' mdp file "
+ "option.\n;\n\n",
ffdir_parent);
}
}
-void print_top_header(FILE *out, const char *filename,
- bool bITP, const char *ffdir, real mHmult)
+void print_top_header(FILE* out, const char* filename, bool bITP, const char* ffdir, real mHmult)
{
- const char *p;
+ const char* p;
print_top_comment(out, filename, ffdir, bITP);
fprintf(out, "; Include forcefield parameters\n");
p = strrchr(ffdir, '/');
- p = (ffdir[0] == '.' || p == nullptr) ? ffdir : p+1;
+ p = (ffdir[0] == '.' || p == nullptr) ? ffdir : p + 1;
fprintf(out, "#include \"%s/%s\"\n\n", p, fflib_forcefield_itp());
}
-static void print_top_posre(FILE *out, const char *pr)
+static void print_top_posre(FILE* out, const char* pr)
{
fprintf(out, "; Include Position restraint file\n");
fprintf(out, "#ifdef POSRES\n");
fprintf(out, "#endif\n\n");
}
-static void print_top_water(FILE *out, const char *ffdir, const char *water)
+static void print_top_water(FILE* out, const char* ffdir, const char* water)
{
- const char *p;
+ const char* p;
char buf[STRLEN];
fprintf(out, "; Include water topology\n");
p = strrchr(ffdir, '/');
- p = (ffdir[0] == '.' || p == nullptr) ? ffdir : p+1;
+ p = (ffdir[0] == '.' || p == nullptr) ? ffdir : p + 1;
fprintf(out, "#include \"%s/%s.itp\"\n", p, water);
fprintf(out, "\n");
}
}
-static void print_top_system(FILE *out, const char *title)
+static void print_top_system(FILE* out, const char* title)
{
fprintf(out, "[ %s ]\n", dir2str(Directive::d_system));
fprintf(out, "; Name\n");
fprintf(out, "%s\n\n", title[0] ? title : "Protein");
}
-void print_top_mols(FILE *out,
- const char *title, const char *ffdir, const char *water,
+void print_top_mols(FILE* out,
+ const char* title,
+ const char* ffdir,
+ const char* water,
gmx::ArrayRef<const std::string> incls,
- gmx::ArrayRef<const t_mols> mols)
+ gmx::ArrayRef<const t_mols> mols)
{
if (!incls.empty())
{
fprintf(out, "; Include chain topologies\n");
- for (const auto &incl : incls)
+ for (const auto& incl : incls)
{
fprintf(out, "#include \"%s\"\n", gmx::Path::getFilename(incl).c_str());
}
{
fprintf(out, "[ %s ]\n", dir2str(Directive::d_molecules));
fprintf(out, "; %-15s %5s\n", "Compound", "#mols");
- for (const auto &mol : mols)
+ for (const auto& mol : mols)
{
fprintf(out, "%-15s %5d\n", mol.name.c_str(), mol.nr);
}
}
}
-void write_top(FILE *out, const char *pr, const char *molname,
- t_atoms *at, bool bRTPresname,
- int bts[], gmx::ArrayRef<const InteractionsOfType> plist, t_excls excls[],
- PreprocessingAtomTypes *atype, int *cgnr, int nrexcl)
+void write_top(FILE* out,
+ const char* pr,
+ const char* molname,
+ t_atoms* at,
+ bool bRTPresname,
+ int bts[],
+ gmx::ArrayRef<const InteractionsOfType> plist,
+ t_excls excls[],
+ PreprocessingAtomTypes* atype,
+ int* cgnr,
+ int nrexcl)
/* NOTE: nrexcl is not the size of *excl! */
{
if (at && atype && cgnr)
fprintf(out, "%-15s %5d\n\n", molname ? molname : "Protein", nrexcl);
print_atoms(out, atype, at, cgnr, bRTPresname);
- print_bondeds(out, at->nr, Directive::d_bonds, F_BONDS, bts[ebtsBONDS], plist);
- print_bondeds(out, at->nr, Directive::d_constraints, F_CONSTR, 0, plist);
- print_bondeds(out, at->nr, Directive::d_constraints, F_CONSTRNC, 0, plist);
- print_bondeds(out, at->nr, Directive::d_pairs, F_LJ14, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_bonds, F_BONDS, bts[ebtsBONDS], plist);
+ print_bondeds(out, at->nr, Directive::d_constraints, F_CONSTR, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_constraints, F_CONSTRNC, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_pairs, F_LJ14, 0, plist);
print_excl(out, at->nr, excls);
- print_bondeds(out, at->nr, Directive::d_angles, F_ANGLES, bts[ebtsANGLES], plist);
- print_bondeds(out, at->nr, Directive::d_dihedrals, F_PDIHS, bts[ebtsPDIHS], plist);
- print_bondeds(out, at->nr, Directive::d_dihedrals, F_IDIHS, bts[ebtsIDIHS], plist);
- print_bondeds(out, at->nr, Directive::d_cmap, F_CMAP, bts[ebtsCMAP], plist);
- print_bondeds(out, at->nr, Directive::d_polarization, F_POLARIZATION, 0, plist);
- print_bondeds(out, at->nr, Directive::d_thole_polarization, F_THOLE_POL, 0, plist);
- print_bondeds(out, at->nr, Directive::d_vsites2, F_VSITE2, 0, plist);
- print_bondeds(out, at->nr, Directive::d_vsites3, F_VSITE3, 0, plist);
- print_bondeds(out, at->nr, Directive::d_vsites3, F_VSITE3FD, 0, plist);
- print_bondeds(out, at->nr, Directive::d_vsites3, F_VSITE3FAD, 0, plist);
- print_bondeds(out, at->nr, Directive::d_vsites3, F_VSITE3OUT, 0, plist);
- print_bondeds(out, at->nr, Directive::d_vsites4, F_VSITE4FD, 0, plist);
- print_bondeds(out, at->nr, Directive::d_vsites4, F_VSITE4FDN, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_angles, F_ANGLES, bts[ebtsANGLES], plist);
+ print_bondeds(out, at->nr, Directive::d_dihedrals, F_PDIHS, bts[ebtsPDIHS], plist);
+ print_bondeds(out, at->nr, Directive::d_dihedrals, F_IDIHS, bts[ebtsIDIHS], plist);
+ print_bondeds(out, at->nr, Directive::d_cmap, F_CMAP, bts[ebtsCMAP], plist);
+ print_bondeds(out, at->nr, Directive::d_polarization, F_POLARIZATION, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_thole_polarization, F_THOLE_POL, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_vsites2, F_VSITE2, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_vsites3, F_VSITE3, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_vsites3, F_VSITE3FD, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_vsites3, F_VSITE3FAD, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_vsites3, F_VSITE3OUT, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_vsites4, F_VSITE4FD, 0, plist);
+ print_bondeds(out, at->nr, Directive::d_vsites4, F_VSITE4FDN, 0, plist);
if (pr)
{
}
-
-static void do_ssbonds(InteractionsOfType *ps, t_atoms *atoms,
- gmx::ArrayRef<const DisulfideBond> ssbonds, bool bAllowMissing)
+static void do_ssbonds(InteractionsOfType* ps,
+ t_atoms* atoms,
+ gmx::ArrayRef<const DisulfideBond> ssbonds,
+ bool bAllowMissing)
{
- for (const auto &bond : ssbonds)
+ for (const auto& bond : ssbonds)
{
int ri = bond.firstResidue;
int rj = bond.secondResidue;
- int ai = search_res_atom(bond.firstAtom.c_str(), ri, atoms,
- "special bond", bAllowMissing);
- int aj = search_res_atom(bond.secondAtom.c_str(), rj, atoms,
- "special bond", bAllowMissing);
+ int ai = search_res_atom(bond.firstAtom.c_str(), ri, atoms, "special bond", bAllowMissing);
+ int aj = search_res_atom(bond.secondAtom.c_str(), rj, atoms, "special bond", bAllowMissing);
if ((ai == -1) || (aj == -1))
{
gmx_fatal(FARGS, "Trying to make impossible special bond (%s-%s)!",
}
}
-static void at2bonds(InteractionsOfType *psb, gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
- t_atoms *atoms,
- gmx::ArrayRef<const gmx::RVec> x,
- real long_bond_dist, real short_bond_dist)
+static void at2bonds(InteractionsOfType* psb,
+ gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
+ t_atoms* atoms,
+ gmx::ArrayRef<const gmx::RVec> x,
+ real long_bond_dist,
+ real short_bond_dist)
{
real long_bond_dist2, short_bond_dist2;
- const char *ptr;
+ const char* ptr;
long_bond_dist2 = gmx::square(long_bond_dist);
short_bond_dist2 = gmx::square(short_bond_dist);
for (int resind = 0; (resind < atoms->nres) && (i < atoms->nr); resind++)
{
/* add bonds from list of bonded interactions */
- for (const auto &patch : globalPatches[resind].rb[ebtsBONDS].b)
+ for (const auto& patch : globalPatches[resind].rb[ebtsBONDS].b)
{
/* Unfortunately we can not issue errors or warnings
* for missing atoms in bonds, as the hydrogens and terminal atoms
* have not been added yet.
*/
- int ai = search_atom(patch.ai().c_str(), i, atoms,
- ptr, TRUE);
- int aj = search_atom(patch.aj().c_str(), i, atoms,
- ptr, TRUE);
+ int ai = search_atom(patch.ai().c_str(), i, atoms, ptr, TRUE);
+ int aj = search_atom(patch.aj().c_str(), i, atoms, ptr, TRUE);
if (ai != -1 && aj != -1)
{
real dist2 = distance2(x[ai], x[aj]);
if (dist2 > long_bond_dist2)
{
- fprintf(stderr, "Warning: Long Bond (%d-%d = %g nm)\n",
- ai+1, aj+1, std::sqrt(dist2));
+ fprintf(stderr, "Warning: Long Bond (%d-%d = %g nm)\n", ai + 1, aj + 1,
+ std::sqrt(dist2));
}
else if (dist2 < short_bond_dist2)
{
- fprintf(stderr, "Warning: Short Bond (%d-%d = %g nm)\n",
- ai+1, aj+1, std::sqrt(dist2));
+ fprintf(stderr, "Warning: Short Bond (%d-%d = %g nm)\n", ai + 1, aj + 1,
+ std::sqrt(dist2));
}
add_param(psb, ai, aj, {}, patch.s.c_str());
}
}
/* add bonds from list of hacks (each added atom gets a bond) */
- while ( (i < atoms->nr) && (atoms->atom[i].resind == resind) )
+ while ((i < atoms->nr) && (atoms->atom[i].resind == resind))
{
- for (const auto &patch : globalPatches[resind].hack)
+ for (const auto& patch : globalPatches[resind].hack)
{
- if ( ( patch.tp > 0 ||
- patch.type() == MoleculePatchType::Add ) &&
- patch.a[0] == *(atoms->atomname[i]))
+ if ((patch.tp > 0 || patch.type() == MoleculePatchType::Add)
+ && patch.a[0] == *(atoms->atomname[i]))
{
switch (patch.tp)
{
- case 9 : /* COOH terminus */
- add_param(psb, i, i+1, {}, nullptr); /* C-O */
- add_param(psb, i, i+2, {}, nullptr); /* C-OA */
- add_param(psb, i+2, i+3, {}, nullptr); /* OA-H */
+ case 9: /* COOH terminus */
+ add_param(psb, i, i + 1, {}, nullptr); /* C-O */
+ add_param(psb, i, i + 2, {}, nullptr); /* C-OA */
+ add_param(psb, i + 2, i + 3, {}, nullptr); /* OA-H */
break;
default:
for (int k = 0; (k < patch.nr); k++)
{
- add_param(psb, i, i+k+1, {}, nullptr);
+ add_param(psb, i, i + k + 1, {}, nullptr);
}
}
}
}
}
-static bool pcompar(const InteractionOfType &a, const InteractionOfType &b)
+static bool pcompar(const InteractionOfType& a, const InteractionOfType& b)
{
- int d;
+ int d;
if ((d = a.ai() - b.ai()) != 0)
{
}
}
-static void clean_bonds(InteractionsOfType *ps)
+static void clean_bonds(InteractionsOfType* ps)
{
if (ps->size() > 0)
{
/* Sort bonds */
- for (auto &bond : ps->interactionTypes)
+ for (auto& bond : ps->interactionTypes)
{
bond.sortAtomIds();
}
/* remove doubles, keep the first one always. */
int oldNumber = ps->size();
- for (auto parm = ps->interactionTypes.begin() + 1; parm != ps->interactionTypes.end(); )
+ for (auto parm = ps->interactionTypes.begin() + 1; parm != ps->interactionTypes.end();)
{
auto prev = parm - 1;
- if (parm->ai() == prev->ai() &&
- parm->aj() == prev->aj())
+ if (parm->ai() == prev->ai() && parm->aj() == prev->aj())
{
parm = ps->interactionTypes.erase(parm);
}
}
}
-void print_sums(const t_atoms *atoms, bool bSystem)
+void print_sums(const t_atoms* atoms, bool bSystem)
{
double m, qtot;
int i;
- const char *where;
+ const char* where;
if (bSystem)
{
qtot = 0;
for (i = 0; (i < atoms->nr); i++)
{
- m += atoms->atom[i].m;
+ m += atoms->atom[i].m;
qtot += atoms->atom[i].q;
}
fprintf(stderr, "Total charge%s %.3f e\n", where, qtot);
}
-static void check_restp_type(const char *name, int t1, int t2)
+static void check_restp_type(const char* name, int t1, int t2)
{
if (t1 != t2)
{
}
}
-static void check_restp_types(const PreprocessResidue &r0, const PreprocessResidue &r1)
+static void check_restp_types(const PreprocessResidue& r0, const PreprocessResidue& r1)
{
- check_restp_type("all dihedrals", static_cast<int>(r0.bKeepAllGeneratedDihedrals), static_cast<int>(r1.bKeepAllGeneratedDihedrals));
+ check_restp_type("all dihedrals", static_cast<int>(r0.bKeepAllGeneratedDihedrals),
+ static_cast<int>(r1.bKeepAllGeneratedDihedrals));
check_restp_type("nrexcl", r0.nrexcl, r1.nrexcl);
- check_restp_type("HH14", static_cast<int>(r0.bGenerateHH14Interactions), static_cast<int>(r1.bGenerateHH14Interactions));
- check_restp_type("remove dihedrals", static_cast<int>(r0.bRemoveDihedralIfWithImproper), static_cast<int>(r1.bRemoveDihedralIfWithImproper));
+ check_restp_type("HH14", static_cast<int>(r0.bGenerateHH14Interactions),
+ static_cast<int>(r1.bGenerateHH14Interactions));
+ check_restp_type("remove dihedrals", static_cast<int>(r0.bRemoveDihedralIfWithImproper),
+ static_cast<int>(r1.bRemoveDihedralIfWithImproper));
for (int i = 0; i < ebtsNR; i++)
{
}
}
-static void add_atom_to_restp(PreprocessResidue *usedPpResidues,
- t_symtab *symtab,
- int at_start,
- const MoleculePatch *patch)
+static void add_atom_to_restp(PreprocessResidue* usedPpResidues,
+ t_symtab* symtab,
+ int at_start,
+ const MoleculePatch* patch)
{
/* now add them */
for (int k = 0; k < patch->nr; k++)
std::string buf = patch->nname;
if (patch->nr > 1)
{
- buf.append(gmx::formatString("%d", k+1));
+ buf.append(gmx::formatString("%d", k + 1));
}
usedPpResidues->atomname.insert(usedPpResidues->atomname.begin() + at_start + 1 + k,
put_symtab(symtab, buf.c_str()));
}
else
{
- usedPpResidues->cgnr.insert(usedPpResidues->cgnr.begin() + at_start + 1 + k, usedPpResidues->cgnr[at_start]);
+ usedPpResidues->cgnr.insert(usedPpResidues->cgnr.begin() + at_start + 1 + k,
+ usedPpResidues->cgnr[at_start]);
}
}
}
-void get_hackblocks_rtp(std::vector<MoleculePatchDatabase> *globalPatches,
- std::vector<PreprocessResidue> *usedPpResidues,
+void get_hackblocks_rtp(std::vector<MoleculePatchDatabase>* globalPatches,
+ std::vector<PreprocessResidue>* usedPpResidues,
gmx::ArrayRef<const PreprocessResidue> rtpFFDB,
- int nres, t_resinfo *resinfo,
- int nterpairs,
- t_symtab *symtab,
- gmx::ArrayRef<MoleculePatchDatabase *> ntdb,
- gmx::ArrayRef<MoleculePatchDatabase *> ctdb,
- gmx::ArrayRef<const int> rn,
- gmx::ArrayRef<const int> rc,
- bool bAllowMissing)
+ int nres,
+ t_resinfo* resinfo,
+ int nterpairs,
+ t_symtab* symtab,
+ gmx::ArrayRef<MoleculePatchDatabase*> ntdb,
+ gmx::ArrayRef<MoleculePatchDatabase*> ctdb,
+ gmx::ArrayRef<const int> rn,
+ gmx::ArrayRef<const int> rc,
+ bool bAllowMissing)
{
- char *key;
- bool bRM;
+ char* key;
+ bool bRM;
globalPatches->resize(nres);
usedPpResidues->clear();
key = *resinfo[i].rtp;
resinfo[i].rtp = put_symtab(symtab, searchResidueDatabase(key, rtpFFDB).c_str());
- auto res = getDatabaseEntry(*resinfo[i].rtp, rtpFFDB);
+ auto res = getDatabaseEntry(*resinfo[i].rtp, rtpFFDB);
usedPpResidues->push_back(PreprocessResidue());
- PreprocessResidue *newentry = &usedPpResidues->back();
+ PreprocessResidue* newentry = &usedPpResidues->back();
copyPreprocessResidues(*res, newentry, symtab);
/* Check that we do not have different bonded types in one molecule */
}
bRM = mergeBondedInteractionList(res->rb, globalPatches->at(i).rb, tern >= 0, terc >= 0);
- if (bRM && ((tern >= 0 && ntdb[tern] == nullptr) ||
- (terc >= 0 && ctdb[terc] == nullptr)))
+ if (bRM && ((tern >= 0 && ntdb[tern] == nullptr) || (terc >= 0 && ctdb[terc] == nullptr)))
{
- const char *errString = "There is a dangling bond at at least one of the terminal ends and the force field does not provide terminal entries or files. Fix your terminal residues so that they match the residue database (.rtp) entries, or provide terminal database entries (.tdb).";
+ const char* errString =
+ "There is a dangling bond at at least one of the terminal ends and the force "
+ "field does not provide terminal entries or files. Fix your terminal "
+ "residues so that they match the residue database (.rtp) entries, or provide "
+ "terminal database entries (.tdb).";
if (bAllowMissing)
{
fprintf(stderr, "%s\n", errString);
gmx_fatal(FARGS, "%s", errString);
}
}
- else if (bRM && ((tern >= 0 && ntdb[tern]->nhack() == 0) ||
- (terc >= 0 && ctdb[terc]->nhack() == 0)))
+ else if (bRM && ((tern >= 0 && ntdb[tern]->nhack() == 0) || (terc >= 0 && ctdb[terc]->nhack() == 0)))
{
- const char *errString = "There is a dangling bond at at least one of the terminal ends. Fix your coordinate file, add a new terminal database entry (.tdb), or select the proper existing terminal entry.";
+ const char* errString =
+ "There is a dangling bond at at least one of the terminal ends. Fix your "
+ "coordinate file, add a new terminal database entry (.tdb), or select the "
+ "proper existing terminal entry.";
if (bAllowMissing)
{
fprintf(stderr, "%s\n", errString);
i.e. add's and deletes from termini database will be
added to/removed from residue topology
we'll do this on one big dirty loop, so it won't make easy reading! */
- for (auto modifiedResidue = globalPatches->begin();
- modifiedResidue != globalPatches->end();
+ for (auto modifiedResidue = globalPatches->begin(); modifiedResidue != globalPatches->end();
modifiedResidue++)
{
- const int pos = std::distance(globalPatches->begin(), modifiedResidue);
- PreprocessResidue *posres = &usedPpResidues->at(pos);
- for (auto patch = modifiedResidue->hack.begin();
- patch != modifiedResidue->hack.end();
- patch++)
+ const int pos = std::distance(globalPatches->begin(), modifiedResidue);
+ PreprocessResidue* posres = &usedPpResidues->at(pos);
+ for (auto patch = modifiedResidue->hack.begin(); patch != modifiedResidue->hack.end(); patch++)
{
if (patch->nr != 0)
{
/* find atom in restp */
- auto found =
- std::find_if(posres->atomname.begin(),
- posres->atomname.end(),
- [&patch](char **name)
- { return (patch->oname.empty() &&
- patch->a[0] == *name) ||
- (patch->oname == *name); });
+ auto found = std::find_if(posres->atomname.begin(), posres->atomname.end(),
+ [&patch](char** name) {
+ return (patch->oname.empty() && patch->a[0] == *name)
+ || (patch->oname == *name);
+ });
if (found == posres->atomname.end())
{
gmx_fatal(FARGS,
"atom %s not found in buiding block %d%s "
"while combining tdb and rtp",
- patch->oname.empty() ?
- patch->a[0].c_str() : patch->oname.c_str(),
- pos+1, *resinfo[pos].rtp);
+ patch->oname.empty() ? patch->a[0].c_str() : patch->oname.c_str(),
+ pos + 1, *resinfo[pos].rtp);
}
}
else
break;
}
case MoleculePatchType::Delete:
- { /* we're deleting */
+ { /* we're deleting */
posres->atom.erase(posres->atom.begin() + l);
posres->atomname.erase(posres->atomname.begin() + l);
posres->cgnr.erase(posres->cgnr.begin() + l);
case MoleculePatchType::Replace:
{
/* we're replacing */
- posres->atom[l] = patch->atom.back();
- posres->atomname[l] = put_symtab(symtab, patch->nname.c_str());
+ posres->atom[l] = patch->atom.back();
+ posres->atomname[l] = put_symtab(symtab, patch->nname.c_str());
if (patch->cgnr != NOTSET)
{
posres->cgnr[l] = patch->cgnr;
}
}
-static bool atomname_cmp_nr(const char *anm, const MoleculePatch *patch, int *nr)
+static bool atomname_cmp_nr(const char* anm, const MoleculePatch* patch, int* nr)
{
if (patch->nr == 1)
}
else
{
- if (isdigit(anm[strlen(anm)-1]))
+ if (isdigit(anm[strlen(anm) - 1]))
{
- *nr = anm[strlen(anm)-1] - '0';
+ *nr = anm[strlen(anm) - 1] - '0';
}
else
{
}
else
{
- return (strlen(anm) == patch->nname.length() + 1 &&
- gmx_strncasecmp(anm, patch->nname.c_str(), patch->nname.length()) == 0);
+ return (strlen(anm) == patch->nname.length() + 1
+ && gmx_strncasecmp(anm, patch->nname.c_str(), patch->nname.length()) == 0);
}
}
}
-static bool match_atomnames_with_rtp_atom(t_atoms *pdba,
+static bool match_atomnames_with_rtp_atom(t_atoms* pdba,
gmx::ArrayRef<gmx::RVec> x,
- t_symtab *symtab,
+ t_symtab* symtab,
int atind,
- PreprocessResidue *localPpResidue,
- const MoleculePatchDatabase &singlePatch,
+ PreprocessResidue* localPpResidue,
+ const MoleculePatchDatabase& singlePatch,
bool bVerbose)
{
- int resnr;
- char *oldnm;
- int anmnr;
- bool bDeleted;
+ int resnr;
+ char* oldnm;
+ int anmnr;
+ bool bDeleted;
oldnm = *pdba->atomname[atind];
resnr = pdba->resinfo[pdba->atom[atind].resind].nr;
bDeleted = FALSE;
- for (auto patch = singlePatch.hack.begin();
- patch != singlePatch.hack.end();
- patch++)
+ for (auto patch = singlePatch.hack.begin(); patch != singlePatch.hack.end(); patch++)
{
- if (patch->type() == MoleculePatchType::Replace &&
- gmx::equalCaseInsensitive(oldnm, patch->oname))
+ if (patch->type() == MoleculePatchType::Replace && gmx::equalCaseInsensitive(oldnm, patch->oname))
{
/* This is a replace entry. */
/* Check if we are not replacing a replaced atom. */
bool bReplaceReplace = false;
- for (auto selfPatch = singlePatch.hack.begin();
- selfPatch != singlePatch.hack.end();
- selfPatch++)
+ for (auto selfPatch = singlePatch.hack.begin(); selfPatch != singlePatch.hack.end(); selfPatch++)
{
- if (patch != selfPatch &&
- selfPatch->type() == MoleculePatchType::Replace &&
- gmx::equalCaseInsensitive(selfPatch->nname, patch->oname))
+ if (patch != selfPatch && selfPatch->type() == MoleculePatchType::Replace
+ && gmx::equalCaseInsensitive(selfPatch->nname, patch->oname))
{
/* The replace in patch replaces an atom that
* was already replaced in selfPatch, we do not want
/* This atom still has the old name, rename it */
std::string newnm = patch->nname;
- auto found = std::find_if(localPpResidue->atomname.begin(),
- localPpResidue->atomname.end(),
- [&newnm](char** name)
- { return gmx::equalCaseInsensitive(newnm, *name); });
+ auto found = std::find_if(
+ localPpResidue->atomname.begin(), localPpResidue->atomname.end(),
+ [&newnm](char** name) { return gmx::equalCaseInsensitive(newnm, *name); });
if (found == localPpResidue->atomname.end())
{
/* The new name is not present in the rtp.
*/
bool bFoundInAdd = false;
for (auto rtpModification = singlePatch.hack.begin();
- rtpModification != singlePatch.hack.end();
- rtpModification++)
+ rtpModification != singlePatch.hack.end(); rtpModification++)
{
int k = std::distance(localPpResidue->atomname.begin(), found);
std::string start_at;
- if (rtpModification->type() == MoleculePatchType::Add &&
- atomname_cmp_nr(newnm.c_str(), &(*rtpModification), &anmnr))
+ if (rtpModification->type() == MoleculePatchType::Add
+ && atomname_cmp_nr(newnm.c_str(), &(*rtpModification), &anmnr))
{
if (anmnr <= 1)
{
}
else
{
- start_at = gmx::formatString("%s%d", singlePatch.hack[k].nname.c_str(), anmnr-1);
+ start_at = gmx::formatString("%s%d", singlePatch.hack[k].nname.c_str(),
+ anmnr - 1);
}
- auto found2 = std::find_if(localPpResidue->atomname.begin(),
- localPpResidue->atomname.end(),
- [&start_at](char **name)
- { return gmx::equalCaseInsensitive(start_at, *name); });
+ auto found2 =
+ std::find_if(localPpResidue->atomname.begin(),
+ localPpResidue->atomname.end(), [&start_at](char** name) {
+ return gmx::equalCaseInsensitive(start_at, *name);
+ });
if (found2 == localPpResidue->atomname.end())
{
- gmx_fatal(FARGS, "Could not find atom '%s' in residue building block '%s' to add atom '%s' to",
+ gmx_fatal(FARGS,
+ "Could not find atom '%s' in residue building block '%s' to "
+ "add atom '%s' to",
start_at.c_str(), localPpResidue->resname.c_str(), newnm.c_str());
}
/* We can add the atom after atom start_nr */
if (!bFoundInAdd)
{
- gmx_fatal(FARGS, "Could not find an 'add' entry for atom named '%s' corresponding to the 'replace' entry from atom name '%s' to '%s' for tdb or hdb database of residue type '%s'",
- newnm.c_str(),
- patch->oname.c_str(), patch->nname.c_str(),
+ gmx_fatal(FARGS,
+ "Could not find an 'add' entry for atom named '%s' corresponding to "
+ "the 'replace' entry from atom name '%s' to '%s' for tdb or hdb "
+ "database of residue type '%s'",
+ newnm.c_str(), patch->oname.c_str(), patch->nname.c_str(),
localPpResidue->resname.c_str());
}
}
if (bVerbose)
{
- printf("Renaming atom '%s' in residue '%s' %d to '%s'\n",
- oldnm, localPpResidue->resname.c_str(), resnr, newnm.c_str());
+ printf("Renaming atom '%s' in residue '%s' %d to '%s'\n", oldnm,
+ localPpResidue->resname.c_str(), resnr, newnm.c_str());
}
/* Rename the atom in pdba */
pdba->atomname[atind] = put_symtab(symtab, newnm.c_str());
}
- else if (patch->type() == MoleculePatchType::Delete &&
- gmx::equalCaseInsensitive(oldnm, patch->oname))
+ else if (patch->type() == MoleculePatchType::Delete
+ && gmx::equalCaseInsensitive(oldnm, patch->oname))
{
/* This is a delete entry, check if this atom is present
* in the rtp entry of this residue.
*/
- auto found3 = std::find_if(localPpResidue->atomname.begin(), localPpResidue->atomname.end(),
- [&oldnm](char **name)
- { return gmx::equalCaseInsensitive(oldnm, *name); });
+ auto found3 = std::find_if(
+ localPpResidue->atomname.begin(), localPpResidue->atomname.end(),
+ [&oldnm](char** name) { return gmx::equalCaseInsensitive(oldnm, *name); });
if (found3 == localPpResidue->atomname.end())
{
/* This atom is not present in the rtp entry,
*/
if (bVerbose)
{
- printf("Deleting atom '%s' in residue '%s' %d\n",
- oldnm, localPpResidue->resname.c_str(), resnr);
+ printf("Deleting atom '%s' in residue '%s' %d\n", oldnm,
+ localPpResidue->resname.c_str(), resnr);
}
/* We should free the atom name,
* but it might be used multiple times in the symtab.
* sfree(pdba->atomname[atind]);
*/
- for (int k = atind+1; k < pdba->nr; k++)
+ for (int k = atind + 1; k < pdba->nr; k++)
{
- pdba->atom[k-1] = pdba->atom[k];
- pdba->atomname[k-1] = pdba->atomname[k];
- copy_rvec(x[k], x[k-1]);
+ pdba->atom[k - 1] = pdba->atom[k];
+ pdba->atomname[k - 1] = pdba->atomname[k];
+ copy_rvec(x[k], x[k - 1]);
}
pdba->nr--;
bDeleted = true;
void match_atomnames_with_rtp(gmx::ArrayRef<PreprocessResidue> usedPpResidues,
gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
- t_atoms *pdba,
- t_symtab *symtab,
+ t_atoms* pdba,
+ t_symtab* symtab,
gmx::ArrayRef<gmx::RVec> x,
bool bVerbose)
{
for (int i = 0; i < pdba->nr; i++)
{
- const char *oldnm = *pdba->atomname[i];
- PreprocessResidue *localPpResidue = &usedPpResidues[pdba->atom[i].resind];
- auto found = std::find_if(localPpResidue->atomname.begin(), localPpResidue->atomname.end(),
- [&oldnm](char **name)
- { return gmx::equalCaseInsensitive(oldnm, *name); });
+ const char* oldnm = *pdba->atomname[i];
+ PreprocessResidue* localPpResidue = &usedPpResidues[pdba->atom[i].resind];
+ auto found = std::find_if(
+ localPpResidue->atomname.begin(), localPpResidue->atomname.end(),
+ [&oldnm](char** name) { return gmx::equalCaseInsensitive(oldnm, *name); });
if (found == localPpResidue->atomname.end())
{
/* Not found yet, check if we have to rename this atom */
- if (match_atomnames_with_rtp_atom(pdba, x, symtab, i,
- localPpResidue, globalPatches[pdba->atom[i].resind],
- bVerbose))
+ if (match_atomnames_with_rtp_atom(pdba, x, symtab, i, localPpResidue,
+ globalPatches[pdba->atom[i].resind], bVerbose))
{
/* We deleted this atom, decrease the atom counter by 1. */
i--;
}
#define NUM_CMAP_ATOMS 5
-static void gen_cmap(InteractionsOfType *psb, gmx::ArrayRef<const PreprocessResidue> usedPpResidues, t_atoms *atoms)
+static void gen_cmap(InteractionsOfType* psb, gmx::ArrayRef<const PreprocessResidue> usedPpResidues, t_atoms* atoms)
{
int residx;
- const char *ptr;
- t_resinfo *resinfo = atoms->resinfo;
+ const char* ptr;
+ t_resinfo* resinfo = atoms->resinfo;
int nres = atoms->nres;
int cmap_atomid[NUM_CMAP_ATOMS];
int cmap_chainnum = -1;
for (residx = 0; residx < nres; residx++)
{
/* Add CMAP terms from the list of CMAP interactions */
- for (const auto &b : usedPpResidues[residx].rb[ebtsCMAP].b)
+ for (const auto& b : usedPpResidues[residx].rb[ebtsCMAP].b)
{
bool bAddCMAP = true;
/* Loop over atoms in a candidate CMAP interaction and
/* Assign the pointer to the name of the next reference atom.
* This can use -/+ labels to refer to previous/next residue.
*/
- const char *pname = b.a[k].c_str();
+ const char* pname = b.a[k].c_str();
/* Skip this CMAP entry if it refers to residues before the
* first or after the last residue.
*/
- if (((strchr(pname, '-') != nullptr) && (residx == 0)) ||
- ((strchr(pname, '+') != nullptr) && (residx == nres-1)))
+ if (((strchr(pname, '-') != nullptr) && (residx == 0))
+ || ((strchr(pname, '+') != nullptr) && (residx == nres - 1)))
{
bAddCMAP = false;
break;
}
- cmap_atomid[k] = search_atom(pname,
- i, atoms, ptr, TRUE);
- bAddCMAP = bAddCMAP && (cmap_atomid[k] != -1);
+ cmap_atomid[k] = search_atom(pname, i, atoms, ptr, TRUE);
+ bAddCMAP = bAddCMAP && (cmap_atomid[k] != -1);
if (!bAddCMAP)
{
/* This break is necessary, because cmap_atomid[k]
/* Does the residue for this atom have the same
* chain number as the residues for previous
* atoms? */
- bAddCMAP = bAddCMAP &&
- cmap_chainnum == resinfo[this_residue_index].chainnum;
+ bAddCMAP = bAddCMAP && cmap_chainnum == resinfo[this_residue_index].chainnum;
}
/* Here we used to check that the residuetype was protein and
* disable bAddCMAP if that was not the case. However, some
if (bAddCMAP)
{
- add_cmap_param(psb, cmap_atomid[0], cmap_atomid[1], cmap_atomid[2], cmap_atomid[3], cmap_atomid[4], b.s.c_str());
+ add_cmap_param(psb, cmap_atomid[0], cmap_atomid[1], cmap_atomid[2], cmap_atomid[3],
+ cmap_atomid[4], b.s.c_str());
}
}
- if (residx < nres-1)
+ if (residx < nres - 1)
{
- while (atoms->atom[i].resind < residx+1)
+ while (atoms->atom[i].resind < residx + 1)
{
i++;
}
/* Start the next residue */
}
-static void
-scrub_charge_groups(int *cgnr, int natoms)
+static void scrub_charge_groups(int* cgnr, int natoms)
{
int i;
for (i = 0; i < natoms; i++)
{
- cgnr[i] = i+1;
+ cgnr[i] = i + 1;
}
}
-void pdb2top(FILE *top_file, const char *posre_fn, const char *molname,
- t_atoms *atoms,
- std::vector<gmx::RVec> *x, PreprocessingAtomTypes *atype, t_symtab *tab,
+void pdb2top(FILE* top_file,
+ const char* posre_fn,
+ const char* molname,
+ t_atoms* atoms,
+ std::vector<gmx::RVec>* x,
+ PreprocessingAtomTypes* atype,
+ t_symtab* tab,
gmx::ArrayRef<const PreprocessResidue> rtpFFDB,
- gmx::ArrayRef<PreprocessResidue> usedPpResidues,
- gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
- bool bAllowMissing,
- bool bVsites, bool bVsiteAromatics,
- const char *ffdir,
- real mHmult,
- gmx::ArrayRef<const DisulfideBond> ssbonds,
- real long_bond_dist, real short_bond_dist,
- bool bDeuterate, bool bChargeGroups, bool bCmap,
- bool bRenumRes, bool bRTPresname)
+ gmx::ArrayRef<PreprocessResidue> usedPpResidues,
+ gmx::ArrayRef<MoleculePatchDatabase> globalPatches,
+ bool bAllowMissing,
+ bool bVsites,
+ bool bVsiteAromatics,
+ const char* ffdir,
+ real mHmult,
+ gmx::ArrayRef<const DisulfideBond> ssbonds,
+ real long_bond_dist,
+ real short_bond_dist,
+ bool bDeuterate,
+ bool bChargeGroups,
+ bool bCmap,
+ bool bRenumRes,
+ bool bRTPresname)
{
- std::array<InteractionsOfType, F_NRE> plist;
- t_excls *excls;
- int *cgnr;
- int *vsite_type;
- int i, nmissat;
- int bts[ebtsNR];
+ std::array<InteractionsOfType, F_NRE> plist;
+ t_excls* excls;
+ int* cgnr;
+ int* vsite_type;
+ int i, nmissat;
+ int bts[ebtsNR];
ResidueType rt;
/* Make bonds */
- at2bonds(&(plist[F_BONDS]), globalPatches,
- atoms, *x,
- long_bond_dist, short_bond_dist);
+ at2bonds(&(plist[F_BONDS]), globalPatches, atoms, *x, long_bond_dist, short_bond_dist);
/* specbonds: disulphide bonds & heme-his */
- do_ssbonds(&(plist[F_BONDS]),
- atoms, ssbonds,
- bAllowMissing);
+ do_ssbonds(&(plist[F_BONDS]), atoms, ssbonds, bAllowMissing);
nmissat = name2type(atoms, &cgnr, usedPpResidues, &rt);
if (nmissat)
{
if (bAllowMissing)
{
- fprintf(stderr, "There were %d missing atoms in molecule %s\n",
- nmissat, molname);
+ fprintf(stderr, "There were %d missing atoms in molecule %s\n", nmissat, molname);
}
else
{
- gmx_fatal(FARGS, "There were %d missing atoms in molecule %s, if you want to use this incomplete topology anyhow, use the option -missing",
+ gmx_fatal(FARGS,
+ "There were %d missing atoms in molecule %s, if you want to use this "
+ "incomplete topology anyhow, use the option -missing",
nmissat, molname);
}
}
{
if (bVsiteAromatics)
{
- fprintf(stdout, "The conversion of aromatic rings into virtual sites is deprecated "
+ fprintf(stdout,
+ "The conversion of aromatic rings into virtual sites is deprecated "
"and may be removed in a future version of GROMACS");
}
/* determine which atoms will be vsites and add dummy masses
also renumber atom numbers in plist[0..F_NRE]! */
- do_vsites(rtpFFDB, atype, atoms, tab, x, plist,
- &vsite_type, &cgnr, mHmult, bVsiteAromatics, ffdir);
+ do_vsites(rtpFFDB, atype, atoms, tab, x, plist, &vsite_type, &cgnr, mHmult, bVsiteAromatics, ffdir);
}
/* Make Angles and Dihedrals */
gen_cmap(&(plist[F_CMAP]), usedPpResidues, atoms);
if (plist[F_CMAP].size() > 0)
{
- fprintf(stderr, "There are %4zu cmap torsion pairs\n",
- plist[F_CMAP].size());
+ fprintf(stderr, "There are %4zu cmap torsion pairs\n", plist[F_CMAP].size());
}
}
" %4zu pairs, %4zu bonds and %4zu virtual sites\n",
plist[F_PDIHS].size(), plist[F_IDIHS].size(), plist[F_ANGLES].size(),
plist[F_LJ14].size(), plist[F_BONDS].size(),
- plist[F_VSITE2].size() +
- plist[F_VSITE3].size() +
- plist[F_VSITE3FD].size() +
- plist[F_VSITE3FAD].size() +
- plist[F_VSITE3OUT].size() +
- plist[F_VSITE4FD].size() +
- plist[F_VSITE4FDN].size() );
+ plist[F_VSITE2].size() + plist[F_VSITE3].size() + plist[F_VSITE3FD].size()
+ + plist[F_VSITE3FAD].size() + plist[F_VSITE3OUT].size()
+ + plist[F_VSITE4FD].size() + plist[F_VSITE4FDN].size());
print_sums(atoms, FALSE);
{
bts[i] = usedPpResidues[0].rb[i].type;
}
- write_top(top_file, posre_fn, molname,
- atoms, bRTPresname,
- bts, plist, excls, atype, cgnr, usedPpResidues[0].nrexcl);
+ write_top(top_file, posre_fn, molname, atoms, bRTPresname, bts, plist, excls, atype, cgnr,
+ usedPpResidues[0].nrexcl);
}