TABLE OF CONTENTS
- ABINIT/m_FFTHyb
- ABINIT/m_FFTHyb/FFTHyb_destroy
- ABINIT/m_FFTHyb/FFTHyb_getData
- ABINIT/m_FFTHyb/FFTHyb_init
- ABINIT/m_FFTHyb/FFTHyb_mirror
- ABINIT/m_FFTHyb/FFTHyb_run
- ABINIT/m_FFTHyb/FFTHyb_setData
- m_FFTHyb/FFTHyb
ABINIT/m_FFTHyb [ Modules ]
NAME
m_FFTHyb
FUNCTION
Almost useless. Just uses for FFT time evolution of number of electrons
COPYRIGHT
Copyright (C) 2013-2024 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
SOURCE
23 #define FFTHyb_FORWARD 1 24 #define FFTHyb_BACKWARD -1 25 #include "defs.h" 26 MODULE m_FFTHyb 27 USE m_global 28 29 IMPLICIT NONE
ABINIT/m_FFTHyb/FFTHyb_destroy [ Functions ]
NAME
FFTHyb_destroy
FUNCTION
destroy every thing
COPYRIGHT
Copyright (C) 2013-2024 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
SOURCE
398 SUBROUTINE FFTHyb_destroy(this) 399 400 !Arguments ------------------------------------ 401 TYPE(FFTHyb), INTENT(INOUT) :: this 402 403 FREEIF(this%bit_rev) 404 FREEIF(this%data_inout) 405 this%set = .FALSE. 406 END SUBROUTINE FFTHyb_destroy
ABINIT/m_FFTHyb/FFTHyb_getData [ Functions ]
NAME
FFTHyb_getData
FUNCTION
get result
COPYRIGHT
Copyright (C) 2013-2024 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
SOURCE
340 SUBROUTINE FFTHyb_getData(this, bound, array_out, freqs) 341 342 !Arguments ------------------------------------ 343 TYPE(FFTHyb), INTENT(IN) :: this 344 INTEGER , INTENT(OUT) :: bound 345 DOUBLE PRECISION, DIMENSION(:), INTENT(OUT) :: array_out 346 DOUBLE PRECISION, DIMENSION(:), OPTIONAL, INTENT(OUT) :: freqs 347 !Local variables ------------------------------ 348 INTEGER :: i 349 INTEGER :: size_out 350 DOUBLE PRECISION :: re 351 DOUBLE PRECISION :: im 352 353 size_out = SIZE(array_out) 354 ! IF ( SIZE(array_out) .NE. this%size/2 ) & 355 ! CALL WARNALL("FFTHyb_getData : size_in != size") 356 array_out = 0.d0 357 bound = MIN(this%size/2, size_out) 358 DO i=1, bound 359 re = REAL(this%data_inout(this%bit_rev(i-1))) 360 im = AIMAG(this%data_inout(this%bit_rev(i-1))) 361 array_out(i) = SQRT(re*re + im*im) 362 END DO 363 IF ( PRESENT( freqs ) .AND. bound .LE. SIZE(freqs)) THEN 364 DO i=1, bound 365 freqs(i) = DBLE(i-1)/this%Ts 366 END DO 367 ! ELSE IF ( PRESENT( freqs ) .AND. bound .GT. SIZE(freqs) ) THEN 368 ! CALL WARNALL("FFHyb_getData : freqs does is too small") 369 END IF 370 371 END SUBROUTINE FFTHyb_getData
ABINIT/m_FFTHyb/FFTHyb_init [ Functions ]
NAME
FFTHyb_init
FUNCTION
Initialize ...
COPYRIGHT
Copyright (C) 2013-2024 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
SOURCE
97 SUBROUTINE FFTHyb_init(this,n,samples_sec) 98 99 !Arguments ------------------------------------ 100 TYPE(FFTHyb), INTENT(INOUT) :: this 101 INTEGER , INTENT(IN ) :: n 102 DOUBLE PRECISION, INTENT(IN ) :: samples_sec 103 !Local variables ------------------------------ 104 INTEGER :: i 105 INTEGER :: inv_bit 106 INTEGER :: total_size 107 108 ! Check n is a power of 2 109 IF ( n .LT. 2 .OR. IAND(n,n-1) .NE. 0 ) THEN 110 CALL WARNALL("FFTHyb_init : array size is not a power of 2 -> auto fix") 111 i = 1 112 DO WHILE ( i .LT. n ) 113 i = ISHFT( i, 1 ) 114 END DO 115 total_size = ISHFT(i, -1) 116 ELSE 117 total_size = n 118 END IF 119 120 this%size = total_size 121 this%Ts = DBLE(total_size) / samples_sec 122 this%fs = 1.d0 / DBLE(total_size) 123 124 FREEIF(this%data_inout) 125 MALLOC(this%data_inout,(0:total_size-1)) 126 this%data_inout(0:total_size-1) = CMPLX(0.d0,0.d0,8) 127 FREEIF(this%bit_rev) 128 MALLOC(this%bit_rev,(0:total_size-1)) 129 this%bit_rev = 0 130 131 DO i = 1, total_size-1 132 inv_bit = FFTHyb_mirror(i,total_size) 133 this%bit_rev(inv_bit) = i 134 END DO 135 136 this%set = .TRUE. 137 138 END SUBROUTINE FFTHyb_init
ABINIT/m_FFTHyb/FFTHyb_mirror [ Functions ]
NAME
FFTHyb_mirror
FUNCTION
mirror bits of an integer
COPYRIGHT
Copyright (C) 2013-2024 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
SOURCE
166 INTEGER FUNCTION FFTHyb_mirror(i,n) 167 168 !Arguments ------------------------------------ 169 INTEGER, INTENT(IN ) :: i 170 INTEGER, INTENT(IN ) :: n 171 !Local variable ------------------------------- 172 INTEGER :: icp 173 INTEGER :: ncp 174 175 icp = i 176 ncp = n 177 178 FFTHyb_mirror = 0 179 180 DO WHILE( ncp .GT. 1 ) 181 FFTHyb_mirror = IOR(ISHFT(FFTHyb_mirror,1) , IAND(icp,1)) 182 icp = ISHFT(icp,-1) 183 ncp = ISHFT(ncp,-1) 184 END DO 185 186 END FUNCTION FFTHyb_mirror
ABINIT/m_FFTHyb/FFTHyb_run [ Functions ]
NAME
FFTHyb_run
FUNCTION
perform FFT
COPYRIGHT
Copyright (C) 2013-2024 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
SOURCE
258 SUBROUTINE FFTHyb_run(this, dir) 259 260 !Arguments ------------------------------------ 261 TYPE(FFTHyb), INTENT(INOUT) :: this 262 INTEGER , INTENT(IN ) :: dir 263 !Local variables ------------------------------ 264 INTEGER :: imax 265 INTEGER :: istep 266 INTEGER :: i 267 INTEGER :: m 268 INTEGER :: j 269 DOUBLE PRECISION :: wtmp 270 DOUBLE PRECISION :: wr 271 DOUBLE PRECISION :: wpr 272 DOUBLE PRECISION :: wpi 273 DOUBLE PRECISION :: wi 274 DOUBLE PRECISION :: theta 275 DOUBLE PRECISION :: twoPi 276 COMPLEX(KIND=8) :: tc 277 278 imax = 1; 279 istep = 2; 280 281 twoPi = DBLE(dir)*2.d0*ACOS(-1.d0) 282 283 DO WHILE ( imax .LT. this%size ) 284 istep = ISHFT(imax,1) 285 theta = twoPi/DBLE(istep) 286 Wtmp = SIN(0.5d0*theta) 287 wpr = -2.d0*wtmp*wtmp 288 wpi = SIN(theta) 289 wr = 1.0d0 290 wi = 0.d0 291 DO m = 0, imax-1 292 DO i = m, this%size-1, istep 293 j= i+imax 294 tc = CMPLX( wr* REAL (this%data_inout(this%bit_rev(j))) & 295 -wi* AIMAG(this%data_inout(this%bit_rev(j))), & 296 wr* AIMAG(this%data_inout(this%bit_rev(j))) & 297 +wi* REAL (this%data_inout(this%bit_rev(j))), 8 ) 298 this%data_inout(this%bit_rev(j)) = this%data_inout(this%bit_rev(i)) - tc 299 this%data_inout(this%bit_rev(i)) = this%data_inout(this%bit_rev(i)) + tc 300 END DO 301 wtmp = wr 302 wr = wr*wpr - wi*wpi +wr 303 wi = wi*wpr + wtmp*wpi+wi 304 END DO 305 imax = istep 306 END DO 307 IF ( dir .EQ. FFTHyb_FORWARD ) & 308 this%data_inout = this%data_inout*this%fs 309 310 END SUBROUTINE FFTHyb_run
ABINIT/m_FFTHyb/FFTHyb_setData [ Functions ]
NAME
FFTHyb_setData
FUNCTION
set input data (in time)
COPYRIGHT
Copyright (C) 2013-2024 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
SOURCE
214 SUBROUTINE FFTHyb_setData(this, array_in) 215 !Arguments ------------------------------------ 216 TYPE(FFTHyb), INTENT(INOUT) :: this 217 DOUBLE PRECISION, DIMENSION(:), INTENT(IN) :: array_in 218 INTEGER :: size_in 219 INTEGER :: i 220 221 size_in = SIZE(array_in) 222 this%data_inout = CMPLX(0.d0,0.d0,KIND=4) 223 ! IF ( size_in .NE. this%size ) & 224 ! CALL WARNALL("FFTHyb_setData : size_in != size") 225 226 DO i = 0, MIN(this%size,size_in)-1 227 this%data_inout(i) = CMPLX(array_in(i+1), 0.d0,8) 228 END DO 229 230 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-2024 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
50 TYPE, PUBLIC :: FFTHyb 51 LOGICAL _PRIVATE :: set = .FALSE. 52 INTEGER :: size 53 DOUBLE PRECISION _PRIVATE :: Ts 54 DOUBLE PRECISION _PRIVATE :: fs 55 INTEGER , ALLOCATABLE, DIMENSION(:) _PRIVATE :: bit_rev 56 COMPLEX(KIND=8) , ALLOCATABLE, DIMENSION(:) _PRIVATE :: data_inout 57 END TYPE FFTHyb