Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / gmxana / powerspect.c
index 6b276b711a454a6217774383fa3d10e8be03316d..67674959c7cceb5f39b903cf11dc70e86f3c5eb8 100644 (file)
@@ -1,50 +1,48 @@
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
- * $Id: densorder.c,v 0.9
+/*
+ * This file is part of the GROMACS molecular simulation package.
  *
- *                This source code is part of
+ * Copyright (c) 2010,2011,2013,2014, 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.
  *
- *                 G   R   O   M   A   C   S
- *
- *          GROningen MAchine for Chemical Simulations
- *
- *                        VERSION 3.0
- *
- * Copyright (c) 1991-2001
- * BIOSON Research Institute, Dept. of Biophysical Chemistry
- * University of Groningen, The Netherlands
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
  * 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.
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- * 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.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
  *
- * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
+ * If you want to redistribute modifications to GROMACS, 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 http://www.gromacs.org.
  *
- * And Hey:
- * Gyas ROwers Mature At Cryogenic Speed
+ * 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 "smalloc.h"
-#include "gromacs/fft/fft.h"
-#include "gmx_fatal.h"
-#include "gromacs/fileio/futil.h"
-#include "interf.h"
 #include "powerspect.h"
 
+#include "gromacs/fft/fft.h"
+#include "gromacs/gmxana/interf.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/utility/smalloc.h"
+
 void addtoavgenergy(t_complex *list, real *result, int size, int tsteps)
 {
     int i;
@@ -74,7 +72,6 @@ void powerspectavg(real ***intftab, int tsteps, int xbins, int ybins, char **out
 /*Prepare data structures for FFT, with time averaging of power spectrum*/
     if ( (status = gmx_fft_init_2d_real(&fftp, xbins, ybins, GMX_FFT_FLAG_NONE) ) != 0)
     {
-        free(fftp);
         gmx_fatal(status, __FILE__, __LINE__, "Error allocating FFT");
     }
 
@@ -100,8 +97,8 @@ void powerspectavg(real ***intftab, int tsteps, int xbins, int ybins, char **out
     }
     /*Print out average energy-spectrum to outfiles[0] and outfiles[1];*/
 
-    datfile1 = ffopen(outfiles[0], "w");
-    datfile2 = ffopen(outfiles[1], "w");
+    datfile1 = gmx_ffopen(outfiles[0], "w");
+    datfile2 = gmx_ffopen(outfiles[1], "w");
 
 /*Filling dat files with spectral data*/
     fprintf(datfile1, "%s\n", "kx\t ky\t\tPower(kx,ky)");
@@ -111,11 +108,11 @@ void powerspectavg(real ***intftab, int tsteps, int xbins, int ybins, char **out
         fprintf(datfile1, "%d\t%d\t %8.6f\n", (n / fy), (n % fy), pspectavg1[n]);
         fprintf(datfile2, "%d\t%d\t %8.6f\n", (n /fy), (n % fy), pspectavg2[n]);
     }
-    ffclose(datfile1);
-    ffclose(datfile2);
+    gmx_ffclose(datfile1);
+    gmx_ffclose(datfile2);
 
-    free(ftspect1);
-    free(ftspect2);
+    sfree(ftspect1);
+    sfree(ftspect2);
 
 }