#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2011,2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2011,2013,2014,2015, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-file(GLOB GMXPREPROCESS_SOURCES *.c *.cpp)
+file(GLOB GMXPREPROCESS_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${GMXPREPROCESS_SOURCES} PARENT_SCOPE)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <string.h>
+#include <algorithm>
+
#include "gromacs/gmxpreprocess/grompp-impl.h"
#include "gromacs/gmxpreprocess/hackblock.h"
#include "gromacs/gmxpreprocess/toputil.h"
int search_jtype(t_restp *rtp, char *name, gmx_bool bNterm)
{
- int niter, iter, j, k, kmax, jmax, minstrlen;
- char *rtpname, searchname[12];
+ int niter, iter, j, jmax;
+ size_t k, kmax, minstrlen;
+ char *rtpname, searchname[12];
strcpy(searchname, name);
}
if (iter == niter - 1)
{
- minstrlen = min(strlen(searchname), strlen(rtpname));
+ minstrlen = std::min(strlen(searchname), strlen(rtpname));
for (k = 0; k < minstrlen; k++)
{
if (searchname[k] != rtpname[k])
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/pdb2top.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
void add_param(t_params *ps, int ai, int aj, real *c, char *s);
void add_imp_param(t_params *ps, int ai, int aj, int ak, int al,
int search_jtype(t_restp *rp, char *name, gmx_bool bFirstRes);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "calch.h"
+#include <cmath>
+
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/math/units.h"
#include "gromacs/math/utilities.h"
#undef BB
#undef CC
int m;
- rvec kkk;
/* This was copied from Gromos */
for (m = 0; (m < DIM); m++)
real s6, rij, ra, rb, xd;
int d;
- s6 = 0.5*sqrt(3.e0);
+ s6 = 0.5*std::sqrt(3.e0);
/* common work for constructing one, two or three dihedral hydrogens */
switch (nht)
sb[d] = xd-xAK[d];
rij += sqr(sij[d]);
}
- rij = sqrt(rij);
+ rij = std::sqrt(rij);
sa[XX] = sij[YY]*sb[ZZ]-sij[ZZ]*sb[YY];
sa[YY] = sij[ZZ]*sb[XX]-sij[XX]*sb[ZZ];
sa[ZZ] = sij[XX]*sb[YY]-sij[YY]*sb[XX];
sij[d] = sij[d]/rij;
ra += sqr(sa[d]);
}
- ra = sqrt(ra);
+ ra = std::sqrt(ra);
for (d = 0; (d < DIM); d++)
{
sa[d] = sa[d]/ra;
rij += sqr(sij[d]);
rb += sqr(sb[d]);
}
- rij = sqrt(rij);
- rb = sqrt(rb);
+ rij = std::sqrt(rij);
+ rb = std::sqrt(rb);
ra = 0.e0;
for (d = 0; (d < DIM); d++)
{
sa[d] = sij[d]/rij+sb[d]/rb;
ra += sqr(sa[d]);
}
- ra = sqrt(ra);
+ ra = std::sqrt(ra);
for (d = 0; (d < DIM); d++)
{
xH1[d] = xAI[d]+distH*sa[d]/ra;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
void calc_h_pos(int nht, rvec xa[], rvec xh[], int *l);
/*
* w.f. van gunsteren, groningen, july 1981
* l : dynamically changed index
*/
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "convparm.h"
-#include <math.h>
#include <string.h>
+#include <cmath>
+
#include "gromacs/gmxpreprocess/gpp_atomtype.h"
#include "gromacs/gmxpreprocess/topio.h"
#include "gromacs/gmxpreprocess/toputil.h"
return i;
}
-static void set_ljparams(int comb, double reppow, real v, real w,
+static void set_ljparams(int comb, double reppow, double v, double w,
real *c6, real *c12)
{
if (comb == eCOMB_ARITHMETIC || comb == eCOMB_GEOM_SIG_EPS)
{
if (v >= 0)
{
- *c6 = 4*w*pow(v, 6.0);
- *c12 = 4*w*pow(v, reppow);
+ *c6 = 4*w*std::pow(v, 6.0);
+ *c12 = 4*w*std::pow(v, reppow);
}
else
{
/* Interpret negative sigma as c6=0 and c12 with -sigma */
*c6 = 0;
- *c12 = 4*w*pow(-v, reppow);
+ *c12 = 4*w*std::pow(-v, reppow);
}
}
else
real old[MAXFORCEPARAM], int comb, double reppow)
{
int i, j;
- real tmp;
gmx_bool all_param_zero = TRUE;
/* Set to zero */
newparam->thole.alpha2 = old[2];
if ((old[1] > 0) && (old[2] > 0))
{
- newparam->thole.rfac = old[0]*pow(old[1]*old[2], -1.0/6.0);
+ newparam->thole.rfac = old[0]*std::pow(old[1]*old[2], static_cast<real>(-1.0/6.0));
}
else
{
newparam->vsiten.a = old[1];
break;
case F_CMAP:
- newparam->cmap.cmapA = old[0];
- newparam->cmap.cmapB = old[1];
+ newparam->cmap.cmapA = static_cast<int>(old[0]);
+ newparam->cmap.cmapB = static_cast<int>(old[1]);
break;
case F_GB12:
case F_GB13:
int comb, double reppow, real fudgeQQ,
gmx_mtop_t *mtop)
{
- int i, j, maxtypes, mt;
+ int i, maxtypes, mt;
unsigned long flags;
gmx_ffparams_t *ffp;
gmx_moltype_t *molt;
#include "gromacs/gmxpreprocess/grompp-impl.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
void convert_params(int atnr, t_params nbtypes[],
t_molinfo *mi,
t_molinfo *intermolecular_interactions,
int comb, double reppow, real fudgeQQ,
gmx_mtop_t *mtop);
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include <stdio.h>
-#include "gromacs/utility/basedefinitions.h"
-
-#ifdef __cplusplus
#include <vector>
+#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/datafilefinder.h"
/*! \brief
*/
std::vector<gmx::DataFileInfo> fflib_enumerate_forcefields();
-extern "C" {
-#endif
-
const char *fflib_forcefield_dir_ext();
/* Returns the name of the force field directory extension */
* either absolute or relative to the current dir.
*/
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "gen_ad.h"
#include <ctype.h>
-#include <math.h>
#include <stdlib.h>
#include <string.h>
+#include <cmath>
+
+#include <algorithm>
+
#include "gromacs/fileio/confio.h"
#include "gromacs/gmxpreprocess/gpp_nextnb.h"
#include "gromacs/gmxpreprocess/pgutil.h"
static int get_impropers(t_atoms *atoms, t_hackblock hb[], t_param **improper,
gmx_bool bAllowMissing)
{
- char *a0;
t_rbondeds *impropers;
- t_rbonded *hbimproper;
- int nimproper, i, j, k, r, start, ninc, nalloc;
+ int nimproper, i, j, k, start, ninc, nalloc;
atom_id ai[MAXATOMLIST];
gmx_bool bStop;
void clean_excls(t_nextnb *nnb, int nrexcl, t_excls excls[])
{
- int i, j, j1, k, k1, l, l1, m, n, e;
+ int i, j, j1, k, k1, l, l1, e;
t_excls *excl;
if (nrexcl >= 1)
void generate_excls(t_nextnb *nnb, int nrexcl, t_excls excls[])
{
- int i, j, j1, k, k1, l, l1, m, n, e, N;
+ int i, j, n, N;
t_excls *excl;
- for (N = 1; (N < min(nrexcl, nnb->nrex)); N++)
+ for (N = 1; (N < std::min(nrexcl, nnb->nrex)); N++)
{
/* extract all i-j-k-l neighbours from nnb struct */
for (i = 0; (i < nnb->nr); i++)
maxres = minres;
for (m = 1; m < 3; m++)
{
- minres = min(minres, atoms->atom[ang[nang].a[m]].resind);
- maxres = max(maxres, atoms->atom[ang[nang].a[m]].resind);
+ minres = std::min(minres, atoms->atom[ang[nang].a[m]].resind);
+ maxres = std::max(maxres, atoms->atom[ang[nang].a[m]].resind);
}
res = 2*minres-maxres;
do
maxres = minres;
for (m = 1; m < 4; m++)
{
- minres = min(minres, atoms->atom[dih[ndih].a[m]].resind);
- maxres = max(maxres, atoms->atom[dih[ndih].a[m]].resind);
+ minres = std::min(minres, atoms->atom[dih[ndih].a[m]].resind);
+ maxres = std::max(maxres, atoms->atom[dih[ndih].a[m]].resind);
}
res = 2*minres-maxres;
do
}
if (nbd == 3)
{
- i1 = min(i, l1);
- i2 = max(i, l1);
+ i1 = std::min(i, l1);
+ i2 = std::max(i, l1);
bExcl = FALSE;
for (m = 0; m < excls[i1].nr; m++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/toputil.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
void generate_excls(t_nextnb *nnb, int nrexcl, t_excls excls[]);
void clean_excls(t_nextnb *nnb, int nrexcl, t_excls excls[]);
t_params plist[], t_excls excls[], t_hackblock hb[],
gmx_bool bAllowMissing);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gen_maxwell_velocities.h"
-#include <math.h>
+#include <cmath>
#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/math/units.h"
mass = atom->m;
if (mass > 0)
{
- sd = sqrt(boltz/mass);
+ sd = std::sqrt(boltz/mass);
for (m = 0; (m < DIM); m++)
{
v[i][m] = sd*gmx_rng_gaussian_real(rng);
temp = (2.0*ekin)/(nrdf*BOLTZ);
if (temp > 0)
{
- scal = sqrt(tempi/temp);
+ scal = std::sqrt(tempi/temp);
for (i = 0; (i < mtop->natoms); i++)
{
for (m = 0; (m < DIM); m++)
void maxwell_speed(real tempi, unsigned int seed, gmx_mtop_t *mtop, rvec v[])
{
- atom_id *dummy;
- int i;
gmx_rng_t rng;
if (seed == 0)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/*! \brief
* Generate Maxwellian velocities.
*
*/
void stop_cm(FILE *log, int natoms, real mass[], rvec x[], rvec v[]);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gen_vsite.h"
-#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <cmath>
+
#include "gromacs/gmxpreprocess/add_par.h"
#include "gromacs/gmxpreprocess/fflibutil.h"
#include "gromacs/gmxpreprocess/gpp_atomtype.h"
FILE *ddb;
char dirstr[STRLEN];
char pline[STRLEN];
- int i, j, n, k, nvsite, ntop, curdir, prevdir;
+ int i, n, k, nvsite, ntop, curdir;
t_vsiteconf *vsiteconflist;
t_vsitetop *vsitetoplist;
char *ch;
int Heavy, int nrHatoms, int Hatoms[],
int nrheavies, int heavies[])
{
- int i, j, ftype, other, moreheavy, bb;
+ int i, j, ftype, other, moreheavy;
gmx_bool bSwapParity;
for (i = 0; i < nrHatoms; i++)
int i, nvsite;
real a, b, dCGCE, tmp1, tmp2, mtot, mG, mrest;
- real xCG, yCG, xCE1, yCE1, xCE2, yCE2;
+ real xCG;
/* CG, CE1 and CE2 stay and each get a part of the total mass,
* so the c-o-m stays the same.
*/
}
/* constraints between CG, CE1 and CE2: */
- dCGCE = sqrt( cosrule(bond_cc, bond_cc, ANGLE_6RING) );
+ dCGCE = std::sqrt( cosrule(bond_cc, bond_cc, ANGLE_6RING) );
my_add_param(&(plist[F_CONSTRNC]), ats[atCG], ats[atCE1], dCGCE);
my_add_param(&(plist[F_CONSTRNC]), ats[atCG], ats[atCE2], dCGCE);
my_add_param(&(plist[F_CONSTRNC]), ats[atCE1], ats[atCE2], dCGCE);
* the CE1-CE2 bond and y=0 at the line from CG to the middle of CE1-CE2 bond.
*/
xCG = -bond_cc+bond_cc*cos(ANGLE_6RING);
- yCG = 0;
- xCE1 = 0;
- yCE1 = bond_cc*sin(0.5*ANGLE_6RING);
- xCE2 = 0;
- yCE2 = -bond_cc*sin(0.5*ANGLE_6RING);
mG = at->atom[ats[atCG]].m = at->atom[ats[atCG]].mB = xcom*mtot/xCG;
mrest = mtot-mG;
atCG, atCD1, atHD1, atCD2, atHD2, atCE1, atHE1, atCE2, atHE2,
atCZ, atHZ, atNR
};
- real x[atNR], y[atNR];
+ real x[atNR];
/* Aromatic rings have 6-fold symmetry, so we only need one bond length.
* (angle is always 120 degrees).
*/
bond_ch = get_ddb_bond(vsitetop, nvsitetop, "PHE", "CD1", "HD1");
x[atCG] = -bond_cc+bond_cc*cos(ANGLE_6RING);
- y[atCG] = 0;
x[atCD1] = -bond_cc;
- y[atCD1] = bond_cc*sin(0.5*ANGLE_6RING);
x[atHD1] = x[atCD1]+bond_ch*cos(ANGLE_6RING);
- y[atHD1] = y[atCD1]+bond_ch*sin(ANGLE_6RING);
x[atCE1] = 0;
- y[atCE1] = y[atCD1];
x[atHE1] = x[atCE1]-bond_ch*cos(ANGLE_6RING);
- y[atHE1] = y[atCE1]+bond_ch*sin(ANGLE_6RING);
x[atCD2] = x[atCD1];
- y[atCD2] = -y[atCD1];
x[atHD2] = x[atHD1];
- y[atHD2] = -y[atHD1];
x[atCE2] = x[atCE1];
- y[atCE2] = -y[atCE1];
x[atHE2] = x[atHE1];
- y[atHE2] = -y[atHE1];
x[atCZ] = bond_cc*cos(0.5*ANGLE_6RING);
- y[atCZ] = 0;
x[atHZ] = x[atCZ]+bond_ch;
- y[atHZ] = 0;
xcom = mtot = 0;
for (i = 0; i < atNR; i++)
* virtual site coordinates here.
*/
real dx_ij, dx_ik, dy_ij, dy_ik;
- real b_ij, b_ik;
dx_ij = xj-xi;
dy_ij = yj-yi;
dx_ik = xk-xi;
dy_ik = yk-yi;
- b_ij = sqrt(dx_ij*dx_ij+dy_ij*dy_ij);
- b_ik = sqrt(dx_ik*dx_ik+dy_ik*dy_ik);
*a = ( (xd-xi)*dy_ik - dx_ik*(yd-yi) ) / (dx_ij*dy_ik - dx_ik*dy_ij);
*b = ( yd - yi - (*a)*dy_ij ) / dy_ik;
};
real xi[atNR], yi[atNR];
- real xcom[NMASS], ycom[NMASS], I, alpha;
- real lineA, lineB, dist;
+ real xcom[NMASS], ycom[NMASS], alpha;
real b_CD2_CE2, b_NE1_CE2, b_CG_CD2, b_CH2_HH2, b_CE2_CZ2;
real b_NE1_HE1, b_CD2_CE3, b_CE3_CZ3, b_CB_CG;
real b_CZ2_CH2, b_CZ2_HZ2, b_CD1_HD1, b_CE3_HE3;
real b_CG_CD1, b_CZ3_HZ3;
real a_NE1_CE2_CD2, a_CE2_CD2_CG, a_CB_CG_CD2, a_CE2_CD2_CE3;
- real a_CB_CG_CD1, a_CD2_CG_CD1, a_CE2_CZ2_HZ2, a_CZ2_CH2_HH2;
+ real a_CD2_CG_CD1, a_CE2_CZ2_HZ2, a_CZ2_CH2_HH2;
real a_CD2_CE2_CZ2, a_CD2_CE3_CZ3, a_CE3_CZ3_HZ3, a_CG_CD1_HD1;
real a_CE2_CZ2_CH2, a_HE1_NE1_CE2, a_CD2_CE3_HE3;
- real xM[NMASS];
int atM[NMASS], tpM, i, i0, j, nvsite;
- real mwtot, mtot, mM[NMASS], dCBM1, dCBM2, dM1M2;
- real a, b, c[MAXFORCEPARAM];
+ real mM[NMASS], dCBM1, dCBM2, dM1M2;
+ real a, b;
rvec r_ij, r_ik, t1, t2;
char name[10];
a_CE2_CD2_CG = DEG2RAD*get_ddb_angle(vsitetop, nvsitetop, "TRP", "CE2", "CD2", "CG");
a_CB_CG_CD2 = DEG2RAD*get_ddb_angle(vsitetop, nvsitetop, "TRP", "CB", "CG", "CD2");
a_CD2_CG_CD1 = DEG2RAD*get_ddb_angle(vsitetop, nvsitetop, "TRP", "CD2", "CG", "CD1");
- a_CB_CG_CD1 = DEG2RAD*get_ddb_angle(vsitetop, nvsitetop, "TRP", "CB", "CG", "CD1");
+ /*a_CB_CG_CD1 = DEG2RAD*get_ddb_angle(vsitetop, nvsitetop, "TRP", "CB", "CG", "CD1"); unused */
a_CE2_CD2_CE3 = DEG2RAD*get_ddb_angle(vsitetop, nvsitetop, "TRP", "CE2", "CD2", "CE3");
a_CD2_CE2_CZ2 = DEG2RAD*get_ddb_angle(vsitetop, nvsitetop, "TRP", "CD2", "CE2", "CZ2");
xi[atHH2] = xi[atCH2]+b_CH2_HH2*sin(alpha);
yi[atHH2] = yi[atCH2]-b_CH2_HH2*cos(alpha);
- /* Determine coeff. for the line CB-CG */
- lineA = (yi[atCB]-yi[atCG])/(xi[atCB]-xi[atCG]);
- lineB = yi[atCG]-lineA*xi[atCG];
-
/* Calculate masses for each ring and put it on the dummy masses */
for (j = 0; j < NMASS; j++)
{
/* constraints between CB, M1 and M2 */
/* 'add_shift' says which atoms won't be renumbered afterwards */
- dCBM1 = sqrt( sqr(xcom[0]-xi[atCB]) + sqr(ycom[0]-yi[atCB]) );
- dM1M2 = sqrt( sqr(xcom[0]-xcom[1]) + sqr(ycom[0]-ycom[1]) );
- dCBM2 = sqrt( sqr(xcom[1]-xi[atCB]) + sqr(ycom[1]-yi[atCB]) );
+ dCBM1 = std::sqrt( sqr(xcom[0]-xi[atCB]) + sqr(ycom[0]-yi[atCB]) );
+ dM1M2 = std::sqrt( sqr(xcom[0]-xcom[1]) + sqr(ycom[0]-ycom[1]) );
+ dCBM2 = std::sqrt( sqr(xcom[1]-xi[atCB]) + sqr(ycom[1]-yi[atCB]) );
my_add_param(&(plist[F_CONSTRNC]), ats[atCB], add_shift+atM[0], dCBM1);
my_add_param(&(plist[F_CONSTRNC]), ats[atCB], add_shift+atM[1], dCBM2);
my_add_param(&(plist[F_CONSTRNC]), add_shift+atM[0], add_shift+atM[1], dM1M2);
real dCGCE, dCEOH, dCGM, tmp1, a, b;
real bond_cc, bond_ch, bond_co, bond_oh, angle_coh;
real xcom, mtot;
- real vmass, vdist, mM;
+ real vdist, mM;
rvec r1;
char name[10];
atCG, atCD1, atHD1, atCD2, atHD2, atCE1, atHE1, atCE2, atHE2,
atCZ, atOH, atHH, atNR
};
- real xi[atNR], yi[atNR];
+ real xi[atNR];
/* CG, CE1, CE2 (as in general 6-ring) and OH and HH stay,
rest gets virtualized.
Now we have two linked triangles with one improper keeping them flat */
angle_coh = DEG2RAD*get_ddb_angle(vsitetop, nvsitetop, "TYR", "CZ", "OH", "HH");
xi[atCG] = -bond_cc+bond_cc*cos(ANGLE_6RING);
- yi[atCG] = 0;
xi[atCD1] = -bond_cc;
- yi[atCD1] = bond_cc*sin(0.5*ANGLE_6RING);
xi[atHD1] = xi[atCD1]+bond_ch*cos(ANGLE_6RING);
- yi[atHD1] = yi[atCD1]+bond_ch*sin(ANGLE_6RING);
xi[atCE1] = 0;
- yi[atCE1] = yi[atCD1];
xi[atHE1] = xi[atCE1]-bond_ch*cos(ANGLE_6RING);
- yi[atHE1] = yi[atCE1]+bond_ch*sin(ANGLE_6RING);
xi[atCD2] = xi[atCD1];
- yi[atCD2] = -yi[atCD1];
xi[atHD2] = xi[atHD1];
- yi[atHD2] = -yi[atHD1];
xi[atCE2] = xi[atCE1];
- yi[atCE2] = -yi[atCE1];
xi[atHE2] = xi[atHE1];
- yi[atHE2] = -yi[atHE1];
xi[atCZ] = bond_cc*cos(0.5*ANGLE_6RING);
- yi[atCZ] = 0;
xi[atOH] = xi[atCZ]+bond_co;
- yi[atOH] = 0;
xcom = mtot = 0;
for (i = 0; i < atOH; i++)
at->atom[ats[atCZ]].m = at->atom[ats[atCZ]].mB = 0;
/* constraints between CE1, CE2 and OH */
- dCGCE = sqrt( cosrule(bond_cc, bond_cc, ANGLE_6RING) );
- dCEOH = sqrt( cosrule(bond_cc, bond_co, ANGLE_6RING) );
+ dCGCE = std::sqrt( cosrule(bond_cc, bond_cc, ANGLE_6RING) );
+ dCEOH = std::sqrt( cosrule(bond_cc, bond_co, ANGLE_6RING) );
my_add_param(&(plist[F_CONSTRNC]), ats[atCE1], ats[atOH], dCEOH);
my_add_param(&(plist[F_CONSTRNC]), ats[atCE2], ats[atOH], dCEOH);
nvsite++;
/* assume we also want the COH angle constrained: */
tmp1 = bond_cc*cos(0.5*ANGLE_6RING) + dCGCE*sin(ANGLE_6RING*0.5) + bond_co;
- dCGM = sqrt( cosrule(tmp1, vdist, angle_coh) );
+ dCGM = std::sqrt( cosrule(tmp1, vdist, angle_coh) );
my_add_param(&(plist[F_CONSTRNC]), ats[atCG], add_shift+atM, dCGM);
my_add_param(&(plist[F_CONSTRNC]), ats[atOH], add_shift+atM, vdist);
}
/* constraints between CG, CE1 and NE1 */
- dCGCE1 = sqrt( cosrule(b_CG_ND1, b_ND1_CE1, a_CG_ND1_CE1) );
- dCGNE2 = sqrt( cosrule(b_CG_CD2, b_CD2_NE2, a_CG_CD2_NE2) );
+ dCGCE1 = std::sqrt( cosrule(b_CG_ND1, b_ND1_CE1, a_CG_ND1_CE1) );
+ dCGNE2 = std::sqrt( cosrule(b_CG_CD2, b_CD2_NE2, a_CG_CD2_NE2) );
my_add_param(&(plist[F_CONSTRNC]), ats[atCG], ats[atCE1], dCGCE1);
my_add_param(&(plist[F_CONSTRNC]), ats[atCG], ats[atNE2], dCGNE2);
y[atCE1] = cosalpha*dCGCE1;
x[atNE2] = 0;
y[atNE2] = y[atCE1]-b_CE1_NE2;
- sinalpha = sqrt(1-cosalpha*cosalpha);
+ sinalpha = std::sqrt(1-cosalpha*cosalpha);
x[atCG] = -sinalpha*dCGCE1;
y[atCG] = 0;
x[atHE1] = x[atHE2] = x[atHD1] = x[atHD2] = 0;
int i, j, k, m, i0, ni0, whatres, resind, add_shift, ftype, nvsite, nadd;
int ai, aj, ak, al;
int nrfound = 0, needed, nrbonds, nrHatoms, Heavy, nrheavies, tpM, tpHeavy;
- int Hatoms[4], heavies[4], bb;
+ int Hatoms[4], heavies[4];
gmx_bool bWARNING, bAddVsiteParam, bFirstWater;
matrix tmpmat;
gmx_bool *bResProcessed;
mHtot *= mHmult;
}
fact2 = mHtot/mtot;
- fact = sqrt(fact2);
+ fact = std::sqrt(fact2);
/* generate vectors parallel and perpendicular to rotational axis:
* rpar = Heavy -> Hcom
* rperp = Hcom -> H1 */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/hackblock.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
/* stuff for pdb2gmx */
void do_vsites(int nrtp, t_restp rtp[], gpp_atomtype_t atype,
void do_h_mass(t_params *psb, int vsite_type[], t_atoms *at, real mHmult,
gmx_bool bDeuterate);
-#ifdef __cplusplus
-}
-#endif
-
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_GMXPREPROCESS_GENCONF_H
#define GMX_GMXPREPROCESS_GENCONF_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
int gmx_genconf(int argc, char *argv[]);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
static void expand_hackblocks_one(t_hackblock *hbr, char *atomname,
int *nabi, t_hack **abi, gmx_bool bN, gmx_bool bC)
{
- int j, k, l, d;
+ int j, k, l;
gmx_bool bIgnore;
/* we'll recursively add atoms to atoms */
static int check_atoms_present(t_atoms *pdba, int nab[], t_hack *ab[])
{
- int i, j, k, d, rnr, nadd;
+ int i, j, k, rnr, nadd;
nadd = 0;
for (i = 0; i < pdba->nr; i++)
{
t_atoms *newpdba = NULL, *pdba = NULL;
int nadd;
- int i, newi, j, d, natoms, nalreadypresent;
+ int i, newi, j, natoms, nalreadypresent;
int *nab = NULL;
t_hack **ab = NULL;
t_hackblock *hb;
}
*pdbaptr = newpdba;
}
- else
- {
- nadd = newi-natoms;
- }
sfree(*xptr);
*xptr = xn;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/fileio/pdbio.h"
#include "gromacs/gmxpreprocess/hackblock.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
int add_h(t_atoms **pdbaptr, rvec *xptr[],
int nah, t_hackblock ah[],
int nterpairs,
* removed
*/
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include <ctype.h>
#include <errno.h>
#include <limits.h>
-#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <cmath>
+
+#include <algorithm>
+
#include <sys/types.h>
#include "gromacs/legacyheaders/macros.h"
int cpp_open_file(const char *filenm, gmx_cpp_t *handle, char **cppopts)
{
gmx_cpp_t cpp;
- char *buf, *pdum;
+ char *buf;
char *ptr, *ptr2;
int i;
- unsigned int i1;
/* First process options, they might be necessary for opening files
(especially include statements). */
/* Make a linked list of open files and move on to the include file */
handle->child->parent = handle;
*handlep = handle->child;
- handle = *handlep;
return eCPP_OK;
}
}
if (nn > 0)
{
- len = strlen(buf) + nn*max(4, 4+strlen(defs[i].def)-strlen(defs[i].name));
+ size_t four = 4;
+
+ len = strlen(buf) + nn*std::max(four, four+strlen(defs[i].def)-strlen(defs[i].name));
snew(name, len);
ptr = buf;
while ((ptr2 = strstrw(ptr, defs[i].name)) != NULL)
/* Close the file! Return integer status. */
int cpp_close_file(gmx_cpp_t *handlep)
{
- int i;
gmx_cpp_t handle = (gmx_cpp_t)*handlep;
if (!handle)
#ifndef GMX_GMXPREPROCESS_GMXCPP_H
#define GMX_GMXPREPROCESS_GMXCPP_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct gmx_cpp *gmx_cpp_t;
/* The possible return codes for these functions */
*/
char *cpp_error(gmx_cpp_t *handlep, int status);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gpp_atomtype.h"
-#include <math.h>
#include <string.h>
+#include <cmath>
+
#include "gromacs/gmxpreprocess/topdirs.h"
#include "gromacs/gmxpreprocess/toputil.h"
#include "gromacs/legacyheaders/txtdump.h"
int add_atomtype(gpp_atomtype_t ga, t_symtab *tab,
t_atom *a, const char *name, t_param *nb,
int bondatomtype,
- real radius, real vol, real surftens, real atomnumber,
+ real radius, real vol, real surftens, int atomnumber,
real gb_radius, real S_hct)
{
int i;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/grompp-impl.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct gpp_atomtype *gpp_atomtype_t;
int get_atomtype_type(const char *str, gpp_atomtype_t at);
int add_atomtype(gpp_atomtype_t at, struct t_symtab *tab,
t_atom *a, const char *name, t_param *nb,
int bondatomtype,
- real radius, real vol, real surftens, real atomnumber,
+ real radius, real vol, real surftens, int atomnumber,
real gb_radius, real S_hct);
/* Add a complete new atom type to an existing atomtype structure. Returns
the number of the atom type. */
void copy_atomtype_atomtypes(gpp_atomtype_t atype, t_atomtypes *atypes);
/* Copy from one structure to another */
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct gpp_bondatomtype *t_bond_atomtype;
int get_bond_atomtype_type(char *str, t_bond_atomtype at);
char *name);
/* Add a complete new atom type to an existing atomtype structure */
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
void generate_excl (int nrexcl, int nratoms, t_params plist[], t_nextnb *nnb, t_blocka *excl)
{
- int i, j, k;
-
if (nrexcl < 0)
{
gmx_fatal(FARGS, "Can't have %d exclusions...", nrexcl);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/grompp-impl.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct {
int nr; /* nr atoms (0 <= i < nr) (atoms->nr) */
int nrex; /* with nrex lists of neighbours */
* plist.
*/
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#define MAXSLEN 32
typedef struct {
* non-bonded parameter combinations, which will be copied to t_params.
*/
-#ifndef __cplusplus
/*
* With the macros below you don't
* have to use an index if you don't wan't to. You can eg. use
#define C0 c[0]
#define C1 c[1]
#define C2 c[2]
-#endif
typedef struct {
atom_id a[MAXATOMLIST]; /* The atom list (eg. bonds: particle */
d_none
} directive;
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "grompp.h"
-#include <assert.h>
#include <errno.h>
#include <limits.h>
-#include <math.h>
#include <string.h>
+#include <cmath>
+
+#include <algorithm>
+
#include <sys/types.h>
#include "gromacs/commandline/pargs.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/futil.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/snprintf.h"
maxsize = 0;
for (cg = 0; cg < cgs->nr; cg++)
{
- maxsize = max(maxsize, cgs->index[cg+1]-cgs->index[cg]);
+ maxsize = std::max(maxsize, cgs->index[cg+1]-cgs->index[cg]);
}
if (maxsize > MAX_CHARGEGROUP_SIZE)
if (debug)
{
fprintf(debug, "fc %g m1 %g m2 %g period %g\n",
- fc, m1, m2, sqrt(period2));
+ fc, m1, m2, std::sqrt(period2));
}
if (period2 < limit2)
{
*w_moltype->name,
w_a1+1, *w_moltype->atoms.atomname[w_a1],
w_a2+1, *w_moltype->atoms.atomname[w_a2],
- sqrt(w_period2), bWarn ? min_steps_warn : min_steps_note, dt,
+ std::sqrt(w_period2), bWarn ? min_steps_warn : min_steps_note, dt,
bWater ?
"Maybe you asked for fexible water." :
"Maybe you forgot to change the constraints mdp option.");
rvec com,
warninp_t wi)
{
- gmx_bool bFirst = TRUE, *hadAtom;
+ gmx_bool *hadAtom;
rvec *x, *v, *xp;
dvec sum;
double totmass;
get_stx_coordnum(fn, &natoms);
if (natoms != mtop->natoms)
{
- sprintf(warn_buf, "The number of atoms in %s (%d) does not match the number of atoms in the topology (%d). Will assume that the first %d atoms in the topology and %s match.", fn, natoms, mtop->natoms, min(mtop->natoms, natoms), fn);
+ sprintf(warn_buf, "The number of atoms in %s (%d) does not match the number of atoms in the topology (%d). Will assume that the first %d atoms in the topology and %s match.", fn, natoms, mtop->natoms, std::min(mtop->natoms, natoms), fn);
warning(wi, warn_buf);
}
snew(x, natoms);
if (rc_scaling != erscNO)
{
- assert(npbcdim <= DIM);
+ GMX_ASSERT(npbcdim <= DIM, "Only DIM dimensions can have PBC");
for (mb = 0; mb < mtop->nmolblock; mb++)
{
rvec com, rvec comB,
warninp_t wi)
{
- int i, j;
-
read_posres (mtop, mi, FALSE, fnA, rc_scaling, ePBC, com, wi);
/* It is safer to simply read the b-state posres rather than trying
* to be smart and copy the positions.
int ix;
double a, b;
- ix = (x-xmin)/dx;
+ ix = static_cast<int>((x-xmin)/dx);
a = (xmin+(ix+1)*dx-x)/dx;
b = (x-xmin-ix*dx)/dx;
void init_cmap_grid(gmx_cmap_t *cmap_grid, int ngrid, int grid_spacing)
{
- int i, k, nelem;
+ int i, nelem;
cmap_grid->ngrid = ngrid;
cmap_grid->grid_spacing = grid_spacing;
const t_inputrec *ir,
rvec *v)
{
- double sum_mv2;
gmx_mtop_atomloop_all_t aloop;
t_atom *atom;
int a;
- int nrdf, g;
-
- sum_mv2 = 0;
+ double sum_mv2 = 0;
aloop = gmx_mtop_atomloop_all_init(mtop);
while (gmx_mtop_atomloop_all_next(aloop, &a, &atom))
{
sum_mv2 += atom->m*norm2(v[a]);
}
- nrdf = 0;
- for (g = 0; g < ir->opts.ngtc; g++)
+ double nrdf = 0;
+ for (int g = 0; g < ir->opts.ngtc; g++)
{
nrdf += ir->opts.nrdf[g];
}
}
else
{
- ref_t = max(ref_t, ir->opts.ref_t[i]);
+ ref_t = std::max(ref_t, ir->opts.ref_t[i]);
}
}
matrix box,
warninp_t wi)
{
- int i;
verletbuf_list_setup_t ls;
real rlist_1x1;
int n_nonlin_vsite;
}
printf("Calculated rlist for %dx%d atom pair-list as %.3f nm, buffer size %.3f nm\n",
- 1, 1, rlist_1x1, rlist_1x1-max(ir->rvdw, ir->rcoulomb));
+ 1, 1, rlist_1x1, rlist_1x1-std::max(ir->rvdw, ir->rcoulomb));
ir->rlistlong = ir->rlist;
printf("Set rlist, assuming %dx%d atom pair-list, to %.3f nm, buffer size %.3f nm\n",
ls.cluster_size_i, ls.cluster_size_j,
- ir->rlist, ir->rlist-max(ir->rvdw, ir->rcoulomb));
+ ir->rlist, ir->rlist-std::max(ir->rvdw, ir->rcoulomb));
printf("Note that mdrun will redetermine rlist based on the actual pair-list setup\n");
if (sqr(ir->rlistlong) >= max_cutoff2(ir->ePBC, box))
{
- gmx_fatal(FARGS, "The pair-list cut-off (%g nm) is longer than half the shortest box vector or longer than the smallest box diagonal element (%g nm). Increase the box size or decrease nstlist or increase verlet-buffer-tolerance.", ir->rlistlong, sqrt(max_cutoff2(ir->ePBC, box)));
+ gmx_fatal(FARGS, "The pair-list cut-off (%g nm) is longer than half the shortest box vector or longer than the smallest box diagonal element (%g nm). Increase the box size or decrease nstlist or increase verlet-buffer-tolerance.", ir->rlistlong, std::sqrt(max_cutoff2(ir->ePBC, box)));
}
}
t_molinfo *mi, *intermolecular_interactions;
gpp_atomtype_t atype;
t_inputrec *ir;
- int natoms, nvsite, comb, mt;
+ int nvsite, comb, mt;
t_params *plist;
t_state *state;
matrix box;
- real max_spacing, fudgeQQ;
+ real fudgeQQ;
double reppow;
char fn[STRLEN], fnB[STRLEN];
const char *mdparin;
int ntype;
gmx_bool bNeedVel, bGenVel;
gmx_bool have_atomnumber;
- int n12, n13, n14;
- t_params *gb_plist = NULL;
- gmx_genborn_t *born = NULL;
output_env_t oenv;
gmx_bool bVerbose = FALSE;
warninp_t wi;
char warn_buf[STRLEN];
- unsigned int useed;
- t_atoms IMDatoms; /* Atoms to be operated on interactively (IMD) */
t_filenm fnm[] = {
{ efMDP, NULL, NULL, ffREAD },
if (ir->ld_seed == -1)
{
ir->ld_seed = (gmx_int64_t)gmx_rng_make_seed();
- fprintf(stderr, "Setting the LD random seed to %"GMX_PRId64 "\n", ir->ld_seed);
+ fprintf(stderr, "Setting the LD random seed to %" GMX_PRId64 "\n", ir->ld_seed);
}
if (ir->expandedvals->lmc_seed == -1)
if (bRenum)
{
renum_atype(plist, sys, ir->wall_atomtype, atype, bVerbose);
- ntype = get_atomtype_ntypes(atype);
+ get_atomtype_ntypes(atype);
}
if (ir->implicit_solvent != eisNO)
}
do_index(mdparin, ftp2fn_null(efNDX, NFILE, fnm),
sys, bVerbose, ir,
- bGenVel ? state->v : NULL,
wi);
if (ir->cutoff_scheme == ecutsVERLET && ir->verletbuf_tol > 0 &&
set_warning_line(wi, mdparin, -1);
warning_error(wi, "Some of the Fourier grid sizes are set, but all of them need to be set.");
}
- max_spacing = calc_grid(stdout, box, ir->fourier_spacing,
- &(ir->nkx), &(ir->nky), &(ir->nkz));
+ calc_grid(stdout, box, ir->fourier_spacing,
+ &(ir->nkx), &(ir->nky), &(ir->nkz));
}
/* MRS: eventually figure out better logic for initializing the fep
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_GMXPREPROCESS_GROMPP_H
#define GMX_GMXPREPROCESS_GROMPP_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-#if 0
-}
-#endif
-
int gmx_grompp(int argc, char *argv[]);
-#ifdef __cplusplus
-}
-#endif
-
#endif
}
gmx_ffclose(in);
- /* Sort the list (necessary to be able to use bsearch */
- qsort(aah, nah, (size_t)sizeof(**ah), compaddh);
+ if (nah > 0)
+ {
+ /* Sort the list (necessary to be able to use bsearch */
+ qsort(aah, nah, (size_t)sizeof(**ah), compaddh);
+ }
/*
if (debug)
int nhdbf, f;
char **hdbf;
int nah;
- FILE *fp;
/* Read the hydrogen database file(s).
* Do not generate an error when no files are found.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/hackblock.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* functions for the h-database */
void read_ab(char *line, const char *fn, t_hack *ab);
t_hackblock *search_h_db(int nh, t_hackblock ah[], char *key);
/* Search for an entry in the database */
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/topology/symtab.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Used for reading .rtp/.tdb */
/* ebtsBONDS must be the first, new types can be added to the end */
/* these *MUST* correspond to the arrays in hackblock.c */
void init_t_protonate(t_protonate *protonate);
/* initialize t_protein struct */
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <stdio.h>
#include <string.h>
+#include <cmath>
+
#include "gromacs/fileio/pdbio.h"
#include "gromacs/gmxpreprocess/pdb2top.h"
#include "gromacs/gmxpreprocess/toputil.h"
pdba->resinfo[pdba->atom[i].resind].nr, *pdba->atomname[i],
*pdba->resinfo[pdba->atom[aj].resind].name,
pdba->resinfo[pdba->atom[aj].resind].nr, *pdba->atomname[aj],
- sqrt(d2), a);
+ std::sqrt(d2), a);
}
hbond[i] = TRUE;
bHB = TRUE;
#define NPD asize(prot_don)
gmx_bool *donor, *acceptor;
- gmx_bool *hbond, bHaveH = FALSE;
+ gmx_bool *hbond;
gmx_bool bHDd, bHEd;
rvec xh1, xh2;
int natom;
- int i, j, nd, na, aj, hisind, his0, type = -1;
+ int i, j, nd, na, hisind, type = -1;
int nd1, ne2, cg, cd2, ce1;
t_blocka *hb;
- real d;
char *atomnm;
natom = pdba->nr;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_GMXPREPROCESS_HIZZIE_H
#define GMX_GMXPREPROCESS_HIZZIE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
void set_histp(t_atoms *pdba, rvec *x, real angle, real distance);
/* calculate HIStidine protonation state */
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include <string.h>
+#include <algorithm>
+
#include "gromacs/fileio/confio.h"
#include "gromacs/gmxpreprocess/fflibutil.h"
#include "gromacs/gmxpreprocess/gpp_atomtype.h"
char format[128], f1[128];
char buf[1024], elem[16], type[16], nbbuf[16], **newbuf;
int i, nb, nnnm, line = 1;
- double qq, mm, *blen;
+ double qq, mm;
t_nm2type *nm2t = NULL;
fp = fflib_open(fn);
int cur = 0;
#define prev (1-cur)
int i, j, k, m, n, nresolved, nb, maxbond, ai, aj, best, im, nqual[2][ematchNR];
- int *bbb, *n_mask, *m_mask, **match, **quality;
+ int *bbb, *n_mask, *m_mask, **match;
char *aname_i, *aname_m, *aname_n, *type;
double qq, mm;
t_param *param;
maxbond = 0;
for (i = 0; (i < atoms->nr); i++)
{
- maxbond = max(maxbond, nbonds[i]);
+ maxbond = std::max(maxbond, nbonds[i]);
}
if (debug)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/grompp-impl.h"
#include "gromacs/topology/atoms.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct {
char *elem, *type;
double q, m;
* with help of the bond list
*/
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/dir_separator.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
#define RTP_MAXCHAR 5
int nrr, rtprename_t *rr, t_symtab *symtab,
gmx_bool bVerbose)
{
- int r, i, j;
+ int r, j;
gmx_bool bStart, bEnd;
char *nn;
gmx_bool bFFRTPTERRNM;
rvec **xnew;
int i, j;
t_restp *rptr;
- t_hackblock *hbr;
t_pdbindex *pdbi;
atom_id *a;
char *atomnm;
{
pdba->atom[j] = pdba->atom[j+1];
pdba->atomname[j] = pdba->atomname[j+1];
- pdba->pdbinfo[j] = pdba->pdbinfo[j+1];
+ if (pdba->pdbinfo)
+ {
+ pdba->pdbinfo[j] = pdba->pdbinfo[j+1];
+ }
copy_rvec(x[j+1], x[j]);
}
srenew(pdba->atom, pdba->nr);
}
-static void
-modify_chain_numbers(t_atoms * pdba,
- const char * chainsep)
+enum SplittingType
{
- int i;
- char old_prev_chainid;
- char old_this_chainid;
- int old_prev_chainnum;
- int old_this_chainnum;
- t_resinfo *ri;
- char select[STRLEN];
- int new_chainnum;
- int this_atomnum;
- int prev_atomnum;
- const char * prev_atomname;
- const char * this_atomname;
- const char * prev_resname;
- const char * this_resname;
- int prev_resnum;
- int this_resnum;
- char prev_chainid;
- char this_chainid;
- int prev_chainnumber;
- int this_chainnumber;
-
- enum
- {
- SPLIT_ID_OR_TER,
- SPLIT_ID_AND_TER,
- SPLIT_ID_ONLY,
- SPLIT_TER_ONLY,
- SPLIT_INTERACTIVE
- }
- splitting;
-
- splitting = SPLIT_TER_ONLY; /* keep compiler happy */
+ SPLIT_ID_OR_TER,
+ SPLIT_ID_AND_TER,
+ SPLIT_ID_ONLY,
+ SPLIT_TER_ONLY,
+ SPLIT_INTERACTIVE
+};
+
+static SplittingType getSplittingType(const char *chainsep)
+{
+ SplittingType splitting = SPLIT_TER_ONLY; /* keep compiler happy */
/* Be a bit flexible to catch typos */
if (!strncmp(chainsep, "id_o", 4))
{
gmx_fatal(FARGS, "Unidentified setting for chain separation: %s\n", chainsep);
}
+ return splitting;
+}
+
+static void
+modify_chain_numbers(t_atoms * pdba,
+ const char * chainsep)
+{
+ int i;
+ char old_prev_chainid;
+ char old_this_chainid;
+ int old_prev_chainnum;
+ int old_this_chainnum;
+ t_resinfo *ri;
+ char select[STRLEN];
+ int new_chainnum;
+ int this_atomnum;
+ int prev_atomnum;
+ const char * prev_atomname;
+ const char * this_atomname;
+ const char * prev_resname;
+ const char * this_resname;
+ int prev_resnum;
+ int this_resnum;
+ char prev_chainid;
+ char this_chainid;
+
+ SplittingType splitting = getSplittingType(chainsep);
/* The default chain enumeration is based on TER records only, which is reflected in chainnum below */
this_resname = NULL;
this_resnum = -1;
this_chainid = '?';
- this_chainnumber = -1;
for (i = 0; i < pdba->nres; i++)
{
prev_resname = this_resname;
prev_resnum = this_resnum;
prev_chainid = this_chainid;
- prev_chainnumber = this_chainnumber;
this_atomname = *(pdba->atomname[i]);
this_atomnum = (pdba->pdbinfo != NULL) ? pdba->pdbinfo[i].atomnr : i+1;
this_resname = *ri->name;
this_resnum = ri->nr;
this_chainid = ri->chainid;
- this_chainnumber = ri->chainnum;
switch (splitting)
{
const char *watres;
int nrtpf;
char **rtpf;
- char rtp[STRLEN];
int nrrn;
char **rrn;
- int nrtprename, naa;
+ int nrtprename;
rtprename_t *rtprename = NULL;
int nah, nNtdb, nCtdb, ntdblist;
t_hackblock *ntdb, *ctdb, **tdblist;
int nssbonds;
t_ssbond *ssbonds;
rvec *pdbx, *x;
- gmx_bool bVsites = FALSE, bWat, bPrevWat = FALSE, bITP, bVsiteAromatics = FALSE, bCheckMerge;
+ gmx_bool bVsites = FALSE, bWat, bPrevWat = FALSE, bITP, bVsiteAromatics = FALSE;
real mHmult = 0;
t_hackblock *hb_chain;
t_restp *restp_chain;
mHmult = 1.0;
}
+ /* parse_common_args ensures vsitestr has been selected, but
+ clang-static-analyzer needs clues to know that */
+ GMX_ASSERT(vsitestr[0], "-vsite default wasn't processed correctly");
switch (vsitestr[0][0])
{
case 'n': /* none */
sfree(rrn);
/* Add all alternative names from the residue renaming database to the list of recognized amino/nucleic acids. */
- naa = 0;
for (i = 0; i < nrtprename; i++)
{
rc = gmx_residuetype_get_type(rt, rtprename[i].gmx, &p_restype);
}
printf("Analyzing pdb file\n");
- nch = 0;
- maxch = 0;
nwaterchain = 0;
modify_chain_numbers(&pdba_all, chainsep[0]);
/* Keep the compiler happy */
prev_chainstart = 0;
- pdb_ch = NULL;
+ nch = 0;
+ maxch = 16;
+ snew(pdb_ch, maxch);
bMerged = FALSE;
for (i = 0; (i < natom); i++)
{
ri = &pdba_all.resinfo[pdba_all.atom[i].resind];
+ /* TODO this should live in a helper object, and consolidate
+ that with code in modify_chain_numbers */
prev_atomname = this_atomname;
prev_atomnum = this_atomnum;
prev_resname = this_resname;
ri->chainid);
}
}
+ // TODO This is too convoluted. Use a std::vector
if (nch == maxch)
{
maxch += 16;
nmol = 0;
incls = NULL;
mols = NULL;
- nres = 0;
for (chain = 0; (chain < nch); chain++)
{
cc = &(chains[chain]);
block = new_blocka();
snew(gnames, 1);
sort_pdbatoms(restp_chain, natom, &pdba, &x, block, &gnames);
- natom = remove_duplicate_atoms(pdba, x, bVerbose);
+ remove_duplicate_atoms(pdba, x, bVerbose);
if (ftp2bSet(efNDX, NFILE, fnm))
{
if (bRemoveH)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_GMXPREPROCESS_PDB2GMX_H
#define GMX_GMXPREPROCESS_PDB2GMX_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-#if 0
-}
-#endif
-
int gmx_pdb2gmx(int argc, char *argv[]);
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "pdb2top.h"
#include <ctype.h>
-#include <math.h>
#include <stdio.h>
#include <string.h>
+#include <cmath>
+
#include <algorithm>
#include <string>
#include <vector>
{
fprintf(stderr, "Warning: Long Bond (%d-%d = %g nm)\n",
- ai+1, aj+1, sqrt(dist2));
+ 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, sqrt(dist2));
+ ai+1, aj+1, std::sqrt(dist2));
}
add_param(psb, ai, aj, NULL, hb[resind].rb[ebtsBONDS].b[j].s);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/toputil.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
/* this *MUST* correspond to array in pdb2top.c */
enum {
ehisA, ehisB, ehisH, ehis1, ehisNR
void print_sums(t_atoms *atoms, gmx_bool bSystem);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
/* Search an atom in array of pointers to strings, starting from start
* if type starts with '-' then searches backwards from start.
* bondtype is only used for printing the error/warning string,
void set_at(t_atom *at, real m, real q, int type, int resind);
-#ifdef __cplusplus
-}
-#endif
-
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/legacyheaders/types/simple.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
struct gmx_atomprop;
struct t_atoms;
char *readConformation(const char *confin, struct t_atoms *atoms, rvec **x, rvec **v,
int *ePBC, matrix box, const char *statusTitle);
-#ifdef __cplusplus
-}
-#endif
-
#endif
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
- * Copyright (c) 2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <limits.h>
#include <stdlib.h>
+#include <cmath>
+
+#include <algorithm>
+
#include "gromacs/gmxpreprocess/toputil.h"
#include "gromacs/legacyheaders/chargegroup.h"
#include "gromacs/legacyheaders/inputrec.h"
}
else if (simtemp->eSimTempScale == esimtempGEOMETRIC) /* should give roughly equal acceptance for constant heat capacity . . . */
{
- simtemp->temperatures[i] = simtemp->simtemp_low * pow(simtemp->simtemp_high/simtemp->simtemp_low, (1.0*i)/(ntemps-1));
+ simtemp->temperatures[i] = simtemp->simtemp_low * std::pow(simtemp->simtemp_high/simtemp->simtemp_low, static_cast<real>((1.0*i)/(ntemps-1)));
}
else if (simtemp->eSimTempScale == esimtempEXPONENTIAL)
{
-static void _low_check(gmx_bool b, char *s, warninp_t wi)
+static void _low_check(gmx_bool b, const char *s, warninp_t wi)
{
if (b)
{
#define CHECK(b) _low_check(b, err_buf, wi)
char err_buf[256], warn_buf[STRLEN];
int i, j;
- int ns_type = 0;
- real dt_coupl = 0;
real dt_pcoupl;
- int nstcmin;
t_lambda *fep = ir->fepvals;
t_expanded *expand = ir->expandedvals;
warning_note(wi, "With Verlet lists the optimal nstlist is >= 10, with GPUs >= 20. Note that with the Verlet scheme, nstlist has no effect on the accuracy of your simulation.");
}
- rc_max = max(ir->rvdw, ir->rcoulomb);
+ rc_max = std::max(ir->rvdw, ir->rcoulomb);
if (ir->verletbuf_tol <= 0)
{
sigma = 0.34;
/* Maximum estimate for A and B charges equal with lambda power 1 */
lambda = 0.5;
- r_sc = pow(lambda*fep->sc_alpha*pow(sigma/ir->rcoulomb, fep->sc_r_power) + 1.0, 1.0/fep->sc_r_power);
+ r_sc = std::pow(lambda*fep->sc_alpha*std::pow(sigma/ir->rcoulomb, fep->sc_r_power) + 1.0, 1.0/fep->sc_r_power);
sprintf(warn_buf, "With PME there is a minor soft core effect present at the cut-off, proportional to (LJsigma/rcoulomb)^%g. This could have a minor effect on energy conservation, but usually other effects dominate. With a common sigma value of %g nm the fraction of the particle-particle potential at the cut-off at lambda=%g is around %.1e, while ewald-rtol is %.1e.",
fep->sc_r_power,
sigma, lambda, r_sc - 1.0, ir->ewald_rtol);
if ((ir->bSimTemp) || (ir->efep == efepEXPANDED))
{
fep = ir->fepvals;
- expand = ir->expandedvals;
/* checking equilibration of weights inputs for validity */
sprintf(err_buf, "If there is no temperature control, and lmc-mcmove!= 'no',mc_temperature must be set to a positive number");
if (expand->nstTij > 0)
{
+ sprintf(err_buf, "nstlog must be non-zero");
+ CHECK(ir->nstlog != 0);
sprintf(err_buf, "nst-transition-matrix (%d) must be an integer multiple of nstlog (%d)",
expand->nstTij, ir->nstlog);
- CHECK((mod(expand->nstTij, ir->nstlog) != 0));
+ CHECK((expand->nstTij % ir->nstlog) != 0);
}
}
}
}
- expand = ir->expandedvals;
/* now read in the weights */
parse_n_real(weights, &nweights, &(expand->init_lambda_weights));
if (nweights == 0)
void read_expandedparams(int *ninp_p, t_inpfile **inp_p,
t_expanded *expand, warninp_t wi)
{
- int ninp, nerror = 0;
+ int ninp;
t_inpfile *inp;
ninp = *ninp_p;
{
dumdub[0][i] = 0;
}
- m = sscanf(is->deform, "%lf %lf %lf %lf %lf %lf",
- &(dumdub[0][0]), &(dumdub[0][1]), &(dumdub[0][2]),
- &(dumdub[0][3]), &(dumdub[0][4]), &(dumdub[0][5]));
+ sscanf(is->deform, "%lf %lf %lf %lf %lf %lf",
+ &(dumdub[0][0]), &(dumdub[0][1]), &(dumdub[0][2]),
+ &(dumdub[0][3]), &(dumdub[0][4]), &(dumdub[0][5]));
for (i = 0; i < 3; i++)
{
ir->deform[i][i] = dumdub[0][i];
{
imin = 2;
}
- imin = min(imin, nrdf2[ai]);
- jmin = min(jmin, nrdf2[aj]);
+ imin = std::min(imin, nrdf2[ai]);
+ jmin = std::min(jmin, nrdf2[aj]);
nrdf2[ai] -= imin;
nrdf2[aj] -= jmin;
nrdf_tc [ggrpnr(groups, egcTC, ai)] -= 0.5*imin;
for (j = 0; j < 3; j++)
{
ai = as + ia[1+j];
- imin = min(2, nrdf2[ai]);
+ imin = std::min(2, nrdf2[ai]);
nrdf2[ai] -= imin;
nrdf_tc [ggrpnr(groups, egcTC, ai)] -= 0.5*imin;
nrdf_vcm[ggrpnr(groups, egcVCM, ai)] -= 0.5*imin;
n_sub = 6;
break;
default:
- n_sub = 0;
gmx_incons("Checking comm_mode");
}
void do_index(const char* mdparin, const char *ndx,
gmx_mtop_t *mtop,
gmx_bool bVerbose,
- t_inputrec *ir, rvec *v,
+ t_inputrec *ir,
warninp_t wi)
{
t_blocka *grps;
int nacg, nfreeze, nfrdim, nenergy, nvcm, nuser;
char *ptr1[MAXPTR], *ptr2[MAXPTR], *ptr3[MAXPTR];
int i, j, k, restnm;
- real SAtime;
gmx_bool bExcl, bTable, bSetTCpar, bAnneal, bRest;
- int nQMmethod, nQMbasis, nQMcharge, nQMmult, nbSH, nCASorb, nCASelec,
- nSAon, nSAoff, nSAsteps, nQMg, nbOPT, nbTS;
+ int nQMmethod, nQMbasis, nQMg;
char warn_buf[STRLEN];
if (bVerbose)
if (ir->opts.tau_t[i] >= 0)
{
- tau_min = min(tau_min, ir->opts.tau_t[i]);
+ tau_min = std::min(tau_min, ir->opts.tau_t[i]);
}
}
if (ir->etc != etcNO && ir->nsttcouple == -1)
{
if (ir->nstpcouple != ir->nsttcouple)
{
- int mincouple = min(ir->nstpcouple, ir->nsttcouple);
+ int mincouple = std::min(ir->nstpcouple, ir->nsttcouple);
ir->nstpcouple = ir->nsttcouple = mincouple;
sprintf(warn_buf, "for current Trotter decomposition methods with vv, nsttcouple and nstpcouple must be equal. Both have been reset to min(nsttcouple,nstpcouple) = %d", mincouple);
warning_note(wi, warn_buf);
/* Now we have filled the freeze struct, so we can calculate NRDF */
calc_nrdf(mtop, ir, gnames);
- if (v && NULL)
- {
- real fac, ntot = 0;
-
- /* Must check per group! */
- for (i = 0; (i < ir->opts.ngtc); i++)
- {
- ntot += ir->opts.nrdf[i];
- }
- if (ntot != (DIM*natoms))
- {
- fac = sqrt(ntot/(DIM*natoms));
- if (bVerbose)
- {
- fprintf(stderr, "Scaling velocities by a factor of %.3f to account for constraints\n"
- "and removal of center of mass motion\n", fac);
- }
- for (i = 0; (i < natoms); i++)
- {
- svmul(fac, v[i], v[i]);
- }
- }
- }
-
nuser = str_nelem(is->user1, MAXPTR, ptr1);
do_numbering(natoms, groups, nuser, ptr1, grps, gnames, egcUser1,
restnm, egrptpALL_GENREST, bVerbose, wi);
eQMbasis_names);
}
- nQMmult = str_nelem(is->QMmult, MAXPTR, ptr1);
- nQMcharge = str_nelem(is->QMcharge, MAXPTR, ptr2);
- nbSH = str_nelem(is->bSH, MAXPTR, ptr3);
+ str_nelem(is->QMmult, MAXPTR, ptr1);
+ str_nelem(is->QMcharge, MAXPTR, ptr2);
+ str_nelem(is->bSH, MAXPTR, ptr3);
snew(ir->opts.QMmult, nr);
snew(ir->opts.QMcharge, nr);
snew(ir->opts.bSH, nr);
ir->opts.bSH[i] = (gmx_strncasecmp(ptr3[i], "Y", 1) == 0);
}
- nCASelec = str_nelem(is->CASelectrons, MAXPTR, ptr1);
- nCASorb = str_nelem(is->CASorbitals, MAXPTR, ptr2);
+ str_nelem(is->CASelectrons, MAXPTR, ptr1);
+ str_nelem(is->CASorbitals, MAXPTR, ptr2);
snew(ir->opts.CASelectrons, nr);
snew(ir->opts.CASorbitals, nr);
for (i = 0; i < nr; i++)
}
/* special optimization options */
- nbOPT = str_nelem(is->bOPT, MAXPTR, ptr1);
- nbTS = str_nelem(is->bTS, MAXPTR, ptr2);
+ str_nelem(is->bOPT, MAXPTR, ptr1);
+ str_nelem(is->bTS, MAXPTR, ptr2);
snew(ir->opts.bOPT, nr);
snew(ir->opts.bTS, nr);
for (i = 0; i < nr; i++)
ir->opts.bOPT[i] = (gmx_strncasecmp(ptr1[i], "Y", 1) == 0);
ir->opts.bTS[i] = (gmx_strncasecmp(ptr2[i], "Y", 1) == 0);
}
- nSAon = str_nelem(is->SAon, MAXPTR, ptr1);
- nSAoff = str_nelem(is->SAoff, MAXPTR, ptr2);
- nSAsteps = str_nelem(is->SAsteps, MAXPTR, ptr3);
+ str_nelem(is->SAon, MAXPTR, ptr1);
+ str_nelem(is->SAoff, MAXPTR, ptr2);
+ str_nelem(is->SAsteps, MAXPTR, ptr3);
snew(ir->opts.SAon, nr);
snew(ir->opts.SAoff, nr);
snew(ir->opts.SAsteps, nr);
gmx_bool *bC6ParametersWorkWithLBRules,
gmx_bool *bLBRulesPossible)
{
- int ntypes, tpi, tpj, thisLBdiff, thisgeomdiff;
+ int ntypes, tpi, tpj;
int *typecount;
real tol;
- double geometricdiff, LBdiff;
double c6i, c6j, c12i, c12j;
double c6, c6_geometric, c6_LB;
double sigmai, sigmaj, epsi, epsj;
*bC6ParametersWorkWithLBRules = TRUE;
*bC6ParametersWorkWithGeometricRules = TRUE;
bCanDoLBRules = TRUE;
- bCanDoGeometricRules = TRUE;
ntypes = mtop->ffparams.atnr;
snew(typecount, ntypes);
gmx_mtop_count_atomtypes(mtop, state, typecount);
- geometricdiff = LBdiff = 0.0;
*bLBRulesPossible = TRUE;
for (tpi = 0; tpi < ntypes; ++tpi)
{
c6j = mtop->ffparams.iparams[(ntypes + 1) * tpj].lj.c6;
c12j = mtop->ffparams.iparams[(ntypes + 1) * tpj].lj.c12;
c6 = mtop->ffparams.iparams[ntypes * tpi + tpj].lj.c6;
- c6_geometric = sqrt(c6i * c6j);
+ c6_geometric = std::sqrt(c6i * c6j);
if (!gmx_numzero(c6_geometric))
{
if (!gmx_numzero(c12i) && !gmx_numzero(c12j))
{
- sigmai = pow(c12i / c6i, 1.0/6.0);
- sigmaj = pow(c12j / c6j, 1.0/6.0);
+ sigmai = std::pow(c12i / c6i, 1.0/6.0);
+ sigmaj = std::pow(c12j / c6j, 1.0/6.0);
epsi = c6i * c6i /(4.0 * c12i);
epsj = c6j * c6j /(4.0 * c12j);
- c6_LB = 4.0 * pow(epsi * epsj, 1.0/2.0) * pow(0.5 * (sigmai + sigmaj), 6);
+ c6_LB = 4.0 * std::pow(epsi * epsj, 1.0/2.0) * std::pow(0.5 * (sigmai + sigmaj), 6);
}
else
{
check_combination_rules(const t_inputrec *ir, const gmx_mtop_t *mtop,
warninp_t wi)
{
- char err_buf[256];
gmx_bool bLBRulesPossible, bC6ParametersWorkWithGeometricRules, bC6ParametersWorkWithLBRules;
check_combination_rule_differences(mtop, 0,
warninp_t wi)
{
char err_buf[STRLEN];
- int i, m, c, nmol, npct;
+ int i, m, c, nmol;
gmx_bool bCharge, bAcc;
- real gdt_max, *mgrp, mt;
+ real *mgrp, mt;
rvec acc;
gmx_mtop_atomloop_block_t aloopb;
gmx_mtop_atomloop_all_t aloop;
tau = 0;
for (i = 0; i < ir->opts.ngtc; i++)
{
- T = max(T, ir->opts.ref_t[i]);
- tau = max(tau, ir->opts.tau_t[i]);
+ T = std::max(T, ir->opts.ref_t[i]);
+ tau = std::max(tau, ir->opts.tau_t[i]);
}
if (T > 0)
{
}
else
{
- min_size = min(box[XX][XX], min(box[YY][YY], box[ZZ][ZZ]));
+ min_size = std::min(box[XX][XX], std::min(box[YY][YY], box[ZZ][ZZ]));
if (2*ir->rlistlong >= min_size)
{
sprintf(warn_buf, "ERROR: One of the box lengths is smaller than twice the cut-off length. Increase the box size or decrease rlist.");
sprintf(warn_buf,
"The sum of the two largest charge group radii (%f) "
"is larger than rlist (%f)\n",
- max(rvdw1+rvdw2, rcoul1+rcoul2), ir->rlist);
+ std::max(rvdw1+rvdw2, rcoul1+rcoul2), ir->rlist);
warning(wi, warn_buf);
}
else
#include "gromacs/legacyheaders/readinp.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
enum {
eshNONE, eshHBONDS, eshALLBONDS, eshHANGLES, eshALLANGLES, eshNR
};
gmx_mtop_t *mtop,
gmx_bool bVerbose,
t_inputrec *ir,
- rvec *v,
warninp_t wi);
/* Read the index file and assign grp numbers to atoms.
- * If v is not NULL, the velocities will be scaled to the correct number
- * of degrees of freedom.
*/
/* Routines In readpull.c */
void set_reference_positions(t_rot *rot, rvec *x, matrix box,
const char *fn, gmx_bool bSet, warninp_t wi);
-#ifdef __cplusplus
-}
-#endif
-
#endif
const char *wbuf)
{
double d;
- int n, m;
+ int n;
pg->nweight = 0;
while (sscanf(wbuf, "%lf %n", &d, &n) == 1)
static void process_pull_dim(char *dim_buf, ivec dim)
{
- int ndim, d, nchar, c;
+ int ndim, d, nchar;
char *ptr, pulldim1[STRLEN];
- t_pull_coord *pcrd;
ptr = dim_buf;
ndim = 0;
pull_params_t *pull,
warninp_t wi)
{
- int ninp, i, nchar, nscan, m, idum;
+ int ninp, i, nscan, idum;
t_inpfile *inp;
const char *tmp;
char **grpbuf;
- char dummy[STRLEN], buf[STRLEN], groups[STRLEN], dim_buf[STRLEN];
- char init[STRLEN];
- const char *init_def1 = "0.0", *init_def3 = "0.0 0.0 0.0";
+ char buf[STRLEN], groups[STRLEN], dim_buf[STRLEN];
char wbuf[STRLEN], origin_buf[STRLEN], vec_buf[STRLEN];
t_pull_group *pgrp;
#include "gromacs/utility/futil.h"
#include "gromacs/utility/smalloc.h"
-static char *RotStr = {"Enforced rotation:"};
+static const char *RotStr = "Enforced rotation:";
static char s_vec[STRLEN];
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <stdlib.h>
#include <string.h>
+#include <algorithm>
+
#include "gromacs/fileio/strdb.h"
#include "gromacs/gmxpreprocess/fflibutil.h"
#include "gromacs/gmxpreprocess/pgutil.h"
if (sscanf(buf, "%s%lf", name, &m) == 2)
{
a->m = m;
- add_atomtype(at, tab, a, name, nb, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 );
+ add_atomtype(at, tab, a, name, nb, 0, 0.0, 0.0, 0.0, 0, 0.0, 0.0 );
fprintf(stderr, "\rAtomtype %d", ++nratt);
}
else
gmx_bool bAllowOverrideRTP)
{
FILE *in;
- char filebase[STRLEN], *ptr, line[STRLEN], header[STRLEN];
+ char filebase[STRLEN], line[STRLEN], header[STRLEN];
int i, nrtp, maxrtp, bt, nparam;
int dum1, dum2, dum3;
t_restp *rrtp, *header_settings;
l1 = (int)strlen(a1);
l2 = (int)strlen(a2);
- lm = min(l1, l2);
+ lm = std::min(l1, l2);
if (lm >= 1 &&
((l1 == l2+1 && is_sign(a1[l1-1])) ||
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/hackblock.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
char *search_rtp(const char *key, int nrtp, t_restp rtp[]);
/* Search for an entry in the rtp database, returns the rtp residue name.
* A mismatch of one character is allowed, if there is only one nearly
void print_resall(FILE *out, int nrtp, t_restp rtp[],
gpp_atomtype_t atype);
/* write rtp database */
-#ifdef __cplusplus
-}
-#endif
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_GMXPREPROCESS_SOLVATE_H
#define GMX_GMXPREPROCESS_SOLVATE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-#if 0
-}
-#endif
-
int gmx_solvate(int argc, char *argv[]);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/random/random.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
void randwater(int astart, int nwater, int nwatom,
rvec x[], rvec v[], gmx_rng_t rng);
/* Randomize the order of nwater molecules of length nwatom, the
/* Make compact subboxes
* IS NOT THREAD SAFE */
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "specbond.h"
#include <ctype.h>
-#include <math.h>
#include <string.h>
+#include <cmath>
+
+#include <algorithm>
+
#include "gromacs/fileio/pdbio.h"
#include "gromacs/fileio/strdb.h"
#include "gromacs/gmxpreprocess/pdb2top.h"
for (j = 0; (j < nspec); j++)
{
aj = sgp[j];
- d[i][j] = sqrt(distance2(x[ai], x[aj]));
+ d[i][j] = std::sqrt(distance2(x[ai], x[aj]));
}
}
if (nspec > 1)
{
/* print resname/number column headings */
fprintf(stderr, "%8s%8s", "", "");
- e = min(b+MAXCOL, nspec-1);
+ e = std::min(b+MAXCOL, nspec-1);
for (i = b; (i < e); i++)
{
sprintf(buf, "%s%d", *pdba->resinfo[pdba->atom[sgp[i]].resind].name,
fprintf(stderr, "\n");
/* print atomname/number column headings */
fprintf(stderr, "%8s%8s", "", "");
- e = min(b+MAXCOL, nspec-1);
+ e = std::min(b+MAXCOL, nspec-1);
for (i = b; (i < e); i++)
{
sprintf(buf, "%s%d", *pdba->atomname[sgp[i]], sgp[i]+1);
}
fprintf(stderr, "\n");
/* print matrix */
- e = min(b+MAXCOL, nspec);
+ e = std::min(b+MAXCOL, nspec);
for (i = b+1; (i < nspec); i++)
{
sprintf(buf, "%s%d", *pdba->resinfo[pdba->atom[sgp[i]].resind].name,
fprintf(stderr, "%8s", buf);
sprintf(buf, "%s%d", *pdba->atomname[sgp[i]], sgp[i]+1);
fprintf(stderr, "%8s", buf);
- e2 = min(i, e);
+ e2 = std::min(i, e);
for (j = b; (j < e2); j++)
{
fprintf(stderr, " %7.3f", d[i][j]);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/pdb2top.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
int mk_specbonds(t_atoms *pdba, rvec x[], gmx_bool bInteractive,
t_ssbond **specbonds, gmx_bool bVerbose);
gmx_bool yesno(void);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
char **nname, t_atom *a, gpp_atomtype_t atype, int *cgnr)
{
int nr, i;
- char buf[5][30], type[12];
+ char buf[5][30];
double m, q;
/* This code is messy, because of support for different formats:
{
FILE *out;
int i, j, k, bt, nrepl, nadd, ndel;
- char buf[STRLEN], nname[STRLEN];
+ char buf[STRLEN];
sprintf(buf, "%s-%c.tdb", ff, C);
out = gmx_fio_fopen(buf, "w");
const char *rtpname,
int *nret)
{
+ // TODO Four years later, no force fields have ever used this, so decide status of this feature
/* Since some force fields (e.g. OPLS) needs different
* atomtypes for different residues there could be a lot
* of entries in the databases for specific residues
*/
t_restp * restp;
- int i, j, n, len, none_idx;
+ int i, j, n, none_idx;
gmx_bool found;
- char *rtpname_match, *s, *s2, *c;
+ char *rtpname_match, *s;
t_hackblock **list;
rtpname_match = search_rtp(rtpname, nrtp, rtp);
while (!found && s != NULL);
}
- /* All residue-specific termini have been added. See if there
- * are some generic ones by searching for the occurence of
+ /* All residue-specific termini have been added. We might have to fall
+ * back on generic termini, which are characterized by not having
* '-' in the name prior to the last position (which indicates charge).
* The [ None ] alternative is special since we don't want that
* to be the default, so we put it last in the list we return.
}
else
{
- c = strchr(s, '-');
- if (c == NULL || ((c-s+1) == strlen(s)))
+ /* Time to see if there's a generic terminus that matches.
+ Is there a hyphen? */
+ char *c = strchr(s, '-');
+
+ /* A conjunction hyphen normally indicates a residue-specific
+ terminus, which is named like "GLY-COOH". A generic terminus
+ won't have a hyphen. */
+ bool bFoundAnyHyphen = (c != NULL);
+ /* '-' as the last character indicates charge, so if that's
+ the only one found e.g. "COO-", then it was not a conjunction
+ hyphen, so this is a generic terminus */
+ bool bOnlyFoundChargeHyphen = (bFoundAnyHyphen &&
+ *(c+1) == '\0');
+ /* Thus, "GLY-COO-" is not recognized as a generic terminus. */
+ bool bFoundGenericTerminus = !bFoundAnyHyphen || bOnlyFoundChargeHyphen;
+ if (bFoundGenericTerminus)
{
/* Check that we haven't already added a residue-specific version
* of this terminus.
printf("%s\n", title);
for (i = 0; (i < nb); i++)
{
- char *advice_string = "";
- if (0 == gmx_wcmatch("*ZWITTERION*", (*tb[i]).name))
- {
- advice_string = " (only use with zwitterions containing exactly one residue)";
- }
- printf("%2d: %s%s\n", i, (*tb[i]).name, advice_string);
+ bool bIsZwitterion = (0 == gmx_wcmatch("*ZWITTERION*", (*tb[i]).name));
+ printf("%2d: %s%s\n", i, (*tb[i]).name,
+ bIsZwitterion ? " (only use with zwitterions containing exactly one residue)" : "");
}
do
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014, by the GROMACS development team, led by
+ * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/grompp-impl.h"
#include "gromacs/gmxpreprocess/hackblock.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
int read_ter_db(const char *ffdir, char ter,
t_hackblock **tbptr, gpp_atomtype_t atype);
t_hackblock *choose_ter(int nb, t_hackblock **tb, const char *title);
/* Interactively select one.. */
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "tomorse.h"
#include <ctype.h>
-#include <math.h>
#include <stdlib.h>
#include <string.h>
+#include <cmath>
+
#include "gromacs/gmxpreprocess/gpp_atomtype.h"
#include "gromacs/gmxpreprocess/grompp-impl.h"
#include "gromacs/gmxpreprocess/toputil.h"
bRemoveHarm[j] = TRUE;
b0 = mols[i].plist[bb].param[j].c[0];
kb = mols[i].plist[bb].param[j].c[1];
- beta = sqrt(kb/(2*edis));
+ beta = std::sqrt(kb/(2*edis));
mols[i].plist[F_MORSE].param[nrmorse].a[0] = ni;
mols[i].plist[F_MORSE].param[nrmorse].a[1] = nj;
mols[i].plist[F_MORSE].param[nrmorse].c[0] = b0;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/grompp-impl.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
void convert_harmonics(int nrmols, t_molinfo mols[], gpp_atomtype_t atype);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/grompp-impl.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct tagDirStack {
directive d;
struct tagDirStack *prev;
int DS_Check_Order (DirStack *DS, directive d);
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "topio.h"
-#include <assert.h>
#include <ctype.h>
#include <errno.h>
-#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <cmath>
+
#include <sys/types.h>
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/futil.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
#define OPENDIR '[' /* starting sign for directive */
int i, j, ntp, nrfp, nrfpA, nrfpB, nnn;
real scaling;
ntp = nbs->nr;
- nnn = sqrt(ntp);
+ nnn = static_cast<int>(std::sqrt(static_cast<double>(ntp)));
+ GMX_ASSERT(nnn * nnn == ntp, "Number of pairs of generated non-bonded parameters should be a perfect square");
nrfp = NRFP(F_LJ);
nrfpA = interaction_function[F_LJ14].nrfpA;
nrfpB = interaction_function[F_LJ14].nrfpB;
if (status1 == 0 && status2 == 0)
{
/* cosine theorem to get r13 */
- *length = sqrt(r12*r12+r23*r23-(2*r12*r23*cos(a123/RAD2DEG)));
+ *length = std::sqrt(r12*r12+r23*r23-(2*r12*r23*cos(a123/RAD2DEG)));
found = 1;
}
}
int
generate_gb_exclusion_interactions(t_molinfo *mi, gpp_atomtype_t atype, t_nextnb *nnb)
{
- int i, j, k, n, ai, aj, ti, tj;
- int n12, n13, n14;
+ int j, n, ai, aj, ti, tj;
int ftype;
t_param param;
t_params * plist;
warninp_t wi)
{
FILE *out;
- int i, sl, nb_funct, comb;
+ int i, sl, nb_funct;
char *pline = NULL, **title = NULL;
char line[STRLEN], errbuf[256], comb_str[256], nb_str[256];
char genpairs[32];
int nrcopies, nmol, nmolb = 0, nscan, ncombs, ncopy;
double fLJ, fQQ, fPOW;
gmx_molblock_t *molb = NULL;
- t_topology *block = NULL;
t_molinfo *mi0 = NULL;
DirStack *DS;
directive d, newd;
t_nbparam **nbparam, **pair;
- gmx_bool bIntermolecularInteractions;
t_block2 *block2;
real fudgeLJ = -1; /* Multiplication factor to generate 1-4 from LJ */
gmx_bool bReadDefaults, bReadMolType, bGenPairs, bWarn_copy_A_B;
push_vsitesn(d, mi0->plist, &(mi0->atoms), pline, wi);
break;
case d_exclusions:
- assert(block2);
+ GMX_ASSERT(block2, "block2 must always be allocated so exclusions can be processed");
if (!block2[nmol-1].nr)
{
init_block2(&(block2[nmol-1]), mi0->atoms.nr);
j = 0;
while (j < molt->ilist[i].nr)
{
- bexcl = FALSE;
switch (nratoms)
{
case 2:
break;
default:
gmx_fatal(FARGS, "no such bonded interactions with %d atoms\n", nratoms);
+ bexcl = FALSE;
}
if (bexcl)
{
#include "gromacs/gmxpreprocess/readir.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
double check_mol(gmx_mtop_t *mtop, warninp_t wi);
/* Check mass and charge */
/* This routine expects sys->molt[m].ilist to be of size F_NRE and ordered. */
void generate_qmexcl(gmx_mtop_t *sys, t_inputrec *ir, warninp_t wi);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "toppush.h"
-#include <assert.h>
#include <ctype.h>
-#include <math.h>
#include <stdlib.h>
+#include <cmath>
+
+#include <algorithm>
+
#include "gromacs/gmxpreprocess/gpp_atomtype.h"
#include "gromacs/gmxpreprocess/gpp_bond_atomtype.h"
#include "gromacs/gmxpreprocess/readir.h"
#include "gromacs/topology/symtab.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
void generate_nbparams(int comb, int ftype, t_params *plist, gpp_atomtype_t atype,
{
ci = get_atomtype_nbparam(i, nf, atype);
cj = get_atomtype_nbparam(j, nf, atype);
- c = sqrt(ci * cj);
+ c = std::sqrt(ci * cj);
plist->param[k].c[nf] = c;
}
}
{
plist->param[k].c[0] *= -1;
}
- plist->param[k].c[1] = sqrt(ci1*cj1);
+ plist->param[k].c[1] = std::sqrt(ci1*cj1);
}
}
cj0 = get_atomtype_nbparam(j, 0, atype);
ci1 = get_atomtype_nbparam(i, 1, atype);
cj1 = get_atomtype_nbparam(j, 1, atype);
- plist->param[k].c[0] = sqrt(fabs(ci0*cj0));
+ plist->param[k].c[0] = std::sqrt(fabs(ci0*cj0));
/* Negative sigma signals that c6 should be set to zero later,
* so we need to propagate that through the combination rules.
*/
{
plist->param[k].c[0] *= -1;
}
- plist->param[k].c[1] = sqrt(ci1*cj1);
+ plist->param[k].c[1] = std::sqrt(ci1*cj1);
}
}
cj2 = get_atomtype_nbparam(j, 2, atype);
bi = get_atomtype_nbparam(i, 1, atype);
bj = get_atomtype_nbparam(j, 1, atype);
- plist->param[k].c[0] = sqrt(ci0 * cj0);
+ plist->param[k].c[0] = std::sqrt(ci0 * cj0);
if ((bi == 0) || (bj == 0))
{
plist->param[k].c[1] = 0;
{
plist->param[k].c[1] = 2.0/(1/bi+1/bj);
}
- plist->param[k].c[2] = sqrt(ci2 * cj2);
+ plist->param[k].c[2] = std::sqrt(ci2 * cj2);
}
}
gmx_fatal(FARGS, "Replacing atomtype %s failed", type);
}
}
- else if ((nr = add_atomtype(at, symtab, atom, type, param,
- batype_nr, radius, vol,
- surftens, atomnr, gb_radius, S_hct)) == NOTSET)
+ else if ((add_atomtype(at, symtab, atom, type, param,
+ batype_nr, radius, vol,
+ surftens, atomnr, gb_radius, S_hct)) == NOTSET)
{
gmx_fatal(FARGS, "Adding atomtype %s failed", type);
}
"%*s%*s%*s%*s%*s%*s%*s"
};
const char *formlf = "%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf";
- int i, ft, ftype, nn, nrfp, nrfpA, nrfpB;
+ int i, ft, ftype, nn, nrfp, nrfpA;
char f1[STRLEN];
char alc[MAXATOMLIST+1][20];
/* One force parameter more, so we can check if we read too many */
ftype = ifunc_index(d, ft);
nrfp = NRFP(ftype);
nrfpA = interaction_function[ftype].nrfpA;
- nrfpB = interaction_function[ftype].nrfpB;
strcpy(f1, formnl[nral]);
strcat(f1, formlf);
if ((nn = sscanf(line, f1, &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6], &c[7], &c[8], &c[9], &c[10], &c[11], &c[12]))
"%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf",
"%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf",
};
- int i, ft, ftype, nn, nrfp, nrfpA, nrfpB, nral;
+ int i, ft, ftype, nn, nrfp, nrfpA, nral;
char f1[STRLEN];
char alc[MAXATOMLIST+1][20];
double c[MAXFORCEPARAM];
ftype = ifunc_index(d, ft);
nrfp = NRFP(ftype);
nrfpA = interaction_function[ftype].nrfpA;
- nrfpB = interaction_function[ftype].nrfpB;
strcpy(f1, formnl[nral]);
strcat(f1, formlf[nrfp-1]);
warninp_t wi)
{
/* swap the atoms */
- const char *form2 = "%*s%*s%*s%lf%lf";
const char *form3 = "%*s%*s%*s%lf%lf%lf";
const char *form4 = "%*s%*s%*s%lf%lf%lf%lf";
const char *form5 = "%*s%*s%*s%lf%lf%lf%lf%lf";
char a0[80], a1[80];
- int i, f, n, ftype, atnr, nrfp;
+ int i, f, n, ftype, nrfp;
double c[4], dum;
- real cr[4], sig6;
+ real cr[4];
atom_id ai, aj;
t_nbparam *nbp;
gmx_bool bId;
/* When the B topology parameters are not set,
* copy them from topology A
*/
- assert(nrfp <= 4);
+ GMX_ASSERT(nrfp <= 4, "LJ-14 cannot have more than 4 parameters");
for (i = n; i < nrfp; i++)
{
c[i] = c[i-2];
{
gmx_fatal(FARGS, "Atomtype %s not found", a1);
}
- nbp = &(nbt[max(ai, aj)][min(ai, aj)]);
+ nbp = &(nbt[std::max(ai, aj)][std::min(ai, aj)]);
if (nbp->bSet)
{
push_gb_params (gpp_atomtype_t at, char *line,
warninp_t wi)
{
- int nfield;
int atype;
double radius, vol, surftens, gb_radius, S_hct;
char atypename[STRLEN];
char errbuf[STRLEN];
- if ( (nfield = sscanf(line, "%s%lf%lf%lf%lf%lf", atypename, &radius, &vol, &surftens, &gb_radius, &S_hct)) != 6)
+ if ( (sscanf(line, "%s%lf%lf%lf%lf%lf", atypename, &radius, &vol, &surftens, &gb_radius, &S_hct)) != 6)
{
sprintf(errbuf, "Too few gb parameters for type %s\n", atypename);
warning(wi, errbuf);
{
const char *formal = "%s%s%s%s%s%s%s%s";
- int i, j, ft, ftype, nn, nrfp, nrfpA, nrfpB;
+ int i, ft, ftype, nn, nrfp, nrfpA, nrfpB;
int start;
int nxcmap, nycmap, ncmap, read_cmap, sl, nct;
char s[20], alc[MAXATOMLIST+2][20];
t_param p;
- gmx_bool bAllowRepeat;
char errbuf[256];
/* Keep the compiler happy */
/* First test the generated-pair position to save
* time when we have 1000*1000 entries for e.g. OPLS...
*/
- ntype = sqrt(nr);
+ ntype = static_cast<int>(std::sqrt(static_cast<double>(nr)));
+ GMX_ASSERT(ntype * ntype == nr, "Number of pairs of generated non-bonded parameters should be a perfect square");
if (bB)
{
ti = at->atom[p->a[0]].typeB;
t_param *p, gmx_bool bB,
int *cmap_type, int *nparam_def)
{
- int i, j, nparam_found;
+ int i, nparam_found;
int ct;
gmx_bool bFound = FALSE;
/* One force parameter more, so we can check if we read too many */
double cc[MAXFORCEPARAM+1];
int aa[MAXATOMLIST+1];
- t_param param, paramB, *param_defA, *param_defB;
+ t_param param, *param_defA, *param_defB;
gmx_bool bFoundA = FALSE, bFoundB = FALSE, bDef, bPert, bSwapParity = FALSE;
int nparam_defA, nparam_defB;
char errbuf[256];
if (bFoundA)
{
/* Copy the A-state and B-state default parameters. */
- assert(NRFPA(ftype)+NRFPB(ftype) <= MAXFORCEPARAM);
+ GMX_ASSERT(NRFPA(ftype)+NRFPB(ftype) <= MAXFORCEPARAM, "Bonded interactions may have at most 12 parameters");
for (j = 0; (j < NRFPA(ftype)+NRFPB(ftype)); j++)
{
param.c[j] = param_defA->c[j];
"%d%d%d%d%d%d%d"
};
- int i, j, nr, ftype, nral, nread, ncmap_params;
+ int i, j, ftype, nral, nread, ncmap_params;
int cmap_type;
int aa[MAXATOMLIST+1];
char errbuf[256];
gmx_bool bFound;
- t_param param, paramB, *param_defA, *param_defB;
+ t_param param;
ftype = ifunc_index(d, 1);
nral = NRAL(ftype);
- nr = bondtype[ftype].nr;
ncmap_params = 0;
nread = sscanf(line, aaformat[nral-1],
param.a[0] = a - 1;
- ret = sscanf(ptr, "%d%n", &type, &n);
+ sscanf(ptr, "%d%n", &type, &n);
ptr += n;
ftype = ifunc_index(d, type);
n = mol->atoms.nr;
atom = mol->atoms.atom;
- ntype = sqrt(nbp->nr);
+ ntype = static_cast<int>(std::sqrt(static_cast<double>(nbp->nr)));
+ GMX_ASSERT(ntype * ntype == nbp->nr, "Number of pairs of generated non-bonded parameters should be a perfect square");
for (i = 0; i < MAXATOMLIST; i++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/legacyheaders/warninp.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct {
int nr; /* The number of entries in the list */
int nra2; /* The total number of entries in a */
* of the system, but full interaction with itself.
*/
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "topshake.h"
#include <ctype.h>
-#include <math.h>
+
+#include <cmath>
#include "gromacs/gmxpreprocess/readir.h"
#include "gromacs/gmxpreprocess/topdirs.h"
t_params *bonds;
t_param p, *bond, *ang;
real b_ij, b_jk;
- int nb, b, i, j, ftype, ftype_a;
+ int i, j, ftype, ftype_a;
gmx_bool bFound;
if (nshake != eshNONE)
if (bFound)
{
/* apply law of cosines */
- p.C0 = sqrt( b_ij*b_ij + b_jk*b_jk -
- 2.0*b_ij*b_jk*cos(DEG2RAD*ang->C0) );
+ p.C0 = std::sqrt( b_ij*b_ij + b_jk*b_jk -
+ 2.0*b_ij*b_jk*cos(DEG2RAD*ang->C0) );
p.C1 = p.C0;
#ifdef DEBUG
printf("p: %d, q: %d, dist: %12.5e\n", p.AI, p.AJ, p.C0);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/topio.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
void make_shake (t_params plist[], t_atoms *atoms, int nshake);
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "toputil.h"
-#include <assert.h>
-#include <math.h>
#include <string.h>
+#include <cmath>
+
+#include <algorithm>
+
#include "gromacs/gmxpreprocess/gpp_atomtype.h"
#include "gromacs/gmxpreprocess/topdirs.h"
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/topology/block.h"
#include "gromacs/topology/symtab.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
/* UTILITIES */
{
return;
}
- assert(!((pr->nr == 0) && (pr->param != NULL)));
+ GMX_ASSERT(pr->nr != 0 || pr->param == NULL, "Invalid t_params object");
if (pr->nr+extra > pr->maxnr)
{
- pr->maxnr = max(1.2*pr->maxnr, pr->maxnr + extra);
+ pr->maxnr = std::max(static_cast<int>(1.2*pr->maxnr), pr->maxnr + extra);
srenew(pr->param, pr->maxnr);
for (i = pr->nr; (i < pr->maxnr); i++)
{
gmx_fatal(FARGS, "tpA = %d, i= %d in print_atoms", tpA, i);
}
+ /* This is true by construction, but static analysers don't know */
+ GMX_ASSERT(!bRTPresname || at->resinfo[at->atom[i].resind].rtp, "-rtpres did not have residue name available");
fprintf(out, "%6d %10s %6d%c %5s %6s %6d %10g %10g",
i+1, tpnmA,
at->resinfo[ri].nr,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/gpp_atomtype.h"
#include "gromacs/gmxpreprocess/grompp-impl.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* UTILITIES */
int name2index(char *str, char ***typenames, int ntypes);
void print_excl(FILE *out, int natoms, t_excls excls[]);
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "vsite_parm.h"
-#include <assert.h>
-#include <math.h>
#include <stdio.h>
#include <string.h>
+#include <cmath>
+
+#include <algorithm>
+
#include "gromacs/gmxpreprocess/add_par.h"
#include "gromacs/gmxpreprocess/resall.h"
#include "gromacs/gmxpreprocess/toputil.h"
#include "gromacs/math/vec.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
typedef struct {
bError = bError || (bjk != bjl);
/* the X atom (C or N) in the XH2/XH3 group is the first after the masses: */
- aN = max(param->AK, param->AL)+1;
+ aN = std::max(param->AK, param->AL)+1;
/* get common bonds */
bMM = get_bond_length(nrbond, bonds, param->AK, param->AL);
/* calculate common things */
rM = 0.5*bMM;
- dM = sqrt( sqr(bCM) - sqr(rM) );
+ dM = std::sqrt( sqr(bCM) - sqr(rM) );
/* are we dealing with the X atom? */
if (param->AI == aN)
bError = bError || (bjk != bjl);
/* the X atom (C or N) in the XH3 group is the first after the masses: */
- aN = max(param->AK, param->AL)+1;
+ aN = std::max(param->AK, param->AL)+1;
/* get all bondlengths and angles: */
bMM = get_bond_length(nrbond, bonds, param->AK, param->AL);
rHx = rH*cos(DEG2RAD*30);
rHy = rH*sin(DEG2RAD*30);
rM = 0.5*bMM;
- dM = sqrt( sqr(bCM) - sqr(rM) );
+ dM = std::sqrt( sqr(bCM) - sqr(rM) );
a = 0.5*( (dH/dM) - (rHy/rM) );
b = 0.5*( (dH/dM) + (rHy/rM) );
c = rHx / (2*dM*rM);
pijl = cos(aijl)*bij;
a = ( pijk + (pijk*cos(akjl)-pijl) * cos(akjl) / sqr(sin(akjl)) ) / bjk;
b = ( pijl + (pijl*cos(akjl)-pijk) * cos(akjl) / sqr(sin(akjl)) ) / bjl;
- c = -sqrt( sqr(bij) -
- ( sqr(pijk) - 2*pijk*pijl*cos(akjl) + sqr(pijl) )
- / sqr(sin(akjl)) )
+ c = -std::sqrt( sqr(bij) -
+ ( sqr(pijk) - 2*pijk*pijl*cos(akjl) + sqr(pijl) )
+ / sqr(sin(akjl)) )
/ ( bjk*bjl*sin(akjl) );
}
gmx_fatal(FARGS, "invalid construction in calc_vsite4fd for atom %d: "
"cosakl=%f, cosakm=%f\n", param->AI+1, cosakl, cosakm);
}
- sinakl = sqrt(1-sqr(cosakl));
- sinakm = sqrt(1-sqr(cosakm));
+ sinakl = std::sqrt(1-sqr(cosakl));
+ sinakm = std::sqrt(1-sqr(cosakm));
/* note: there is a '+' because of the way the sines are calculated */
cl = -pk / ( pl*cosakl - pk + pl*sinakl*(pm*cosakm-pk)/(pm*sinakm) );
t_mybonded *idihs;
bFirst = TRUE;
- bERROR = TRUE;
nvsite = 0;
if (debug)
{
"for %s atom %d",
interaction_function[ftype].longname,
plist[ftype].param[i].AI+1);
+ bERROR = TRUE;
} /* switch */
if (bERROR)
{
static void clean_vsite_bonds(t_params *plist, t_pindex pindex[],
int cftype, int vsite_type[])
{
- int ftype, i, j, parnr, k, l, m, n, nvsite, nOut, kept_i, vsitetype;
+ int ftype, i, j, k, m, n, nvsite, nOut, kept_i;
int nconverted, nremoved;
atom_id atom, oatom, at1, at2;
gmx_bool bKeep, bRemove, bUsed, bPresent, bThisFD, bThisOUT, bAllFD, bFirstTwo;
}
else
{
- assert(vsnral != 0);
- assert(first_atoms != NULL);
+ GMX_ASSERT(vsnral != 0, "nvsite > 1 must have vsnral != 0");
+ GMX_ASSERT(first_atoms != NULL, "nvsite > 1 must have first_atoms != NULL");
/* if it is not the first then
check if this vsite is constructed from the same atoms */
if (vsnral == NRAL(pindex[atom].ftype)-1)
bUsed = FALSE;
for (m = 0; (m < vsnral) && !bUsed; m++)
{
- assert(first_atoms != NULL);
+ GMX_ASSERT(first_atoms != NULL, "If we've seen a vsite before, we know what its first atom index was");
if (atom == first_atoms[m])
{
int cftype, int vsite_type[],
at2vsitecon_t *at2vc)
{
- int i, j, parnr, k, l, m, n, nvsite, kept_i, vsitetype;
+ int i, j, k, m, n, nvsite, kept_i;
atom_id atom, at1, at2;
gmx_bool bKeep, bUsed, bPresent, bAll3FAD, bFirstTwo;
t_params *ps;
}
else
{
- assert(vsnral != 0);
- assert(first_atoms != NULL);
+ GMX_ASSERT(vsnral != 0, "If we've seen a vsite before, we know how many constructing atoms it had");
+ GMX_ASSERT(first_atoms != NULL, "If we've seen a vsite before, we know what its first atom index was");
/* check if this vsite is constructed from the same atoms */
if (vsnral == NRAL(pindex[atom].ftype)-1)
{
bUsed = FALSE;
for (m = 0; (m < vsnral) && !bUsed; m++)
{
- assert(first_atoms != NULL);
+ GMX_ASSERT(first_atoms != NULL, "If we've seen a vsite before, we know what its first atom index was");
if (atom == first_atoms[m])
{
kept_i = 0;
for (i = 0; (i < ps->nr); i++) /* for all dihedrals in the plist */
{
- int ftype, parnr, k, l, m, n, nvsite;
+ int k, m, n, nvsite;
int vsnral = 0;
const atom_id *first_atoms = NULL;
atom_id atom;
}
else
{
- assert(vsnral != 0);
- assert(first_atoms != NULL);
-
+ GMX_ASSERT(vsnral != 0, "If we've seen a vsite before, we know how many constructing atoms it had");
+ GMX_ASSERT(first_atoms != NULL, "If we've seen a vsite before, we know what its first atom index was");
/* check if this vsite is constructed from the same atoms */
if (vsnral == NRAL(pindex[atom].ftype)-1)
{
construction of virtual sites. If so, keep it, if not throw away: */
for (k = 0; (k < 4) && !bKeep; k++) /* for all atoms in the dihedral */
{
- assert(vsnral != 0);
- assert(first_atoms != NULL);
-
+ GMX_ASSERT(vsnral != 0, "If we've seen a vsite before, we know how many constructing atoms it had");
+ GMX_ASSERT(first_atoms != NULL, "If we've seen a vsite before, we know what its first atom index was");
atom = ps->param[i].a[k];
if (vsite_type[atom] == NOTSET && vsite_type[atom] != F_VSITEN)
{
#include "gromacs/gmxpreprocess/grompp-impl.h"
#include "gromacs/legacyheaders/typedefs.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
int set_vsites(gmx_bool bVerbose, t_atoms *atoms, gpp_atomtype_t atype,
t_params plist[]);
/* set parameters for virtual sites, return number of virtual sites */
* Throw away all constraints. */
void clean_vsite_bondeds(t_params *ps, int natoms, gmx_bool bRmVSiteBds);
-#ifdef __cplusplus
-}
-#endif
-
#endif
#include "x2top.h"
-#include <assert.h>
+#include <cmath>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/topology/symtab.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
char atp[7] = "HCNOSX";
dx2 = iprod(dx, dx);
if (is_bond(nnm, nmt, *atoms->atomname[i], *atoms->atomname[j],
- sqrt(dx2)))
+ std::sqrt(dx2)))
{
b.AI = i;
b.AJ = j;
- b.C0 = sqrt(dx2);
+ b.C0 = std::sqrt(dx2);
add_param_to_list (bond, &b);
nbond[i]++;
nbond[j]++;
{
int i, n = 1;
int *cgnr;
- double qt = 0, mt = 0;
+ double qt = 0;
*qtot = *mtot = 0;
snew(cgnr, atoms->nr);
c[0] += 180;
}
}
- assert(nrfp <= MAXFORCEPARAM/2);
+ GMX_ASSERT(nrfp <= MAXFORCEPARAM/2, "Only 6 parameters may be used for an interaction");
for (j = 0; (j < nrfp); j++)
{
plist->param[i].c[j] = c[j];
void set_force_const(t_params plist[], real kb, real kt, real kp, gmx_bool bRound,
gmx_bool bParam)
{
- int i;
real c[MAXFORCEPARAM];
c[0] = 0;
int bts[] = { 1, 1, 1, 2 };
matrix box; /* box length matrix */
int natoms; /* number of atoms in one molecule */
- int nres; /* number of molecules? */
- int i, j, k, l, m, ndih;
int epbc;
gmx_bool bRTP, bTOP, bOPLS;
t_symtab symtab;
- real cutoff, qtot, mtot;
+ real qtot, mtot;
char n2t[STRLEN];
output_env_t oenv;
{ efRTP, "-r", "out", ffOPTWR }
};
#define NFILE asize(fnm)
- static real scale = 1.1, kb = 4e5, kt = 400, kp = 5;
+ static real kb = 4e5, kt = 400, kp = 5;
static t_restp rtp_header_settings;
static gmx_bool bRemoveDihedralIfWithImproper = FALSE;
static gmx_bool bGenerateHH14Interactions = TRUE;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#ifndef GMX_GMXPREPROCESS_X2TOP_H
#define GMX_GMXPREPROCESS_X2TOP_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-#if 0
-}
-#endif
-
int gmx_x2top(int argc, char *argv[]);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/gmxpreprocess/hackblock.h"
#include "gromacs/utility/basedefinitions.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
struct gmx_residuetype_t;
struct t_atoms;
struct t_symtab;
gmx_bool bResname, struct gmx_residuetype_t *rt, gmx_bool bReorderNum,
gmx_bool bVerbose);
-#ifdef __cplusplus
-}
-#endif
-
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
return a/b;
}
-static gmx_inline int _mod(int a, int b, char *file, int line)
+static gmx_inline int _mod(int a, int b, const char *file, int line)
{
if (b == 0)
{