*
* 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.
eigensolver(hess, ndim, begin-1, end-1, eigenvalues, eigenvectors);
/* And scale the output eigenvectors */
- if (bM && eigenvectors != NULL)
+ if (bM && eigenvectors != nullptr)
{
for (int i = 0; i < (end-begin+1); i++)
{
/* Cannot check symmetry since we only store half matrix */
/* divide elements hess[i][j] by sqrt(mas[i])*sqrt(mas[j]) when required */
- GMX_RELEASE_ASSERT(sparse_hessian != NULL, "NULL matrix pointer provided to nma_sparse_hessian");
+ GMX_RELEASE_ASSERT(sparse_hessian != nullptr, "NULL matrix pointer provided to nma_sparse_hessian");
if (bM)
{
sparse_eigensolver(sparse_hessian, neig, eigenvalues, eigenvectors, 10000000);
/* Scale output eigenvectors */
- if (bM && eigenvectors != NULL)
+ if (bM && eigenvectors != nullptr)
{
for (i = 0; i < neig; i++)
{
real value, omega, nu;
real factor_gmx_to_omega2;
real factor_omega_to_wavenumber;
- real *spectrum = NULL;
+ real *spectrum = nullptr;
real wfac;
gmx_output_env_t *oenv;
const char *qcleg[] = {
"Heat Capacity cV (J/mol K)",
"Enthalpy H (kJ/mol)"
};
- real * full_hessian = NULL;
- gmx_sparsematrix_t * sparse_hessian = NULL;
+ real * full_hessian = nullptr;
+ gmx_sparsematrix_t * sparse_hessian = nullptr;
t_filenm fnm[] = {
{ efMTX, "-f", "hessian", ffREAD },
- { efTPR, NULL, NULL, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
{ efXVG, "-of", "eigenfreq", ffWRITE },
{ efXVG, "-ol", "eigenval", ffWRITE },
{ efXVG, "-os", "spectrum", ffOPTWR },
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, 0,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
snew(top_x, tpx.natoms);
int natoms_tpx;
- read_tpx(ftp2fn(efTPR, NFILE, fnm), NULL, box, &natoms_tpx,
- top_x, NULL, &mtop);
+ read_tpx(ftp2fn(efTPR, NFILE, fnm), nullptr, box, &natoms_tpx,
+ top_x, nullptr, &mtop);
int nharm = 0;
if (bCons)
{
}
std::vector<size_t> atom_index = get_atom_index(&mtop);
- top = gmx_mtop_t_to_t_topology(&mtop);
+ top = gmx_mtop_t_to_t_topology(&mtop, true);
bM = TRUE;
int ndim = DIM*atom_index.size();
* If this is not valid we convert to full matrix storage,
* but warn the user that we might run out of memory...
*/
- if ((sparse_hessian != NULL) && (end == ndim))
+ if ((sparse_hessian != nullptr) && (end == ndim))
{
fprintf(stderr, "Cannot use sparse Hessian to calculate all eigenvectors.\n");
}
}
gmx_sparsematrix_destroy(sparse_hessian);
- sparse_hessian = NULL;
+ sparse_hessian = nullptr;
fprintf(stderr, "Converted sparse to full matrix storage.\n");
}
snew(eigenvalues, nrow);
- if (full_hessian != NULL)
+ if (full_hessian != nullptr)
{
/* Using full matrix storage */
eigenvectors = allocateEigenvectors(nrow, begin, end, false);
}
else
{
- qc = NULL;
+ qc = nullptr;
}
printf("Writing eigenfrequencies - negative eigenvalues will be set to zero.\n");
}
}
/* Spectrum ? */
- spec = NULL;
+ spec = nullptr;
if (opt2bSet("-os", NFILE, fnm) && (maxspec > 0))
{
snew(spectrum, maxspec);
nu = 1e-12*omega/(2*M_PI);
value = omega*factor_omega_to_wavenumber;
fprintf (out, "%6d %15g\n", i, value);
- if (NULL != spec)
+ if (nullptr != spec)
{
wfac = eigenvalues[i-begin]/(width*std::sqrt(2*M_PI));
for (j = 0; (j < maxspec); j++)
spectrum[j] += wfac*std::exp(-gmx::square(j-value)/(2*gmx::square(width)));
}
}
- if (NULL != qc)
+ if (nullptr != qc)
{
qcv = cv_corr(nu, T);
qu = u_corr(nu, T);
}
}
xvgrclose(out);
- if (NULL != spec)
+ if (nullptr != spec)
{
for (j = 0; (j < maxspec); j++)
{
}
xvgrclose(spec);
}
- if (NULL != qc)
+ if (nullptr != qc)
{
printf("Quantum corrections for harmonic degrees of freedom\n");
printf("Use appropriate -first and -last options to get reliable results.\n");
* will not be strictly orthogonal in plain cartesian scalar products.
*/
const real *eigenvectorPtr;
- if (full_hessian != NULL)
+ if (full_hessian != nullptr)
{
eigenvectorPtr = eigenvectors;
}
eigenvectorPtr = eigenvectors + (begin - 1)*atom_index.size();
}
write_eigenvectors(opt2fn("-v", NFILE, fnm), atom_index.size(), eigenvectorPtr, FALSE, begin, end,
- eWXR_NO, NULL, FALSE, top_x, bM, eigenvalues);
+ eWXR_NO, nullptr, FALSE, top_x, bM, eigenvalues);
return 0;
}