X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Fgmxana%2Fgmx_nmeig.cpp;fp=src%2Fgromacs%2Fgmxana%2Fgmx_nmeig.c;h=fbfb008c863fd7222b8538bbf9dcde3e7dd0a49d;hb=c3f2d46e4047f0c465f7234b3784a2fa6f02a065;hp=4560444e68827885052559546f1ce325b3c30aa9;hpb=0595b4a4c763a0bc574658992081abf8b0abc3fe;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/gmxana/gmx_nmeig.c b/src/gromacs/gmxana/gmx_nmeig.cpp similarity index 96% rename from src/gromacs/gmxana/gmx_nmeig.c rename to src/gromacs/gmxana/gmx_nmeig.cpp index 4560444e68..fbfb008c86 100644 --- a/src/gromacs/gmxana/gmx_nmeig.c +++ b/src/gromacs/gmxana/gmx_nmeig.cpp @@ -36,8 +36,8 @@ */ #include "gmxpre.h" -#include -#include +#include +#include #include "gromacs/commandline/pargs.h" #include "gromacs/fileio/mtxio.h" @@ -55,12 +55,13 @@ #include "gromacs/math/vec.h" #include "gromacs/topology/mtop_util.h" #include "gromacs/utility/futil.h" +#include "gromacs/utility/gmxassert.h" #include "gromacs/utility/smalloc.h" static double cv_corr(double nu, double T) { double x = PLANCK*nu/(BOLTZ*T); - double ex = exp(x); + double ex = std::exp(x); if (nu <= 0) { @@ -75,7 +76,7 @@ static double cv_corr(double nu, double T) static double u_corr(double nu, double T) { double x = PLANCK*nu/(BOLTZ*T); - double ex = exp(x); + double ex = std::exp(x); if (nu <= 0) { @@ -145,7 +146,7 @@ nma_full_hessian(real * hess, real * eigenvectors) { int i, j, k, l; - real mass_fac, rdum; + real mass_fac; int natoms; natoms = top->atoms.nr; @@ -217,6 +218,8 @@ nma_sparse_hessian(gmx_sparsematrix_t * sparse_hessian, /* 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"); + if (bM) { for (iatom = 0; (iatom < natoms); iatom++) @@ -312,20 +315,16 @@ int gmx_nmeig(int argc, char *argv[]) "Width (sigma) of the gaussian peaks (1/cm) when generating a spectrum" } }; FILE *out, *qc, *spec; - int status, trjout; t_topology top; gmx_mtop_t mtop; - int ePBC; rvec *top_x; matrix box; real *eigenvalues; real *eigenvectors; - real rdum, mass_fac, qcvtot, qutot, qcv, qu; - int natoms, ndim, nrow, ncol, count, nharm, nvsite; - char *grpname; - int i, j, k, l, d, gnx; + real qcvtot, qutot, qcv, qu; + int natoms, ndim, nrow, ncol, nharm, nvsite; + int i, j, k; gmx_bool bSuck; - atom_id *index; t_tpxheader tpx; int version, generation; real value, omega, nu; @@ -455,7 +454,7 @@ int gmx_nmeig(int argc, char *argv[]) bSuck = FALSE; for (i = begin-1; (i < 6); i++) { - if (fabs(eigenvalues[i]) > 1.0e-3) + if (std::abs(eigenvalues[i]) > 1.0e-3) { bSuck = TRUE; } @@ -551,16 +550,16 @@ int gmx_nmeig(int argc, char *argv[]) { value = 0; } - omega = sqrt(value*factor_gmx_to_omega2); + omega = std::sqrt(value*factor_gmx_to_omega2); nu = 1e-12*omega/(2*M_PI); value = omega*factor_omega_to_wavenumber; fprintf (out, "%6d %15g\n", i, value); if (NULL != spec) { - wfac = eigenvalues[i-begin]/(width*sqrt(2*M_PI)); + wfac = eigenvalues[i-begin]/(width*std::sqrt(2*M_PI)); for (j = 0; (j < maxspec); j++) { - spectrum[j] += wfac*exp(-sqr(j-value)/(2*sqr(width))); + spectrum[j] += wfac*std::exp(-sqr(j-value)/(2*sqr(width))); } } if (NULL != qc)