minor fixes in ditribution files
[gromacs/qmmm-gamess-us.git] / include / fftgrid.h
blobf26eed4ddb99002322317f7249b90bb15d489312
1 /*
2 *
3 * This source code is part of
4 *
5 * G R O M A C S
6 *
7 * GROningen MAchine for Chemical Simulations
8 *
9 * VERSION 3.2.0
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gromacs Runs On Most of All Computer Systems
36 #ifndef _fftgrid_h
37 #define _fftgrid_h
39 #ifdef HAVE_CONFIG_H
40 #include <config.h>
41 #endif
43 #include <stdio.h>
44 #include "typedefs.h"
45 #include "gmxcomplex.h"
46 #include "network.h"
47 #include "gmx_fft.h"
49 #ifdef GMX_MPI
50 #include "gmx_parallel_3dfft.h"
51 #endif
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
57 /* Use FFTW */
59 #define INDEX(i,j,k) ((i)*la12+(j)*la2+(k))
61 typedef struct {
62 int local_nx,local_x_start,local_ny_after_transpose;
63 int local_y_start_after_transpose;
64 } t_parfft;
66 typedef struct {
67 real * ptr;
68 bool bParallel;
69 real * workspace;
70 int nx,ny,nz,la2r,la2c,la12r,la12c;
71 int nptr,nxyz;
72 gmx_fft_t fft_setup;
73 #ifdef GMX_MPI
74 gmx_parallel_3dfft_t mpi_fft_setup;
75 t_parfft pfft;
76 #endif
77 } t_fftgrid;
79 extern t_fftgrid *mk_fftgrid(int nx,
80 int ny,
81 int nz,
82 int *node2slab,
83 int *slab2grid_x,
84 t_commrec * cr,
85 bool bReproducible);
87 /* Create an FFT grid (1 Dimensional), to be indexed by the INDEX macro
88 * Setup FFT plans and extract local sizes for the grid.
89 * If the file pointer is given, information is printed to it.
90 * If cr is non-NULL and cr->nnodes>1, a parallel grid and FFT will be created.
91 * The node2slab array translates to node ids to slab indices,
92 * when NULL the slab ids are assumed to be identical to the node ids.
93 * The slab2grid_x array determines which grid x-indices beling to which slab
94 * (array size nnodes+1), when NULL this is determined automatically.
95 * Set bReproducible to avoid FFTW timing and other optimizations that
96 * could affect reproducibility of simulations.
99 extern void pr_fftgrid(FILE *fp,char *title,t_fftgrid *grid);
100 /* Dump a grid to a file */
102 extern void done_fftgrid(t_fftgrid *grid);
103 /* And throw it away again */
105 extern void gmxfft3D(t_fftgrid *grid,enum gmx_fft_direction dir,t_commrec *cr);
106 /* Do the FFT, direction may be either
107 * FFTW_FORWARD (sign -1) for real -> complex transform
108 * FFTW_BACKWARD (sign 1) for complex -> real transform
111 extern void clear_fftgrid(t_fftgrid *grid);
112 /* Set it to zero */
114 extern void unpack_fftgrid(t_fftgrid *grid,int *nx,int *ny,int *nz,
115 int *nx2,int *ny2,int *nz2,
116 int *la2, int *la12,bool bReal, real **ptr);
118 /* Get the values for the constants into local copies */
123 /************************************************************************
125 * For backward compatibility (for testing the ewald code vs. PPPM etc)
126 * some old grid routines are retained here.
128 ************************************************************************/
130 extern real ***mk_rgrid(int nx,int ny,int nz);
132 extern void free_rgrid(real ***grid,int nx,int ny);
134 extern real print_rgrid(FILE *fp,char *title,int nx,int ny,int nz,
135 real ***grid);
137 extern void print_rgrid_pdb(char *fn,int nx,int ny,int nz,real ***grid);
139 extern t_complex ***mk_cgrid(int nx,int ny,int nz);
141 extern void free_cgrid(t_complex ***grid,int nx,int ny);
143 extern t_complex print_cgrid(FILE *fp,char *title,int nx,int ny,int nz,
144 t_complex ***grid);
146 extern void clear_cgrid(int nx,int ny,int nz,t_complex ***grid);
148 extern void clear_rgrid(int nx,int ny,int nz,real ***grid);
150 #ifdef __cplusplus
152 #endif
154 #endif