Skip to content

Commit

Permalink
Removing global variables EPS_EX
Browse files Browse the repository at this point in the history
  • Loading branch information
f-fathurrahman committed Dec 11, 2017
1 parent 4eece98 commit b8f9789
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 40 deletions.
2 changes: 1 addition & 1 deletion create_targz.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/sh
filname="ffr-LFDFT-0.2.0.tar.gz"
rm -v ../$filname
tar cvzf ../$filname src/ works/ HGH/ platform/ tests/
tar cvzf ../$filname src/ works/ pseudopotentials/ platform/ tests/
3 changes: 0 additions & 3 deletions src/alloc_hamiltonian.f90
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ SUBROUTINE alloc_hamiltonian()
USE m_PsPot, ONLY : NbetaNL
USE m_atoms, ONLY : Natoms
USE m_states, ONLY : Nstates
USE m_xc, ONLY : EPS_XC
IMPLICIT NONE

ALLOCATE( V_ps_loc( Npoints ) )
Expand All @@ -31,7 +30,5 @@ SUBROUTINE alloc_hamiltonian()

Rhoe(:) = 0.d0

ALLOCATE( EPS_XC(Npoints) )

END SUBROUTINE

9 changes: 7 additions & 2 deletions src/calc_Exc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ SUBROUTINE calc_Exc()
USE m_xc
USE xc_f90_types_m
USE xc_f90_lib_m
USE m_options, ONLY : USE_ARIAS_VWN
IMPLICIT NONE
REAL(8), ALLOCATABLE :: gRhoe(:,:), gRhoe2(:)
REAL(8), ALLOCATABLE :: eps_x(:), eps_c(:)
REAL(8), ALLOCATABLE :: EPS_XC(:)
TYPE(xc_f90_pointer_t) :: xc_func
TYPE(xc_f90_pointer_t) :: xc_info
INTEGER :: ip
Expand All @@ -17,6 +17,7 @@ SUBROUTINE calc_Exc()
IF( XC_NAME == 'VWN' ) THEN

IF( USE_ARIAS_VWN ) THEN
ALLOCATE( EPS_XC(Npoints) )
CALL excVWN( Npoints, Rhoe, EPS_XC )
ELSE

Expand All @@ -39,7 +40,11 @@ SUBROUTINE calc_Exc()
EPS_XC(:) = eps_x(:) + eps_c(:)
ENDIF ! USE_ARIAS_VWN

E_xc = sum( Rhoe(:) * EPS_XC(:) )*dVol
E_xc = sum( Rhoe(:) * (eps_x(:) + eps_c(:)) )*dVol

IF( USE_ARIAS_VWN ) THEN
DEALLOCATE( EPS_XC )
ENDIF

ELSEIF( XC_NAME == 'PBE' ) THEN
!
Expand Down
9 changes: 4 additions & 5 deletions src/calc_Exc_Vxc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ SUBROUTINE calc_Exc_Vxc()
USE m_xc
USE xc_f90_types_m
USE xc_f90_lib_m
USE m_options, ONLY : USE_ARIAS_VWN
IMPLICIT NONE
REAL(8), ALLOCATABLE :: gRhoe(:,:), gRhoe2(:)
REAL(8), ALLOCATABLE :: eps_x(:), eps_c(:)
Expand All @@ -13,18 +12,20 @@ SUBROUTINE calc_Exc_Vxc()
TYPE(xc_f90_pointer_t) :: xc_func
TYPE(xc_f90_pointer_t) :: xc_info
INTEGER :: ip
REAL(8), ALLOCATABLE :: d_EPS_XC_RHO(:)
REAL(8), ALLOCATABLE :: d_EPS_XC_RHO(:), EPS_XC(:)

! these calls should only be done for LDA
IF( XC_NAME == 'VWN' ) THEN

IF( USE_ARIAS_VWN ) THEN
ALLOCATE( d_EPS_XC_RHO(Npoints) )
ALLOCATE( EPS_XC(Npoints) )
CALL excVWN( Npoints, Rhoe, EPS_XC )
CALL excpVWN( Npoints, Rhoe, d_EPS_XC_RHO )
! calculate potential
V_xc(:) = EPS_XC(:) + d_EPS_XC_RHO(:)*Rhoe(:)
DEALLOCATE( d_EPS_XC_RHO )
DEALLOCATE( EPS_XC )
ELSE

ALLOCATE( eps_x(Npoints), eps_c(Npoints) )
Expand All @@ -47,10 +48,8 @@ SUBROUTINE calc_Exc_Vxc()
CALL xc_f90_lda_exc_vxc(xc_func, Npoints, Rhoe(1), eps_c(1), vrho_c(1))
CALL xc_f90_func_end(xc_func)

EPS_XC(1:Npoints) = eps_x(1:Npoints) + eps_c(1:Npoints)

! calculate potential
V_xc(:) = EPS_XC(:) + vrho_x(:) + vrho_c(:)
V_xc(:) = eps_x(:) + eps_c(:) + vrho_x(:) + vrho_c(:)
!
DEALLOCATE( eps_x, eps_c )
DEALLOCATE( vrho_x, vrho_c )
Expand Down
3 changes: 0 additions & 3 deletions src/dealloc_hamiltonian.f90
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
SUBROUTINE dealloc_hamiltonian()
USE m_hamiltonian
USE m_xc
IMPLICIT NONE

IF( allocated(Rhoe) ) DEALLOCATE( Rhoe )
Expand All @@ -10,6 +9,4 @@ SUBROUTINE dealloc_hamiltonian()

IF( allocated(betaNL_psi) ) DEALLOCATE(betaNL_psi)

IF( allocated(EPS_XC) ) DEALLOCATE( EPS_XC )

END SUBROUTINE
3 changes: 1 addition & 2 deletions src/init_V_ps_loc_gaussian_G.f90
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SUBROUTINE init_V_ps_loc_gaussian_G( Nparams, A, alpha )
REAL(8) :: alpha(Nparams)
!
INTEGER :: ip, isp, Nx, Ny, Nz
REAL(8) :: Gm, Omega
REAL(8) :: Omega
COMPLEX(8), ALLOCATABLE :: ctmp(:)

IF( Nspecies /= Nparams ) THEN
Expand Down Expand Up @@ -48,7 +48,6 @@ SUBROUTINE init_V_ps_loc_gaussian_G( Nparams, A, alpha )
WRITE(*,*)
ctmp(:) = cmplx(0.d0,0.d0,kind=8)
DO ip = 1,Npoints
Gm = sqrt(G2(ip))
ctmp(ip) = -A(isp)*(PI/alpha(isp))**1.5d0 * exp(-0.25d0*G2(ip)/alpha(isp)) &
* strf(ip,isp) / Omega
ENDDO
Expand Down
2 changes: 0 additions & 2 deletions src/m_options.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ MODULE m_options

IMPLICIT NONE

LOGICAL :: USE_ARIAS_VWN = .TRUE. ! only for debugging

LOGICAL :: T_PRINT_INTEG_RHO = .FALSE.

INTEGER :: I_POISSON_SOLVE = 1
Expand Down
2 changes: 1 addition & 1 deletion src/m_xc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MODULE m_xc
CHARACTER(10) :: XC_NAME = 'VWN'
! 'PBE'

REAL(8), ALLOCATABLE :: EPS_XC(:)
LOGICAL :: USE_ARIAS_VWN = .TRUE. ! only for debugging

END MODULE

25 changes: 9 additions & 16 deletions src/make.inc
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
EXE_MAIN = ffr_LFDFT_ifort.x
EXE_MAIN = ffr_LFDFT_g95.x
MAKE = make
AR = ar
F77 = ifort
F77_OPTS = -O3
AR = ar

F90 = ifort
F90_OPTS = -fpp -xHost -O2 -fpp -warn -nogen-interfaces
F90_OPTS_NOWARN = -fpp -xHost -O2 -fpp
F90 = g95
F90_OPTS = -Wall -ftrace=full -O3 -fno-second-underscore -cpp -g
F90_OPTS_NOWARN = -ftrace=full -O3 -fno-second-underscore -cpp -g

CC_OPTS = -std=c99
F77 = g95
F77_OPTS = -O3 -fno-second-underscore -cpp

#F90_OPTS = -fpp -O3 # -check uninit -xHost
# -CB for check bound of arrays
#F90_OPTS = -CB -warn -nogen-interfaces
#F90_OPTS = -O3 -funroll-all-loops -vector
#LIB_FFTW3 = /home/efefer/mysoftwares/lib/libfftw3.a

LIB_FFTW3 = -lfftw3
LIB_LINALG = -L$(MKLROOT)/lib/intel64 -lmkl_core -lmkl_sequential -lmkl_intel_lp64
LIB_LINALG = -lblas -llapack
LIB_FFTW3 = -lfftw3
LIB_XC = -L/home/efefer/mysoftwares/libxc-3.0.0/lib -lxcf90 -lxc
LIBS = $(LIB_LINALG) $(LIB_FFTW3) $(LIB_XC)

5 changes: 2 additions & 3 deletions src/update_potentials.f90
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
SUBROUTINE update_potentials()

USE m_options, ONLY : I_POISSON_SOLVE
USE m_LF3d, ONLY : Npoints => LF3d_Npoints, &
LF3d_TYPE, LF3d_PERIODIC
USE m_hamiltonian, ONLY : Rhoe, V_Hartree, V_xc
USE m_LF3d, ONLY : LF3d_TYPE, LF3d_PERIODIC
USE m_hamiltonian, ONLY : Rhoe, V_Hartree

IMPLICIT NONE

Expand Down
4 changes: 2 additions & 2 deletions works/Al_dimer/INPUT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
&CONTROL
pseudo_dir = '../../HGH'
pseudo_dir = '../../pseudopotentials/pade_gth/'
etot_conv_thr = 1.0d-6
/

Expand All @@ -24,7 +24,7 @@
/

ATOMIC_SPECIES
Al 1.0 Al.hgh
Al 1.0 Al-q3.gth

ATOMIC_POSITIONS angstrom
Al 0.0 0.0 0.0
Expand Down

0 comments on commit b8f9789

Please sign in to comment.