Fix a table generation bug for pme-shift
[alexxy/gromacs.git] / src / gromacs / mdlib / tables.c
index 5f5d9d58fdb01c9d22a69032c3c4e4bbdee3dc82..c883d4afabfceb5154892a069d2254b6d584d640 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, 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.
  */
 #include "gmxpre.h"
 
+#include "gromacs/legacyheaders/tables.h"
+
 #include <math.h>
-#include "gromacs/math/utilities.h"
-#include "gromacs/legacyheaders/typedefs.h"
-#include "gromacs/legacyheaders/names.h"
-#include "gromacs/utility/smalloc.h"
-#include "gromacs/utility/fatalerror.h"
-#include "gromacs/utility/futil.h"
+
 #include "gromacs/fileio/xvgr.h"
-#include "gromacs/math/vec.h"
-#include "gromacs/legacyheaders/network.h"
-#include "gromacs/math/units.h"
 #include "gromacs/legacyheaders/force.h"
-#include "gromacs/fileio/gmxfio.h"
 #include "gromacs/legacyheaders/macros.h"
-#include "gromacs/legacyheaders/tables.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/math/units.h"
+#include "gromacs/math/utilities.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/utility/smalloc.h"
 
 /* All the possible (implemented) table functions */
 enum {
@@ -942,11 +944,11 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr,
                 break;
             case etabEwald:
             case etabEwaldSwitch:
-                Vtab  = gmx_erfc(ewc*rc)/rc;
+                Vcut  = gmx_erfc(ewc*rc)/rc;
                 break;
             case etabEwaldUser:
                 /* Only calculate minus the reciprocal space contribution */
-                Vtab  = -gmx_erf(ewc*rc)/rc;
+                Vcut  = -gmx_erf(ewc*rc)/rc;
                 break;
             case etabRF:
             case etabRF_ZERO:
@@ -1199,7 +1201,7 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr,
     }
 
 #ifdef DEBUG_SWITCH
-    gmx_fio_fclose(fp);
+    xvgrclose(fp);
 #endif
 }
 
@@ -1533,7 +1535,7 @@ t_forcetable make_tables(FILE *out, const output_env_t oenv,
                 evaluate_table(table.data, 4*k, 12, table.scale, x0, &y0, &yp);
                 fprintf(fp, "%15.10e  %15.10e  %15.10e\n", x0, y0, yp);
             }
-            gmx_fio_fclose(fp);
+            xvgrclose(fp);
         }
         done_tabledata(&(td[k]));
     }
@@ -1643,7 +1645,7 @@ t_forcetable make_gb_table(const output_env_t oenv,
             fprintf(fp, "%15.10e  %15.10e  %15.10e\n", x0, y0, yp);
 
         }
-        gmx_fio_fclose(fp);
+        xvgrclose(fp);
     }
 
     /*
@@ -1782,7 +1784,7 @@ t_forcetable make_atf_table(FILE *out, const output_env_t oenv,
             fprintf(fp, "%15.10e  %15.10e  %15.10e\n", x0, y0, yp);
 
         }
-        gmx_ffclose(fp);
+        xvgrclose(fp);
     }
 
     done_tabledata(&(td[0]));