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 safe_allocate(zw(1:2,1:ncache/4,1:2))
281 safe_allocate(trig(1:2,1:1024))
282 safe_allocate(after(1:20))
283 safe_allocate(now(1:20))
284 safe_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 safe_deallocate_a(zw)
445 safe_deallocate_a(trig)
446 safe_deallocate_a(after)
447 safe_deallocate_a(now)
448 safe_deallocate_a(before)
449 if (iam == 0) inzee=inzet
468 subroutine ctrig(n,trig,after,before,now,isign,ic)
469 integer :: n, isign, ic
470 integer :: now(7), after(7), before(7)
471 real(real64) :: trig(:,:)
473 integer :: i, j, itt, nh
474 real(real64) :: angle, trigc, trigs, twopi
475 INTEGER,
DIMENSION(7,149) :: idata
478 data ((idata(i,j),i=1,7),j=1,74) / &
479 3, 3, 1, 1, 1, 1, 1, 4, 4, 1, 1, 1, 1, 1, &
480 5, 5, 1, 1, 1, 1, 1, 6, 6, 1, 1, 1, 1, 1, &
481 8, 8, 1, 1, 1, 1, 1, 9, 3, 3, 1, 1, 1, 1, &
482 12, 4, 3, 1, 1, 1, 1, 15, 5, 3, 1, 1, 1, 1, &
483 16, 4, 4, 1, 1, 1, 1, 18, 6, 3, 1, 1, 1, 1, &
484 20, 5, 4, 1, 1, 1, 1, 24, 8, 3, 1, 1, 1, 1, &
485 25, 5, 5, 1, 1, 1, 1, 27, 3, 3, 3, 1, 1, 1, &
486 30, 6, 5, 1, 1, 1, 1, 32, 8, 4, 1, 1, 1, 1, &
487 36, 4, 3, 3, 1, 1, 1, 40, 8, 5, 1, 1, 1, 1, &
488 45, 5, 3, 3, 1, 1, 1, 48, 4, 4, 3, 1, 1, 1, &
489 54, 6, 3, 3, 1, 1, 1, 60, 5, 4, 3, 1, 1, 1, &
490 64, 8, 8, 1, 1, 1, 1, 72, 8, 3, 3, 1, 1, 1, &
491 75, 5, 5, 3, 1, 1, 1, 80, 5, 4, 4, 1, 1, 1, &
492 81, 3, 3, 3, 3, 1, 1, 90, 6, 5, 3, 1, 1, 1, &
493 96, 8, 4, 3, 1, 1, 1, 100, 5, 5, 4, 1, 1, 1, &
494 108, 4, 3, 3, 3, 1, 1, 120, 8, 5, 3, 1, 1, 1, &
495 125, 5, 5, 5, 1, 1, 1, 128, 8, 4, 4, 1, 1, 1, &
496 135, 5, 3, 3, 3, 1, 1, 144, 6, 8, 3, 1, 1, 1, &
497 150, 6, 5, 5, 1, 1, 1, 160, 8, 5, 4, 1, 1, 1, &
498 162, 6, 3, 3, 3, 1, 1, 180, 5, 4, 3, 3, 1, 1, &
499 192, 6, 8, 4, 1, 1, 1, 200, 8, 5, 5, 1, 1, 1, &
500 216, 8, 3, 3, 3, 1, 1, 225, 5, 5, 3, 3, 1, 1, &
501 240, 6, 8, 5, 1, 1, 1, 243, 3, 3, 3, 3, 3, 1, &
502 256, 8, 8, 4, 1, 1, 1, 270, 6, 5, 3, 3, 1, 1, &
503 288, 8, 4, 3, 3, 1, 1, 300, 5, 5, 4, 3, 1, 1, &
504 320, 5, 4, 4, 4, 1, 1, 324, 4, 3, 3, 3, 3, 1, &
505 360, 8, 5, 3, 3, 1, 1, 375, 5, 5, 5, 3, 1, 1, &
506 384, 8, 4, 4, 3, 1, 1, 400, 5, 5, 4, 4, 1, 1, &
507 405, 5, 3, 3, 3, 3, 1, 432, 4, 4, 3, 3, 3, 1, &
508 450, 6, 5, 5, 3, 1, 1, 480, 8, 5, 4, 3, 1, 1, &
509 486, 6, 3, 3, 3, 3, 1, 500, 5, 5, 5, 4, 1, 1, &
510 512, 8, 8, 8, 1, 1, 1, 540, 5, 4, 3, 3, 3, 1, &
511 576, 4, 4, 4, 3, 3, 1, 600, 8, 5, 5, 3, 1, 1, &
512 625, 5, 5, 5, 5, 1, 1, 640, 8, 5, 4, 4, 1, 1, &
513 648, 8, 3, 3, 3, 3, 1, 675, 5, 5, 3, 3, 3, 1, &
514 720, 5, 4, 4, 3, 3, 1, 729, 3, 3, 3, 3, 3, 3, &
515 750, 6, 5, 5, 5, 1, 1, 768, 4, 4, 4, 4, 3, 1/
517 data ((idata(i,j),i=1,7),j=75,149) / &
518 800, 8, 5, 5, 4, 1, 1, 810, 6, 5, 3, 3, 3, 1, &
519 864, 8, 4, 3, 3, 3, 1, 900, 5, 5, 4, 3, 3, 1, &
520 960, 5, 4, 4, 4, 3, 1, 972, 4, 3, 3, 3, 3, 3, &
521 1000, 8, 5, 5, 5, 1, 1, 1024, 4, 4, 4, 4, 4, 1, &
522 1080, 6, 5, 4, 3, 3, 1, 1125, 5, 5, 5, 3, 3, 1, &
523 1152, 6, 4, 4, 4, 3, 1, 1200, 6, 8, 5, 5, 1, 1, &
524 1215, 5, 3, 3, 3, 3, 3, 1280, 8, 8, 5, 4, 1, 1, &
525 1296, 6, 8, 3, 3, 3, 1, 1350, 6, 5, 5, 3, 3, 1, &
526 1440, 6, 5, 4, 4, 3, 1, 1458, 6, 3, 3, 3, 3, 3, &
527 1500, 5, 5, 5, 4, 3, 1, 1536, 6, 8, 8, 4, 1, 1, &
528 1600, 8, 8, 5, 5, 1, 1, 1620, 5, 4, 3, 3, 3, 3, &
529 1728, 6, 8, 4, 3, 3, 1, 1800, 6, 5, 5, 4, 3, 1, &
530 1875, 5, 5, 5, 5, 3, 1, 1920, 6, 5, 4, 4, 4, 1, &
531 1944, 6, 4, 3, 3, 3, 3, 2000, 5, 5, 5, 4, 4, 1, &
532 2025, 5, 5, 3, 3, 3, 3, 2048, 8, 4, 4, 4, 4, 1, &
533 2160, 6, 8, 5, 3, 3, 1, 2250, 6, 5, 5, 5, 3, 1, &
534 2304, 6, 8, 4, 4, 3, 1, 2400, 6, 5, 5, 4, 4, 1, &
535 2430, 6, 5, 3, 3, 3, 3, 2500, 5, 5, 5, 5, 4, 1, &
536 2560, 8, 5, 4, 4, 4, 1, 2592, 6, 4, 4, 3, 3, 3, &
537 2700, 5, 5, 4, 3, 3, 3, 2880, 6, 8, 5, 4, 3, 1, &
538 3000, 6, 5, 5, 5, 4, 1, 3072, 6, 8, 4, 4, 4, 1, &
539 3125, 5, 5, 5, 5, 5, 1, 3200, 8, 5, 5, 4, 4, 1, &
540 3240, 6, 5, 4, 3, 3, 3, 3375, 5, 5, 5, 3, 3, 3, &
541 3456, 6, 4, 4, 4, 3, 3, 3600, 6, 8, 5, 5, 3, 1, &
542 3750, 6, 5, 5, 5, 5, 1, 3840, 6, 8, 5, 4, 4, 1, &
543 3888, 6, 8, 3, 3, 3, 3, 4000, 8, 5, 5, 5, 4, 1, &
544 4050, 6, 5, 5, 3, 3, 3, 4096, 8, 8, 4, 4, 4, 1, &
545 4320, 6, 5, 4, 4, 3, 3, 4500, 5, 5, 5, 4, 3, 3, &
546 4608, 6, 8, 8, 4, 3, 1, 4800, 6, 8, 5, 5, 4, 1, &
547 5000, 8, 5, 5, 5, 5, 1, 5120, 8, 8, 5, 4, 4, 1, &
548 5184, 6, 8, 4, 3, 3, 3, 5400, 6, 5, 5, 4, 3, 3, &
549 5625, 5, 5, 5, 5, 3, 3, 5760, 6, 8, 8, 5, 3, 1, &
550 6000, 6, 8, 5, 5, 5, 1, 6144, 6, 8, 8, 4, 4, 1, &
551 6400, 8, 8, 5, 5, 4, 1, 6480, 6, 8, 5, 3, 3, 3, &
552 6750, 6, 5, 5, 5, 3, 3, 6912, 6, 8, 4, 4, 3, 3, &
553 7200, 6, 5, 5, 4, 4, 3, 7500, 5, 5, 5, 5, 4, 3, &
554 7680, 6, 8, 8, 5, 4, 1, 8000, 8, 8, 5, 5, 5, 1, &
555 8192, 8, 8, 8, 4, 4, 1 /
558 if (n == idata(1,i))
then
573 print*,
'VALUE OF',n,
'NOT ALLOWED FOR FFT, ALLOWED VALUES ARE:'
575 write(6,37) (idata(1,i),i=1,149)
582 after(i)=after(i-1)*now(i-1)
583 before(ic-i+1)=before(ic-i+2)*now(ic-i+2)
586 twopi=6.283185307179586_real64
589 if (mod(n,2) == 0)
then
626 subroutine fftstp(mm,nfft,m,nn,n,zin,zout,trig,after,now,before,isign)
627 integer :: mm, nfft, m, nn, n, isign
628 integer :: after, before, atn, atb, now
629 real(real64) :: trig(:,:)
630 real(real64) :: zin(2, mm, m), zout(2, nn, n)
632 real(real64) :: rt2i, dp, cp, cm, ci5, cr5, ci6, cr6, am, ap, ci8, cr8
633 real(real64) :: r, r1, r2, r3, r4, r5, r6, r7, r8_, r25, r34
634 real(real64) :: s, s1, s2, s3, s4, s5, s6, s7, s8, s25, s34
635 real(real64) :: bb, bm, dm, bp
636 real(real64) :: cr2, ci2, cr3, ci3, cr4, ci4, cr7, ci7
637 real(real64) :: cos2, sin2, cos4, sin4
638 real(real64) :: ur1, ur2, ur3, ui1, ui2, ui3
639 real(real64) :: vr1, vr2, vr3, vi1, vi2, vi3
640 integer :: ia, ib, j, ias, itrig, itt
641 integer :: nin1, nin2, nin3, nin4, nin5, nin6, nin7, nin8
642 integer :: nout1, nout2, nout3, nout4, nout5, nout6, nout7, nout8
648 rt2i=0.7071067811865475_real64
663 zout(1,j,nout1)= r2 + r1
664 zout(2,j,nout1)= s2 + s1
665 zout(1,j,nout2)= r1 - r2
666 zout(2,j,nout2)= s1 - s2
671 if (2*ias == after)
then
685 zout(1,j,nout1)= r1 - r2
686 zout(2,j,nout1)= s2 + s1
687 zout(1,j,nout2)= r2 + r1
688 zout(2,j,nout2)= s1 - s2
704 zout(1,j,nout1)= r2 + r1
705 zout(2,j,nout1)= s1 - s2
706 zout(1,j,nout2)= r1 - r2
707 zout(2,j,nout2)= s2 + s1
711 else if (4*ias == after)
then
727 zout(1,j,nout1)= r2 + r1
728 zout(2,j,nout1)= s2 + s1
729 zout(1,j,nout2)= r1 - r2
730 zout(2,j,nout2)= s1 - s2
748 zout(1,j,nout1)= r2 + r1
749 zout(2,j,nout1)= s2 + s1
750 zout(1,j,nout2)= r1 - r2
751 zout(2,j,nout2)= s1 - s2
755 else if (4*ias == 3*after)
then
771 zout(1,j,nout1)= r1 - r2
772 zout(2,j,nout1)= s2 + s1
773 zout(1,j,nout2)= r2 + r1
774 zout(2,j,nout2)= s1 - s2
792 zout(1,j,nout1)= r2 + r1
793 zout(2,j,nout1)= s1 - s2
794 zout(1,j,nout2)= r1 - r2
795 zout(2,j,nout2)= s2 + s1
817 zout(1,j,nout1)= r2 + r1
818 zout(2,j,nout1)= s2 + s1
819 zout(1,j,nout2)= r1 - r2
820 zout(2,j,nout2)= s1 - s2
825 else if (now == 4)
then
850 zout(1,j,nout1) = r + s
851 zout(1,j,nout3) = r - s
854 zout(1,j,nout2) = r - s
855 zout(1,j,nout4) = r + s
858 zout(2,j,nout1) = r + s
859 zout(2,j,nout3) = r - s
862 zout(2,j,nout2) = r + s
863 zout(2,j,nout4) = r - s
868 if (2*ias == after)
then
895 zout(1,j,nout1) = r + s
896 zout(1,j,nout3) = r - s
899 zout(1,j,nout2) = r - s
900 zout(1,j,nout4) = r + s
903 zout(2,j,nout1) = r + s
904 zout(2,j,nout3) = r - s
907 zout(2,j,nout2) = r + s
908 zout(2,j,nout4) = r - s
950 zout(1,j,nout1) = r + s
951 zout(1,j,nout3) = r - s
954 zout(1,j,nout2) = r - s
955 zout(1,j,nout4) = r + s
958 zout(2,j,nout1) = r + s
959 zout(2,j,nout3) = r - s
962 zout(2,j,nout2) = r + s
963 zout(2,j,nout4) = r - s
992 zout(1,j,nout1) = r + s
993 zout(1,j,nout3) = r - s
996 zout(1,j,nout2) = r + s
997 zout(1,j,nout4) = r - s
1000 zout(2,j,nout1) = r + s
1001 zout(2,j,nout3) = r - s
1004 zout(2,j,nout2) = r - s
1005 zout(2,j,nout4) = r + s
1010 if (2*ias == after)
then
1037 zout(1,j,nout1) = r + s
1038 zout(1,j,nout3) = r - s
1041 zout(1,j,nout2) = r + s
1042 zout(1,j,nout4) = r - s
1045 zout(2,j,nout1) = r + s
1046 zout(2,j,nout3) = r - s
1049 zout(2,j,nout2) = r - s
1050 zout(2,j,nout4) = r + s
1092 zout(1,j,nout1) = r + s
1093 zout(1,j,nout3) = r - s
1096 zout(1,j,nout2) = r + s
1097 zout(1,j,nout4) = r - s
1100 zout(2,j,nout1) = r + s
1101 zout(2,j,nout3) = r - s
1104 zout(2,j,nout2) = r - s
1105 zout(2,j,nout4) = r + s
1111 else if (now == 8)
then
1112 if (isign == -1)
then
1166 zout(1,j,nout1) = ap + bp
1167 zout(2,j,nout1) = cp + dp
1168 zout(1,j,nout5) = ap - bp
1169 zout(2,j,nout5) = cp - dp
1170 zout(1,j,nout3) = am + dm
1171 zout(2,j,nout3) = cm - bm
1172 zout(1,j,nout7) = am - dm
1173 zout(2,j,nout7) = cm + bm
1193 dp = ( cm - dp)*rt2i
1194 zout(1,j,nout2) = ap + r
1195 zout(2,j,nout2) = bm + s
1196 zout(1,j,nout6) = ap - r
1197 zout(2,j,nout6) = bm - s
1198 zout(1,j,nout4) = am + cp
1199 zout(2,j,nout4) = bp + dp
1200 zout(1,j,nout8) = am - cp
1201 zout(2,j,nout8) = bp - dp
1294 zout(1,j,nout1) = ap + bp
1295 zout(2,j,nout1) = cp + dp
1296 zout(1,j,nout5) = ap - bp
1297 zout(2,j,nout5) = cp - dp
1298 zout(1,j,nout3) = am + dm
1299 zout(2,j,nout3) = cm - bm
1300 zout(1,j,nout7) = am - dm
1301 zout(2,j,nout7) = cm + bm
1321 dp = ( cm - dp)*rt2i
1322 zout(1,j,nout2) = ap + r
1323 zout(2,j,nout2) = bm + s
1324 zout(1,j,nout6) = ap - r
1325 zout(2,j,nout6) = bm - s
1326 zout(1,j,nout4) = am + cp
1327 zout(2,j,nout4) = bp + dp
1328 zout(1,j,nout8) = am - cp
1329 zout(2,j,nout8) = bp - dp
1387 zout(1,j,nout1) = ap + bp
1388 zout(2,j,nout1) = cp + dp
1389 zout(1,j,nout5) = ap - bp
1390 zout(2,j,nout5) = cp - dp
1391 zout(1,j,nout3) = am - dm
1392 zout(2,j,nout3) = cm + bm
1393 zout(1,j,nout7) = am + dm
1394 zout(2,j,nout7) = cm - bm
1415 zout(1,j,nout2) = ap + r
1416 zout(2,j,nout2) = bm + s
1417 zout(1,j,nout6) = ap - r
1418 zout(2,j,nout6) = bm - s
1419 zout(1,j,nout4) = am + cp
1420 zout(2,j,nout4) = bp + dp
1421 zout(1,j,nout8) = am - cp
1422 zout(2,j,nout8) = bp - dp
1516 zout(1,j,nout1) = ap + bp
1517 zout(2,j,nout1) = cp + dp
1518 zout(1,j,nout5) = ap - bp
1519 zout(2,j,nout5) = cp - dp
1520 zout(1,j,nout3) = am - dm
1521 zout(2,j,nout3) = cm + bm
1522 zout(1,j,nout7) = am + dm
1523 zout(2,j,nout7) = cm - bm
1544 zout(1,j,nout2) = ap + r
1545 zout(2,j,nout2) = bm + s
1546 zout(1,j,nout6) = ap - r
1547 zout(2,j,nout6) = bm - s
1548 zout(1,j,nout4) = am + cp
1549 zout(2,j,nout4) = bp + dp
1550 zout(1,j,nout8) = am - cp
1551 zout(2,j,nout8) = bp - dp
1557 else if (now == 3)
then
1559 bb=isign*0.8660254037844387_real64
1579 zout(1,j,nout1) = r + r1
1580 zout(2,j,nout1) = s + s1
1585 zout(1,j,nout2) = r1 - s2
1586 zout(2,j,nout2) = s1 + r2
1587 zout(1,j,nout3) = r1 + s2
1588 zout(2,j,nout3) = s1 - r2
1593 if (4*ias == 3*after)
then
1594 if (isign == 1)
then
1613 zout(1,j,nout1) = r1 - r
1614 zout(2,j,nout1) = s + s1
1619 zout(1,j,nout2) = r1 - s2
1620 zout(2,j,nout2) = s1 - r2
1621 zout(1,j,nout3) = r1 + s2
1622 zout(2,j,nout3) = s1 + r2
1644 zout(1,j,nout1) = r + r1
1645 zout(2,j,nout1) = s1 - s
1650 zout(1,j,nout2) = r1 + s2
1651 zout(2,j,nout2) = s1 + r2
1652 zout(1,j,nout3) = r1 - s2
1653 zout(2,j,nout3) = s1 - r2
1657 else if (8*ias == 3*after)
then
1658 if (isign == 1)
then
1679 zout(1,j,nout1) = r + r1
1680 zout(2,j,nout1) = s + s1
1685 zout(1,j,nout2) = r1 - s2
1686 zout(2,j,nout2) = s1 + r2
1687 zout(1,j,nout3) = r1 + s2
1688 zout(2,j,nout3) = s1 - r2
1712 zout(1,j,nout1) = r + r1
1713 zout(2,j,nout1) = s + s1
1718 zout(1,j,nout2) = r1 - s2
1719 zout(2,j,nout2) = s1 + r2
1720 zout(1,j,nout3) = r1 + s2
1721 zout(2,j,nout3) = s1 - r2
1755 zout(1,j,nout1) = r + r1
1756 zout(2,j,nout1) = s + s1
1761 zout(1,j,nout2) = r1 - s2
1762 zout(2,j,nout2) = s1 + r2
1763 zout(1,j,nout3) = r1 + s2
1764 zout(2,j,nout3) = s1 - r2
1769 else if (now == 5)
then
1771 cos2=0.3090169943749474_real64
1773 cos4=-0.8090169943749474_real64
1775 sin2=isign*0.9510565162951536_real64
1777 sin4=isign*0.5877852522924731_real64
1807 zout(1,j,nout1) = r1 + r25 + r34
1808 r = r1 + cos2*r25 + cos4*r34
1809 s = sin2*s25 + sin4*s34
1810 zout(1,j,nout2) = r - s
1811 zout(1,j,nout5) = r + s
1812 r = r1 + cos4*r25 + cos2*r34
1813 s = sin4*s25 - sin2*s34
1814 zout(1,j,nout3) = r - s
1815 zout(1,j,nout4) = r + s
1820 zout(2,j,nout1) = s1 + s25 + s34
1821 r = s1 + cos2*s25 + cos4*s34
1822 s = sin2*r25 + sin4*r34
1823 zout(2,j,nout2) = r + s
1824 zout(2,j,nout5) = r - s
1825 r = s1 + cos4*s25 + cos2*s34
1826 s = sin4*r25 - sin2*r34
1827 zout(2,j,nout3) = r + s
1828 zout(2,j,nout4) = r - s
1833 if (8*ias == 5*after)
then
1834 if (isign == 1)
then
1867 zout(1,j,nout1) = r1 + r25 - r34
1868 r = r1 + cos2*r25 - cos4*r34
1869 s = sin2*s25 + sin4*s34
1870 zout(1,j,nout2) = r - s
1871 zout(1,j,nout5) = r + s
1872 r = r1 + cos4*r25 - cos2*r34
1873 s = sin4*s25 - sin2*s34
1874 zout(1,j,nout3) = r - s
1875 zout(1,j,nout4) = r + s
1880 zout(2,j,nout1) = s1 + s25 + s34
1881 r = s1 + cos2*s25 + cos4*s34
1882 s = sin2*r25 + sin4*r34
1883 zout(2,j,nout2) = r + s
1884 zout(2,j,nout5) = r - s
1885 r = s1 + cos4*s25 + cos2*s34
1886 s = sin4*r25 - sin2*r34
1887 zout(2,j,nout3) = r + s
1888 zout(2,j,nout4) = r - s
1924 zout(1,j,nout1) = r1 + r25 + r34
1925 r = r1 + cos2*r25 + cos4*r34
1926 s = sin2*s25 + sin4*s34
1927 zout(1,j,nout2) = r - s
1928 zout(1,j,nout5) = r + s
1929 r = r1 + cos4*r25 + cos2*r34
1930 s = sin4*s25 - sin2*s34
1931 zout(1,j,nout3) = r - s
1932 zout(1,j,nout4) = r + s
1937 zout(2,j,nout1) = s1 + s25 - s34
1938 r = s1 + cos2*s25 - cos4*s34
1939 s = sin2*r25 + sin4*r34
1940 zout(2,j,nout2) = r + s
1941 zout(2,j,nout5) = r - s
1942 r = s1 + cos4*s25 - cos2*s34
1943 s = sin4*r25 - sin2*r34
1944 zout(2,j,nout3) = r + s
1945 zout(2,j,nout4) = r - s
2000 zout(1,j,nout1) = r1 + r25 + r34
2001 r = r1 + cos2*r25 + cos4*r34
2002 s = sin2*s25 + sin4*s34
2003 zout(1,j,nout2) = r - s
2004 zout(1,j,nout5) = r + s
2005 r = r1 + cos4*r25 + cos2*r34
2006 s = sin4*s25 - sin2*s34
2007 zout(1,j,nout3) = r - s
2008 zout(1,j,nout4) = r + s
2013 zout(2,j,nout1) = s1 + s25 + s34
2014 r = s1 + cos2*s25 + cos4*s34
2015 s = sin2*r25 + sin4*r34
2016 zout(2,j,nout2) = r + s
2017 zout(2,j,nout5) = r - s
2018 r = s1 + cos4*s25 + cos2*s34
2019 s = sin4*r25 - sin2*r34
2020 zout(2,j,nout3) = r + s
2021 zout(2,j,nout4) = r - s
2026 else if (now == 6)
then
2028 bb=isign*0.8660254037844387_real64
2085 zout(1,j,nout1)=ur1+vr1
2086 zout(2,j,nout1)=ui1+vi1
2087 zout(1,j,nout5)=ur2+vr2
2088 zout(2,j,nout5)=ui2+vi2
2089 zout(1,j,nout3)=ur3+vr3
2090 zout(2,j,nout3)=ui3+vi3
2091 zout(1,j,nout4)=ur1-vr1
2092 zout(2,j,nout4)=ui1-vi1
2093 zout(1,j,nout2)=ur2-vr2
2094 zout(2,j,nout2)=ui2-vi2
2095 zout(1,j,nout6)=ur3-vr3
2096 zout(2,j,nout6)=ui3-vi3
2111 subroutine fftrot(mm,nfft,m,nn,n,zin,zout,trig,after,now,before,isign)
2112 integer :: mm, nfft, m, nn, n, isign
2113 integer :: after, before, atn, atb, now
2114 real(real64) :: trig(:,:)
2115 real(real64) :: zin(2, mm, m), zout(2, n, nn)
2117 real(real64) :: rt2i, dp, cp, cm, ci5, cr5, ci6, cr6, am, ap, ci8, cr8
2118 real(real64) :: r, r1, r2, r3, r4, r5, r6, r7, r8_, r25, r34
2119 real(real64) :: s, s1, s2, s3, s4, s5, s6, s7, s8, s25, s34
2120 real(real64) :: bb, bm, dm, bp
2121 real(real64) :: cr2, ci2, cr3, ci3, cr4, ci4, cr7, ci7
2122 real(real64) :: cos2, sin2, cos4, sin4
2123 real(real64) :: ur1, ur2, ur3, ui1, ui2, ui3
2124 real(real64) :: vr1, vr2, vr3, vi1, vi2, vi3
2125 integer :: ia, ib, ib1, j, ias, itrig, itt
2126 integer :: nin1, nin2, nin3, nin4, nin5, nin6, nin7, nin8
2127 integer :: nout1, nout2, nout3, nout4, nout5, nout6, nout7, nout8
2133 rt2i=0.7071067811865475_real64
2148 zout(1,nout1,j)= r2 + r1
2149 zout(2,nout1,j)= s2 + s1
2150 zout(1,nout2,j)= r1 - r2
2151 zout(2,nout2,j)= s1 - s2
2157 if (2*ias == after)
then
2158 if (isign == 1)
then
2171 zout(1,nout1,j)= r1 - r2
2172 zout(2,nout1,j)= s2 + s1
2173 zout(1,nout2,j)= r2 + r1
2174 zout(2,nout2,j)= s1 - s2
2190 zout(1,nout1,j)= r2 + r1
2191 zout(2,nout1,j)= s1 - s2
2192 zout(1,nout2,j)= r1 - r2
2193 zout(2,nout2,j)= s2 + s1
2197 else if (4*ias == after)
then
2198 if (isign == 1)
then
2213 zout(1,nout1,j)= r2 + r1
2214 zout(2,nout1,j)= s2 + s1
2215 zout(1,nout2,j)= r1 - r2
2216 zout(2,nout2,j)= s1 - s2
2234 zout(1,nout1,j)= r2 + r1
2235 zout(2,nout1,j)= s2 + s1
2236 zout(1,nout2,j)= r1 - r2
2237 zout(2,nout2,j)= s1 - s2
2241 else if (4*ias == 3*after)
then
2242 if (isign == 1)
then
2257 zout(1,nout1,j)= r1 - r2
2258 zout(2,nout1,j)= s2 + s1
2259 zout(1,nout2,j)= r2 + r1
2260 zout(2,nout2,j)= s1 - s2
2278 zout(1,nout1,j)= r2 + r1
2279 zout(2,nout1,j)= s1 - s2
2280 zout(1,nout2,j)= r1 - r2
2281 zout(2,nout2,j)= s2 + s1
2303 zout(1,nout1,j)= r2 + r1
2304 zout(2,nout1,j)= s2 + s1
2305 zout(1,nout2,j)= r1 - r2
2306 zout(2,nout2,j)= s1 - s2
2311 else if (now == 4)
then
2312 if (isign == 1)
then
2336 zout(1,nout1,j) = r + s
2337 zout(1,nout3,j) = r - s
2340 zout(1,nout2,j) = r - s
2341 zout(1,nout4,j) = r + s
2344 zout(2,nout1,j) = r + s
2345 zout(2,nout3,j) = r - s
2348 zout(2,nout2,j) = r + s
2349 zout(2,nout4,j) = r - s
2354 if (2*ias == after)
then
2381 zout(1,nout1,j) = r + s
2382 zout(1,nout3,j) = r - s
2385 zout(1,nout2,j) = r - s
2386 zout(1,nout4,j) = r + s
2389 zout(2,nout1,j) = r + s
2390 zout(2,nout3,j) = r - s
2393 zout(2,nout2,j) = r + s
2394 zout(2,nout4,j) = r - s
2436 zout(1,nout1,j) = r + s
2437 zout(1,nout3,j) = r - s
2440 zout(1,nout2,j) = r - s
2441 zout(1,nout4,j) = r + s
2444 zout(2,nout1,j) = r + s
2445 zout(2,nout3,j) = r - s
2448 zout(2,nout2,j) = r + s
2449 zout(2,nout4,j) = r - s
2478 zout(1,nout1,j) = r + s
2479 zout(1,nout3,j) = r - s
2482 zout(1,nout2,j) = r + s
2483 zout(1,nout4,j) = r - s
2486 zout(2,nout1,j) = r + s
2487 zout(2,nout3,j) = r - s
2490 zout(2,nout2,j) = r - s
2491 zout(2,nout4,j) = r + s
2496 if (2*ias == after)
then
2523 zout(1,nout1,j) = r + s
2524 zout(1,nout3,j) = r - s
2527 zout(1,nout2,j) = r + s
2528 zout(1,nout4,j) = r - s
2531 zout(2,nout1,j) = r + s
2532 zout(2,nout3,j) = r - s
2535 zout(2,nout2,j) = r - s
2536 zout(2,nout4,j) = r + s
2578 zout(1,nout1,j) = r + s
2579 zout(1,nout3,j) = r - s
2582 zout(1,nout2,j) = r + s
2583 zout(1,nout4,j) = r - s
2586 zout(2,nout1,j) = r + s
2587 zout(2,nout3,j) = r - s
2590 zout(2,nout2,j) = r - s
2591 zout(2,nout4,j) = r + s
2597 else if (now == 8)
then
2598 if (isign == -1)
then
2652 zout(1,nout1,j) = ap + bp
2653 zout(2,nout1,j) = cp + dp
2654 zout(1,nout5,j) = ap - bp
2655 zout(2,nout5,j) = cp - dp
2656 zout(1,nout3,j) = am + dm
2657 zout(2,nout3,j) = cm - bm
2658 zout(1,nout7,j) = am - dm
2659 zout(2,nout7,j) = cm + bm
2680 zout(1,nout2,j) = ap + r
2681 zout(2,nout2,j) = bm + s
2682 zout(1,nout6,j) = ap - r
2683 zout(2,nout6,j) = bm - s
2684 zout(1,nout4,j) = am + cp
2685 zout(2,nout4,j) = bp + dp
2686 zout(1,nout8,j) = am - cp
2687 zout(2,nout8,j) = bp - dp
2780 zout(1,nout1,j) = ap + bp
2781 zout(2,nout1,j) = cp + dp
2782 zout(1,nout5,j) = ap - bp
2783 zout(2,nout5,j) = cp - dp
2784 zout(1,nout3,j) = am + dm
2785 zout(2,nout3,j) = cm - bm
2786 zout(1,nout7,j) = am - dm
2787 zout(2,nout7,j) = cm + bm
2808 zout(1,nout2,j) = ap + r
2809 zout(2,nout2,j) = bm + s
2810 zout(1,nout6,j) = ap - r
2811 zout(2,nout6,j) = bm - s
2812 zout(1,nout4,j) = am + cp
2813 zout(2,nout4,j) = bp + dp
2814 zout(1,nout8,j) = am - cp
2815 zout(2,nout8,j) = bp - dp
2874 zout(1,nout1,j) = ap + bp
2875 zout(2,nout1,j) = cp + dp
2876 zout(1,nout5,j) = ap - bp
2877 zout(2,nout5,j) = cp - dp
2878 zout(1,nout3,j) = am - dm
2879 zout(2,nout3,j) = cm + bm
2880 zout(1,nout7,j) = am + dm
2881 zout(2,nout7,j) = cm - bm
2902 zout(1,nout2,j) = ap + r
2903 zout(2,nout2,j) = bm + s
2904 zout(1,nout6,j) = ap - r
2905 zout(2,nout6,j) = bm - s
2906 zout(1,nout4,j) = am + cp
2907 zout(2,nout4,j) = bp + dp
2908 zout(1,nout8,j) = am - cp
2909 zout(2,nout8,j) = bp - dp
3003 zout(1,nout1,j) = ap + bp
3004 zout(2,nout1,j) = cp + dp
3005 zout(1,nout5,j) = ap - bp
3006 zout(2,nout5,j) = cp - dp
3007 zout(1,nout3,j) = am - dm
3008 zout(2,nout3,j) = cm + bm
3009 zout(1,nout7,j) = am + dm
3010 zout(2,nout7,j) = cm - bm
3031 zout(1,nout2,j) = ap + r
3032 zout(2,nout2,j) = bm + s
3033 zout(1,nout6,j) = ap - r
3034 zout(2,nout6,j) = bm - s
3035 zout(1,nout4,j) = am + cp
3036 zout(2,nout4,j) = bp + dp
3037 zout(1,nout8,j) = am - cp
3038 zout(2,nout8,j) = bp - dp
3044 else if (now == 3)
then
3046 bb=isign*0.8660254037844387_real64
3066 zout(1,nout1,j) = r + r1
3067 zout(2,nout1,j) = s + s1
3072 zout(1,nout2,j) = r1 - s2
3073 zout(2,nout2,j) = s1 + r2
3074 zout(1,nout3,j) = r1 + s2
3075 zout(2,nout3,j) = s1 - r2
3080 if (4*ias == 3*after)
then
3081 if (isign == 1)
then
3100 zout(1,nout1,j) = r1 - r
3101 zout(2,nout1,j) = s + s1
3106 zout(1,nout2,j) = r1 - s2
3107 zout(2,nout2,j) = s1 - r2
3108 zout(1,nout3,j) = r1 + s2
3109 zout(2,nout3,j) = s1 + r2
3131 zout(1,nout1,j) = r + r1
3132 zout(2,nout1,j) = s1 - s
3137 zout(1,nout2,j) = r1 + s2
3138 zout(2,nout2,j) = s1 + r2
3139 zout(1,nout3,j) = r1 - s2
3140 zout(2,nout3,j) = s1 - r2
3144 else if (8*ias == 3*after)
then
3145 if (isign == 1)
then
3166 zout(1,nout1,j) = r + r1
3167 zout(2,nout1,j) = s + s1
3172 zout(1,nout2,j) = r1 - s2
3173 zout(2,nout2,j) = s1 + r2
3174 zout(1,nout3,j) = r1 + s2
3175 zout(2,nout3,j) = s1 - r2
3199 zout(1,nout1,j) = r + r1
3200 zout(2,nout1,j) = s + s1
3205 zout(1,nout2,j) = r1 - s2
3206 zout(2,nout2,j) = s1 + r2
3207 zout(1,nout3,j) = r1 + s2
3208 zout(2,nout3,j) = s1 - r2
3242 zout(1,nout1,j) = r + r1
3243 zout(2,nout1,j) = s + s1
3248 zout(1,nout2,j) = r1 - s2
3249 zout(2,nout2,j) = s1 + r2
3250 zout(1,nout3,j) = r1 + s2
3251 zout(2,nout3,j) = s1 - r2
3256 else if (now == 5)
then
3258 cos2=0.3090169943749474_real64
3260 cos4=-0.8090169943749474_real64
3262 sin2=isign*0.9510565162951536_real64
3264 sin4=isign*0.5877852522924731_real64
3294 zout(1,nout1,j) = r1 + r25 + r34
3295 r = r1 + cos2*r25 + cos4*r34
3296 s = sin2*s25 + sin4*s34
3297 zout(1,nout2,j) = r - s
3298 zout(1,nout5,j) = r + s
3299 r = r1 + cos4*r25 + cos2*r34
3300 s = sin4*s25 - sin2*s34
3301 zout(1,nout3,j) = r - s
3302 zout(1,nout4,j) = r + s
3307 zout(2,nout1,j) = s1 + s25 + s34
3308 r = s1 + cos2*s25 + cos4*s34
3309 s = sin2*r25 + sin4*r34
3310 zout(2,nout2,j) = r + s
3311 zout(2,nout5,j) = r - s
3312 r = s1 + cos4*s25 + cos2*s34
3313 s = sin4*r25 - sin2*r34
3314 zout(2,nout3,j) = r + s
3315 zout(2,nout4,j) = r - s
3320 if (8*ias == 5*after)
then
3321 if (isign == 1)
then
3354 zout(1,nout1,j) = r1 + r25 - r34
3355 r = r1 + cos2*r25 - cos4*r34
3356 s = sin2*s25 + sin4*s34
3357 zout(1,nout2,j) = r - s
3358 zout(1,nout5,j) = r + s
3359 r = r1 + cos4*r25 - cos2*r34
3360 s = sin4*s25 - sin2*s34
3361 zout(1,nout3,j) = r - s
3362 zout(1,nout4,j) = r + s
3367 zout(2,nout1,j) = s1 + s25 + s34
3368 r = s1 + cos2*s25 + cos4*s34
3369 s = sin2*r25 + sin4*r34
3370 zout(2,nout2,j) = r + s
3371 zout(2,nout5,j) = r - s
3372 r = s1 + cos4*s25 + cos2*s34
3373 s = sin4*r25 - sin2*r34
3374 zout(2,nout3,j) = r + s
3375 zout(2,nout4,j) = r - s
3411 zout(1,nout1,j) = r1 + r25 + r34
3412 r = r1 + cos2*r25 + cos4*r34
3413 s = sin2*s25 + sin4*s34
3414 zout(1,nout2,j) = r - s
3415 zout(1,nout5,j) = r + s
3416 r = r1 + cos4*r25 + cos2*r34
3417 s = sin4*s25 - sin2*s34
3418 zout(1,nout3,j) = r - s
3419 zout(1,nout4,j) = r + s
3424 zout(2,nout1,j) = s1 + s25 - s34
3425 r = s1 + cos2*s25 - cos4*s34
3426 s = sin2*r25 + sin4*r34
3427 zout(2,nout2,j) = r + s
3428 zout(2,nout5,j) = r - s
3429 r = s1 + cos4*s25 - cos2*s34
3430 s = sin4*r25 - sin2*r34
3431 zout(2,nout3,j) = r + s
3432 zout(2,nout4,j) = r - s
3487 zout(1,nout1,j) = r1 + r25 + r34
3488 r = r1 + cos2*r25 + cos4*r34
3489 s = sin2*s25 + sin4*s34
3490 zout(1,nout2,j) = r - s
3491 zout(1,nout5,j) = r + s
3492 r = r1 + cos4*r25 + cos2*r34
3493 s = sin4*s25 - sin2*s34
3494 zout(1,nout3,j) = r - s
3495 zout(1,nout4,j) = r + s
3500 zout(2,nout1,j) = s1 + s25 + s34
3501 r = s1 + cos2*s25 + cos4*s34
3502 s = sin2*r25 + sin4*r34
3503 zout(2,nout2,j) = r + s
3504 zout(2,nout5,j) = r - s
3505 r = s1 + cos4*s25 + cos2*s34
3506 s = sin4*r25 - sin2*r34
3507 zout(2,nout3,j) = r + s
3508 zout(2,nout4,j) = r - s
3513 else if (now == 6)
then
3515 bb=isign*0.8660254037844387_real64
3572 zout(1,nout1,j)=ur1+vr1
3573 zout(2,nout1,j)=ui1+vi1
3574 zout(1,nout5,j)=ur2+vr2
3575 zout(2,nout5,j)=ui2+vi2
3576 zout(1,nout3,j)=ur3+vr3
3577 zout(2,nout3,j)=ui3+vi3
3578 zout(1,nout4,j)=ur1-vr1
3579 zout(2,nout4,j)=ui1-vi1
3580 zout(1,nout2,j)=ur2-vr2
3581 zout(2,nout2,j)=ui2-vi2
3582 zout(1,nout6,j)=ur3-vr3
3583 zout(2,nout6,j)=ui3-vi3
3646 subroutine convolxc_off(n1,n2,n3,nd1,nd2,nd3,md1,md2,md3, &
3647 nproc,iproc,pot,zf,scal,comm)
3648 integer,
intent(in) :: n1,n2,n3,nd1,nd2,nd3,md1,md2,md3,nproc,iproc
3649 real(real64),
intent(in) :: scal
3650 real(real64),
dimension(nd1,nd2,nd3/nproc),
intent(in) :: pot
3651 real(real64),
dimension(md1,md3,md2/nproc),
intent(inout) :: zf
3652 type(mpi_comm),
intent(in) :: comm
3654 integer :: ncache,lzt,lot,ma,mb,nfft,ic1,ic2,ic3,Jp2stb,J2stb,Jp2stf,J2stf
3655 integer :: j2,j3,i1,i3,i,j,inzee
3656#if defined(HAVE_MPI)
3659 real(real64) :: twopion
3661 real(real64),
allocatable :: zt(:,:,:)
3663 real(real64),
allocatable :: zmpi1(:,:,:,:,:)
3664 real(real64),
allocatable :: zmpi2(:,:,:,:)
3666 real(real64),
allocatable :: zw(:,:,:)
3668 real(real64),
allocatable :: cosinarr(:,:)
3669 real(real64) :: btrig1(2,8192)
3670 real(real64) :: ftrig1(2,8192)
3671 integer :: after1(7)
3673 integer :: before1(7)
3674 real(real64) :: btrig2(2,8192)
3675 real(real64) :: ftrig2(2,8192)
3676 integer :: after2(7)
3678 integer :: before2(7)
3679 real(real64) :: btrig3(2,8192)
3680 real(real64) :: ftrig3(2,8192)
3681 integer :: after3(7)
3683 integer :: before3(7)
3688 if (mod(n1,2) /= 0) stop
'Parallel convolution:ERROR:n1'
3689 if (mod(n2,2) /= 0) stop
'Parallel convolution:ERROR:n2'
3690 if (mod(n3,2) /= 0) stop
'Parallel convolution:ERROR:n3'
3691 if (nd1 < n1/2+1) stop
'Parallel convolution:ERROR:nd1'
3692 if (nd2 < n2/2+1) stop
'Parallel convolution:ERROR:nd2'
3693 if (nd3 < n3/2+1) stop
'Parallel convolution:ERROR:nd3'
3694 if (md1 < n1/2) stop
'Parallel convolution:ERROR:md1'
3695 if (md2 < n2/2) stop
'Parallel convolution:ERROR:md2'
3696 if (md3 < n3/2) stop
'Parallel convolution:ERROR:md3'
3697 if (mod(nd3,nproc) /= 0) stop
'Parallel convolution:ERROR:nd3'
3698 if (mod(md2,nproc) /= 0) stop
'Parallel convolution:ERROR:md2'
3702 if (ncache <= max(n1,n2,n3/2)*4) ncache=max(n1,n2,n3/2)*4
3707 if (mod(n2/2,2) == 0) lzt=lzt+1
3708 if (mod(n2/2,4) == 0) lzt=lzt+1
3710 safe_allocate(zw(1:2, 1:ncache/4, 1:2))
3711 safe_allocate(zt(1:2, 1:lzt, 1:n1))
3712 safe_allocate(zmpi2(1:2, 1:n1, 1:md2/nproc, 1:nd3))
3713 safe_allocate(cosinarr(1:2, 1:n3/2))
3716 safe_allocate(zmpi1(1:2, 1:n1, 1:md2/nproc, 1:nd3/nproc, 1:nproc))
3720 call ctrig(n3/2,btrig3,after3,before3,now3,1,ic3)
3721 call ctrig(n1,btrig1,after1,before1,now1,1,ic1)
3722 call ctrig(n2,btrig2,after2,before2,now2,1,ic2)
3724 ftrig1(1,j)= btrig1(1,j)
3725 ftrig1(2,j)=-btrig1(2,j)
3728 ftrig2(1,j)= btrig2(1,j)
3729 ftrig2(2,j)=-btrig2(2,j)
3732 ftrig3(1,j)= btrig3(1,j)
3733 ftrig3(2,j)=-btrig3(2,j)
3737 twopion=8._real64*datan(1.0_8)/real(n3, real64)
3739 cosinarr(1,i3)=dcos(twopion*(i3-1))
3740 cosinarr(2,i3)=-dsin(twopion*(i3-1))
3750 'convolxc_off:ncache has to be enlarged to be able to hold at' // &
3751 'least one 1-d FFT of this size even though this will' // &
3752 'reduce the performance for shorter transform lengths'
3758 if (iproc*(md2/nproc)+j2 <= n2/2)
then
3759 do i1 = 1,(n1/2),lot
3761 mb=min(i1+(lot-1),(n1/2))
3765 call halfill_upcorn(md1,md3,lot,nfft,n3,zf(i1,1,j2),zw(1,1,1))
3771 call fftstp(lot,nfft,n3/2,lot,n3/2,zw(1,1,inzee),zw(1,1,3-inzee), &
3772 btrig3,after3(i),now3(i),before3(i),1)
3780 call scramble_unpack(i1,j2,lot,nfft,n1/2,n3,md2,nproc,nd3,zw(1,1,inzee),zmpi2,cosinarr)
3791#if defined(HAVE_MPI)
3792 call mpi_alltoall(zmpi2(1, 1, 1, 1), n1*(md2/nproc)*(nd3/nproc), &
3793 mpi_double_precision, &
3794 zmpi1(1, 1, 1, 1, 1), n1*(md2/nproc)*(nd3/nproc), &
3795 mpi_double_precision, comm, ierr)
3804 if (iproc*(nd3/nproc)+j3 <= n3/2+1)
then
3814 'convolxc_off:ncache has to be enlarged to be able to hold at' // &
3815 'least one 1-d FFT of this size even though this will' // &
3816 'reduce the performance for shorter transform lengths'
3822 mb=min(j+(lot-1),n2/2)
3827 if (nproc == 1)
then
3828 call mpiswitch_upcorn(j3,nfft,jp2stb,j2stb,lot,n1,md2,nd3,nproc,zmpi2,zw(1,1,1))
3830 call mpiswitch_upcorn(j3,nfft,jp2stb,j2stb,lot,n1,md2,nd3,nproc,zmpi1,zw(1,1,1))
3838 call fftstp(lot,nfft,n1,lot,n1,zw(1,1,inzee),zw(1,1,3-inzee), &
3839 btrig1,after1(i),now1(i),before1(i),1)
3845 call fftstp(lot,nfft,n1,lzt,n1,zw(1,1,inzee),zt(1,j,1), &
3846 btrig1,after1(i),now1(i),before1(i),1)
3854 'convolxc_off:ncache has to be enlarged to be able to hold at' // &
3855 'least one 1-d FFT of this size even though this will' // &
3856 'reduce the performance for shorter transform lengths'
3862 mb=min(j+(lot-1),n1)
3867 call switch_upcorn(nfft,n2,lot,n1,lzt,zt(1,1,j),zw(1,1,1))
3874 call fftstp(lot,nfft,n2,lot,n2,zw(1,1,inzee),zw(1,1,3-inzee), &
3875 btrig2,after2(i),now2(i),before2(i),1)
3881 call multkernel(nd1,nd2,n1,n2,lot,nfft,j,pot(1,1,j3),zw(1,1,inzee))
3888 call fftstp(lot,nfft,n2,lot,n2,zw(1,1,inzee),zw(1,1,3-inzee), &
3889 ftrig2,after2(i),now2(i),before2(i),-1)
3895 call unswitch_downcorn(nfft,n2,lot,n1,lzt,zw(1,1,inzee),zt(1,1,j))
3904 mb=min(j+(lot-1),n2/2)
3909 call fftstp(lzt,nfft,n1,lot,n1,zt(1,j,1),zw(1,1,1), &
3910 ftrig1,after1(i),now1(i),before1(i),-1)
3914 call fftstp(lot,nfft,n1,lot,n1,zw(1,1,inzee),zw(1,1,3-inzee), &
3915 ftrig1,after1(i),now1(i),before1(i),-1)
3922 if (nproc == 1)
then
3923 call unmpiswitch_downcorn(j3,nfft,jp2stf,j2stf,lot,n1,md2,nd3,nproc,zw(1,1,inzee),zmpi2)
3925 call unmpiswitch_downcorn(j3,nfft,jp2stf,j2stf,lot,n1,md2,nd3,nproc,zw(1,1,inzee),zmpi1)
3938#if defined(HAVE_MPI)
3939 call mpi_alltoall(zmpi1(1, 1, 1, 1, 1), n1*(md2/nproc)*(nd3/nproc), &
3940 mpi_double_precision, &
3941 zmpi2(1, 1, 1, 1), n1*(md2/nproc)*(nd3/nproc), &
3942 mpi_double_precision, comm, ierr)
3953 if (iproc*(md2/nproc)+j2 <= n2/2)
then
3954 do i1 = 1,(n1/2),lot
3956 mb=min(i1+(lot-1),(n1/2))
3961 call unscramble_pack(i1,j2,lot,nfft,n1/2,n3,md2,nproc,nd3,zmpi2,zw(1,1,1),cosinarr)
3968 call fftstp(lot,nfft,n3/2,lot,n3/2,zw(1,1,inzee),zw(1,1,3-inzee), &
3969 ftrig3,after3(i),now3(i),before3(i),-1)
3975 call unfill_downcorn(md1, md3, lot, nfft, n3, zw(1,1,inzee), zf(i1,1,j2), scal)
3981 safe_deallocate_a(zmpi2)
3982 safe_deallocate_a(zw)
3983 safe_deallocate_a(zt)
3984 safe_deallocate_a(cosinarr)
3985 safe_deallocate_a(zmpi1)
4024 subroutine multkernel(nd1,nd2,n1,n2,lot,nfft,jS,pot,zw)
4025 integer,
intent(in) :: nd1,nd2,n1,n2,lot,nfft,js
4026 real(real64),
dimension(nd1,nd2),
intent(in) :: pot
4027 real(real64),
dimension(2,lot,n2),
intent(inout) :: zw
4030 integer :: j,j1,i2,j2
4034 j1=n1/2+1-abs(n1/2+2-js-j)
4035 zw(1,j,1)=zw(1,j,1)*pot(j1,1)
4036 zw(2,j,1)=zw(2,j,1)*pot(j1,1)
4042 j1=n1/2+1-abs(n1/2+2-js-j)
4044 zw(1,j,i2)=zw(1,j,i2)*pot(j1,i2)
4045 zw(2,j,i2)=zw(2,j,i2)*pot(j1,i2)
4046 zw(1,j,j2)=zw(1,j,j2)*pot(j1,i2)
4047 zw(2,j,j2)=zw(2,j,j2)*pot(j1,i2)
4053 j1=n1/2+1-abs(n1/2+2-js-j)
4055 zw(1,j,j2)=zw(1,j,j2)*pot(j1,j2)
4056 zw(2,j,j2)=zw(2,j,j2)*pot(j1,j2)
4063 integer :: lot, n1, n2, lzt, j, nfft, i
4064 real(real64) :: zw(2,lot,n2), zt(2,lzt,n1)
4072 zw(1,j,i)=zt(1,i-n2/2,j)
4073 zw(2,j,i)=zt(2,i-n2/2,j)
4089 subroutine mpiswitch_upcorn(j3,nfft,Jp2stb,J2stb,lot,n1,md2,nd3,nproc,zmpi1,zw)
4090 integer :: n1, nd3, nproc, lot, mfft, jp2, jp2stb, j2
4091 integer :: j2stb, nfft, i1, j3, md2
4092 real(real64) :: zmpi1(2,n1/2,md2/nproc,nd3/nproc,nproc),zw(2,lot,n1)
4098 do jp2 = jp2stb, nproc
4099 do j2 = j2stb, md2/nproc
4101 if (mfft > nfft)
then
4111 zw(1,mfft,i1)=zmpi1(1,i1-n1/2,j2,j3,jp2)
4112 zw(2,mfft,i1)=zmpi1(2,i1-n1/2,j2,j3,jp2)
4123 integer :: lot, n3, md1, md3, i3, i1, nfft
4124 real(real64) :: zw(2,lot,n3/2),zf(md1,md3)
4139 zw(1,i1,i3)=zf(i1,2*i3-1-n3/2)
4140 zw(2,i1,i3)=zf(i1,2*i3-n3/2)
4181 subroutine scramble_unpack(i1,j2,lot,nfft,n1,n3,md2,nproc,nd3,zw,zmpi2,cosinarr)
4182 integer,
intent(in) :: i1,j2,lot,nfft,n1,n3,md2,nproc,nd3
4183 real(real64),
dimension(2,lot,n3/2),
intent(in) :: zw
4184 real(real64),
dimension(2,n3/2),
intent(in) :: cosinarr
4185 real(real64),
dimension(2,n1,md2/nproc,nd3),
intent(out) :: zmpi2
4187 integer :: i3,i,ind1,ind2
4188 real(real64) :: a,b,c,d,cp,sp,feR,feI,foR,foI,fR,fI
4194 zmpi2(1,i1+i,j2,1)=a+b
4195 zmpi2(2,i1+i,j2,1)=0.0_8
4196 zmpi2(1,i1+i,j2,n3/2+1)=a-b
4197 zmpi2(2,i1+i,j2,n3/2+1)=0.0_8
4211 fer = .5_real64*(a+c)
4212 fei = .5_real64*(b-d)
4213 for = .5_real64*(a-c)
4214 foi = .5_real64*(b+d)
4215 fr = fer+cp*foi-sp*for
4216 fi = fei-cp*for-sp*foi
4217 zmpi2(1,i1+i,j2,ind1) = fr
4218 zmpi2(2,i1+i,j2,ind1) = fi
4259 subroutine unscramble_pack(i1,j2,lot,nfft,n1,n3,md2,nproc,nd3,zmpi2,zw,cosinarr)
4260 integer,
intent(in) :: i1,j2,lot,nfft,n1,n3,md2,nproc,nd3
4261 real(real64),
dimension(2,lot,n3/2),
intent(out) :: zw
4262 real(real64),
dimension(2,n3/2),
intent(in) :: cosinarr
4263 real(real64),
dimension(2,n1,md2/nproc,nd3),
intent(in) :: zmpi2
4265 integer :: i3,i,indA,indB
4266 real(real64) :: a,b,c,d,cp,sp,re,ie,ro,io,rh,ih
4274 a=zmpi2(1,i1+i,j2,inda)
4275 b=zmpi2(2,i1+i,j2,inda)
4276 c= zmpi2(1,i1+i,j2,indb)
4277 d=-zmpi2(2,i1+i,j2,indb)
4280 ro=(a-c)*cp-(b-d)*sp
4281 io=(a-c)*sp+(b-d)*cp
4294 integer :: lot, n2, lzt, n1, j, nfft, i
4295 real(real64) :: zw(2,lot,n2),zt(2,lzt,n1)
4310 subroutine unmpiswitch_downcorn(j3,nfft,Jp2stf,J2stf,lot,n1,md2,nd3,nproc,zw,zmpi1)
4311 integer :: n1, md2, nproc, nd3, lot, mfft, i1, j3
4312 integer :: jp2, j2, nfft, jp2stf, j2stf
4313 real(real64) :: zmpi1(2,n1/2,md2/nproc,nd3/nproc,nproc),zw(2,lot,n1)
4319 do j2 = j2stf, md2/nproc
4321 if (mfft > nfft)
then
4327 zmpi1(1,i1,j2,j3,jp2)=zw(1,mfft,i1)
4328 zmpi1(2,i1,j2,j3,jp2)=zw(2,mfft,i1)
4374 integer,
intent(in) :: md1,md3,lot,nfft,n3
4375 real(real64),
dimension(2,lot,n3/2),
intent(in) :: zw
4376 real(real64),
dimension(md1,md3),
intent(inout) :: zf
4377 real(real64),
intent(in) :: scal
4380 real(real64) :: pot1
4384 pot1 = scal*zw(1,i1,i3)
4385 zf(i1, 2*i3 - 1) = pot1
4386 pot1 = scal*zw(2, i1, i3)
4433 subroutine kernelfft(n1,n2,n3,nd1,nd2,nd3,nproc,iproc,zf,zr,comm)
4434 integer,
intent(in) :: n1,n2,n3,nd1,nd2,nd3,nproc,iproc
4435 real(real64),
dimension(nd1,n3,nd2/nproc),
intent(in) :: zf
4436 real(real64),
dimension(2,nd1,nd2,nd3/nproc),
intent(out) :: zr
4437 type(mpi_comm),
intent(in) :: comm
4440 integer :: ncache,lzt,lot,ma,mb,nfft,ic1,ic2,ic3,Jp2st,J2st
4441 integer :: j2,j3,i1,i3,i,j,inzee
4442#if defined(HAVE_MPI)
4445 real(real64) :: twopion
4447 real(real64),
dimension(:,:,:),
allocatable :: zt
4449 real(real64),
dimension(:,:,:,:,:),
allocatable :: zmpi1
4450 real(real64),
dimension(:,:,:,:),
allocatable :: zmpi2
4452 real(real64),
dimension(:,:,:),
allocatable :: zw
4454 real(real64),
dimension(:,:),
allocatable :: trig1,trig2,trig3,cosinarr
4455 integer,
dimension(:),
allocatable :: after1,now1,before1, &
4456 after2,now2,before2,after3,now3,before3
4459 if (nd1 < n1) stop
'ERROR:nd1'
4460 if (nd2 < n2) stop
'ERROR:nd2'
4461 if (nd3 < n3/2+1) stop
'ERROR:nd3'
4462 if (mod(nd3,nproc) /= 0) stop
'ERROR:nd3'
4463 if (mod(nd2,nproc) /= 0) stop
'ERROR:nd2'
4467 if (ncache <= max(n1,n2,n3/2)*4) ncache=max(n1,n2,n3/2)*4
4469 if (mod(n2,2) == 0) lzt=lzt+1
4470 if (mod(n2,4) == 0) lzt=lzt+1
4473 safe_allocate(trig1(1:2,1:8192))
4474 safe_allocate(after1(1:7))
4475 safe_allocate(now1(1:7))
4476 safe_allocate(before1(1:7))
4477 safe_allocate(trig2(1:2,1:8192))
4478 safe_allocate(after2(1:7))
4479 safe_allocate(now2(1:7))
4480 safe_allocate(before2(1:7))
4481 safe_allocate(trig3(1:2,1:8192))
4482 safe_allocate(after3(1:7))
4483 safe_allocate(now3(1:7))
4484 safe_allocate(before3(1:7))
4485 safe_allocate(zw(1:2,1:ncache/4,1:2))
4486 safe_allocate(zt(1:2,1:lzt,1:n1))
4487 safe_allocate(zmpi2(1:2,1:n1,1:nd2/nproc,1:nd3))
4488 safe_allocate(cosinarr(1:2,1:n3/2))
4490 safe_allocate(zmpi1(1:2,1:n1,1:nd2/nproc,1:nd3/nproc,1:nproc))
4494 call ctrig(n3/2,trig3,after3,before3,now3,1,ic3)
4495 call ctrig(n1,trig1,after1,before1,now1,1,ic1)
4496 call ctrig(n2,trig2,after2,before2,now2,1,ic2)
4499 twopion=8._real64*datan(1.0_8)/real(n3, real64)
4501 cosinarr(1,i3)=dcos(twopion*(i3-1))
4502 cosinarr(2,i3)=-dsin(twopion*(i3-1))
4508 if (lot < 1) stop
'kernelfft:enlarge ncache for z'
4515 mb=min(i1+(lot-1),n1)
4520 call inserthalf(nd1,lot,nfft,n3,zf(i1,1,j2),zw(1,1,1))
4525 call fftstp(lot,nfft,n3/2,lot,n3/2,zw(1,1,inzee),zw(1,1,3-inzee), &
4526 trig3,after3(i),now3(i),before3(i),1)
4534 call scramble_unpack(i1,j2,lot,nfft,n1,n3,nd2,nproc,nd3,zw(1,1,inzee),zmpi2,cosinarr)
4544#if defined(HAVE_MPI)
4545 call mpi_alltoall(zmpi2(:, 1, 1, 1),2*n1*(nd2/nproc)*(nd3/nproc), &
4546 mpi_double_precision, &
4547 zmpi1(:, 1, 1, 1, 1),2*n1*(nd2/nproc)*(nd3/nproc), &
4548 mpi_double_precision,comm,ierr)
4554 do j3 = 1, nd3/nproc
4556 if (iproc*(nd3/nproc)+j3 <= n3/2+1)
then
4562 if (lot < 1) stop
'kernelfft:enlarge ncache for x'
4566 mb = min(j+(lot-1),n2)
4571 if (nproc == 1)
then
4572 call mpiswitch(j3,nfft,jp2st,j2st,lot,n1,nd2,nd3,nproc,zmpi2,zw(1,1,1))
4574 call mpiswitch(j3,nfft,jp2st,j2st,lot,n1,nd2,nd3,nproc,zmpi1,zw(1,1,1))
4582 call fftstp(lot,nfft,n1,lot,n1,zw(1,1,inzee),zw(1,1,3-inzee), &
4583 trig1,after1(i),now1(i),before1(i),1)
4588 call fftstp(lot,nfft,n1,lzt,n1,zw(1,1,inzee),zt(1,j,1), &
4589 trig1,after1(i),now1(i),before1(i),1)
4595 if (lot < 1) stop
'kernelfft:enlarge ncache for y'
4599 mb = min(j+(lot-1), n1)
4604 call switch(nfft,n2,lot,n1,lzt,zt(1,1,j),zw(1,1,1))
4611 call fftstp(lot,nfft,n2,lot,n2,zw(1,1,inzee),zw(1,1,3-inzee), &
4612 trig2,after2(i),now2(i),before2(i),1)
4617 call fftstp(lot,nfft,n2,nd1,nd2,zw(1,1,inzee),zr(1,j,1,j3), &
4618 trig2,after2(i),now2(i),before2(i),1)
4626 safe_deallocate_a(trig1)
4627 safe_deallocate_a(after1)
4628 safe_deallocate_a(now1)
4629 safe_deallocate_a(before1)
4630 safe_deallocate_a(trig2)
4631 safe_deallocate_a(after2)
4632 safe_deallocate_a(now2)
4633 safe_deallocate_a(before2)
4634 safe_deallocate_a(trig3)
4635 safe_deallocate_a(after3)
4636 safe_deallocate_a(now3)
4637 safe_deallocate_a(before3)
4638 safe_deallocate_a(zmpi2)
4639 safe_deallocate_a(zw)
4640 safe_deallocate_a(zt)
4641 safe_deallocate_a(cosinarr)
4643 safe_deallocate_a(zmpi1)
4649 subroutine switch(nfft,n2,lot,n1,lzt,zt,zw)
4650 integer :: lot, n2, lzt, n1, j, nfft, i
4651 real(real64) :: zw(1:2, 1:lot, 1:n2), zt(1:2, 1:lzt, 1:n1)
4655 zw(1,j,i) = zt(1,i,j)
4656 zw(2,j,i) = zt(2,i,j)
4663 subroutine mpiswitch(j3,nfft,Jp2st,J2st,lot,n1,nd2,nd3,nproc,zmpi1,zw)
4664 integer :: n1, nd2, nproc, nd3, lot, mfft, jp2, jp2st
4665 integer :: j2st, nfft, i1, j3, j2
4666 real(real64) :: zmpi1(2,n1,nd2/nproc,nd3/nproc,nproc),zw(2,lot,n1)
4669 do jp2 = jp2st, nproc
4670 do j2 = j2st, nd2/nproc
4672 if (mfft > nfft)
then
4678 zw(1,mfft,i1) = zmpi1(1, i1, j2, j3, jp2)
4679 zw(2,mfft,i1) = zmpi1(2, i1, j2, j3, jp2)
4689 integer :: lot, n3, nd1, i3, i1, nfft
4690 real(real64) :: zw(1:2, 1:lot, 1:n3/2), zf(1:nd1, 1:n3)
4694 zw(1, i1, i3) = zf(i1, 2*i3 - 1)
4695 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()