how-to/visualize.rst
install-guide/index.rst
release-notes/index.rst
+ release-notes/2020/major/highlights.rst
+ release-notes/2020/major/features.rst
+ release-notes/2020/major/performance.rst
+ release-notes/2020/major/tools.rst
+ release-notes/2020/major/bugs-fixed.rst
+ release-notes/2020/major/removed-functionality.rst
+ release-notes/2020/major/deprecated-functionality.rst
+ release-notes/2020/major/portability.rst
+ release-notes/2020/major/miscellaneous.rst
+ release-notes/2019/2019.6.rst
release-notes/2019/2019.5.rst
release-notes/2019/2019.4.rst
release-notes/2019/2019.3.rst
std::strcpy(buf, nm);
trim(buf);
- return (buf[0] == 'M') && (std::isdigit(buf[strlen(buf)-1]) != 0);
+ return (buf[0] == 'M') && (std::isdigit(buf[strlen(buf) - 1]) != 0);
}
-static void gmx_conect_addline(gmx_conect_t *con, char *line)
+static void gmx_conect_addline(gmx_conect_t* con, char* line)
{
- int n, ai, aj;
+ int n, ai, aj;
- std::string form2 = "%%*s";
- std::string format = form2 + "%%d";
+ std::string form2 = "%*s";
+ std::string format = form2 + "%d";
if (sscanf(line, format.c_str(), &ai) == 1)
{
do
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xvgr.h"
+ #include "gromacs/gmxana/angle_correction.h"
#include "gromacs/gmxana/gstat.h"
-#include "gromacs/listed-forces/bonded.h"
+#include "gromacs/listed_forces/bonded.h"
#include "gromacs/math/functions.h"
#include "gromacs/math/units.h"
#include "gromacs/math/vec.h"
}
}
-void read_ang_dih(const char *trj_fn,
- gmx_bool bAngles, gmx_bool bSaveAll, gmx_bool bRb, gmx_bool bPBC,
- int maxangstat, int angstat[],
- int *nframes, real **time,
- int isize, int index[],
- real **trans_frac,
- real **aver_angle,
- real *dih[],
- const gmx_output_env_t *oenv)
+void read_ang_dih(const char* trj_fn,
+ gmx_bool bAngles,
+ gmx_bool bSaveAll,
+ gmx_bool bRb,
+ gmx_bool bPBC,
+ int maxangstat,
+ int angstat[],
+ int* nframes,
+ real** time,
+ int isize,
+ int index[],
+ real** trans_frac,
+ real** aver_angle,
+ real* dih[],
+ const gmx_output_env_t* oenv)
{
- struct t_pbc *pbc;
- t_trxstatus *status;
+ struct t_pbc* pbc;
+ t_trxstatus* status;
int i, angind, total, teller;
int nangles, n_alloc;
- real t, fraction, pifac, aa, angle;
+ real t, fraction, pifac, angle;
- real *angles[2];
+ real* angles[2];
matrix box;
- rvec *x;
+ rvec* x;
int cur = 0;
-#define prev (1-cur)
+#define prev (1 - cur)
snew(pbc, 1);
read_first_x(oenv, &status, trj_fn, &t, &x, box);
}
/* Average angles */
- aa = 0;
+ double aa = 0;
for (i = 0; (i < nangles); i++)
{
- real diffa = angles[cur][i] - angles[cur][i-1];
+ if (!bAngles && i > 0)
+ {
- angles[cur][i] = angles[cur][i-1] + diffa;
++ real diffa = angles[cur][i] - angles[cur][i - 1];
+ diffa = correctRadianAngleRange(diffa);
++ angles[cur][i] = angles[cur][i - 1] + diffa;
+ }
+
aa = aa + angles[cur][i];
/* angle in rad / 2Pi * max determines bin. bins go from 0 to maxangstat,
angle = angles[cur][i];
if (!bAngles)
{
- while (angle < -M_PI)
- {
- angle += 2 * M_PI;
- }
- while (angle >= M_PI)
- {
- angle -= 2 * M_PI;
- }
-
- angle = correctRadianAngleRange(angle);
++ angle = correctRadianAngleRange(angle);
angle += M_PI;
}
}
/* average over all angles */
- (*aver_angle)[teller] = (aa / nangles);
- aa = correctRadianAngleRange(aa/nangles);
++ aa = correctRadianAngleRange(aa / nangles);
+ (*aver_angle)[teller] = (aa);
/* this copies all current dih. angles to dih[i], teller is frame */
if (bSaveAll)
--- /dev/null
- correctedAngle += 2*M_PI;
+ /*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2019, 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version 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.
+ */
+ #include "gmxpre.h"
+
+ #include "angle_correction.h"
+
+ #include <algorithm>
+
+ #include "gromacs/math/units.h"
+ #include "gromacs/math/vec.h"
+
+ real correctRadianAngleRange(const real angle)
+ {
+ real correctedAngle = angle;
+ while (correctedAngle < -M_PI)
+ {
- correctedAngle -= 2*M_PI;
++ correctedAngle += 2 * M_PI;
+ }
+ while (correctedAngle >= M_PI)
+ {
++ correctedAngle -= 2 * M_PI;
+ }
+ return correctedAngle;
+ }
}
}
- fp = xvgropen(fn, "RMS Distribution", "RMS (nm)", "a.u.", oenv);
+ fp = xvgropen(fn, "RMS Distribution", "RMS (nm)", "counts", oenv);
for (i = 0; (i < 101); i++)
{
- fprintf(fp, "%10g %10d\n", i/fac, histo[i]);
+ fprintf(fp, "%10g %10d\n", i / fac, histo[i]);
}
xvgrclose(fp);
sfree(histo);
"Counting transitions only works for dihedrals with multiplicity 3"
};
- FILE *out;
- real dt;
- int isize;
- int *index;
- char *grpname;
- real maxang, S2, norm_fac, maxstat;
- unsigned long mode;
- int nframes, maxangstat, mult, *angstat;
- int i, j, nangles, first, last;
- gmx_bool bAver, bRb, bPeriodic,
- bFrac, /* calculate fraction too? */
- bTrans, /* worry about transtions too? */
- bCorr; /* correlation function ? */
- double tfrac = 0;
- char title[256];
- real **dih = nullptr; /* mega array with all dih. angles at all times*/
- real *time, *trans_frac, *aver_angle;
- t_filenm fnm[] = {
- { efTRX, "-f", nullptr, ffREAD },
- { efNDX, nullptr, "angle", ffREAD },
- { efXVG, "-od", "angdist", ffWRITE },
- { efXVG, "-ov", "angaver", ffOPTWR },
- { efXVG, "-of", "dihfrac", ffOPTWR },
- { efXVG, "-ot", "dihtrans", ffOPTWR },
- { efXVG, "-oh", "trhisto", ffOPTWR },
- { efXVG, "-oc", "dihcorr", ffOPTWR },
- { efTRR, "-or", nullptr, ffOPTWR }
- };
+ FILE* out;
+ real dt;
+ int isize;
+ int* index;
+ char* grpname;
+ real maxang, S2, norm_fac, maxstat;
+ unsigned long mode;
+ int nframes, maxangstat, mult, *angstat;
+ int i, j, nangles, first, last;
+ gmx_bool bAver, bRb, bPeriodic, bFrac, /* calculate fraction too? */
+ bTrans, /* worry about transtions too? */
+ bCorr; /* correlation function ? */
- real aver, aver2, aversig; /* fraction trans dihedrals */
+ double tfrac = 0;
+ char title[256];
+ real** dih = nullptr; /* mega array with all dih. angles at all times*/
+ real * time, *trans_frac, *aver_angle;
+ t_filenm fnm[] = { { efTRX, "-f", nullptr, ffREAD }, { efNDX, nullptr, "angle", ffREAD },
+ { efXVG, "-od", "angdist", ffWRITE }, { efXVG, "-ov", "angaver", ffOPTWR },
+ { efXVG, "-of", "dihfrac", ffOPTWR }, { efXVG, "-ot", "dihtrans", ffOPTWR },
+ { efXVG, "-oh", "trhisto", ffOPTWR }, { efXVG, "-oc", "dihcorr", ffOPTWR },
+ { efTRR, "-or", nullptr, ffOPTWR } };
#define NFILE asize(fnm)
- int npargs;
- t_pargs *ppa;
- gmx_output_env_t *oenv;
+ int npargs;
+ t_pargs* ppa;
+ gmx_output_env_t* oenv;
npargs = asize(pa);
ppa = add_acf_pargs(&npargs, pa);
/* Determine the non-zero part of the distribution */
- for (first = 0; (first < maxangstat-1) && (angstat[first+1] == 0); first++)
- {
- ;
- }
- for (last = maxangstat-1; (last > 0) && (angstat[last-1] == 0); last--)
- {
- ;
- }
+ for (first = 0; (first < maxangstat - 1) && (angstat[first + 1] == 0); first++) {}
+ for (last = maxangstat - 1; (last > 0) && (angstat[last - 1] == 0); last--) {}
- aver = aver2 = 0;
- for (i = 0; (i < nframes); i++)
- {
- aver += RAD2DEG * aver_angle[i];
- aver2 += gmx::square(RAD2DEG * aver_angle[i]);
- double aver = 0;
- printf("Found points in the range from %d to %d (max %d)\n",
- first, last, maxangstat);
- if (bTrans || bCorr || bALL || opt2bSet("-or", NFILE, fnm))
- { /* It's better to re-calculate Std. Dev per sample */
++ double aver = 0;
++ printf("Found points in the range from %d to %d (max %d)\n", first, last, maxangstat);
++ if (bTrans || bCorr || bALL || opt2bSet("-or", NFILE, fnm))
++ { /* It's better to re-calculate Std. Dev per sample */
+ real b_aver = aver_angle[0];
+ real b = dih[0][0];
+ real delta;
+ for (int i = 0; (i < nframes); i++)
+ {
- delta = correctRadianAngleRange(aver_angle[i] - b_aver);
++ delta = correctRadianAngleRange(aver_angle[i] - b_aver);
+ b_aver += delta;
- aver += b_aver;
++ aver += b_aver;
+ for (int j = 0; (j < nangles); j++)
+ {
- delta = correctRadianAngleRange(dih[j][i] - b);
- b += delta;
++ delta = correctRadianAngleRange(dih[j][i] - b);
++ b += delta;
+ }
+ }
+ }
+ else
- { /* Incorrect for Std. Dev. */
++ { /* Incorrect for Std. Dev. */
+ real delta, b_aver = aver_angle[0];
+ for (i = 0; (i < nframes); i++)
+ {
- delta = correctRadianAngleRange(aver_angle[i] - b_aver);
++ delta = correctRadianAngleRange(aver_angle[i] - b_aver);
+ b_aver += delta;
- aver += b_aver;
++ aver += b_aver;
+ }
}
- aver /= nframes;
+ aver /= nframes;
- aver2 /= nframes;
- aversig = std::sqrt(aver2 - gmx::square(aver));
- printf("Found points in the range from %d to %d (max %d)\n", first, last, maxangstat);
- printf(" < angle > = %g\n", aver);
- printf("< angle^2 > = %g\n", aver2);
- printf("Std. Dev. = %g\n", aversig);
+ double aversig = correctRadianAngleRange(aver);
+ aversig *= RAD2DEG;
- aver *= RAD2DEG;
++ aver *= RAD2DEG;
+ printf(" < angle > = %g\n", aversig);
if (mult == 3)
{
if (useGpuForBonded)
{
- auto stream = DOMAINDECOMP(cr)
- // TODO use havePPDomainDecomposition here to simplify the code.
- auto stream = (DOMAINDECOMP(cr) && (cr->nnodes - cr->npmenodes > 1)) ?
- nbnxn_gpu_get_command_stream(fr->nbv->gpu_nbv, eintNonlocal) :
- nbnxn_gpu_get_command_stream(fr->nbv->gpu_nbv, eintLocal);
++ auto stream = havePPDomainDecomposition(cr)
+ ? Nbnxm::gpu_get_command_stream(
+ fr->nbv->gpu_nbv, gmx::InteractionLocality::NonLocal)
+ : Nbnxm::gpu_get_command_stream(fr->nbv->gpu_nbv,
+ gmx::InteractionLocality::Local);
// TODO the heap allocation is only needed while
// t_forcerec lacks a constructor.
- fr->gpuBonded = new gmx::GpuBonded(mtop->ffparams,
- stream);
+ fr->gpuBonded = new gmx::GpuBonded(mtop->ffparams, stream, wcycle);
}
}