1 2! Copyright (C) 2002-2005 J. K. Dewhurst, S. Sharma and C. Ambrosch-Draxl. 3! This file is distributed under the terms of the GNU General Public License. 4! See the file COPYING for license details. 5 6!BOP 7! !ROUTINE: nfftifc 8! !INTERFACE: 9subroutine nfftifc(np,n) 10! !INPUT/OUTPUT PARAMETERS: 11! np : number of allowed primes (in,integer) 12! n : required/avalable grid size (inout,integer) 13! !DESCRIPTION: 14! Interface to the grid requirements of the fast Fourier transform routine. 15! Most routines restrict $n$ to specific prime factorisations. This routine 16! returns the next largest grid size allowed by the FFT routine. 17! 18! !REVISION HISTORY: 19! Created October 2002 (JKD) 20!EOP 21!BOC 22implicit none 23! arguments 24integer, intent(in) :: np 25integer, intent(inout) :: n 26! local variables 27integer i,j 28integer, parameter :: p(10)=[2,3,5,7,11,13,17,19,23,29] 29if ((np.lt.1).or.(np.gt.10)) then 30 write(*,*) 31 write(*,'("Error(nfftifc): np out of range : ",I8)') np 32 write(*,*) 33 stop 34end if 35if (n.le.0) then 36 write(*,*) 37 write(*,'("Error(nfftifc): n <= 0 : ",I8)') n 38 write(*,*) 39 stop 40end if 4110 continue 42i=n 43do j=1,np 44 do while(mod(i,p(j)).eq.0) 45 i=i/p(j) 46 end do 47end do 48if (i.ne.1) then 49 n=n+1 50 goto 10 51end if 52end subroutine 53!EOC 54 55