Merge branch 'release-5-0'
[alexxy/gromacs.git] / src / gromacs / mdlib / mdatom.cpp
similarity index 96%
rename from src/gromacs/mdlib/mdatom.c
rename to src/gromacs/mdlib/mdatom.cpp
index e4b698a018a9f5a000109c8b7fd25eddc816af4e..3d1c2e2a96cb99bc419e9e40fda3fad3599c7b35 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
 
 #include <math.h>
 
-#include "typedefs.h"
-#include "mdatoms.h"
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/mdatoms.h"
+#include "gromacs/legacyheaders/qmmm.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/topology/mtop_util.h"
 #include "gromacs/utility/smalloc.h"
-#include "main.h"
-#include "qmmm.h"
-#include "mtop_util.h"
-#include "gmx_omp_nthreads.h"
 
 #define ALMOST_ZERO 1e-30
 
 t_mdatoms *init_mdatoms(FILE *fp, gmx_mtop_t *mtop, gmx_bool bFreeEnergy)
 {
-    int                     mb, a, g, nmol;
+    int                     a;
     double                  tmA, tmB;
     t_atom                 *atom;
     t_mdatoms              *md;
     gmx_mtop_atomloop_all_t aloop;
-    t_ilist                *ilist;
 
     snew(md, 1);
 
@@ -120,8 +116,8 @@ void atoms2md(gmx_mtop_t *mtop, t_inputrec *ir,
     int                   i;
     t_grpopts            *opts;
     gmx_groups_t         *groups;
-    gmx_molblock_t       *molblock;
     int                   nthreads gmx_unused;
+    const real            oneOverSix = 1.0 / 6.0;
 
     bLJPME = EVDW_PME(ir->vdwtype);
 
@@ -129,8 +125,6 @@ void atoms2md(gmx_mtop_t *mtop, t_inputrec *ir,
 
     groups = &mtop->groups;
 
-    molblock = mtop->molblock;
-
     /* Index==NULL indicates no DD (unless we have a DD node with no
      * atoms), so also check for homenr. This should be
      * signaled properly with an extra parameter or nindex==-1.
@@ -231,11 +225,12 @@ void atoms2md(gmx_mtop_t *mtop, t_inputrec *ir,
 
     alook = gmx_mtop_atomlookup_init(mtop);
 
+    // cppcheck-suppress unreadVariable
     nthreads = gmx_omp_nthreads_get(emntDefault);
 #pragma omp parallel for num_threads(nthreads) schedule(static)
     for (i = 0; i < md->nr; i++)
     {
-        int      g, ag, molb;
+        int      g, ag;
         real     mA, mB, fac;
         real     c6, c12;
         t_atom  *atom;
@@ -333,7 +328,7 @@ void atoms2md(gmx_mtop_t *mtop, t_inputrec *ir,
             }
             else
             {
-                md->sigmaA[i] = pow(c12/c6, 1.0/6.0);
+                md->sigmaA[i] = pow(c12/c6, oneOverSix);
             }
             md->sigma3A[i]    = 1/(md->sigmaA[i]*md->sigmaA[i]*md->sigmaA[i]);
         }
@@ -353,7 +348,7 @@ void atoms2md(gmx_mtop_t *mtop, t_inputrec *ir,
                 }
                 else
                 {
-                    md->sigmaB[i] = pow(c12/c6, 1.0/6.0);
+                    md->sigmaB[i] = pow(c12/c6, oneOverSix);
                 }
                 md->sigma3B[i]    = 1/(md->sigmaB[i]*md->sigmaB[i]*md->sigmaB[i]);
             }