Remove unnecessary config.h includes
[alexxy/gromacs.git] / src / gromacs / mdlib / mdatom.c
index eb41eb1c9d95c0b5d67eaa5757d5cddd4a72538f..ea59275ec10e2143156eaaf95a5ab72b11285dfc 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 "smalloc.h"
-#include "main.h"
-#include "qmmm.h"
-#include "mtop_util.h"
-#include "gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/mdatoms.h"
+#include "gromacs/utility/smalloc.h"
+#include "gromacs/legacyheaders/qmmm.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
 
 #define ALMOST_ZERO 1e-30
 
@@ -115,12 +112,15 @@ void atoms2md(gmx_mtop_t *mtop, t_inputrec *ir,
               int homenr,
               t_mdatoms *md)
 {
+    gmx_bool              bLJPME;
     gmx_mtop_atomlookup_t alook;
     int                   i;
     t_grpopts            *opts;
     gmx_groups_t         *groups;
     gmx_molblock_t       *molblock;
 
+    bLJPME = EVDW_PME(ir->vdwtype);
+
     opts = &ir->opts;
 
     groups = &mtop->groups;
@@ -152,15 +152,21 @@ void atoms2md(gmx_mtop_t *mtop, t_inputrec *ir,
         srenew(md->massT, md->nalloc);
         srenew(md->invmass, md->nalloc);
         srenew(md->chargeA, md->nalloc);
-        srenew(md->c6A, md->nalloc);
-        srenew(md->sigmaA, md->nalloc);
-        srenew(md->sigma3A, md->nalloc);
+        if (bLJPME)
+        {
+            srenew(md->sqrt_c6A, md->nalloc);
+            srenew(md->sigmaA, md->nalloc);
+            srenew(md->sigma3A, md->nalloc);
+        }
         if (md->nPerturbed)
         {
             srenew(md->chargeB, md->nalloc);
-            srenew(md->c6B, md->nalloc);
-            srenew(md->sigmaB, md->nalloc);
-            srenew(md->sigma3B, md->nalloc);
+            if (bLJPME)
+            {
+                srenew(md->sqrt_c6B, md->nalloc);
+                srenew(md->sigmaB, md->nalloc);
+                srenew(md->sigma3B, md->nalloc);
+            }
         }
         srenew(md->typeA, md->nalloc);
         if (md->nPerturbed)
@@ -314,36 +320,41 @@ void atoms2md(gmx_mtop_t *mtop, t_inputrec *ir,
         }
         md->chargeA[i]      = atom->q;
         md->typeA[i]        = atom->type;
-        c6                  = mtop->ffparams.iparams[atom->type*(mtop->ffparams.atnr+1)].lj.c6;
-        c12                 = mtop->ffparams.iparams[atom->type*(mtop->ffparams.atnr+1)].lj.c12;
-        md->c6A[i]          = sqrt(c6);
-        if (c6 == 0.0 || c12 == 0.0)
-        {
-            md->sigmaA[i]     = 1.0;
-        }
-        else
+        if (bLJPME)
         {
-            md->sigmaA[i]     = pow(c12/c6, 1.0/6.0);
+            c6                = mtop->ffparams.iparams[atom->type*(mtop->ffparams.atnr+1)].lj.c6;
+            c12               = mtop->ffparams.iparams[atom->type*(mtop->ffparams.atnr+1)].lj.c12;
+            md->sqrt_c6A[i]   = sqrt(c6);
+            if (c6 == 0.0 || c12 == 0)
+            {
+                md->sigmaA[i] = 1.0;
+            }
+            else
+            {
+                md->sigmaA[i] = pow(c12/c6, 1.0/6.0);
+            }
+            md->sigma3A[i]    = 1/(md->sigmaA[i]*md->sigmaA[i]*md->sigmaA[i]);
         }
-        md->sigma3A[i] = 1/(md->sigmaA[i]*md->sigmaA[i]*md->sigmaA[i]);
-
         if (md->nPerturbed)
         {
+            md->bPerturbed[i] = PERTURBED(*atom);
             md->chargeB[i]    = atom->qB;
             md->typeB[i]      = atom->typeB;
-            c6                = mtop->ffparams.iparams[atom->typeB*(mtop->ffparams.atnr+1)].lj.c6;
-            c12               = mtop->ffparams.iparams[atom->typeB*(mtop->ffparams.atnr+1)].lj.c12;
-            md->c6B[i]        = sqrt(c6);
-            if (c6 == 0.0 || c12 == 0.0)
-            {
-                md->sigmaB[i]   = 1.0;
-            }
-            else
+            if (bLJPME)
             {
-                md->sigmaB[i]   = pow(c12/c6, 1.0/6.0);
+                c6                = mtop->ffparams.iparams[atom->typeB*(mtop->ffparams.atnr+1)].lj.c6;
+                c12               = mtop->ffparams.iparams[atom->typeB*(mtop->ffparams.atnr+1)].lj.c12;
+                md->sqrt_c6B[i]   = sqrt(c6);
+                if (c6 == 0.0 || c12 == 0)
+                {
+                    md->sigmaB[i] = 1.0;
+                }
+                else
+                {
+                    md->sigmaB[i] = pow(c12/c6, 1.0/6.0);
+                }
+                md->sigma3B[i]    = 1/(md->sigmaB[i]*md->sigmaB[i]*md->sigmaB[i]);
             }
-            md->bPerturbed[i] = PERTURBED(*atom);
-            md->sigma3B[i]    = 1/(md->sigmaB[i]*md->sigmaB[i]*md->sigmaB[i]);
         }
         md->ptype[i]    = atom->ptype;
         if (md->cTC)