#include <math.h>
#include <stdio.h>
#include <time.h>
+
#include "typedefs.h"
#include "macros.h"
#include "smalloc.h"
#include "xvgr.h"
-#include "complex.h"
+#include "gmxcomplex.h"
#include "copyrite.h"
-#include "gmx_fft.h"
#include "mdrun.h"
#include "main.h"
#include "statutil.h"
+#include "gromacs/fft/fft.h"
#ifdef GMX_MPI
-#include "gmx_parallel_3dfft.h"
+#include "gromacs/fft/parallel_3dfft.h"
#endif
#include "fftgrid.h"
add_subdirectory(gmxana)
add_subdirectory(analysisdata)
add_subdirectory(commandline)
+add_subdirectory(fft)
add_subdirectory(linearalgebra)
add_subdirectory(onlinehelp)
add_subdirectory(options)
--- /dev/null
+#
+# This file is part of the GROMACS molecular simulation package.
+#
+# Copyright (c) 2013, by the GROMACS development team, led by
+# David van der Spoel, Berk Hess, Erik Lindahl, and including many
+# others, as listed in the AUTHORS file in the top-level source
+# directory and at http://www.gromacs.org.
+#
+# 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.
+#
+# 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.
+#
+# 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.
+#
+# 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.
+#
+# To help us fund GROMACS development, we humbly ask that you cite
+# the research papers on the package. Check out http://www.gromacs.org.
+
+# GLOB is used to get full paths
+file(GLOB FFT_SOURCES
+ fft.c fft5d.cpp parallel_3dfft.c)
+
+if (GMX_FFT_FFTPACK)
+ file(GLOB FFT_SPECIFIC_SOURCES fft_fftpack.c)
+ list(APPEND FFT_SPECIFIC_SOURCES
+ ${CMAKE_SOURCE_DIR}/src/external/fftpack/fftpack.c)
+endif()
+if (GMX_FFT_FFTW3)
+ file(GLOB FFT_SPECIFIC_SOURCES fft_fftw3.cpp)
+endif()
+if (GMX_FFT_MKL)
+ file(GLOB FFT_SPECIFIC_SOURCES fft_mkl.c)
+endif()
+
+set(LIBGROMACS_SOURCES
+ ${LIBGROMACS_SOURCES} ${FFT_SOURCES} ${FFT_SPECIFIC_SOURCES} PARENT_SCOPE)
+
+set(FFT_PUBLIC_HEADERS
+ fft.h)
+install(FILES ${FFT_PUBLIC_HEADERS}
+ DESTINATION ${INCL_INSTALL_DIR}/gromacs/fft
+ COMPONENT development)
+
+if (BUILD_TESTING)
+ add_subdirectory(tests)
+endif (BUILD_TESTING)
#include <config.h>
#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "types/simple.h"
#include "gmxcomplex.h"
-#include "gmx_fft.h"
-
#include "gmx_fatal.h"
+#include "gromacs/fft/fft.h"
/* This file contains common fft utility functions, but not
* the actual transform implementations. Check the
- * files like gmx_fft_fftw3.c or gmx_fft_intel_mkl.c for that.
+ * files like fft_fftw3.c or fft_mkl.c for that.
*/
#ifndef GMX_FFT_FFTW3
* And Hey:
* Gnomes, ROck Monsters And Chili Sauce
*/
-
-#ifndef _GMX_FFT_H_
-#define _GMX_FFT_H_
-
-/*! \file gmx_fft.h
+/*! \file
* \brief Fast Fourier Transforms.
*
* This file provides an abstract Gromacs interface to Fourier transforms,
* We also provide our own multi-dimensional transform setups even when
* the underlying library does not support it directly.
*
+ * \ingroup module_fft
*/
+#ifndef GMX_FFT_FFT_H
+#define GMX_FFT_FFT_H
#include <stdio.h>
-#include "types/simple.h"
-#include "gmxcomplex.h"
-
+#include "../legacyheaders/types/simple.h"
+#include "../legacyheaders/gmxcomplex.h"
#ifdef __cplusplus
extern "C" {
}
#endif
-#endif /* _GMX_FFT_H_ */
+#endif
FILE* debug;
#endif
-#include <types/commrec.h>
-#include "gmxcomplex.h"
-#include "gmx_fft.h"
+#include "gromacs/legacyheaders/gmxcomplex.h"
+#include "gromacs/utility/gmxmpi.h"
+#include "gromacs/fft/fft.h"
#ifndef GMX_MPI
double MPI_Wtime();
#include <config.h>
#endif
-#ifdef GMX_FFT_FFTPACK
-
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-
-#include "gmx_fft.h"
+#include "gromacs/fft/fft.h"
#include "gmx_fatal.h"
+
#include "external/fftpack/fftpack.h"
-/** Contents of the FFTPACK fft datatype.
+/*! \internal \brief
+ * Contents of the FFTPACK fft datatype.
+ *
+ * Note that this is one of several possible implementations of gmx_fft_t.
*
* FFTPACK only does 1d transforms, so we use a pointers to another fft for
* the transform in the next dimension.
* Thus, a 3d-structure contains a pointer to a 2d one, which in turns contains
* a pointer to a 1d. The 1d structure has next==NULL.
*/
+#ifdef DOXYGEN
+struct gmx_fft_fftpack
+#else
struct gmx_fft
+#endif
{
int ndim; /**< Dimensions, including our subdimensions. */
int n; /**< Number of points in this dimension. */
void gmx_fft_cleanup()
{
}
-#endif /* GMX_FFT_FFTPACK */
#include <config.h>
#endif
-#ifdef GMX_FFT_FFTW3
-
#include <errno.h>
#include <stdlib.h>
#include <fftw3.h>
-#include "gmx_fft.h"
+#include "gromacs/fft/fft.h"
#include "gmx_fatal.h"
#ifdef GMX_DOUBLE
This is OK as long as the memory directly comes from malloc and is not some subarray within alloated memory.
- This has to be fixed if any future architecute requires memory to be aligned to multiples of 32 bytes.
*/
-
+/*! \internal \brief
+ * Contents of the FFTW3 fft datatype.
+ *
+ * Note that this is one of several possible implementations of gmx_fft_t.
+ */
+#ifdef DOXYGEN
+struct gmx_fft_fftw3
+#else
struct gmx_fft
+#endif
{
- /* Three alternatives (unaligned/aligned, out-of-place/in-place, forward/backward)
+ /*! \brief
+ * FFTW plans.
+ *
+ * Three alternatives (unaligned/aligned, out-of-place/in-place, forward/backward)
* results in 8 different FFTW plans. Keep track of them with 3 array indices:
* first index: 0=unaligned, 1=aligned
* second index: 0=out-of-place, 1=in-place
* third index: 0=backward, 1=forward
*/
FFTWPREFIX(plan) plan[2][2][2];
- /* Catch user mistakes */
+ /** Used to catch user mistakes */
int real_transform;
+ /** Number of dimensions in the FFT */
int ndim;
};
{
FFTWPREFIX(cleanup)();
}
-#endif /* GMX_FFT_FFTW3 */
#include <config.h>
#endif
-#ifdef GMX_FFT_MKL
-
#include <errno.h>
#include <stdlib.h>
#include <mkl_dfti.h>
#include <mkl_service.h>
-
-#include "gmx_fft.h"
+#include "gromacs/fft/fft.h"
#include "gmx_fatal.h"
#define GMX_DFTI_PREC DFTI_SINGLE
#endif
-/* Contents of the Intel MKL FFT fft datatype.
+/*! \internal \brief
+ * Contents of the Intel MKL FFT fft datatype.
*
* Note that this is one of several possible implementations of gmx_fft_t.
*
* 3D, ooplace real FFT: 0=FFTx, 1=FFTy, 2=r2c FFTz, 3=c2r FFTz
*
* Intel people reading this: Learn from FFTW what a good interface looks like :-)
- *
*/
+#ifdef DOXYGEN
+struct gmx_fft_mkl
+#else
struct gmx_fft
+#endif
{
int ndim; /**< Number of dimensions in FFT */
int nx; /**< Length of X transform */
{
mkl_free_buffers();
}
-
-#else
-int
- gmx_fft_mkl_empty;
-#endif /* GMX_FFT_MKL */
#include <string.h>
#include <errno.h>
+#include "gromacs/fft/parallel_3dfft.h"
+#include "gromacs/fft/fft.h"
#include "gromacs/utility/gmxmpi.h"
#include "smalloc.h"
-#include "gmx_parallel_3dfft.h"
-#include "gmx_fft.h"
#include "gmxcomplex.h"
#include "gmx_fatal.h"
* Gnomes, ROck Monsters And Chili Sauce
*/
-#ifndef _gmx_parallel_3dfft_h_
-#define _gmx_parallel_3dfft_h_
+#ifndef GMX_FFT_PARALLEL_3DFFT_H
+#define GMX_FFT_PARALLEL_3DFFT_H
-
-#include "types/simple.h"
-#include "types/commrec.h"
-#include "gmxcomplex.h"
-#include "gmx_fft.h"
+#include "../legacyheaders/types/nrnb.h"
+#include "../legacyheaders/types/simple.h"
+#include "../legacyheaders/gmxcomplex.h"
+#include "../utility/gmxmpi.h"
+#include "fft.h"
#ifdef __cplusplus
extern "C" {
}
#endif
-
-#endif /* _gmx_parallel_3dfft_h_ */
+#endif
--- /dev/null
+gmx_add_unit_test(FFTUnitTests fft-test
+ fft.cpp)
* Tests utilities for fft calculations.
*
* \author Roland Schulz <roland@utk.edu>
- * \ingroup module_mdlibs
+ * \ingroup module_fft
*/
-
-#include "config.h"
#include <vector>
-#include <complex>
+
#include <gtest/gtest.h>
-#include "testutils/refdata.h"
+
+#include "gromacs/fft/fft.h"
+#include "gromacs/fft/parallel_3dfft.h"
#include "gromacs/utility/stringutil.h"
-#include "gmx_fft.h"
-#include "gmx_parallel_3dfft.h"
+#include "testutils/refdata.h"
namespace
{
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
-#include "gmx_fft.h"
+
+#include "gromacs/fft/fft.h"
#include "smalloc.h"
#include "correl.h"
#define _correl_h
#include "typedefs.h"
-#include "gmx_fft.h"
-
+#include "gromacs/fft/fft.h"
typedef struct {
int n;
#include "xvgr.h"
#include "correl.h"
#include "gmx_ana.h"
-#include "gmx_fft.h"
+#include "gromacs/fft/fft.h"
enum {
VACF, MVACF, DOS, DOS_SOLID, DOS_DIFF, DOS_CP, DOS_S, DOS_A, DOS_E, DOS_NR
#include "strdb.h"
#include "xvgr.h"
#include "gmx_ana.h"
-#include "gmx_fft.h"
+#include "gromacs/fft/fft.h"
static void index_atom2mol(int *n, atom_id *index, t_block *mols)
{
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include <smalloc.h>
-#include <gmx_fft.h>
-#include <gmx_fatal.h>
-#include <futil.h>
+
+#include "smalloc.h"
+#include "gromacs/fft/fft.h"
+#include "gmx_fatal.h"
+#include "futil.h"
#include "interf.h"
#include "powerspect.h"
file(GLOB MDLIB_SOURCES nbnxn_kernels/*.c *.c *.cpp)
-if(GMX_FFT_FFTPACK)
-list(APPEND MDLIB_SOURCES ${CMAKE_SOURCE_DIR}/src/external/fftpack/fftpack.c)
-endif()
set(MDLIB_SOURCES ${MDLIB_SOURCES} PARENT_SCOPE)
-if (BUILD_TESTING)
- add_subdirectory(tests)
-endif (BUILD_TESTING)
if(GMX_GPU)
add_subdirectory(nbnxn_cuda)
#include <config.h>
#endif
+#include "gromacs/fft/parallel_3dfft.h"
#include "gromacs/utility/gmxmpi.h"
#include <stdio.h>
#include "nrnb.h"
#include "copyrite.h"
#include "gmx_wallcycle.h"
-#include "gmx_parallel_3dfft.h"
#include "pdbio.h"
#include "gmx_cyclecounter.h"
#include "gmx_omp.h"
+++ /dev/null
-gmx_add_unit_test(MDLibUnitTests mdlib-test
- fft.cpp)