Commit c3a836d1 authored by Matthias Redies's avatar Matthias Redies

merge prodtype into mpbasis

parent dbcce486
......@@ -20,7 +20,7 @@ CONTAINS
IMPLICIT NONE
TYPE(t_mpbasis), INTENT(in) :: mpbasis
TYPE(t_mpbasis), INTENT(inout) :: mpbasis
TYPE(t_hybrid), INTENT(INOUT) :: hybrid
TYPE(t_kpts), INTENT(IN) :: kpts
TYPE(t_dimension), INTENT(IN) :: dimension
......@@ -220,10 +220,10 @@ CONTAINS
allocate(hybdat%prodm(maxval(mpbasis%num_radbasfn), hybrid%max_indx_p_1, 0:maxval(hybrid%lcutm1), atoms%ntype), stat=ok)
IF (ok /= 0) call judft_error('eigen_hf: failure allocation hybdat%prodm')
call hybdat%prod%init(hybrid, atoms)
call mpbasis%init(hybrid, atoms)
basprod = 0; hybdat%prodm = 0; hybdat%prod%l1 = 0; hybdat%prod%l2 = 0
hybdat%prod%n1 = 0; hybdat%prod%n2 = 0
basprod = 0; hybdat%prodm = 0; mpbasis%l1 = 0; mpbasis%l2 = 0
mpbasis%n1 = 0; mpbasis%n2 = 0
IF(ALLOCATED(hybdat%nindxp1)) DEALLOCATE(hybdat%nindxp1) ! for spinpolarized systems
ALLOCATE (hybdat%nindxp1(0:maxval(hybrid%lcutm1), atoms%ntype))
hybdat%nindxp1 = 0
......@@ -245,10 +245,10 @@ CONTAINS
IF (MOD(l1 + l2 + l, 2) == 0) THEN
hybdat%nindxp1(l, itype) = hybdat%nindxp1(l, itype) + 1
n = hybdat%nindxp1(l, itype)
hybdat%prod%l1(n,l,itype) = l1
hybdat%prod%l2(n,l,itype) = l2
hybdat%prod%n1(n,l,itype) = n1
hybdat%prod%n2(n,l,itype) = n2
mpbasis%l1(n,l,itype) = l1
mpbasis%l2(n,l,itype) = l2
mpbasis%n1(n,l,itype) = n1
mpbasis%n2(n,l,itype) = n2
DO i = 1, mpbasis%num_radbasfn(l, itype)
hybdat%prodm(i, n, l, itype) = intgrf(basprod(:ng)*mpbasis%radbasfn_mt(:ng, i, l, itype), &
atoms, itype, hybdat%gridf)
......
......@@ -394,10 +394,10 @@ CONTAINS
DO n = 1, hybdat%nindxp1(l, itype)
! determine l1,p1 and l2,p2 for the basis functions, which can generate l
l1 = hybdat%prod%l1(n,l,itype)
l2 = hybdat%prod%l2(n,l,itype)
p1 = hybdat%prod%n1(n,l,itype)
p2 = hybdat%prod%n2(n,l,itype)
l1 = mpbasis%l1(n,l,itype)
l2 = mpbasis%l2(n,l,itype)
p1 = mpbasis%n1(n,l,itype)
p2 = mpbasis%n2(n,l,itype)
! condition for Gaunt coefficients
IF (mod(l + l1 + l2, 2) /= 0) CYCLE
......@@ -515,10 +515,10 @@ CONTAINS
DO n = 1, hybdat%nindxp1(l, itype)
! determine l1,p1 and l2,p2 for the basis functions, which can generate l
l1 = hybdat%prod%l1(n,l,itype)
l2 = hybdat%prod%l2(n,l,itype)
p1 = hybdat%prod%n1(n,l,itype)
p2 = hybdat%prod%n2(n,l,itype)
l1 = mpbasis%l1(n,l,itype)
l2 = mpbasis%l2(n,l,itype)
p1 = mpbasis%n1(n,l,itype)
p2 = mpbasis%n2(n,l,itype)
! condition for Gaunt coefficients
IF (mod(l + l1 + l2, 2) /= 0) CYCLE
......
......@@ -265,7 +265,7 @@ CONTAINS
DO l = 0, hybrid%lcutm1(itype)
DO n = 1, hybdat%nindxp1(l, itype) ! loop over basis-function products
call hybdat%prod%set_nl(n,l,itype, n1,l1,n2,l2)
call mpbasis%set_nl(n,l,itype, n1,l1,n2,l2)
IF (mod(l1 + l2 + l, 2) == 0) THEN
offdiag = (l1 /= l2) .or. (n1 /= n2) ! offdiag=true means that b1*b2 and b2*b1 are different combinations
......
......@@ -454,7 +454,7 @@ SUBROUTINE rdmft(eig_id,mpi,input,kpts,banddos,sliceplot,cell,atoms,enpara,stars
IF(ALLOCATED(hybdat%pntgpt)) DEALLOCATE (hybdat%pntgpt)
IF(ALLOCATED(hybdat%prodm)) DEALLOCATE (hybdat%prodm)
call hybdat%prod%free()
call mpbasis%free()
IF(ALLOCATED(hybdat%nindxp1)) DEALLOCATE (hybdat%nindxp1)
......
......@@ -30,18 +30,6 @@ MODULE m_types_hybrid
procedure :: set_num_radfun_per_l => set_num_radfun_per_l_hybrid
END TYPE t_hybrid
TYPE t_prodtype
INTEGER, ALLOCATABLE :: l1(:,:,:)
INTEGER, ALLOCATABLE :: l2(:,:,:)
INTEGER, ALLOCATABLE :: n1(:,:,:)
INTEGER, ALLOCATABLE :: n2(:,:,:)
contains
procedure :: init => prodtype_init
procedure :: free => prodtype_free
procedure :: set_nl => prodtype_set_nl
END TYPE t_prodtype
TYPE t_hybdat
INTEGER :: lmaxcd, maxindxc
INTEGER :: maxfac
......@@ -56,11 +44,10 @@ MODULE m_types_hybrid
REAL, ALLOCATABLE :: bas1(:,:,:,:), bas2(:,:,:,:)
REAL, ALLOCATABLE :: bas1_MT(:,:,:), drbas1_MT(:,:,:)
REAL, ALLOCATABLE :: prodm(:,:,:,:)
TYPE(t_PRODTYPE) :: prod
INTEGER, ALLOCATABLE :: pntgptd(:)
INTEGER, ALLOCATABLE :: pntgpt(:,:,:,:)
INTEGER, ALLOCATABLE :: nindxp1(:,:)
COMPLEX, ALLOCATABLE :: stepfunc(:,:,:)
COMPLEX, ALLOCATABLE :: stepfunc(:,:,:)
contains
procedure :: set_stepfunction => set_stepfunction
END TYPE t_hybdat
......@@ -142,53 +129,6 @@ contains
END FUNCTION gptnorm
subroutine prodtype_init(prod, hybrid, atoms)
use m_types_setup
use m_judft
implicit none
class(t_prodtype) :: prod
type(t_hybrid), intent(in) :: hybrid
type(t_atoms), intent(in) :: atoms
integer :: ok
ALLOCATE (prod%l1(hybrid%max_indx_p_1, 0:maxval(hybrid%lcutm1), atoms%ntype), stat=ok)
IF (ok /= 0) call judft_error('prodtype_init: failure allocation prod%l1')
ALLOCATE (prod%l2, mold=prod%l1, stat=ok)
IF (ok /= 0) call judft_error('prodtype_init: failure allocation prod%l2')
ALLOCATE (prod%n1, mold=prod%l1, stat=ok)
IF (ok /= 0) call judft_error('prodtype_init: failure allocation prod%n1')
ALLOCATE (prod%n2, mold=prod%l1, stat=ok)
IF (ok /= 0) call judft_error('prodtype_init: failure allocation prod%n2')
end subroutine prodtype_init
subroutine prodtype_free(prod)
use m_types_setup
implicit NONE
class(t_prodtype) :: prod
IF(ALLOCATED(prod%l1)) DEALLOCATE (prod%l1)
IF(ALLOCATED(prod%l2)) DEALLOCATE (prod%l2)
IF(ALLOCATED(prod%n1)) DEALLOCATE (prod%n1)
IF(ALLOCATED(prod%n2)) DEALLOCATE (prod%n2)
end subroutine prodtype_free
subroutine prodtype_set_nl(prod,n,l,itype,n1,l1,n2,l2)
use m_types_setup
implicit NONE
class(t_prodtype) :: prod
integer, intent(in) :: n, l, itype
integer, intent(out) :: n1, l1, n2, l2
l1 = prod%l1(n,l,itype) !
l2 = prod%l2(n,l,itype) ! current basis-function product
n1 = prod%n1(n,l,itype) ! = bas(:,n1,l1,itype)*bas(:,n2,l2,itype) = b1*b2
n2 = prod%n2(n,l,itype) !
end subroutine prodtype_set_nl
subroutine set_num_radfun_per_l_hybrid(hybrid, atoms)
use m_types_setup
implicit NONE
......
This diff is collapsed.
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