25 use,
intrinsic :: iso_fortran_env
56 integer,
intent(in) :: n
57 integer,
intent(out) :: n_next
60 integer,
parameter :: ndata1024 = 149, ndata = 149
62 integer,
dimension(ndata),
parameter :: idata = (/ &
63 3, 4, 5, 6, 8, 9, 12, 15, 16, 18, &
64 20, 24, 25, 27, 30, 32, 36, 40, 45, 48, &
65 54, 60, 64, 72, 75, 80, 81, 90, 96, 100, &
66 108, 120, 125, 128, 135, 144, 150, 160, 162, 180, &
67 192, 200, 216, 225, 240, 243, 256, 270, 288, 300, &
68 320, 324, 360, 375, 384, 400, 405, 432, 450, 480, &
69 486, 500, 512, 540, 576, 600, 625, 640, 648, 675, &
70 720, 729, 750, 768, 800, 810, 864, 900, 960, 972, &
71 1000, 1024, 1080, 1125, 1152, 1200, 1215, 1280, 1296, 1350,&
72 1440, 1458, 1500, 1536, 1600, 1620, 1728, 1800, 1875, 1920,&
73 1944, 2000, 2025, 2048, 2160, 2250, 2304, 2400, 2430, 2500,&
74 2560, 2592, 2700, 2880, 3000, 3072, 3125, 3200, 3240, 3375,&
75 3456, 3600, 3750, 3840, 3888, 4000, 4050, 4096, 4320, 4500,&
76 4608, 4800, 5000, 5120, 5184, 5400, 5625, 5760, 6000, 6144,&
77 6400, 6480, 6750, 6912, 7200, 7500, 7680, 8000, 8192 /)
80 loop_data:
do i = 1,ndata1024
81 if (n <= idata(i))
then
86 write(unit=*,fmt=*)
"fourier_dim: ",n,
" is bigger than ",idata(ndata1024)
177 subroutine fft(n1, n2, n3, nd1, nd2, nd3, z, isign, inzee)
178 integer,
intent(in) :: n1, n2, n3, nd1, nd2, nd3
179 real(real64),
intent(inout) :: z(1:2, 1:nd1*nd2*nd3, 1:2)
180 integer,
intent(in) :: isign
181 integer,
intent(inout) :: inzee
183 real(real64),
allocatable :: zw(:, :, :)
184 real(real64),
allocatable :: trig(:, :)
185 integer,
allocatable :: after(:), now(:), before(:)
187 integer :: ncache, nfft, mm, i, ic
188 integer :: npr, iam, inzet, m, lot, nn, lotomp, j, jompa, jompb
189 integer :: n, ma, mb, jj, inzeep
193 if (max(n1,n2,n3) > 8192) stop
'fft:8192 limit reached'
202 if (ncache /= 0 .and. ncache <= max(n1,n2,n3)*4) ncache=max(n1,n2,n3/2)*4
205 if (inzee <= 0 .or. inzee >= 3) stop
'fft:wrong inzee'
206 if (isign /= 1 .and. isign /= -1) stop
'fft:wrong isign'
207 if (n1 > nd1) stop
'fft:n1>nd1'
208 if (n2 > nd2) stop
'fft:n2>nd2'
209 if (n3 > nd3) stop
'fft:n3>nd3'
213 if (ncache == 0)
then
214 safe_allocate(trig(1:2,1:8192))
215 safe_allocate(after(1:20))
216 safe_allocate(now(1:20))
217 safe_allocate(before(1:20))
219 call ctrig(n3,trig,after,before,now,isign,ic)
224 call fftstp(mm,nfft,nd3,mm,nd3,z(1,1,inzee),z(1,1,3-inzee), &
225 trig,after(i),now(i),before(i),isign)
231 call fftrot(mm,nfft,nd3,mm,nd3,z(1,1,inzee),z(1,1,3-inzee), &
232 trig,after(i),now(i),before(i),isign)
236 if (n2 /= n3)
call ctrig(n2,trig,after,before,now,isign,ic)
241 call fftstp(mm,nfft,nd2,mm,nd2,z(1,1,inzee),z(1,1,3-inzee), &
242 trig,after(i),now(i),before(i),isign)
247 call fftrot(mm,nfft,nd2,mm,nd2,z(1,1,inzee),z(1,1,3-inzee), &
248 trig,after(i),now(i),before(i),isign)
251 if (n1 /= n2)
call ctrig(n1,trig,after,before,now,isign,ic)
256 call fftstp(mm,nfft,nd1,mm,nd1,z(1,1,inzee),z(1,1,3-inzee), &
257 trig,after(i),now(i),before(i),isign)
263 call fftrot(mm,nfft,nd1,mm,nd1,z(1,1,inzee),z(1,1,3-inzee), &
264 trig,after(i),now(i),before(i),isign)
280 allocate(zw(1:2,1:ncache/4,1:2))
281 allocate(trig(1:2,1:1024))
282 allocate(after(1:20))
284 allocate(before(1:20))
291 lot = max(1,ncache/(4*n3))
294 if (2*n*lot*2 > ncache) stop
'fft:ncache1'
296 call ctrig(n3,trig,after,before,now,isign,ic)
300 lotomp=(nd1*n2)/npr+1
302 mb = min((iam+1)*lotomp,nd1*n2)
306 call fftrot(mm,nfft,m,mm,m,z(1,j,inzet),z(1,jj,3-inzet), &
307 trig,after(i),now(i),before(i),isign)
311 lotomp = (nd1*n2)/npr+1
313 jompb = min((iam+1)*lotomp,nd1*n2)
314 do j = jompa,jompb,lot
316 mb = min(j+(lot-1),jompb)
322 call fftstp(mm,nfft,m,nn,n,z(1,j,inzet),zw(1,1,3-inzeep), &
323 trig,after(i),now(i),before(i),isign)
327 call fftstp(nn,nfft,n,nn,n,zw(1,1,inzeep),zw(1,1,3-inzeep), &
328 trig,after(i),now(i),before(i),isign)
332 call fftrot(nn,nfft,n,mm,m,zw(1,1,inzeep),z(1,jj,3-inzet), &
333 trig,after(i),now(i),before(i),isign)
344 lot = max(1,ncache/(4*n2))
347 if (2*n*lot*2 > ncache) stop
'fft:ncache2'
349 if (n2 /= n3)
call ctrig(n2,trig,after,before,now,isign,ic)
353 lotomp = (nd3*n1)/npr+1
355 mb = min((iam+1)*lotomp,nd3*n1)
359 call fftrot(mm,nfft,m,mm,m,z(1,j,inzet),z(1,jj,3-inzet), &
360 trig,after(i),now(i),before(i),isign)
364 lotomp = (nd3*n1)/npr+1
366 jompb = min((iam+1)*lotomp,nd3*n1)
367 do j = jompa,jompb,lot
369 mb = min(j+(lot-1),jompb)
375 call fftstp(mm,nfft,m,nn,n,z(1,j,inzet),zw(1,1,3-inzeep), &
376 trig,after(i),now(i),before(i),isign)
380 call fftstp(nn,nfft,n,nn,n,zw(1,1,inzeep),zw(1,1,3-inzeep), &
381 trig,after(i),now(i),before(i),isign)
386 call fftrot(nn,nfft,n,mm,m,zw(1,1,inzeep),z(1,jj,3-inzet), &
387 trig,after(i),now(i),before(i),isign)
397 lot = max(1,ncache/(4*n1))
400 if (2*n*lot*2 > ncache) stop
'fft:ncache3'
402 if (n1 /= n2)
call ctrig(n1,trig,after,before,now,isign,ic)
406 lotomp = (nd2*n3)/npr+1
408 mb = min((iam+1)*lotomp,nd2*n3)
412 call fftrot(mm,nfft,m,mm,m,z(1,j,inzet),z(1,jj,3-inzet), &
413 trig,after(i),now(i),before(i),isign)
417 lotomp=(nd2*n3)/npr+1
419 jompb=min((iam+1)*lotomp,nd2*n3)
422 mb=min(j+(lot-1),jompb)
428 call fftstp(mm,nfft,m,nn,n,z(1,j,inzet),zw(1,1,3-inzeep), &
429 trig,after(i),now(i),before(i),isign)
433 call fftstp(nn,nfft,n,nn,n,zw(1,1,inzeep),zw(1,1,3-inzeep), &
434 trig,after(i),now(i),before(i),isign)
438 call fftrot(nn,nfft,n,mm,m,zw(1,1,inzeep),z(1,jj,3-inzet), &
439 trig,after(i),now(i),before(i),isign)
444 deallocate(zw, trig, after, now, before)
445 if (iam == 0) inzee=inzet
464 subroutine ctrig(n,trig,after,before,now,isign,ic)
465 integer :: n, isign, ic
466 integer :: now(7), after(7), before(7)
467 real(real64) :: trig(:,:)
469 integer :: i, j, itt, nh
470 real(real64) :: angle, trigc, trigs, twopi
471 INTEGER,
DIMENSION(7,149) :: idata
474 data ((idata(i,j),i=1,7),j=1,74) / &
475 3, 3, 1, 1, 1, 1, 1, 4, 4, 1, 1, 1, 1, 1, &
476 5, 5, 1, 1, 1, 1, 1, 6, 6, 1, 1, 1, 1, 1, &
477 8, 8, 1, 1, 1, 1, 1, 9, 3, 3, 1, 1, 1, 1, &
478 12, 4, 3, 1, 1, 1, 1, 15, 5, 3, 1, 1, 1, 1, &
479 16, 4, 4, 1, 1, 1, 1, 18, 6, 3, 1, 1, 1, 1, &
480 20, 5, 4, 1, 1, 1, 1, 24, 8, 3, 1, 1, 1, 1, &
481 25, 5, 5, 1, 1, 1, 1, 27, 3, 3, 3, 1, 1, 1, &
482 30, 6, 5, 1, 1, 1, 1, 32, 8, 4, 1, 1, 1, 1, &
483 36, 4, 3, 3, 1, 1, 1, 40, 8, 5, 1, 1, 1, 1, &
484 45, 5, 3, 3, 1, 1, 1, 48, 4, 4, 3, 1, 1, 1, &
485 54, 6, 3, 3, 1, 1, 1, 60, 5, 4, 3, 1, 1, 1, &
486 64, 8, 8, 1, 1, 1, 1, 72, 8, 3, 3, 1, 1, 1, &
487 75, 5, 5, 3, 1, 1, 1, 80, 5, 4, 4, 1, 1, 1, &
488 81, 3, 3, 3, 3, 1, 1, 90, 6, 5, 3, 1, 1, 1, &
489 96, 8, 4, 3, 1, 1, 1, 100, 5, 5, 4, 1, 1, 1, &
490 108, 4, 3, 3, 3, 1, 1, 120, 8, 5, 3, 1, 1, 1, &
491 125, 5, 5, 5, 1, 1, 1, 128, 8, 4, 4, 1, 1, 1, &
492 135, 5, 3, 3, 3, 1, 1, 144, 6, 8, 3, 1, 1, 1, &
493 150, 6, 5, 5, 1, 1, 1, 160, 8, 5, 4, 1, 1, 1, &
494 162, 6, 3, 3, 3, 1, 1, 180, 5, 4, 3, 3, 1, 1, &
495 192, 6, 8, 4, 1, 1, 1, 200, 8, 5, 5, 1, 1, 1, &
496 216, 8, 3, 3, 3, 1, 1, 225, 5, 5, 3, 3, 1, 1, &
497 240, 6, 8, 5, 1, 1, 1, 243, 3, 3, 3, 3, 3, 1, &
498 256, 8, 8, 4, 1, 1, 1, 270, 6, 5, 3, 3, 1, 1, &
499 288, 8, 4, 3, 3, 1, 1, 300, 5, 5, 4, 3, 1, 1, &
500 320, 5, 4, 4, 4, 1, 1, 324, 4, 3, 3, 3, 3, 1, &
501 360, 8, 5, 3, 3, 1, 1, 375, 5, 5, 5, 3, 1, 1, &
502 384, 8, 4, 4, 3, 1, 1, 400, 5, 5, 4, 4, 1, 1, &
503 405, 5, 3, 3, 3, 3, 1, 432, 4, 4, 3, 3, 3, 1, &
504 450, 6, 5, 5, 3, 1, 1, 480, 8, 5, 4, 3, 1, 1, &
505 486, 6, 3, 3, 3, 3, 1, 500, 5, 5, 5, 4, 1, 1, &
506 512, 8, 8, 8, 1, 1, 1, 540, 5, 4, 3, 3, 3, 1, &
507 576, 4, 4, 4, 3, 3, 1, 600, 8, 5, 5, 3, 1, 1, &
508 625, 5, 5, 5, 5, 1, 1, 640, 8, 5, 4, 4, 1, 1, &
509 648, 8, 3, 3, 3, 3, 1, 675, 5, 5, 3, 3, 3, 1, &
510 720, 5, 4, 4, 3, 3, 1, 729, 3, 3, 3, 3, 3, 3, &
511 750, 6, 5, 5, 5, 1, 1, 768, 4, 4, 4, 4, 3, 1/
513 data ((idata(i,j),i=1,7),j=75,149) / &
514 800, 8, 5, 5, 4, 1, 1, 810, 6, 5, 3, 3, 3, 1, &
515 864, 8, 4, 3, 3, 3, 1, 900, 5, 5, 4, 3, 3, 1, &
516 960, 5, 4, 4, 4, 3, 1, 972, 4, 3, 3, 3, 3, 3, &
517 1000, 8, 5, 5, 5, 1, 1, 1024, 4, 4, 4, 4, 4, 1, &
518 1080, 6, 5, 4, 3, 3, 1, 1125, 5, 5, 5, 3, 3, 1, &
519 1152, 6, 4, 4, 4, 3, 1, 1200, 6, 8, 5, 5, 1, 1, &
520 1215, 5, 3, 3, 3, 3, 3, 1280, 8, 8, 5, 4, 1, 1, &
521 1296, 6, 8, 3, 3, 3, 1, 1350, 6, 5, 5, 3, 3, 1, &
522 1440, 6, 5, 4, 4, 3, 1, 1458, 6, 3, 3, 3, 3, 3, &
523 1500, 5, 5, 5, 4, 3, 1, 1536, 6, 8, 8, 4, 1, 1, &
524 1600, 8, 8, 5, 5, 1, 1, 1620, 5, 4, 3, 3, 3, 3, &
525 1728, 6, 8, 4, 3, 3, 1, 1800, 6, 5, 5, 4, 3, 1, &
526 1875, 5, 5, 5, 5, 3, 1, 1920, 6, 5, 4, 4, 4, 1, &
527 1944, 6, 4, 3, 3, 3, 3, 2000, 5, 5, 5, 4, 4, 1, &
528 2025, 5, 5, 3, 3, 3, 3, 2048, 8, 4, 4, 4, 4, 1, &
529 2160, 6, 8, 5, 3, 3, 1, 2250, 6, 5, 5, 5, 3, 1, &
530 2304, 6, 8, 4, 4, 3, 1, 2400, 6, 5, 5, 4, 4, 1, &
531 2430, 6, 5, 3, 3, 3, 3, 2500, 5, 5, 5, 5, 4, 1, &
532 2560, 8, 5, 4, 4, 4, 1, 2592, 6, 4, 4, 3, 3, 3, &
533 2700, 5, 5, 4, 3, 3, 3, 2880, 6, 8, 5, 4, 3, 1, &
534 3000, 6, 5, 5, 5, 4, 1, 3072, 6, 8, 4, 4, 4, 1, &
535 3125, 5, 5, 5, 5, 5, 1, 3200, 8, 5, 5, 4, 4, 1, &
536 3240, 6, 5, 4, 3, 3, 3, 3375, 5, 5, 5, 3, 3, 3, &
537 3456, 6, 4, 4, 4, 3, 3, 3600, 6, 8, 5, 5, 3, 1, &
538 3750, 6, 5, 5, 5, 5, 1, 3840, 6, 8, 5, 4, 4, 1, &
539 3888, 6, 8, 3, 3, 3, 3, 4000, 8, 5, 5, 5, 4, 1, &
540 4050, 6, 5, 5, 3, 3, 3, 4096, 8, 8, 4, 4, 4, 1, &
541 4320, 6, 5, 4, 4, 3, 3, 4500, 5, 5, 5, 4, 3, 3, &
542 4608, 6, 8, 8, 4, 3, 1, 4800, 6, 8, 5, 5, 4, 1, &
543 5000, 8, 5, 5, 5, 5, 1, 5120, 8, 8, 5, 4, 4, 1, &
544 5184, 6, 8, 4, 3, 3, 3, 5400, 6, 5, 5, 4, 3, 3, &
545 5625, 5, 5, 5, 5, 3, 3, 5760, 6, 8, 8, 5, 3, 1, &
546 6000, 6, 8, 5, 5, 5, 1, 6144, 6, 8, 8, 4, 4, 1, &
547 6400, 8, 8, 5, 5, 4, 1, 6480, 6, 8, 5, 3, 3, 3, &
548 6750, 6, 5, 5, 5, 3, 3, 6912, 6, 8, 4, 4, 3, 3, &
549 7200, 6, 5, 5, 4, 4, 3, 7500, 5, 5, 5, 5, 4, 3, &
550 7680, 6, 8, 8, 5, 4, 1, 8000, 8, 8, 5, 5, 5, 1, &
551 8192, 8, 8, 8, 4, 4, 1 /
554 if (n == idata(1,i))
then
569 print*,
'VALUE OF',n,
'NOT ALLOWED FOR FFT, ALLOWED VALUES ARE:'
571 write(6,37) (idata(1,i),i=1,149)
578 after(i)=after(i-1)*now(i-1)
579 before(ic-i+1)=before(ic-i+2)*now(ic-i+2)
582 twopi=6.283185307179586_real64
585 if (mod(n,2) == 0)
then
622 subroutine fftstp(mm,nfft,m,nn,n,zin,zout,trig,after,now,before,isign)
623 integer :: mm, nfft, m, nn, n, isign
624 integer :: after, before, atn, atb, now
625 real(real64) :: trig(:,:)
626 real(real64) :: zin(2, mm, m), zout(2, nn, n)
628 real(real64) :: rt2i, dp, cp, cm, ci5, cr5, ci6, cr6, am, ap, ci8, cr8
629 real(real64) :: r, r1, r2, r3, r4, r5, r6, r7, r8_, r25, r34
630 real(real64) :: s, s1, s2, s3, s4, s5, s6, s7, s8, s25, s34
631 real(real64) :: bb, bm, dm, bp
632 real(real64) :: cr2, ci2, cr3, ci3, cr4, ci4, cr7, ci7
633 real(real64) :: cos2, sin2, cos4, sin4
634 real(real64) :: ur1, ur2, ur3, ui1, ui2, ui3
635 real(real64) :: vr1, vr2, vr3, vi1, vi2, vi3
636 integer :: ia, ib, j, ias, itrig, itt
637 integer :: nin1, nin2, nin3, nin4, nin5, nin6, nin7, nin8
638 integer :: nout1, nout2, nout3, nout4, nout5, nout6, nout7, nout8
644 rt2i=0.7071067811865475_real64
659 zout(1,j,nout1)= r2 + r1
660 zout(2,j,nout1)= s2 + s1
661 zout(1,j,nout2)= r1 - r2
662 zout(2,j,nout2)= s1 - s2
667 if (2*ias == after)
then
681 zout(1,j,nout1)= r1 - r2
682 zout(2,j,nout1)= s2 + s1
683 zout(1,j,nout2)= r2 + r1
684 zout(2,j,nout2)= s1 - s2
700 zout(1,j,nout1)= r2 + r1
701 zout(2,j,nout1)= s1 - s2
702 zout(1,j,nout2)= r1 - r2
703 zout(2,j,nout2)= s2 + s1
707 else if (4*ias == after)
then
723 zout(1,j,nout1)= r2 + r1
724 zout(2,j,nout1)= s2 + s1
725 zout(1,j,nout2)= r1 - r2
726 zout(2,j,nout2)= s1 - s2
744 zout(1,j,nout1)= r2 + r1
745 zout(2,j,nout1)= s2 + s1
746 zout(1,j,nout2)= r1 - r2
747 zout(2,j,nout2)= s1 - s2
751 else if (4*ias == 3*after)
then
767 zout(1,j,nout1)= r1 - r2
768 zout(2,j,nout1)= s2 + s1
769 zout(1,j,nout2)= r2 + r1
770 zout(2,j,nout2)= s1 - s2
788 zout(1,j,nout1)= r2 + r1
789 zout(2,j,nout1)= s1 - s2
790 zout(1,j,nout2)= r1 - r2
791 zout(2,j,nout2)= s2 + s1
813 zout(1,j,nout1)= r2 + r1
814 zout(2,j,nout1)= s2 + s1
815 zout(1,j,nout2)= r1 - r2
816 zout(2,j,nout2)= s1 - s2
821 else if (now == 4)
then
846 zout(1,j,nout1) = r + s
847 zout(1,j,nout3) = r - s
850 zout(1,j,nout2) = r - s
851 zout(1,j,nout4) = r + s
854 zout(2,j,nout1) = r + s
855 zout(2,j,nout3) = r - s
858 zout(2,j,nout2) = r + s
859 zout(2,j,nout4) = r - s
864 if (2*ias == after)
then
891 zout(1,j,nout1) = r + s
892 zout(1,j,nout3) = r - s
895 zout(1,j,nout2) = r - s
896 zout(1,j,nout4) = r + s
899 zout(2,j,nout1) = r + s
900 zout(2,j,nout3) = r - s
903 zout(2,j,nout2) = r + s
904 zout(2,j,nout4) = r - s
946 zout(1,j,nout1) = r + s
947 zout(1,j,nout3) = r - s
950 zout(1,j,nout2) = r - s
951 zout(1,j,nout4) = r + s
954 zout(2,j,nout1) = r + s
955 zout(2,j,nout3) = r - s
958 zout(2,j,nout2) = r + s
959 zout(2,j,nout4) = r - s
988 zout(1,j,nout1) = r + s
989 zout(1,j,nout3) = r - s
992 zout(1,j,nout2) = r + s
993 zout(1,j,nout4) = r - s
996 zout(2,j,nout1) = r + s
997 zout(2,j,nout3) = r - s
1000 zout(2,j,nout2) = r - s
1001 zout(2,j,nout4) = r + s
1006 if (2*ias == after)
then
1033 zout(1,j,nout1) = r + s
1034 zout(1,j,nout3) = r - s
1037 zout(1,j,nout2) = r + s
1038 zout(1,j,nout4) = r - s
1041 zout(2,j,nout1) = r + s
1042 zout(2,j,nout3) = r - s
1045 zout(2,j,nout2) = r - s
1046 zout(2,j,nout4) = r + s
1088 zout(1,j,nout1) = r + s
1089 zout(1,j,nout3) = r - s
1092 zout(1,j,nout2) = r + s
1093 zout(1,j,nout4) = r - s
1096 zout(2,j,nout1) = r + s
1097 zout(2,j,nout3) = r - s
1100 zout(2,j,nout2) = r - s
1101 zout(2,j,nout4) = r + s
1107 else if (now == 8)
then
1108 if (isign == -1)
then
1162 zout(1,j,nout1) = ap + bp
1163 zout(2,j,nout1) = cp + dp
1164 zout(1,j,nout5) = ap - bp
1165 zout(2,j,nout5) = cp - dp
1166 zout(1,j,nout3) = am + dm
1167 zout(2,j,nout3) = cm - bm
1168 zout(1,j,nout7) = am - dm
1169 zout(2,j,nout7) = cm + bm
1189 dp = ( cm - dp)*rt2i
1190 zout(1,j,nout2) = ap + r
1191 zout(2,j,nout2) = bm + s
1192 zout(1,j,nout6) = ap - r
1193 zout(2,j,nout6) = bm - s
1194 zout(1,j,nout4) = am + cp
1195 zout(2,j,nout4) = bp + dp
1196 zout(1,j,nout8) = am - cp
1197 zout(2,j,nout8) = bp - dp
1290 zout(1,j,nout1) = ap + bp
1291 zout(2,j,nout1) = cp + dp
1292 zout(1,j,nout5) = ap - bp
1293 zout(2,j,nout5) = cp - dp
1294 zout(1,j,nout3) = am + dm
1295 zout(2,j,nout3) = cm - bm
1296 zout(1,j,nout7) = am - dm
1297 zout(2,j,nout7) = cm + bm
1317 dp = ( cm - dp)*rt2i
1318 zout(1,j,nout2) = ap + r
1319 zout(2,j,nout2) = bm + s
1320 zout(1,j,nout6) = ap - r
1321 zout(2,j,nout6) = bm - s
1322 zout(1,j,nout4) = am + cp
1323 zout(2,j,nout4) = bp + dp
1324 zout(1,j,nout8) = am - cp
1325 zout(2,j,nout8) = bp - dp
1383 zout(1,j,nout1) = ap + bp
1384 zout(2,j,nout1) = cp + dp
1385 zout(1,j,nout5) = ap - bp
1386 zout(2,j,nout5) = cp - dp
1387 zout(1,j,nout3) = am - dm
1388 zout(2,j,nout3) = cm + bm
1389 zout(1,j,nout7) = am + dm
1390 zout(2,j,nout7) = cm - bm
1411 zout(1,j,nout2) = ap + r
1412 zout(2,j,nout2) = bm + s
1413 zout(1,j,nout6) = ap - r
1414 zout(2,j,nout6) = bm - s
1415 zout(1,j,nout4) = am + cp
1416 zout(2,j,nout4) = bp + dp
1417 zout(1,j,nout8) = am - cp
1418 zout(2,j,nout8) = bp - dp
1512 zout(1,j,nout1) = ap + bp
1513 zout(2,j,nout1) = cp + dp
1514 zout(1,j,nout5) = ap - bp
1515 zout(2,j,nout5) = cp - dp
1516 zout(1,j,nout3) = am - dm
1517 zout(2,j,nout3) = cm + bm
1518 zout(1,j,nout7) = am + dm
1519 zout(2,j,nout7) = cm - bm
1540 zout(1,j,nout2) = ap + r
1541 zout(2,j,nout2) = bm + s
1542 zout(1,j,nout6) = ap - r
1543 zout(2,j,nout6) = bm - s
1544 zout(1,j,nout4) = am + cp
1545 zout(2,j,nout4) = bp + dp
1546 zout(1,j,nout8) = am - cp
1547 zout(2,j,nout8) = bp - dp
1553 else if (now == 3)
then
1555 bb=isign*0.8660254037844387_real64
1575 zout(1,j,nout1) = r + r1
1576 zout(2,j,nout1) = s + s1
1581 zout(1,j,nout2) = r1 - s2
1582 zout(2,j,nout2) = s1 + r2
1583 zout(1,j,nout3) = r1 + s2
1584 zout(2,j,nout3) = s1 - r2
1589 if (4*ias == 3*after)
then
1590 if (isign == 1)
then
1609 zout(1,j,nout1) = r1 - r
1610 zout(2,j,nout1) = s + s1
1615 zout(1,j,nout2) = r1 - s2
1616 zout(2,j,nout2) = s1 - r2
1617 zout(1,j,nout3) = r1 + s2
1618 zout(2,j,nout3) = s1 + r2
1640 zout(1,j,nout1) = r + r1
1641 zout(2,j,nout1) = s1 - s
1646 zout(1,j,nout2) = r1 + s2
1647 zout(2,j,nout2) = s1 + r2
1648 zout(1,j,nout3) = r1 - s2
1649 zout(2,j,nout3) = s1 - r2
1653 else if (8*ias == 3*after)
then
1654 if (isign == 1)
then
1675 zout(1,j,nout1) = r + r1
1676 zout(2,j,nout1) = s + s1
1681 zout(1,j,nout2) = r1 - s2
1682 zout(2,j,nout2) = s1 + r2
1683 zout(1,j,nout3) = r1 + s2
1684 zout(2,j,nout3) = s1 - r2
1708 zout(1,j,nout1) = r + r1
1709 zout(2,j,nout1) = s + s1
1714 zout(1,j,nout2) = r1 - s2
1715 zout(2,j,nout2) = s1 + r2
1716 zout(1,j,nout3) = r1 + s2
1717 zout(2,j,nout3) = s1 - r2
1751 zout(1,j,nout1) = r + r1
1752 zout(2,j,nout1) = s + s1
1757 zout(1,j,nout2) = r1 - s2
1758 zout(2,j,nout2) = s1 + r2
1759 zout(1,j,nout3) = r1 + s2
1760 zout(2,j,nout3) = s1 - r2
1765 else if (now == 5)
then
1767 cos2=0.3090169943749474_real64
1769 cos4=-0.8090169943749474_real64
1771 sin2=isign*0.9510565162951536_real64
1773 sin4=isign*0.5877852522924731_real64
1803 zout(1,j,nout1) = r1 + r25 + r34
1804 r = r1 + cos2*r25 + cos4*r34
1805 s = sin2*s25 + sin4*s34
1806 zout(1,j,nout2) = r - s
1807 zout(1,j,nout5) = r + s
1808 r = r1 + cos4*r25 + cos2*r34
1809 s = sin4*s25 - sin2*s34
1810 zout(1,j,nout3) = r - s
1811 zout(1,j,nout4) = r + s
1816 zout(2,j,nout1) = s1 + s25 + s34
1817 r = s1 + cos2*s25 + cos4*s34
1818 s = sin2*r25 + sin4*r34
1819 zout(2,j,nout2) = r + s
1820 zout(2,j,nout5) = r - s
1821 r = s1 + cos4*s25 + cos2*s34
1822 s = sin4*r25 - sin2*r34
1823 zout(2,j,nout3) = r + s
1824 zout(2,j,nout4) = r - s
1829 if (8*ias == 5*after)
then
1830 if (isign == 1)
then
1863 zout(1,j,nout1) = r1 + r25 - r34
1864 r = r1 + cos2*r25 - cos4*r34
1865 s = sin2*s25 + sin4*s34
1866 zout(1,j,nout2) = r - s
1867 zout(1,j,nout5) = r + s
1868 r = r1 + cos4*r25 - cos2*r34
1869 s = sin4*s25 - sin2*s34
1870 zout(1,j,nout3) = r - s
1871 zout(1,j,nout4) = r + s
1876 zout(2,j,nout1) = s1 + s25 + s34
1877 r = s1 + cos2*s25 + cos4*s34
1878 s = sin2*r25 + sin4*r34
1879 zout(2,j,nout2) = r + s
1880 zout(2,j,nout5) = r - s
1881 r = s1 + cos4*s25 + cos2*s34
1882 s = sin4*r25 - sin2*r34
1883 zout(2,j,nout3) = r + s
1884 zout(2,j,nout4) = r - s
1920 zout(1,j,nout1) = r1 + r25 + r34
1921 r = r1 + cos2*r25 + cos4*r34
1922 s = sin2*s25 + sin4*s34
1923 zout(1,j,nout2) = r - s
1924 zout(1,j,nout5) = r + s
1925 r = r1 + cos4*r25 + cos2*r34
1926 s = sin4*s25 - sin2*s34
1927 zout(1,j,nout3) = r - s
1928 zout(1,j,nout4) = r + s
1933 zout(2,j,nout1) = s1 + s25 - s34
1934 r = s1 + cos2*s25 - cos4*s34
1935 s = sin2*r25 + sin4*r34
1936 zout(2,j,nout2) = r + s
1937 zout(2,j,nout5) = r - s
1938 r = s1 + cos4*s25 - cos2*s34
1939 s = sin4*r25 - sin2*r34
1940 zout(2,j,nout3) = r + s
1941 zout(2,j,nout4) = r - s
1996 zout(1,j,nout1) = r1 + r25 + r34
1997 r = r1 + cos2*r25 + cos4*r34
1998 s = sin2*s25 + sin4*s34
1999 zout(1,j,nout2) = r - s
2000 zout(1,j,nout5) = r + s
2001 r = r1 + cos4*r25 + cos2*r34
2002 s = sin4*s25 - sin2*s34
2003 zout(1,j,nout3) = r - s
2004 zout(1,j,nout4) = r + s
2009 zout(2,j,nout1) = s1 + s25 + s34
2010 r = s1 + cos2*s25 + cos4*s34
2011 s = sin2*r25 + sin4*r34
2012 zout(2,j,nout2) = r + s
2013 zout(2,j,nout5) = r - s
2014 r = s1 + cos4*s25 + cos2*s34
2015 s = sin4*r25 - sin2*r34
2016 zout(2,j,nout3) = r + s
2017 zout(2,j,nout4) = r - s
2022 else if (now == 6)
then
2024 bb=isign*0.8660254037844387_real64
2081 zout(1,j,nout1)=ur1+vr1
2082 zout(2,j,nout1)=ui1+vi1
2083 zout(1,j,nout5)=ur2+vr2
2084 zout(2,j,nout5)=ui2+vi2
2085 zout(1,j,nout3)=ur3+vr3
2086 zout(2,j,nout3)=ui3+vi3
2087 zout(1,j,nout4)=ur1-vr1
2088 zout(2,j,nout4)=ui1-vi1
2089 zout(1,j,nout2)=ur2-vr2
2090 zout(2,j,nout2)=ui2-vi2
2091 zout(1,j,nout6)=ur3-vr3
2092 zout(2,j,nout6)=ui3-vi3
2107 subroutine fftrot(mm,nfft,m,nn,n,zin,zout,trig,after,now,before,isign)
2108 integer :: mm, nfft, m, nn, n, isign
2109 integer :: after, before, atn, atb, now
2110 real(real64) :: trig(:,:)
2111 real(real64) :: zin(2, mm, m), zout(2, n, nn)
2113 real(real64) :: rt2i, dp, cp, cm, ci5, cr5, ci6, cr6, am, ap, ci8, cr8
2114 real(real64) :: r, r1, r2, r3, r4, r5, r6, r7, r8_, r25, r34
2115 real(real64) :: s, s1, s2, s3, s4, s5, s6, s7, s8, s25, s34
2116 real(real64) :: bb, bm, dm, bp
2117 real(real64) :: cr2, ci2, cr3, ci3, cr4, ci4, cr7, ci7
2118 real(real64) :: cos2, sin2, cos4, sin4
2119 real(real64) :: ur1, ur2, ur3, ui1, ui2, ui3
2120 real(real64) :: vr1, vr2, vr3, vi1, vi2, vi3
2121 integer :: ia, ib, ib1, j, ias, itrig, itt
2122 integer :: nin1, nin2, nin3, nin4, nin5, nin6, nin7, nin8
2123 integer :: nout1, nout2, nout3, nout4, nout5, nout6, nout7, nout8
2129 rt2i=0.7071067811865475_real64
2144 zout(1,nout1,j)= r2 + r1
2145 zout(2,nout1,j)= s2 + s1
2146 zout(1,nout2,j)= r1 - r2
2147 zout(2,nout2,j)= s1 - s2
2153 if (2*ias == after)
then
2154 if (isign == 1)
then
2167 zout(1,nout1,j)= r1 - r2
2168 zout(2,nout1,j)= s2 + s1
2169 zout(1,nout2,j)= r2 + r1
2170 zout(2,nout2,j)= s1 - s2
2186 zout(1,nout1,j)= r2 + r1
2187 zout(2,nout1,j)= s1 - s2
2188 zout(1,nout2,j)= r1 - r2
2189 zout(2,nout2,j)= s2 + s1
2193 else if (4*ias == after)
then
2194 if (isign == 1)
then
2209 zout(1,nout1,j)= r2 + r1
2210 zout(2,nout1,j)= s2 + s1
2211 zout(1,nout2,j)= r1 - r2
2212 zout(2,nout2,j)= s1 - s2
2230 zout(1,nout1,j)= r2 + r1
2231 zout(2,nout1,j)= s2 + s1
2232 zout(1,nout2,j)= r1 - r2
2233 zout(2,nout2,j)= s1 - s2
2237 else if (4*ias == 3*after)
then
2238 if (isign == 1)
then
2253 zout(1,nout1,j)= r1 - r2
2254 zout(2,nout1,j)= s2 + s1
2255 zout(1,nout2,j)= r2 + r1
2256 zout(2,nout2,j)= s1 - s2
2274 zout(1,nout1,j)= r2 + r1
2275 zout(2,nout1,j)= s1 - s2
2276 zout(1,nout2,j)= r1 - r2
2277 zout(2,nout2,j)= s2 + s1
2299 zout(1,nout1,j)= r2 + r1
2300 zout(2,nout1,j)= s2 + s1
2301 zout(1,nout2,j)= r1 - r2
2302 zout(2,nout2,j)= s1 - s2
2307 else if (now == 4)
then
2308 if (isign == 1)
then
2332 zout(1,nout1,j) = r + s
2333 zout(1,nout3,j) = r - s
2336 zout(1,nout2,j) = r - s
2337 zout(1,nout4,j) = r + s
2340 zout(2,nout1,j) = r + s
2341 zout(2,nout3,j) = r - s
2344 zout(2,nout2,j) = r + s
2345 zout(2,nout4,j) = r - s
2350 if (2*ias == after)
then
2377 zout(1,nout1,j) = r + s
2378 zout(1,nout3,j) = r - s
2381 zout(1,nout2,j) = r - s
2382 zout(1,nout4,j) = r + s
2385 zout(2,nout1,j) = r + s
2386 zout(2,nout3,j) = r - s
2389 zout(2,nout2,j) = r + s
2390 zout(2,nout4,j) = r - s
2432 zout(1,nout1,j) = r + s
2433 zout(1,nout3,j) = r - s
2436 zout(1,nout2,j) = r - s
2437 zout(1,nout4,j) = r + s
2440 zout(2,nout1,j) = r + s
2441 zout(2,nout3,j) = r - s
2444 zout(2,nout2,j) = r + s
2445 zout(2,nout4,j) = r - s
2474 zout(1,nout1,j) = r + s
2475 zout(1,nout3,j) = r - s
2478 zout(1,nout2,j) = r + s
2479 zout(1,nout4,j) = r - s
2482 zout(2,nout1,j) = r + s
2483 zout(2,nout3,j) = r - s
2486 zout(2,nout2,j) = r - s
2487 zout(2,nout4,j) = r + s
2492 if (2*ias == after)
then
2519 zout(1,nout1,j) = r + s
2520 zout(1,nout3,j) = r - s
2523 zout(1,nout2,j) = r + s
2524 zout(1,nout4,j) = r - s
2527 zout(2,nout1,j) = r + s
2528 zout(2,nout3,j) = r - s
2531 zout(2,nout2,j) = r - s
2532 zout(2,nout4,j) = r + s
2574 zout(1,nout1,j) = r + s
2575 zout(1,nout3,j) = r - s
2578 zout(1,nout2,j) = r + s
2579 zout(1,nout4,j) = r - s
2582 zout(2,nout1,j) = r + s
2583 zout(2,nout3,j) = r - s
2586 zout(2,nout2,j) = r - s
2587 zout(2,nout4,j) = r + s
2593 else if (now == 8)
then
2594 if (isign == -1)
then
2648 zout(1,nout1,j) = ap + bp
2649 zout(2,nout1,j) = cp + dp
2650 zout(1,nout5,j) = ap - bp
2651 zout(2,nout5,j) = cp - dp
2652 zout(1,nout3,j) = am + dm
2653 zout(2,nout3,j) = cm - bm
2654 zout(1,nout7,j) = am - dm
2655 zout(2,nout7,j) = cm + bm
2676 zout(1,nout2,j) = ap + r
2677 zout(2,nout2,j) = bm + s
2678 zout(1,nout6,j) = ap - r
2679 zout(2,nout6,j) = bm - s
2680 zout(1,nout4,j) = am + cp
2681 zout(2,nout4,j) = bp + dp
2682 zout(1,nout8,j) = am - cp
2683 zout(2,nout8,j) = bp - dp
2776 zout(1,nout1,j) = ap + bp
2777 zout(2,nout1,j) = cp + dp
2778 zout(1,nout5,j) = ap - bp
2779 zout(2,nout5,j) = cp - dp
2780 zout(1,nout3,j) = am + dm
2781 zout(2,nout3,j) = cm - bm
2782 zout(1,nout7,j) = am - dm
2783 zout(2,nout7,j) = cm + bm
2804 zout(1,nout2,j) = ap + r
2805 zout(2,nout2,j) = bm + s
2806 zout(1,nout6,j) = ap - r
2807 zout(2,nout6,j) = bm - s
2808 zout(1,nout4,j) = am + cp
2809 zout(2,nout4,j) = bp + dp
2810 zout(1,nout8,j) = am - cp
2811 zout(2,nout8,j) = bp - dp
2870 zout(1,nout1,j) = ap + bp
2871 zout(2,nout1,j) = cp + dp
2872 zout(1,nout5,j) = ap - bp
2873 zout(2,nout5,j) = cp - dp
2874 zout(1,nout3,j) = am - dm
2875 zout(2,nout3,j) = cm + bm
2876 zout(1,nout7,j) = am + dm
2877 zout(2,nout7,j) = cm - bm
2898 zout(1,nout2,j) = ap + r
2899 zout(2,nout2,j) = bm + s
2900 zout(1,nout6,j) = ap - r
2901 zout(2,nout6,j) = bm - s
2902 zout(1,nout4,j) = am + cp
2903 zout(2,nout4,j) = bp + dp
2904 zout(1,nout8,j) = am - cp
2905 zout(2,nout8,j) = bp - dp
2999 zout(1,nout1,j) = ap + bp
3000 zout(2,nout1,j) = cp + dp
3001 zout(1,nout5,j) = ap - bp
3002 zout(2,nout5,j) = cp - dp
3003 zout(1,nout3,j) = am - dm
3004 zout(2,nout3,j) = cm + bm
3005 zout(1,nout7,j) = am + dm
3006 zout(2,nout7,j) = cm - bm
3027 zout(1,nout2,j) = ap + r
3028 zout(2,nout2,j) = bm + s
3029 zout(1,nout6,j) = ap - r
3030 zout(2,nout6,j) = bm - s
3031 zout(1,nout4,j) = am + cp
3032 zout(2,nout4,j) = bp + dp
3033 zout(1,nout8,j) = am - cp
3034 zout(2,nout8,j) = bp - dp
3040 else if (now == 3)
then
3042 bb=isign*0.8660254037844387_real64
3062 zout(1,nout1,j) = r + r1
3063 zout(2,nout1,j) = s + s1
3068 zout(1,nout2,j) = r1 - s2
3069 zout(2,nout2,j) = s1 + r2
3070 zout(1,nout3,j) = r1 + s2
3071 zout(2,nout3,j) = s1 - r2
3076 if (4*ias == 3*after)
then
3077 if (isign == 1)
then
3096 zout(1,nout1,j) = r1 - r
3097 zout(2,nout1,j) = s + s1
3102 zout(1,nout2,j) = r1 - s2
3103 zout(2,nout2,j) = s1 - r2
3104 zout(1,nout3,j) = r1 + s2
3105 zout(2,nout3,j) = s1 + r2
3127 zout(1,nout1,j) = r + r1
3128 zout(2,nout1,j) = s1 - s
3133 zout(1,nout2,j) = r1 + s2
3134 zout(2,nout2,j) = s1 + r2
3135 zout(1,nout3,j) = r1 - s2
3136 zout(2,nout3,j) = s1 - r2
3140 else if (8*ias == 3*after)
then
3141 if (isign == 1)
then
3162 zout(1,nout1,j) = r + r1
3163 zout(2,nout1,j) = s + s1
3168 zout(1,nout2,j) = r1 - s2
3169 zout(2,nout2,j) = s1 + r2
3170 zout(1,nout3,j) = r1 + s2
3171 zout(2,nout3,j) = s1 - r2
3195 zout(1,nout1,j) = r + r1
3196 zout(2,nout1,j) = s + s1
3201 zout(1,nout2,j) = r1 - s2
3202 zout(2,nout2,j) = s1 + r2
3203 zout(1,nout3,j) = r1 + s2
3204 zout(2,nout3,j) = s1 - r2
3238 zout(1,nout1,j) = r + r1
3239 zout(2,nout1,j) = s + s1
3244 zout(1,nout2,j) = r1 - s2
3245 zout(2,nout2,j) = s1 + r2
3246 zout(1,nout3,j) = r1 + s2
3247 zout(2,nout3,j) = s1 - r2
3252 else if (now == 5)
then
3254 cos2=0.3090169943749474_real64
3256 cos4=-0.8090169943749474_real64
3258 sin2=isign*0.9510565162951536_real64
3260 sin4=isign*0.5877852522924731_real64
3290 zout(1,nout1,j) = r1 + r25 + r34
3291 r = r1 + cos2*r25 + cos4*r34
3292 s = sin2*s25 + sin4*s34
3293 zout(1,nout2,j) = r - s
3294 zout(1,nout5,j) = r + s
3295 r = r1 + cos4*r25 + cos2*r34
3296 s = sin4*s25 - sin2*s34
3297 zout(1,nout3,j) = r - s
3298 zout(1,nout4,j) = r + s
3303 zout(2,nout1,j) = s1 + s25 + s34
3304 r = s1 + cos2*s25 + cos4*s34
3305 s = sin2*r25 + sin4*r34
3306 zout(2,nout2,j) = r + s
3307 zout(2,nout5,j) = r - s
3308 r = s1 + cos4*s25 + cos2*s34
3309 s = sin4*r25 - sin2*r34
3310 zout(2,nout3,j) = r + s
3311 zout(2,nout4,j) = r - s
3316 if (8*ias == 5*after)
then
3317 if (isign == 1)
then
3350 zout(1,nout1,j) = r1 + r25 - r34
3351 r = r1 + cos2*r25 - cos4*r34
3352 s = sin2*s25 + sin4*s34
3353 zout(1,nout2,j) = r - s
3354 zout(1,nout5,j) = r + s
3355 r = r1 + cos4*r25 - cos2*r34
3356 s = sin4*s25 - sin2*s34
3357 zout(1,nout3,j) = r - s
3358 zout(1,nout4,j) = r + s
3363 zout(2,nout1,j) = s1 + s25 + s34
3364 r = s1 + cos2*s25 + cos4*s34
3365 s = sin2*r25 + sin4*r34
3366 zout(2,nout2,j) = r + s
3367 zout(2,nout5,j) = r - s
3368 r = s1 + cos4*s25 + cos2*s34
3369 s = sin4*r25 - sin2*r34
3370 zout(2,nout3,j) = r + s
3371 zout(2,nout4,j) = r - s
3407 zout(1,nout1,j) = r1 + r25 + r34
3408 r = r1 + cos2*r25 + cos4*r34
3409 s = sin2*s25 + sin4*s34
3410 zout(1,nout2,j) = r - s
3411 zout(1,nout5,j) = r + s
3412 r = r1 + cos4*r25 + cos2*r34
3413 s = sin4*s25 - sin2*s34
3414 zout(1,nout3,j) = r - s
3415 zout(1,nout4,j) = r + s
3420 zout(2,nout1,j) = s1 + s25 - s34
3421 r = s1 + cos2*s25 - cos4*s34
3422 s = sin2*r25 + sin4*r34
3423 zout(2,nout2,j) = r + s
3424 zout(2,nout5,j) = r - s
3425 r = s1 + cos4*s25 - cos2*s34
3426 s = sin4*r25 - sin2*r34
3427 zout(2,nout3,j) = r + s
3428 zout(2,nout4,j) = r - s
3483 zout(1,nout1,j) = r1 + r25 + r34
3484 r = r1 + cos2*r25 + cos4*r34
3485 s = sin2*s25 + sin4*s34
3486 zout(1,nout2,j) = r - s
3487 zout(1,nout5,j) = r + s
3488 r = r1 + cos4*r25 + cos2*r34
3489 s = sin4*s25 - sin2*s34
3490 zout(1,nout3,j) = r - s
3491 zout(1,nout4,j) = r + s
3496 zout(2,nout1,j) = s1 + s25 + s34
3497 r = s1 + cos2*s25 + cos4*s34
3498 s = sin2*r25 + sin4*r34
3499 zout(2,nout2,j) = r + s
3500 zout(2,nout5,j) = r - s
3501 r = s1 + cos4*s25 + cos2*s34
3502 s = sin4*r25 - sin2*r34
3503 zout(2,nout3,j) = r + s
3504 zout(2,nout4,j) = r - s
3509 else if (now == 6)
then
3511 bb=isign*0.8660254037844387_real64
3568 zout(1,nout1,j)=ur1+vr1
3569 zout(2,nout1,j)=ui1+vi1
3570 zout(1,nout5,j)=ur2+vr2
3571 zout(2,nout5,j)=ui2+vi2
3572 zout(1,nout3,j)=ur3+vr3
3573 zout(2,nout3,j)=ui3+vi3
3574 zout(1,nout4,j)=ur1-vr1
3575 zout(2,nout4,j)=ui1-vi1
3576 zout(1,nout2,j)=ur2-vr2
3577 zout(2,nout2,j)=ui2-vi2
3578 zout(1,nout6,j)=ur3-vr3
3579 zout(2,nout6,j)=ui3-vi3
3642 subroutine convolxc_off(n1,n2,n3,nd1,nd2,nd3,md1,md2,md3, &
3643 nproc,iproc,pot,zf,scal,comm)
3644 integer,
intent(in) :: n1,n2,n3,nd1,nd2,nd3,md1,md2,md3,nproc,iproc
3645 real(real64),
intent(in) :: scal
3646 real(real64),
dimension(nd1,nd2,nd3/nproc),
intent(in) :: pot
3647 real(real64),
dimension(md1,md3,md2/nproc),
intent(inout) :: zf
3648 type(mpi_comm),
intent(in) :: comm
3650 integer :: ncache,lzt,lot,ma,mb,nfft,ic1,ic2,ic3,Jp2stb,J2stb,Jp2stf,J2stf
3651 integer :: j2,j3,i1,i3,i,j,inzee
3652#if defined(HAVE_MPI)
3655 real(real64) :: twopion
3657 real(real64),
allocatable :: zt(:,:,:)
3659 real(real64),
allocatable :: zmpi1(:,:,:,:,:)
3660 real(real64),
allocatable :: zmpi2(:,:,:,:)
3662 real(real64),
allocatable :: zw(:,:,:)
3664 real(real64),
allocatable :: cosinarr(:,:)
3665 real(real64) :: btrig1(2,8192)
3666 real(real64) :: ftrig1(2,8192)
3667 integer :: after1(7)
3669 integer :: before1(7)
3670 real(real64) :: btrig2(2,8192)
3671 real(real64) :: ftrig2(2,8192)
3672 integer :: after2(7)
3674 integer :: before2(7)
3675 real(real64) :: btrig3(2,8192)
3676 real(real64) :: ftrig3(2,8192)
3677 integer :: after3(7)
3679 integer :: before3(7)
3684 if (mod(n1,2) /= 0) stop
'Parallel convolution:ERROR:n1'
3685 if (mod(n2,2) /= 0) stop
'Parallel convolution:ERROR:n2'
3686 if (mod(n3,2) /= 0) stop
'Parallel convolution:ERROR:n3'
3687 if (nd1 < n1/2+1) stop
'Parallel convolution:ERROR:nd1'
3688 if (nd2 < n2/2+1) stop
'Parallel convolution:ERROR:nd2'
3689 if (nd3 < n3/2+1) stop
'Parallel convolution:ERROR:nd3'
3690 if (md1 < n1/2) stop
'Parallel convolution:ERROR:md1'
3691 if (md2 < n2/2) stop
'Parallel convolution:ERROR:md2'
3692 if (md3 < n3/2) stop
'Parallel convolution:ERROR:md3'
3693 if (mod(nd3,nproc) /= 0) stop
'Parallel convolution:ERROR:nd3'
3694 if (mod(md2,nproc) /= 0) stop
'Parallel convolution:ERROR:md2'
3698 if (ncache <= max(n1,n2,n3/2)*4) ncache=max(n1,n2,n3/2)*4
3703 if (mod(n2/2,2) == 0) lzt=lzt+1
3704 if (mod(n2/2,4) == 0) lzt=lzt+1
3706 safe_allocate(zw(1:2, 1:ncache/4, 1:2))
3707 safe_allocate(zt(1:2, 1:lzt, 1:n1))
3708 safe_allocate(zmpi2(1:2, 1:n1, 1:md2/nproc, 1:nd3))
3709 safe_allocate(cosinarr(1:2, 1:n3/2))
3712 safe_allocate(zmpi1(1:2, 1:n1, 1:md2/nproc, 1:nd3/nproc, 1:nproc))
3716 call ctrig(n3/2,btrig3,after3,before3,now3,1,ic3)
3717 call ctrig(n1,btrig1,after1,before1,now1,1,ic1)
3718 call ctrig(n2,btrig2,after2,before2,now2,1,ic2)
3720 ftrig1(1,j)= btrig1(1,j)
3721 ftrig1(2,j)=-btrig1(2,j)
3724 ftrig2(1,j)= btrig2(1,j)
3725 ftrig2(2,j)=-btrig2(2,j)
3728 ftrig3(1,j)= btrig3(1,j)
3729 ftrig3(2,j)=-btrig3(2,j)
3733 twopion=8._real64*datan(1.0_8)/real(n3, real64)
3735 cosinarr(1,i3)=dcos(twopion*(i3-1))
3736 cosinarr(2,i3)=-dsin(twopion*(i3-1))
3746 'convolxc_off:ncache has to be enlarged to be able to hold at' // &
3747 'least one 1-d FFT of this size even though this will' // &
3748 'reduce the performance for shorter transform lengths'
3754 if (iproc*(md2/nproc)+j2 <= n2/2)
then
3755 do i1 = 1,(n1/2),lot
3757 mb=min(i1+(lot-1),(n1/2))
3761 call halfill_upcorn(md1,md3,lot,nfft,n3,zf(i1,1,j2),zw(1,1,1))
3767 call fftstp(lot,nfft,n3/2,lot,n3/2,zw(1,1,inzee),zw(1,1,3-inzee), &
3768 btrig3,after3(i),now3(i),before3(i),1)
3776 call scramble_unpack(i1,j2,lot,nfft,n1/2,n3,md2,nproc,nd3,zw(1,1,inzee),zmpi2,cosinarr)
3787#if defined(HAVE_MPI)
3788 call mpi_alltoall(zmpi2(1, 1, 1, 1), n1*(md2/nproc)*(nd3/nproc), &
3789 mpi_double_precision, &
3790 zmpi1(1, 1, 1, 1, 1), n1*(md2/nproc)*(nd3/nproc), &
3791 mpi_double_precision, comm, ierr)
3800 if (iproc*(nd3/nproc)+j3 <= n3/2+1)
then
3810 'convolxc_off:ncache has to be enlarged to be able to hold at' // &
3811 'least one 1-d FFT of this size even though this will' // &
3812 'reduce the performance for shorter transform lengths'
3818 mb=min(j+(lot-1),n2/2)
3823 if (nproc == 1)
then
3824 call mpiswitch_upcorn(j3,nfft,jp2stb,j2stb,lot,n1,md2,nd3,nproc,zmpi2,zw(1,1,1))
3826 call mpiswitch_upcorn(j3,nfft,jp2stb,j2stb,lot,n1,md2,nd3,nproc,zmpi1,zw(1,1,1))
3834 call fftstp(lot,nfft,n1,lot,n1,zw(1,1,inzee),zw(1,1,3-inzee), &
3835 btrig1,after1(i),now1(i),before1(i),1)
3841 call fftstp(lot,nfft,n1,lzt,n1,zw(1,1,inzee),zt(1,j,1), &
3842 btrig1,after1(i),now1(i),before1(i),1)
3850 'convolxc_off:ncache has to be enlarged to be able to hold at' // &
3851 'least one 1-d FFT of this size even though this will' // &
3852 'reduce the performance for shorter transform lengths'
3858 mb=min(j+(lot-1),n1)
3863 call switch_upcorn(nfft,n2,lot,n1,lzt,zt(1,1,j),zw(1,1,1))
3870 call fftstp(lot,nfft,n2,lot,n2,zw(1,1,inzee),zw(1,1,3-inzee), &
3871 btrig2,after2(i),now2(i),before2(i),1)
3877 call multkernel(nd1,nd2,n1,n2,lot,nfft,j,pot(1,1,j3),zw(1,1,inzee))
3884 call fftstp(lot,nfft,n2,lot,n2,zw(1,1,inzee),zw(1,1,3-inzee), &
3885 ftrig2,after2(i),now2(i),before2(i),-1)
3891 call unswitch_downcorn(nfft,n2,lot,n1,lzt,zw(1,1,inzee),zt(1,1,j))
3900 mb=min(j+(lot-1),n2/2)
3905 call fftstp(lzt,nfft,n1,lot,n1,zt(1,j,1),zw(1,1,1), &
3906 ftrig1,after1(i),now1(i),before1(i),-1)
3910 call fftstp(lot,nfft,n1,lot,n1,zw(1,1,inzee),zw(1,1,3-inzee), &
3911 ftrig1,after1(i),now1(i),before1(i),-1)
3918 if (nproc == 1)
then
3919 call unmpiswitch_downcorn(j3,nfft,jp2stf,j2stf,lot,n1,md2,nd3,nproc,zw(1,1,inzee),zmpi2)
3921 call unmpiswitch_downcorn(j3,nfft,jp2stf,j2stf,lot,n1,md2,nd3,nproc,zw(1,1,inzee),zmpi1)
3934#if defined(HAVE_MPI)
3935 call mpi_alltoall(zmpi1(1, 1, 1, 1, 1), n1*(md2/nproc)*(nd3/nproc), &
3936 mpi_double_precision, &
3937 zmpi2(1, 1, 1, 1), n1*(md2/nproc)*(nd3/nproc), &
3938 mpi_double_precision, comm, ierr)
3949 if (iproc*(md2/nproc)+j2 <= n2/2)
then
3950 do i1 = 1,(n1/2),lot
3952 mb=min(i1+(lot-1),(n1/2))
3957 call unscramble_pack(i1,j2,lot,nfft,n1/2,n3,md2,nproc,nd3,zmpi2,zw(1,1,1),cosinarr)
3964 call fftstp(lot,nfft,n3/2,lot,n3/2,zw(1,1,inzee),zw(1,1,3-inzee), &
3965 ftrig3,after3(i),now3(i),before3(i),-1)
3971 call unfill_downcorn(md1, md3, lot, nfft, n3, zw(1,1,inzee), zf(i1,1,j2), scal)
3977 safe_deallocate_a(zmpi2)
3978 safe_deallocate_a(zw)
3979 safe_deallocate_a(zt)
3980 safe_deallocate_a(cosinarr)
3981 safe_deallocate_a(zmpi1)
4020 subroutine multkernel(nd1,nd2,n1,n2,lot,nfft,jS,pot,zw)
4021 integer,
intent(in) :: nd1,nd2,n1,n2,lot,nfft,js
4022 real(real64),
dimension(nd1,nd2),
intent(in) :: pot
4023 real(real64),
dimension(2,lot,n2),
intent(inout) :: zw
4026 integer :: j,j1,i2,j2
4030 j1=n1/2+1-abs(n1/2+2-js-j)
4031 zw(1,j,1)=zw(1,j,1)*pot(j1,1)
4032 zw(2,j,1)=zw(2,j,1)*pot(j1,1)
4038 j1=n1/2+1-abs(n1/2+2-js-j)
4040 zw(1,j,i2)=zw(1,j,i2)*pot(j1,i2)
4041 zw(2,j,i2)=zw(2,j,i2)*pot(j1,i2)
4042 zw(1,j,j2)=zw(1,j,j2)*pot(j1,i2)
4043 zw(2,j,j2)=zw(2,j,j2)*pot(j1,i2)
4049 j1=n1/2+1-abs(n1/2+2-js-j)
4051 zw(1,j,j2)=zw(1,j,j2)*pot(j1,j2)
4052 zw(2,j,j2)=zw(2,j,j2)*pot(j1,j2)
4059 integer :: lot, n1, n2, lzt, j, nfft, i
4060 real(real64) :: zw(2,lot,n2), zt(2,lzt,n1)
4068 zw(1,j,i)=zt(1,i-n2/2,j)
4069 zw(2,j,i)=zt(2,i-n2/2,j)
4085 subroutine mpiswitch_upcorn(j3,nfft,Jp2stb,J2stb,lot,n1,md2,nd3,nproc,zmpi1,zw)
4086 integer :: n1, nd3, nproc, lot, mfft, jp2, jp2stb, j2
4087 integer :: j2stb, nfft, i1, j3, md2
4088 real(real64) :: zmpi1(2,n1/2,md2/nproc,nd3/nproc,nproc),zw(2,lot,n1)
4094 do jp2 = jp2stb, nproc
4095 do j2 = j2stb, md2/nproc
4097 if (mfft > nfft)
then
4107 zw(1,mfft,i1)=zmpi1(1,i1-n1/2,j2,j3,jp2)
4108 zw(2,mfft,i1)=zmpi1(2,i1-n1/2,j2,j3,jp2)
4119 integer :: lot, n3, md1, md3, i3, i1, nfft
4120 real(real64) :: zw(2,lot,n3/2),zf(md1,md3)
4135 zw(1,i1,i3)=zf(i1,2*i3-1-n3/2)
4136 zw(2,i1,i3)=zf(i1,2*i3-n3/2)
4177 subroutine scramble_unpack(i1,j2,lot,nfft,n1,n3,md2,nproc,nd3,zw,zmpi2,cosinarr)
4178 integer,
intent(in) :: i1,j2,lot,nfft,n1,n3,md2,nproc,nd3
4179 real(real64),
dimension(2,lot,n3/2),
intent(in) :: zw
4180 real(real64),
dimension(2,n3/2),
intent(in) :: cosinarr
4181 real(real64),
dimension(2,n1,md2/nproc,nd3),
intent(out) :: zmpi2
4183 integer :: i3,i,ind1,ind2
4184 real(real64) :: a,b,c,d,cp,sp,feR,feI,foR,foI,fR,fI
4190 zmpi2(1,i1+i,j2,1)=a+b
4191 zmpi2(2,i1+i,j2,1)=0.0_8
4192 zmpi2(1,i1+i,j2,n3/2+1)=a-b
4193 zmpi2(2,i1+i,j2,n3/2+1)=0.0_8
4207 fer = .5_real64*(a+c)
4208 fei = .5_real64*(b-d)
4209 for = .5_real64*(a-c)
4210 foi = .5_real64*(b+d)
4211 fr = fer+cp*foi-sp*for
4212 fi = fei-cp*for-sp*foi
4213 zmpi2(1,i1+i,j2,ind1) = fr
4214 zmpi2(2,i1+i,j2,ind1) = fi
4255 subroutine unscramble_pack(i1,j2,lot,nfft,n1,n3,md2,nproc,nd3,zmpi2,zw,cosinarr)
4256 integer,
intent(in) :: i1,j2,lot,nfft,n1,n3,md2,nproc,nd3
4257 real(real64),
dimension(2,lot,n3/2),
intent(out) :: zw
4258 real(real64),
dimension(2,n3/2),
intent(in) :: cosinarr
4259 real(real64),
dimension(2,n1,md2/nproc,nd3),
intent(in) :: zmpi2
4261 integer :: i3,i,indA,indB
4262 real(real64) :: a,b,c,d,cp,sp,re,ie,ro,io,rh,ih
4270 a=zmpi2(1,i1+i,j2,inda)
4271 b=zmpi2(2,i1+i,j2,inda)
4272 c= zmpi2(1,i1+i,j2,indb)
4273 d=-zmpi2(2,i1+i,j2,indb)
4276 ro=(a-c)*cp-(b-d)*sp
4277 io=(a-c)*sp+(b-d)*cp
4290 integer :: lot, n2, lzt, n1, j, nfft, i
4291 real(real64) :: zw(2,lot,n2),zt(2,lzt,n1)
4306 subroutine unmpiswitch_downcorn(j3,nfft,Jp2stf,J2stf,lot,n1,md2,nd3,nproc,zw,zmpi1)
4307 integer :: n1, md2, nproc, nd3, lot, mfft, i1, j3
4308 integer :: jp2, j2, nfft, jp2stf, j2stf
4309 real(real64) :: zmpi1(2,n1/2,md2/nproc,nd3/nproc,nproc),zw(2,lot,n1)
4315 do j2 = j2stf, md2/nproc
4317 if (mfft > nfft)
then
4323 zmpi1(1,i1,j2,j3,jp2)=zw(1,mfft,i1)
4324 zmpi1(2,i1,j2,j3,jp2)=zw(2,mfft,i1)
4370 integer,
intent(in) :: md1,md3,lot,nfft,n3
4371 real(real64),
dimension(2,lot,n3/2),
intent(in) :: zw
4372 real(real64),
dimension(md1,md3),
intent(inout) :: zf
4373 real(real64),
intent(in) :: scal
4376 real(real64) :: pot1
4380 pot1 = scal*zw(1,i1,i3)
4381 zf(i1, 2*i3 - 1) = pot1
4382 pot1 = scal*zw(2, i1, i3)
4429 subroutine kernelfft(n1,n2,n3,nd1,nd2,nd3,nproc,iproc,zf,zr,comm)
4430 integer,
intent(in) :: n1,n2,n3,nd1,nd2,nd3,nproc,iproc
4431 real(real64),
dimension(nd1,n3,nd2/nproc),
intent(in) :: zf
4432 real(real64),
dimension(2,nd1,nd2,nd3/nproc),
intent(out) :: zr
4433 type(mpi_comm),
intent(in) :: comm
4436 integer :: ncache,lzt,lot,ma,mb,nfft,ic1,ic2,ic3,Jp2st,J2st
4437 integer :: j2,j3,i1,i3,i,j,inzee
4438#if defined(HAVE_MPI)
4441 real(real64) :: twopion
4443 real(real64),
dimension(:,:,:),
allocatable :: zt
4445 real(real64),
dimension(:,:,:,:,:),
allocatable :: zmpi1
4446 real(real64),
dimension(:,:,:,:),
allocatable :: zmpi2
4448 real(real64),
dimension(:,:,:),
allocatable :: zw
4450 real(real64),
dimension(:,:),
allocatable :: trig1,trig2,trig3,cosinarr
4451 integer,
dimension(:),
allocatable :: after1,now1,before1, &
4452 after2,now2,before2,after3,now3,before3
4455 if (nd1 < n1) stop
'ERROR:nd1'
4456 if (nd2 < n2) stop
'ERROR:nd2'
4457 if (nd3 < n3/2+1) stop
'ERROR:nd3'
4458 if (mod(nd3,nproc) /= 0) stop
'ERROR:nd3'
4459 if (mod(nd2,nproc) /= 0) stop
'ERROR:nd2'
4463 if (ncache <= max(n1,n2,n3/2)*4) ncache=max(n1,n2,n3/2)*4
4465 if (mod(n2,2) == 0) lzt=lzt+1
4466 if (mod(n2,4) == 0) lzt=lzt+1
4469 safe_allocate(trig1(1:2,1:8192))
4470 safe_allocate(after1(1:7))
4471 safe_allocate(now1(1:7))
4472 safe_allocate(before1(1:7))
4473 safe_allocate(trig2(1:2,1:8192))
4474 safe_allocate(after2(1:7))
4475 safe_allocate(now2(1:7))
4476 safe_allocate(before2(1:7))
4477 safe_allocate(trig3(1:2,1:8192))
4478 safe_allocate(after3(1:7))
4479 safe_allocate(now3(1:7))
4480 safe_allocate(before3(1:7))
4481 safe_allocate(zw(1:2,1:ncache/4,1:2))
4482 safe_allocate(zt(1:2,1:lzt,1:n1))
4483 safe_allocate(zmpi2(1:2,1:n1,1:nd2/nproc,1:nd3))
4484 safe_allocate(cosinarr(1:2,1:n3/2))
4486 safe_allocate(zmpi1(1:2,1:n1,1:nd2/nproc,1:nd3/nproc,1:nproc))
4490 call ctrig(n3/2,trig3,after3,before3,now3,1,ic3)
4491 call ctrig(n1,trig1,after1,before1,now1,1,ic1)
4492 call ctrig(n2,trig2,after2,before2,now2,1,ic2)
4495 twopion=8._real64*datan(1.0_8)/real(n3, real64)
4497 cosinarr(1,i3)=dcos(twopion*(i3-1))
4498 cosinarr(2,i3)=-dsin(twopion*(i3-1))
4504 if (lot < 1) stop
'kernelfft:enlarge ncache for z'
4511 mb=min(i1+(lot-1),n1)
4516 call inserthalf(nd1,lot,nfft,n3,zf(i1,1,j2),zw(1,1,1))
4521 call fftstp(lot,nfft,n3/2,lot,n3/2,zw(1,1,inzee),zw(1,1,3-inzee), &
4522 trig3,after3(i),now3(i),before3(i),1)
4530 call scramble_unpack(i1,j2,lot,nfft,n1,n3,nd2,nproc,nd3,zw(1,1,inzee),zmpi2,cosinarr)
4540#if defined(HAVE_MPI)
4541 call mpi_alltoall(zmpi2(:, 1, 1, 1),2*n1*(nd2/nproc)*(nd3/nproc), &
4542 mpi_double_precision, &
4543 zmpi1(:, 1, 1, 1, 1),2*n1*(nd2/nproc)*(nd3/nproc), &
4544 mpi_double_precision,comm,ierr)
4550 do j3 = 1, nd3/nproc
4552 if (iproc*(nd3/nproc)+j3 <= n3/2+1)
then
4558 if (lot < 1) stop
'kernelfft:enlarge ncache for x'
4562 mb = min(j+(lot-1),n2)
4567 if (nproc == 1)
then
4568 call mpiswitch(j3,nfft,jp2st,j2st,lot,n1,nd2,nd3,nproc,zmpi2,zw(1,1,1))
4570 call mpiswitch(j3,nfft,jp2st,j2st,lot,n1,nd2,nd3,nproc,zmpi1,zw(1,1,1))
4578 call fftstp(lot,nfft,n1,lot,n1,zw(1,1,inzee),zw(1,1,3-inzee), &
4579 trig1,after1(i),now1(i),before1(i),1)
4584 call fftstp(lot,nfft,n1,lzt,n1,zw(1,1,inzee),zt(1,j,1), &
4585 trig1,after1(i),now1(i),before1(i),1)
4591 if (lot < 1) stop
'kernelfft:enlarge ncache for y'
4595 mb = min(j+(lot-1), n1)
4600 call switch(nfft,n2,lot,n1,lzt,zt(1,1,j),zw(1,1,1))
4607 call fftstp(lot,nfft,n2,lot,n2,zw(1,1,inzee),zw(1,1,3-inzee), &
4608 trig2,after2(i),now2(i),before2(i),1)
4613 call fftstp(lot,nfft,n2,nd1,nd2,zw(1,1,inzee),zr(1,j,1,j3), &
4614 trig2,after2(i),now2(i),before2(i),1)
4622 safe_deallocate_a(trig1)
4623 safe_deallocate_a(after1)
4624 safe_deallocate_a(now1)
4625 safe_deallocate_a(before1)
4626 safe_deallocate_a(trig2)
4627 safe_deallocate_a(after2)
4628 safe_deallocate_a(now2)
4629 safe_deallocate_a(before2)
4630 safe_deallocate_a(trig3)
4631 safe_deallocate_a(after3)
4632 safe_deallocate_a(now3)
4633 safe_deallocate_a(before3)
4634 safe_deallocate_a(zmpi2)
4635 safe_deallocate_a(zw)
4636 safe_deallocate_a(zt)
4637 safe_deallocate_a(cosinarr)
4639 safe_deallocate_a(zmpi1)
4645 subroutine switch(nfft,n2,lot,n1,lzt,zt,zw)
4646 integer :: lot, n2, lzt, n1, j, nfft, i
4647 real(real64) :: zw(1:2, 1:lot, 1:n2), zt(1:2, 1:lzt, 1:n1)
4651 zw(1,j,i) = zt(1,i,j)
4652 zw(2,j,i) = zt(2,i,j)
4659 subroutine mpiswitch(j3,nfft,Jp2st,J2st,lot,n1,nd2,nd3,nproc,zmpi1,zw)
4660 integer :: n1, nd2, nproc, nd3, lot, mfft, jp2, jp2st
4661 integer :: j2st, nfft, i1, j3, j2
4662 real(real64) :: zmpi1(2,n1,nd2/nproc,nd3/nproc,nproc),zw(2,lot,n1)
4665 do jp2 = jp2st, nproc
4666 do j2 = j2st, nd2/nproc
4668 if (mfft > nfft)
then
4674 zw(1,mfft,i1) = zmpi1(1, i1, j2, j3, jp2)
4675 zw(2,mfft,i1) = zmpi1(2, i1, j2, j3, jp2)
4685 integer :: lot, n3, nd1, i3, i1, nfft
4686 real(real64) :: zw(1:2, 1:lot, 1:n3/2), zf(1:nd1, 1:n3)
4690 zw(1, i1, i3) = zf(i1, 2*i3 - 1)
4691 zw(2, i1, i3) = zf(i1, 2*i3)
double sin(double __x) __attribute__((__nothrow__
double cos(double __x) __attribute__((__nothrow__
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
These routines are part of the ISF poisson solver, eventually they will be integrated with the other ...
subroutine, public fourier_dim(n, n_next)
subroutine mpiswitch_upcorn(j3, nfft, Jp2stb, J2stb, lot, n1, md2, nd3, nproc, zmpi1, zw)
subroutine multkernel(nd1, nd2, n1, n2, lot, nfft, jS, pot, zw)
subroutine ctrig(n, trig, after, before, now, isign, ic)
subroutine switch(nfft, n2, lot, n1, lzt, zt, zw)
subroutine, public fft(n1, n2, n3, nd1, nd2, nd3, z, isign, inzee)
subroutine switch_upcorn(nfft, n2, lot, n1, lzt, zt, zw)
subroutine halfill_upcorn(md1, md3, lot, nfft, n3, zf, zw)
subroutine unmpiswitch_downcorn(j3, nfft, Jp2stf, J2stf, lot, n1, md2, nd3, nproc, zw, zmpi1)
subroutine fftrot(mm, nfft, m, nn, n, zin, zout, trig, after, now, before, isign)
subroutine unswitch_downcorn(nfft, n2, lot, n1, lzt, zw, zt)
subroutine unscramble_pack(i1, j2, lot, nfft, n1, n3, md2, nproc, nd3, zmpi2, zw, cosinarr)
subroutine fftstp(mm, nfft, m, nn, n, zin, zout, trig, after, now, before, isign)
subroutine, public convolxc_off(n1, n2, n3, nd1, nd2, nd3, md1, md2, md3, nproc, iproc, pot, zf, scal, comm)
subroutine unfill_downcorn(md1, md3, lot, nfft, n3, zw, zf, scal)
subroutine scramble_unpack(i1, j2, lot, nfft, n1, n3, md2, nproc, nd3, zw, zmpi2, cosinarr)
subroutine mpiswitch(j3, nfft, Jp2st, J2st, lot, n1, nd2, nd3, nproc, zmpi1, zw)
subroutine, public kernelfft(n1, n2, n3, nd1, nd2, nd3, nproc, iproc, zf, zr, comm)
subroutine inserthalf(nd1, lot, nfft, n3, zf, zw)
integer function ncache_optimal()