Code beautification with uncrustify
[alexxy/gromacs.git] / src / gromacs / gmxlib / shift_util.c
index 9df8e3dc53c1b7cb29d51ad857201a2de719edb5..9f5aeb2e38502f2d46ce9949d5de06eafb01dbaa 100644 (file)
@@ -1,11 +1,11 @@
 /*
- * 
+ *
  *                This source code is part of
- * 
+ *
  *                 G   R   O   M   A   C   S
- * 
+ *
  *          GROningen MAchine for Chemical Simulations
- * 
+ *
  *                        VERSION 3.2.0
  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * 
+ *
  * If you want to redistribute modifications, please consider that
  * scientific software is very special. Version control is crucial -
  * bugs must be traceable. We will be happy to consider code for
  * inclusion in the official distribution, but derived work must not
  * be called official GROMACS. Details are found in the README & COPYING
  * files - if they are missing, get the official version at www.gromacs.org.
- * 
+ *
  * To help us fund GROMACS development, we humbly ask that you cite
  * the papers on the package - you can find them in the top README file.
- * 
+ *
  * For more info, check our website at http://www.gromacs.org
- * 
+ *
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
 #endif
 
 #define p2(x) ((x)*(x))
-#define p3(x) ((x)*(x)*(x)) 
-#define p4(x) ((x)*(x)*(x)*(x)) 
+#define p3(x) ((x)*(x)*(x))
+#define p4(x) ((x)*(x)*(x)*(x))
 
-static real A,A_3,B,B_4,C,c1,c2,c3,c4,c5,c6,One_4pi,FourPi_V,Vol,N0;
+static real                A, A_3, B, B_4, C, c1, c2, c3, c4, c5, c6, One_4pi, FourPi_V, Vol, N0;
 #ifdef GMX_THREAD_MPI
-static tMPI_Thread_mutex_t shift_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
+static tMPI_Thread_mutex_t shift_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
 #endif
 
 
-void set_shift_consts(FILE *log,real r1,real rc,rvec box,t_forcerec *fr)
+void set_shift_consts(FILE *log, real r1, real rc, rvec box, t_forcerec *fr)
 {
 #ifdef GMX_THREAD_MPI
-  /* at the very least we shouldn't allow multiple threads to set these 
-     simulataneously */
-  tMPI_Thread_mutex_lock(&shift_mutex);
+    /* at the very least we shouldn't allow multiple threads to set these
+       simulataneously */
+    tMPI_Thread_mutex_lock(&shift_mutex);
 #endif
-  /* A, B and C are recalculated in tables.c */
-  if (r1 < rc) {
-    A   = (2*r1-5*rc)/(p3(rc)*p2(rc-r1));
-    B   = (4*rc-2*r1)/(p3(rc)*p3(rc-r1));
-    /*C   = (10*rc*rc-5*rc*r1+r1*r1)/(6*rc*rc); Hermans Eq. not correct */
-  }
-  else
-    gmx_fatal(FARGS,"r1 (%f) >= rc (%f) in %s, line %d",
-             r1,rc,__FILE__,__LINE__);
+    /* A, B and C are recalculated in tables.c */
+    if (r1 < rc)
+    {
+        A   = (2*r1-5*rc)/(p3(rc)*p2(rc-r1));
+        B   = (4*rc-2*r1)/(p3(rc)*p3(rc-r1));
+        /*C   = (10*rc*rc-5*rc*r1+r1*r1)/(6*rc*rc); Hermans Eq. not correct */
+    }
+    else
+    {
+        gmx_fatal(FARGS, "r1 (%f) >= rc (%f) in %s, line %d",
+                  r1, rc, __FILE__, __LINE__);
+    }
 
-  A_3 = A/3.0;
-  B_4 = B/4.0;
-  C   = 1/rc-A_3*p3(rc-r1)-B_4*p4(rc-r1);
-  N0  = 2.0*M_PI*p3(rc)*p3(rc-r1);
+    A_3 = A/3.0;
+    B_4 = B/4.0;
+    C   = 1/rc-A_3*p3(rc-r1)-B_4*p4(rc-r1);
+    N0  = 2.0*M_PI*p3(rc)*p3(rc-r1);
 
-  Vol     =(box[XX]*box[YY]*box[ZZ]);
-  FourPi_V=4.0*M_PI/Vol;
+    Vol      = (box[XX]*box[YY]*box[ZZ]);
+    FourPi_V = 4.0*M_PI/Vol;
 
-  if (debug) {
-      fprintf(debug,"Constants for short-range and fourier stuff:\n"
-             "r1 = %10.3f,  rc = %10.3f\n"
-             "A  = %10.3e,  B  = %10.3e,  C  = %10.3e, FourPi_V = %10.3e\n",
-             r1,rc,A,B,C,FourPi_V);
-  }
+    if (debug)
+    {
+        fprintf(debug, "Constants for short-range and fourier stuff:\n"
+                "r1 = %10.3f,  rc = %10.3f\n"
+                "A  = %10.3e,  B  = %10.3e,  C  = %10.3e, FourPi_V = %10.3e\n",
+                r1, rc, A, B, C, FourPi_V);
+    }
 
-  /* Constants derived by Mathematica */
-  c1 = -40*rc*rc    + 50*rc*r1    - 16*r1*r1;
-  c2 =  60*rc       - 30*r1;
-  c3 = -10*rc*rc*rc + 20*rc*rc*r1 - 13*rc*r1*r1 + 3*r1*r1*r1;
-  c4 = -20*rc*rc    + 40*rc*r1    - 14*r1*r1;
-  c5 = -c2;
-  c6 = -5*rc*rc*r1  +  7*rc*r1*r1 - 2*r1*r1*r1;
+    /* Constants derived by Mathematica */
+    c1 = -40*rc*rc    + 50*rc*r1    - 16*r1*r1;
+    c2 =  60*rc       - 30*r1;
+    c3 = -10*rc*rc*rc + 20*rc*rc*r1 - 13*rc*r1*r1 + 3*r1*r1*r1;
+    c4 = -20*rc*rc    + 40*rc*r1    - 14*r1*r1;
+    c5 = -c2;
+    c6 = -5*rc*rc*r1  +  7*rc*r1*r1 - 2*r1*r1*r1;
 
-  if (debug) {
-      fprintf(debug,"c1 = %10.3e,  c2 = %10.3e,  c3 = %10.3e\n"
-             "c4 = %10.3e,  c5 = %10.3e,  c6 = %10.3e,  N0 = %10.3e\n",
-             c1,c2,c3,c4,c5,c6,N0);
-  }
-    
-  One_4pi = 1.0/(4.0*M_PI);
+    if (debug)
+    {
+        fprintf(debug, "c1 = %10.3e,  c2 = %10.3e,  c3 = %10.3e\n"
+                "c4 = %10.3e,  c5 = %10.3e,  c6 = %10.3e,  N0 = %10.3e\n",
+                c1, c2, c3, c4, c5, c6, N0);
+    }
+
+    One_4pi = 1.0/(4.0*M_PI);
 #ifdef GMX_THREAD_MPI
-  tMPI_Thread_mutex_unlock(&shift_mutex);
+    tMPI_Thread_mutex_unlock(&shift_mutex);
 #endif
 }