TABLE OF CONTENTS


ABINIT/m_FFTHyb [ Modules ]

[ Top ] [ Modules ]

NAME

  m_FFTHyb

FUNCTION

  Almost useless. Just uses for FFT time evolution
  of number of electrons

COPYRIGHT

  Copyright (C) 2013-2018 ABINIT group (J. Bieder)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

29 #define FFTHyb_FORWARD   1
30 #define FFTHyb_BACKWARD -1
31 #include "defs.h"
32 MODULE m_FFTHyb
33 USE m_global
34 
35 IMPLICIT NONE

ABINIT/m_FFTHyb/FFTHyb_destroy [ Functions ]

[ Top ] [ Functions ]

NAME

  FFTHyb_destroy

FUNCTION

  destroy every thing

COPYRIGHT

  Copyright (C) 2013-2018 ABINIT group (J. Bieder)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

INPUTS

  this=FFT

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

475 SUBROUTINE FFTHyb_destroy(this)
476 
477 !Arguments ------------------------------------
478 
479 !This section has been created automatically by the script Abilint (TD).
480 !Do not modify the following lines by hand.
481 #undef ABI_FUNC
482 #define ABI_FUNC 'FFTHyb_destroy'
483 !End of the abilint section
484 
485   TYPE(FFTHyb), INTENT(INOUT) :: this
486 
487   FREEIF(this%bit_rev)
488   FREEIF(this%data_inout)
489   this%set = .FALSE.
490 END SUBROUTINE FFTHyb_destroy

ABINIT/m_FFTHyb/FFTHyb_getData [ Functions ]

[ Top ] [ Functions ]

NAME

  FFTHyb_getData

FUNCTION

  get result

COPYRIGHT

  Copyright (C) 2013-2018 ABINIT group (J. Bieder)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

INPUTS

  this=FFT

OUTPUT

  bound=number of frequencies
  array_out=output data
  freqs=output frequencies

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

404 SUBROUTINE FFTHyb_getData(this, bound, array_out, freqs)
405 
406 !Arguments ------------------------------------
407 
408 !This section has been created automatically by the script Abilint (TD).
409 !Do not modify the following lines by hand.
410 #undef ABI_FUNC
411 #define ABI_FUNC 'FFTHyb_getData'
412 !End of the abilint section
413 
414   TYPE(FFTHyb), INTENT(IN) :: this
415   INTEGER         ,               INTENT(OUT) :: bound
416   DOUBLE PRECISION, DIMENSION(:), INTENT(OUT) :: array_out
417   DOUBLE PRECISION, DIMENSION(:), OPTIONAL, INTENT(OUT) :: freqs
418 !Local variables ------------------------------
419   INTEGER :: i
420   INTEGER :: size_out
421   DOUBLE PRECISION :: re
422   DOUBLE PRECISION :: im
423 
424   size_out = SIZE(array_out)
425 !  IF ( SIZE(array_out) .NE. this%size/2 ) &
426 !    CALL WARNALL("FFTHyb_getData : size_in != size")
427   array_out = 0.d0
428   bound = MIN(this%size/2, size_out)
429   DO i=1, bound
430     re = REAL(this%data_inout(this%bit_rev(i-1)))
431     im = AIMAG(this%data_inout(this%bit_rev(i-1)))
432     array_out(i) = SQRT(re*re + im*im)
433   END DO
434   IF ( PRESENT( freqs ) .AND. bound .LE. SIZE(freqs)) THEN
435     DO i=1, bound
436         freqs(i) = DBLE(i-1)/this%Ts 
437     END DO
438 !  ELSE IF ( PRESENT( freqs ) .AND. bound .GT. SIZE(freqs) ) THEN
439 !    CALL WARNALL("FFHyb_getData : freqs does is too small")
440   END IF
441   
442 END SUBROUTINE FFTHyb_getData

ABINIT/m_FFTHyb/FFTHyb_init [ Functions ]

[ Top ] [ Functions ]

NAME

  FFTHyb_init

FUNCTION

  Initialize ...

COPYRIGHT

  Copyright (C) 2013-2018 ABINIT group (J. Bieder)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

INPUTS

  this=FFT
  n=Number of point (should be power of 2)
  samples_sec=number of samples per sec

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

109 SUBROUTINE FFTHyb_init(this,n,samples_sec)
110 
111 !Arguments ------------------------------------
112 
113 !This section has been created automatically by the script Abilint (TD).
114 !Do not modify the following lines by hand.
115 #undef ABI_FUNC
116 #define ABI_FUNC 'FFTHyb_init'
117 !End of the abilint section
118 
119   TYPE(FFTHyb), INTENT(INOUT) :: this
120   INTEGER     , INTENT(IN   ) :: n
121   DOUBLE PRECISION, INTENT(IN   ) :: samples_sec
122 !Local variables ------------------------------
123   INTEGER :: i
124   INTEGER :: inv_bit
125   INTEGER :: total_size
126 
127   ! Check n is a power of 2
128   IF ( n .LT. 2 .OR. IAND(n,n-1) .NE. 0 ) THEN
129     CALL WARNALL("FFTHyb_init : array size is not a power of 2 -> auto fix")
130     i = 1
131     DO WHILE ( i .LT. n )
132       i = ISHFT( i, 1 )
133     END DO
134     total_size = ISHFT(i, -1)
135   ELSE
136     total_size = n
137   END IF
138   
139   this%size = total_size
140   this%Ts = DBLE(total_size) / samples_sec
141   this%fs = 1.d0 / DBLE(total_size)
142 
143   FREEIF(this%data_inout)
144   MALLOC(this%data_inout,(0:total_size-1))
145   this%data_inout(0:total_size-1) = CMPLX(0.d0,0.d0,8)
146   FREEIF(this%bit_rev)
147   MALLOC(this%bit_rev,(0:total_size-1))
148   this%bit_rev = 0
149 
150   DO i = 1, total_size-1
151     inv_bit = FFTHyb_mirror(i,total_size)
152     this%bit_rev(inv_bit) = i 
153   END DO
154 
155   this%set = .TRUE.
156 
157 END SUBROUTINE FFTHyb_init

ABINIT/m_FFTHyb/FFTHyb_mirror [ Functions ]

[ Top ] [ Functions ]

NAME

  FFTHyb_mirror

FUNCTION

  mirror bits of an integer

COPYRIGHT

  Copyright (C) 2013-2018 ABINIT group (J. Bieder)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

INPUTS

  i=bits
  n=integer

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

191 INTEGER FUNCTION FFTHyb_mirror(i,n)
192 
193 !Arguments ------------------------------------
194 
195 !This section has been created automatically by the script Abilint (TD).
196 !Do not modify the following lines by hand.
197 #undef ABI_FUNC
198 #define ABI_FUNC 'FFTHyb_mirror'
199 !End of the abilint section
200 
201   INTEGER, INTENT(IN ) :: i
202   INTEGER, INTENT(IN ) :: n
203 !Local variable -------------------------------
204   INTEGER              :: icp
205   INTEGER              :: ncp
206 
207   icp = i
208   ncp = n
209 
210   FFTHyb_mirror = 0
211 
212   DO WHILE( ncp .GT. 1 )
213     FFTHyb_mirror = IOR(ISHFT(FFTHyb_mirror,1) , IAND(icp,1))
214     icp = ISHFT(icp,-1)
215     ncp = ISHFT(ncp,-1)
216   END DO
217 
218 END FUNCTION FFTHyb_mirror

ABINIT/m_FFTHyb/FFTHyb_run [ Functions ]

[ Top ] [ Functions ]

NAME

  FFTHyb_run

FUNCTION

  perform FFT

COPYRIGHT

  Copyright (C) 2013-2018 ABINIT group (J. Bieder)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

INPUTS

  this=FFT
  dir=direction FFTHyb_FORWARD or FFTHyb_BACKWARD

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

309 SUBROUTINE FFTHyb_run(this, dir)
310 
311 !Arguments ------------------------------------
312 
313 !This section has been created automatically by the script Abilint (TD).
314 !Do not modify the following lines by hand.
315 #undef ABI_FUNC
316 #define ABI_FUNC 'FFTHyb_run'
317 !End of the abilint section
318 
319   TYPE(FFTHyb), INTENT(INOUT) :: this
320   INTEGER     , INTENT(IN   ) :: dir
321 !Local variables ------------------------------
322   INTEGER :: imax
323   INTEGER :: istep
324   INTEGER :: i
325   INTEGER :: m
326   INTEGER :: j
327   DOUBLE PRECISION :: wtmp
328   DOUBLE PRECISION :: wr
329   DOUBLE PRECISION :: wpr
330   DOUBLE PRECISION :: wpi
331   DOUBLE PRECISION :: wi
332   DOUBLE PRECISION :: theta
333   DOUBLE PRECISION :: twoPi
334   COMPLEX(KIND=8) :: tc
335  
336   imax = 1;
337   istep = 2;
338   
339   twoPi = DBLE(dir)*2.d0*ACOS(-1.d0)
340  
341   DO WHILE ( imax .LT. this%size )
342     istep = ISHFT(imax,1)
343     theta = twoPi/DBLE(istep)
344     Wtmp  = SIN(0.5d0*theta)
345     wpr   = -2.d0*wtmp*wtmp
346     wpi   = SIN(theta)
347     wr    = 1.0d0
348     wi    = 0.d0
349     DO m = 0, imax-1
350       DO i = m, this%size-1, istep
351         j= i+imax
352         tc = CMPLX( wr* REAL (this%data_inout(this%bit_rev(j)))  &
353                    -wi* AIMAG(this%data_inout(this%bit_rev(j))), &
354                     wr* AIMAG(this%data_inout(this%bit_rev(j)))  &
355                    +wi* REAL (this%data_inout(this%bit_rev(j))), 8 )
356         this%data_inout(this%bit_rev(j)) = this%data_inout(this%bit_rev(i)) - tc
357         this%data_inout(this%bit_rev(i)) = this%data_inout(this%bit_rev(i)) + tc
358       END DO
359       wtmp = wr
360       wr   = wr*wpr - wi*wpi  +wr
361       wi   = wi*wpr + wtmp*wpi+wi
362     END DO
363     imax = istep
364   END DO
365   IF ( dir .EQ. FFTHyb_FORWARD ) &
366     this%data_inout = this%data_inout*this%fs
367 
368 END SUBROUTINE FFTHyb_run

ABINIT/m_FFTHyb/FFTHyb_setData [ Functions ]

[ Top ] [ Functions ]

NAME

  FFTHyb_setData

FUNCTION

  set input data (in time)

COPYRIGHT

  Copyright (C) 2013-2018 ABINIT group (J. Bieder)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

INPUTS

  this=FFThyb
  array_in=data in

OUTPUT

SIDE EFFECTS

NOTES

PARENTS

  Will be filled automatically by the parent script

CHILDREN

  Will be filled automatically by the parent script

SOURCE

252 SUBROUTINE FFTHyb_setData(this, array_in)
253 !Arguments ------------------------------------
254 
255 !This section has been created automatically by the script Abilint (TD).
256 !Do not modify the following lines by hand.
257 #undef ABI_FUNC
258 #define ABI_FUNC 'FFTHyb_setData'
259 !End of the abilint section
260 
261   TYPE(FFTHyb), INTENT(INOUT) :: this
262   DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: array_in
263   INTEGER :: size_in
264   INTEGER :: i
265 
266   size_in = SIZE(array_in)
267   this%data_inout = CMPLX(0.d0,0.d0,KIND=4)
268 !  IF ( size_in .NE. this%size ) &
269 !    CALL WARNALL("FFTHyb_setData : size_in != size")
270   
271   DO i = 0, MIN(this%size,size_in)-1
272     this%data_inout(i) = CMPLX(array_in(i+1), 0.d0,8)
273   END DO
274 
275 END SUBROUTINE FFTHyb_setData

m_FFTHyb/FFTHyb [ Types ]

[ Top ] [ m_FFTHyb ] [ Types ]

NAME

  FFTHyb

FUNCTION

  This structured datatype contains the necessary data

COPYRIGHT

  Copyright (C) 2013-2018 ABINIT group (J. Bieder)
  This file is distributed under the terms of the
  GNU General Public License, see ~abinit/COPYING
  or http://www.gnu.org/copyleft/gpl.txt .

SOURCE

56 TYPE, PUBLIC :: FFTHyb
57   LOGICAL _PRIVATE :: set = .FALSE.
58   INTEGER          :: size
59   DOUBLE PRECISION _PRIVATE :: Ts
60   DOUBLE PRECISION _PRIVATE :: fs
61   INTEGER         , ALLOCATABLE, DIMENSION(:) _PRIVATE :: bit_rev   
62   COMPLEX(KIND=8) , ALLOCATABLE, DIMENSION(:) _PRIVATE :: data_inout
63 END TYPE FFTHyb