2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2005 David van der Spoel, Erik Lindahl, University of Groningen.
5 * Copyright (c) 2013,2014, by the GROMACS development team, led by
6 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 * and including many others, as listed in the AUTHORS file in the
8 * top-level source directory and at http://www.gromacs.org.
10 * GROMACS is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1
13 * of the License, or (at your option) any later version.
15 * GROMACS is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with GROMACS; if not, see
22 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 * If you want to redistribute modifications to GROMACS, please
26 * consider that scientific software is very special. Version
27 * control is crucial - bugs must be traceable. We will be happy to
28 * consider code for inclusion in the official distribution, but
29 * derived work must not be called official GROMACS. Details are found
30 * in the README & COPYING files - if they are missing, get the
31 * official version at http://www.gromacs.org.
33 * To help us fund GROMACS development, we humbly ask that you cite
34 * the research papers on the package. Check out http://www.gromacs.org.
37 #ifndef GMX_FFT_PARALLEL_3DFFT_H
38 #define GMX_FFT_PARALLEL_3DFFT_H
40 #include "../legacyheaders/types/nrnb.h"
41 #include "../legacyheaders/types/simple.h"
42 #include "../math/gmxcomplex.h"
43 #include "../utility/gmxmpi.h"
50 typedef struct gmx_parallel_3dfft *
55 /*! \brief Initialize parallel MPI-based 3D-FFT.
57 * This routine performs real-to-complex and complex-to-real parallel 3D FFTs,
58 * but not complex-to-complex.
60 * The routine is optimized for small-to-medium size FFTs used for PME and
61 * PPPM algorithms, and do allocate extra workspace whenever it might improve
64 * \param pfft_setup Pointer to parallel 3dfft setup structure, previously
65 * allocated or with automatic storage.
66 * \param ndata Number of grid cells in each direction
67 * \param real_data Real data. Input for forward and output for backward.
68 * \param complex_data Complex data.
69 * \param comm MPI communicator for both parallelization axis.
70 * Needs to be either initialized or MPI_NULL for
71 * no parallelization in that axis.
72 * \param bReproducible Try to avoid FFT timing optimizations and other stuff
73 * that could make results differ for two runs with
74 * identical input (reproducibility for debugging).
75 * \param nthreads Run in parallel using n threads
77 * \return 0 or a standard error code.
80 gmx_parallel_3dfft_init (gmx_parallel_3dfft_t * pfft_setup,
83 t_complex **complex_data,
85 gmx_bool bReproducible,
92 /*! \brief Get direct space grid index limits
95 gmx_parallel_3dfft_real_limits(gmx_parallel_3dfft_t pfft_setup,
101 /*! \brief Get reciprocal space grid index limits
104 gmx_parallel_3dfft_complex_limits(gmx_parallel_3dfft_t pfft_setup,
112 gmx_parallel_3dfft_execute(gmx_parallel_3dfft_t pfft_setup,
113 enum gmx_fft_direction dir,
115 gmx_wallcycle_t wcycle);
118 /*! \brief Release all data in parallel fft setup
120 * All temporary storage and FFT plans are released. The structure itself
121 * is not released, but the contents is invalid after this call.
123 * \param pfft_setup Parallel 3dfft setup.
124 * \param in_data Input data.
125 * \param out_data Output data.
126 * \param thread Thread index of the calling thread, i.e. index to the part
127 * of the data operated on last by the calling thread. This
128 * is needed to start the FFT without an OpenMP barrier.
129 * \param wcycle Wall cycle counters.
131 * \return 0 or a standard error code.
134 gmx_parallel_3dfft_destroy(gmx_parallel_3dfft_t pfft_setup);