*/
#include "gmxpre.h"
+#include <cassert>
#include <cmath>
#include <cstring>
if ((ri->nr == atoms->resinfo[atoms->atom[i].resind].nr) &&
(ri->ic == atoms->resinfo[atoms->atom[i].resind].ic) &&
(std::strcmp(*atoms->resinfo[atoms->atom[i].resind].name, rresnm) == 0) &&
- (std::strstr(*atoms->atomname[i], atomnm) != NULL))
+ (std::strstr(*atoms->atomname[i], atomnm) != nullptr))
{
break;
}
start = 0;
av = 0;
m = 0;
+ if (!f)
+ {
+ assert(U);
+ }
for (i = 0; i < isize; i++)
{
- av += w_rls[index[i]]*(f != NULL ? f[i] : U[i][uind]);
+ av += w_rls[index[i]]*(f != nullptr ? f[i] : U[i][uind]);
m += w_rls[index[i]];
if (i+1 == isize ||
atoms->atom[index[i]].resind != atoms->atom[index[i+1]].resind)
{
av /= m;
- if (f != NULL)
+ if (f != nullptr)
{
for (j = start; j <= i; j++)
{
real bfac, pdb_bfac, *Uaver;
double **U, *xav;
int aid;
- rvec *rmsd_x = NULL;
+ rvec *rmsd_x = nullptr;
double *rmsf, invcount, totmass;
int d;
real count = 0;
rvec xcm;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
gmx_output_env_t *oenv;
const char *leg[2] = { "MD", "X-Ray" };
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efPDB, "-q", NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efPDB, "-q", nullptr, ffOPTRD },
{ efPDB, "-oq", "bfac", ffOPTWR },
{ efPDB, "-ox", "xaver", ffOPTWR },
{ efXVG, "-o", "rmsf", ffWRITE },
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, asize(pargs), pargs, asize(desc), desc, 0, NULL,
+ NFILE, fnm, asize(pargs), pargs, asize(desc), desc, 0, nullptr,
&oenv))
{
return 0;
devfn = opt2fn_null("-od", NFILE, fnm);
dirfn = opt2fn_null("-dir", NFILE, fnm);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xref, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xref, nullptr, box, TRUE);
const char *title = *top.name;
snew(w_rls, top.atoms.nr);
t_topology *top_pdb;
snew(top_pdb, 1);
/* Read coordinates twice */
- read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, NULL, NULL, NULL, pdbbox, FALSE);
+ read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, nullptr, nullptr, nullptr, pdbbox, FALSE);
snew(pdbatoms, 1);
*pdbatoms = top_pdb->atoms;
- read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, NULL, &pdbx, NULL, pdbbox, FALSE);
+ read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, nullptr, &pdbx, nullptr, pdbbox, FALSE);
/* TODO Should this assert that top_pdb->atoms.nr == top.atoms.nr?
* See discussion at https://gerrit.gromacs.org/#/c/6430/1 */
title = *top_pdb->name;
refatoms = &top.atoms;
pdbx = xref;
snew(pdbatoms->pdbinfo, pdbatoms->nr);
+ pdbatoms->havePdbInfo = TRUE;
copy_mat(box, pdbbox);
}
{
for (d = 0; d < DIM*DIM; d++)
{
- average_residues(NULL, U, d, isize, index, w_rls, &top.atoms);
+ average_residues(nullptr, U, d, isize, index, w_rls, &top.atoms);
}
}
}
if (bRes)
{
- average_residues(rmsf, NULL, 0, isize, index, w_rls, &top.atoms);
+ average_residues(rmsf, nullptr, 0, isize, index, w_rls, &top.atoms);
}
/* Write RMSD output */
fp = xvgropen(devfn, "RMS Deviation", label, "(nm)", oenv);
rvec_inc(pdbx[index[i]], xcm);
}
write_sto_conf_indexed(opt2fn("-oq", NFILE, fnm), title, pdbatoms, pdbx,
- NULL, ePBC, pdbbox, isize, index);
+ nullptr, ePBC, pdbbox, isize, index);
}
if (opt2bSet("-ox", NFILE, fnm))
{
}
}
/* Write a .pdb file with B-factors and optionally anisou records */
- write_sto_conf_indexed(opt2fn("-ox", NFILE, fnm), title, pdbatoms, bFactorX, NULL,
+ write_sto_conf_indexed(opt2fn("-ox", NFILE, fnm), title, pdbatoms, bFactorX, nullptr,
ePBC, pdbbox, isize, index);
sfree(bFactorX);
}