*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017, 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.
// better to be safe than sorry, so we check it with an assert.
// If we are in this comparison routine in the first place, neig2 should not be 0,
// so eigval2 should always be a valid pointer.
- GMX_RELEASE_ASSERT(eigval2 != NULL, "NULL pointer provided for eigval2");
+ GMX_RELEASE_ASSERT(eigval2 != nullptr, "NULL pointer provided for eigval2");
for (i = n; i < neig2; i++)
{
int noutvec, int *outvec, gmx_bool bSplit,
const gmx_output_env_t *oenv)
{
- FILE *xvgrout = NULL;
+ FILE *xvgrout = nullptr;
int nat, i, j, d, v, vec, nfr, nframes = 0, snew_size, frame;
- t_trxstatus *out = NULL;
+ t_trxstatus *out = nullptr;
t_trxstatus *status;
int noutvec_extr, imin, imax;
real *pmin, *pmax;
int *all_at;
matrix box;
rvec *xread, *x;
- real t, inp, **inprod = NULL;
+ real t, inp, **inprod = nullptr;
char str[STRLEN], str2[STRLEN], **ylabel, *c;
real fact;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
snew(x, natoms);
/* calculate x: a fitted struture of the selected atoms */
if (bFit)
{
- reset_x(nfit, ifit, nat, NULL, xread, w_rls);
+ reset_x(nfit, ifit, nat, nullptr, xread, w_rls);
do_fit(nat, w_rls, xref, xread);
}
for (i = 0; i < natoms; i++)
}
}
}
- write_trx(out, natoms, index, atoms, 0, t, box, xread, NULL, NULL);
+ write_trx(out, natoms, index, atoms, 0, t, box, xread, nullptr, nullptr);
}
nframes++;
}
if (projfile)
{
- GMX_RELEASE_ASSERT(inprod != NULL, "inprod must be non-NULL if projfile is non-NULL");
+ GMX_RELEASE_ASSERT(inprod != nullptr, "inprod must be non-NULL if projfile is non-NULL");
snew(ylabel, noutvec);
for (v = 0; v < noutvec; v++)
{
ylabel[v] = gmx_strdup(str);
}
sprintf(str, "projection on eigenvectors (%s)", proj_unit);
- write_xvgr_graphs(projfile, noutvec, 1, str, NULL, output_env_get_xvgr_tlabel(oenv),
+ write_xvgr_graphs(projfile, noutvec, 1, str, nullptr, output_env_get_xvgr_tlabel(oenv),
(const char **)ylabel,
- nframes, inprod[noutvec], inprod, NULL,
+ nframes, inprod[noutvec], inprod, nullptr,
output_env_get_time_factor(oenv), FALSE, bSplit, oenv);
}
{
t_atoms atoms;
rvec *x;
- real *b = NULL;
+ real *b = nullptr;
matrix box;
char *resnm, *atnm;
gmx_bool bPDB, b4D;
}
if ( ( b4D || bSplit ) && bPDB)
{
- GMX_RELEASE_ASSERT(inprod != NULL, "inprod must be non-NULL with 4D or split PDB output options");
+ GMX_RELEASE_ASSERT(inprod != nullptr, "inprod must be non-NULL with 4D or split PDB output options");
out = gmx_ffopen(threedplotfile, "w");
fprintf(out, "HEADER %s\n", str);
}
else
{
- write_sto_conf(threedplotfile, str, &atoms, x, NULL, ePBC, box);
+ write_sto_conf(threedplotfile, str, &atoms, x, nullptr, ePBC, box);
}
done_atom(&atoms);
}
snew(pmax, noutvec_extr);
if (extreme == 0)
{
- GMX_RELEASE_ASSERT(inprod != NULL, "inprod must be non-NULL");
+ GMX_RELEASE_ASSERT(inprod != nullptr, "inprod must be non-NULL");
fprintf(stderr, "%11s %17s %17s\n", "eigenvector", "Minimum", "Maximum");
fprintf(stderr,
"%11s %10s %10s %10s %10s\n", "", "value", "frame", "value", "frame");
*eigvec[outvec[v]][i][d]/sqrtm[i]);
}
}
- write_trx(out, natoms, index, atoms, 0, frame, topbox, xread, NULL, NULL);
+ write_trx(out, natoms, index, atoms, 0, frame, topbox, xread, nullptr, nullptr);
}
close_trx(out);
}
write_xvgr_graphs(outfile, noutvec, 4, "Eigenvector components",
"black: total, red: x, green: y, blue: z",
"Atom number", (const char **)ylabel,
- natoms, x, NULL, y, 1, FALSE, FALSE, oenv);
+ natoms, x, nullptr, y, 1, FALSE, FALSE, oenv);
fprintf(stderr, "\n");
}
y[g][i] = std::sqrt(eigval[eignr[v]]*norm2(eigvec[v][i]))/sqrtm[i];
}
}
- write_xvgr_graphs(outfile, noutvec, 1, "RMS fluctuation (nm) ", NULL,
+ write_xvgr_graphs(outfile, noutvec, 1, "RMS fluctuation (nm) ", nullptr,
"Atom number", (const char **)ylabel,
- natoms, x, y, NULL, 1, TRUE, FALSE, oenv);
+ natoms, x, y, nullptr, 1, TRUE, FALSE, oenv);
fprintf(stderr, "\n");
}
t_topology top;
int ePBC = -1;
- const t_atoms *atoms = NULL;
- rvec *xtop, *xref1, *xref2, *xrefp = NULL;
+ const t_atoms *atoms = nullptr;
+ rvec *xtop, *xref1, *xref2, *xrefp = nullptr;
gmx_bool bDMR1, bDMA1, bDMR2, bDMA2;
- int nvec1, nvec2, *eignr1 = NULL, *eignr2 = NULL;
- rvec *xav1, *xav2, **eigvec1 = NULL, **eigvec2 = NULL;
+ int nvec1, nvec2, *eignr1 = nullptr, *eignr2 = nullptr;
+ rvec *xav1, *xav2, **eigvec1 = nullptr, **eigvec2 = nullptr;
matrix topbox;
real totmass, *sqrtm, *w_rls, t;
int natoms;
const char *indexfile;
int i, j, d;
int nout, *iout, noutvec, *outvec, nfit;
- int *index = NULL, *ifit = NULL;
+ int *index = nullptr, *ifit = nullptr;
const char *VecFile, *Vec2File, *topfile;
const char *EigFile, *Eig2File;
const char *CompFile, *RmsfFile, *ProjOnVecFile;
const char *OverlapFile, *InpMatFile;
gmx_bool bFit1, bFit2, bM, bIndex, bTPS, bTop, bVec2, bProj;
gmx_bool bFirstToLast, bFirstLastSet, bTraj, bCompare, bPDB3D;
- real *eigval1 = NULL, *eigval2 = NULL;
+ real *eigval1 = nullptr, *eigval2 = nullptr;
int neig1, neig2;
double **xvgdata;
gmx_output_env_t *oenv;
t_filenm fnm[] = {
{ efTRN, "-v", "eigenvec", ffREAD },
{ efTRN, "-v2", "eigenvec2", ffOPTRD },
- { efTRX, "-f", NULL, ffOPTRD },
- { efTPS, NULL, NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffOPTRD },
+ { efTPS, nullptr, nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXVG, "-eig", "eigenval", ffOPTRD },
{ efXVG, "-eig2", "eigenval2", ffOPTRD },
{ efXVG, "-comp", "eigcomp", ffOPTWR },
if (!parse_common_args(&argc, argv,
PCA_CAN_TIME | PCA_TIME_UNIT | PCA_CAN_VIEW,
- NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
neig1 = DIM*natoms;
/* Overwrite eigenvalues from separate files if the user provides them */
- if (EigFile != NULL)
+ if (EigFile != nullptr)
{
int neig_tmp = read_xvg(EigFile, &xvgdata, &i);
if (neig_tmp != neig1)
neig2 = 0;
}
- if (Eig2File != NULL)
+ if (Eig2File != nullptr)
{
neig2 = read_xvg(Eig2File, &xvgdata, &i);
srenew(eigval2, neig2);
{
bM = FALSE;
}
- if ((xref1 == NULL) && (bM || bTraj))
+ if ((xref1 == nullptr) && (bM || bTraj))
{
bTPS = TRUE;
}
- xtop = NULL;
+ xtop = nullptr;
nfit = 0;
- ifit = NULL;
- w_rls = NULL;
+ ifit = nullptr;
+ w_rls = nullptr;
if (!bTPS)
{
else
{
bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm),
- &top, &ePBC, &xtop, NULL, topbox, bM);
+ &top, &ePBC, &xtop, nullptr, topbox, bM);
atoms = &top.atoms;
gpbc = gmx_rmpbc_init(&top.idef, ePBC, atoms->nr);
gmx_rmpbc(gpbc, atoms->nr, topbox, xtop);
/* Fitting is only required for the projection */
if (bProj && bFit1)
{
- if (xref1 == NULL)
+ if (xref1 == nullptr)
{
printf("\nNote: the structure in %s should be the same\n"
" as the one used for the fit in g_covar\n", topfile);
}
snew(xrefp, atoms->nr);
- if (xref1 != NULL)
+ if (xref1 != nullptr)
{
/* Safety check between selected fit-group and reference structure read from the eigenvector file */
if (natoms != nfit)
{
copy_rvec(xtop[ifit[i]], xrefp[ifit[i]]);
}
- reset_x(nfit, ifit, atoms->nr, NULL, xrefp, w_rls);
+ reset_x(nfit, ifit, atoms->nr, nullptr, xrefp, w_rls);
}
}
gmx_rmpbc_done(gpbc);
{
printf("Select eigenvectors for output, end your selection with 0\n");
nout = -1;
- iout = NULL;
+ iout = nullptr;
do
{
if (bProj)
{
- project(bTraj ? opt2fn("-f", NFILE, fnm) : NULL,
- bTop ? &top : NULL, ePBC, topbox,
+ project(bTraj ? opt2fn("-f", NFILE, fnm) : nullptr,
+ bTop ? &top : nullptr, ePBC, topbox,
ProjOnVecFile, TwoDPlotFile, ThreeDPlotFile, FilterFile, skip,
ExtremeFile, bFirstLastSet, max, nextr, atoms, natoms, index,
bFit1, xrefp, nfit, ifit, w_rls,