    module DFT_demon
    use fftw3
    implicit none
    private
    integer(8),allocatable,dimension(:,:) :: DFT_plan,C2R_plan,DFT_plan_Forward,R2C_plan
    public DFT_DEMON_GetC2C 
    contains
    
    
    
    subroutine DFT_DEMON_GetC2C(out_plan,n)
    implicit none
    integer(4) :: n,id
    integer(8) :: out_plan,test
    complex(8) :: HH2(size(DFT_plan,dim=1)),An2(size(DFT_plan,dim=1))
        
    if (n .gt. size(DFT_plan)) stop 'Erro1 1 DFT_DEMON.f90'
   
    !------------------------------------ Source of the errors--------------------
    if (DFT_plan(n,id) .eq. 0)  call dfftw_plan_dft_1d(DFT_plan(n,id),n,HH2,An2,FFTW_Backward,FFTW_exhaustive);
    !------------------------------------
    
    
    end subroutine
    

    end module