Skip to content

Commit

Permalink
Test calculation of E Hartree in G-space, update build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
f-fathurrahman committed Jun 18, 2018
1 parent ecb6a27 commit c75db75
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/poisson/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

INC="-I../../"
LIB="../../libmain.a -lblas -llapack -lfftw3"
INC="-I../../src"
LIB="../../src/libmain.a -lblas -llapack -lfftw3"

bas=`basename $1 .f90`

Expand Down
16 changes: 16 additions & 0 deletions tests/poisson/t_poisson.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ PROGRAM t_poisson
INTEGER :: N_in
CHARACTER(56) :: chars_arg
INTEGER :: iargc
!
COMPLEX(8), ALLOCATABLE :: rhoG(:), phiG(:)
REAL(8) :: UnumG

IF( iargc() /= 1 ) THEN
WRITE(*,*) 'Exactly one argument must be given:', iargc()
Expand Down Expand Up @@ -66,6 +69,19 @@ PROGRAM t_poisson
WRITE(*,'(1x,A,F18.10)') 'Uana = ', Uana
WRITE(*,'(1x,A,E18.10)') 'diff = ', abs(Unum-Uana)

ALLOCATE( rhoG(Npoints), phiG(Npoints) )
DO ip = 1,Npoints
rhoG(ip) = cmplx( rho(ip), 0.d0, kind=8 )
phiG(ip) = cmplx( phi(ip), 0.d0, kind=8 )
ENDDO
CALL fft_fftw3( rhoG, NN(1), NN(2), NN(3), .false. )
CALL fft_fftw3( phiG, NN(1), NN(2), NN(3), .false. )

Unumg = real( sum( rhoG(:)*conjg(phiG(:)) ) )*0.5d0*dVol*Npoints
WRITE(*,*)
WRITE(*,*) 'In G space = ', Unumg
WRITE(*,*) 'Diff = ', abs(Unumg-Uana)

DEALLOCATE( rho, phi )

CALL dealloc_ilu0_prec()
Expand Down

0 comments on commit c75db75

Please sign in to comment.