Dear Prof. Taylor
The commented out plan in isw.eq.1 was my attempt before asking in the forum. I am attaching another file which has the relevant code for the Fourier Transforms including plan creation(lines 84-91) and execution(lines 148,159 etc.). The function endings R2C and C2R are from real to complex transforms and vice versa. What I am trying to do now is take these plan creation routines out of this subroutine and perform them only once as I do not change the size of the arrays which is given from the material file at the moment.
To create the plan, one has to provide the size of the transform, the input and output arrays, and flags indicating the desired behavior of the plan (e.g., FFTW_FORWARD or FFTW_BACKWARD for the transform direction). Then the planner function searches the set of plans and provides an optimum plan considering also the plan creation flags(FFTW_EXECUTE, FFTW_MEASURE, etc.). And quoting from "Implementing FFTs in Practice" by S. G. Johnson and Matteo Frigo, the theoretical basis behind these plans is, "Roughly speaking, to solve a general DFT problem, one must perform three tasks. First, one must reduce a problem of arbitrary vector rank to a set of loops nested around a problem of vector rank 0, i.e., a single (possibly multi-dimensional) DFT. Second, one must reduce the multi-dimensional DFT to a sequence of of rank-1 problems, i.e., one-dimensional DFTs; for simplicity, however, we do not consider multi-dimensional DFTs below. Third, one must solve the rank-1, vector rank-0 problem by means of some DFT algorithm such as Cooley-Tukey. These three steps need not be executed in the stated order, however, and in fact, almost every permutation and interleaving of these three steps leads to a correct DFT plan."