use fi in hf_init (and therefore rdmft)

parent 39f32d8d
MODULE m_hf_init
!
! preparations for HF and hybinp functional calculation
! preparations for HF and fi%hybinp functional calculation
!
CONTAINS
SUBROUTINE hf_init(eig_id, mpdata, hybinp, atoms, input, hybdat)
SUBROUTINE hf_init(eig_id, mpdata,fi, hybdat)
USE m_types
USE m_hybrid_core
USE m_util
use m_intgrf
USE m_io_hybinp
USE m_types_hybdat
IMPLICIT NONE
integer, intent(in) :: eig_id
TYPE(t_mpdata), intent(inout) :: mpdata
TYPE(t_hybinp), INTENT(IN) :: hybinp
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_input), INTENT(IN) :: input
type(t_fleurinput), intent(in) :: fi
TYPE(t_hybdat), INTENT(INOUT) :: hybdat
INTEGER:: l, m, i, l1, l2, m1, m2
!initialize hybdat%gridf for radial integration
CALL intgrf_init(atoms%ntype, atoms%jmtd, atoms%jri, atoms%dx, atoms%rmsh, hybdat%gridf)
CALL intgrf_init(fi%atoms%ntype, fi%atoms%jmtd, fi%atoms%jri, fi%atoms%dx, fi%atoms%rmsh, hybdat%gridf)
! preparations for core states
CALL core_init( input, atoms, hybdat%lmaxcd, hybdat%maxindxc)
hybdat%maxfac = max(2*atoms%lmaxd + maxval(hybinp%lcutm1) + 1, 2*hybdat%lmaxcd + 2*atoms%lmaxd + 1)
CALL core_init( fi%input, fi%atoms, hybdat%lmaxcd, hybdat%maxindxc)
hybdat%maxfac = max(2*fi%atoms%lmaxd + maxval(fi%hybinp%lcutm1) + 1, 2*hybdat%lmaxcd + 2*fi%atoms%lmaxd + 1)
!Alloc variables
call hybdat%free()
call hybdat%allocate(atoms, hybinp, mpdata%num_radfun_per_l)
call hybdat%allocate(fi, mpdata%num_radfun_per_l)
hybdat%eig_id = eig_id
! pre-calculate gaunt coefficients
......@@ -40,9 +37,9 @@ CONTAINS
hybdat%sfac(i) = hybdat%sfac(i - 1)*sqrt(i*1.0) ! hybdat%sfac(i) = sqrt(i!)
END DO
DO l2 = 0, atoms%lmaxd
DO l1 = 0, atoms%lmaxd
DO l = abs(l1 - l2), min(l1 + l2, maxval(hybinp%lcutm1))
DO l2 = 0, fi%atoms%lmaxd
DO l1 = 0, fi%atoms%lmaxd
DO l = abs(l1 - l2), min(l1 + l2, maxval(fi%hybinp%lcutm1))
DO m = -l, l
DO m1 = -l1, l1
m2 = m1 + m ! Gaunt condition -m1+m2-m = 0
......
......@@ -125,7 +125,7 @@ CONTAINS
CALL coulombmatrix(mpi, fi%atoms, fi%kpts, fi%cell, fi%sym, mpdata, fi%hybinp, hybdat, xcpot)
CALL hf_init(eig_id, mpdata, fi%hybinp, fi%atoms, fi%input, hybdat)
CALL hf_init(eig_id, mpdata, fi, hybdat)
CALL timestop("Preparation for hybrid functionals")
CALL timestart("Calculation of non-local HF potential")
DO jsp = 1, fi%input%jspins
......
......@@ -447,9 +447,9 @@ CONTAINS
IF (fi%input%l_rdmft) THEN
SELECT TYPE(xcpot)
TYPE IS(t_xcpot_inbuild)
CALL rdmft(eig_id,mpi,input_soc,fi%kpts,fi%banddos,fi%sliceplot,fi%cell,fi%atoms,enpara,stars,fi%vacuum,&
sphhar,fi%sym,fi%field,vTot,vCoul,fi%oneD,fi%noco,nococonv,xcpot,fi%mpinp,mpdata,fi%hybinp,hybdat,&
fi%gfinp,fi%hub1inp,results,fi%corespecinput,archiveType,outDen)
CALL rdmft(eig_id,mpi,fi,enpara,stars,&
sphhar,vTot,vCoul,nococonv,xcpot,mpdata,hybdat,&
results,archiveType,outDen)
END SELECT
END IF
......
This diff is collapsed.
MODULE m_types_hybdat
use m_types_usdus
use m_types_mat
IMPLICIT NONE
TYPE t_hybdat
......@@ -32,7 +33,9 @@ MODULE m_types_hybdat
INTEGER :: maxbasm1 = -1
INTEGER :: eig_id = -1
INTEGER, ALLOCATABLE :: nbasm(:)
type(t_usdus) :: usdus
type(t_usdus) :: usdus
type(t_mat), allocatable :: v_x(:,:) ! (jsp, nkpt)
contains
procedure :: set_stepfunction => set_stepfunction
procedure :: free => free_hybdat
......@@ -40,44 +43,42 @@ MODULE m_types_hybdat
END TYPE t_hybdat
contains
subroutine allocate_hybdat(hybdat, atoms, hybinp, num_radfun_per_l)
use m_types_atoms
use m_types_hybinp
subroutine allocate_hybdat(hybdat, fi, num_radfun_per_l)
use m_types_fleurinput
use m_judft
implicit none
class(t_hybdat), intent(inout) :: hybdat
type(t_atoms), intent(in) :: atoms
type(t_hybinp), intent(in) :: hybinp
type(t_fleurinput), intent(in) :: fi
integer, intent(in) :: num_radfun_per_l(:, :)
integer :: ok(12)
ok = -1
allocate(hybdat%lmaxc(atoms%ntype), &
allocate(hybdat%lmaxc(fi%atoms%ntype), &
stat=ok(1), source=0)
allocate(hybdat%bas1(atoms%jmtd, maxval(num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), &
allocate(hybdat%bas1(fi%atoms%jmtd, maxval(num_radfun_per_l), 0:fi%atoms%lmaxd, fi%atoms%ntype), &
stat=ok(2), source=0.0)
allocate(hybdat%bas2(atoms%jmtd, maxval(num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), &
allocate(hybdat%bas2(fi%atoms%jmtd, maxval(num_radfun_per_l), 0:fi%atoms%lmaxd, fi%atoms%ntype), &
stat=ok(3), source=0.0)
allocate(hybdat%bas1_MT(maxval(num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), &
allocate(hybdat%bas1_MT(maxval(num_radfun_per_l), 0:fi%atoms%lmaxd, fi%atoms%ntype), &
stat=ok(4), source=0.0)
allocate(hybdat%drbas1_MT(maxval(num_radfun_per_l), 0:atoms%lmaxd, atoms%ntype), &
allocate(hybdat%drbas1_MT(maxval(num_radfun_per_l), 0:fi%atoms%lmaxd, fi%atoms%ntype), &
stat=ok(5), source=0.0)
! core allocs
allocate(hybdat%nindxc(0:hybdat%lmaxcd, atoms%ntype), &
allocate(hybdat%nindxc(0:hybdat%lmaxcd, fi%atoms%ntype), &
stat=ok(6), source=0)
allocate(hybdat%core1(atoms%jmtd, hybdat%maxindxc, 0:hybdat%lmaxcd, atoms%ntype), &
allocate(hybdat%core1(fi%atoms%jmtd, hybdat%maxindxc, 0:hybdat%lmaxcd, fi%atoms%ntype), &
stat=ok(7), source=0.0)
allocate(hybdat%core2(atoms%jmtd, hybdat%maxindxc, 0:hybdat%lmaxcd, atoms%ntype), &
allocate(hybdat%core2(fi%atoms%jmtd, hybdat%maxindxc, 0:hybdat%lmaxcd, fi%atoms%ntype), &
stat=ok(8), source=0.0)
allocate(hybdat%eig_c(hybdat%maxindxc, 0:hybdat%lmaxcd, atoms%ntype), &
allocate(hybdat%eig_c(hybdat%maxindxc, 0:hybdat%lmaxcd, fi%atoms%ntype), &
stat=ok(9), source=0.0)
allocate(hybdat%fac(0:hybdat%maxfac), stat=ok(10), source=0.0)
allocate(hybdat%sfac(0:hybdat%maxfac), stat=ok(11), source=0.0)
ALLOCATE(hybdat%gauntarr(2, 0:atoms%lmaxd, 0:atoms%lmaxd, 0:maxval(hybinp%lcutm1), &
-atoms%lmaxd:atoms%lmaxd, -maxval(hybinp%lcutm1):maxval(hybinp%lcutm1)), &
ALLOCATE(hybdat%gauntarr(2, 0:fi%atoms%lmaxd, 0:fi%atoms%lmaxd, 0:maxval(fi%hybinp%lcutm1), &
-fi%atoms%lmaxd:fi%atoms%lmaxd, -maxval(fi%hybinp%lcutm1):maxval(fi%hybinp%lcutm1)), &
stat=ok(12), source=0.0)
if(any(ok /= 0)) then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment