Commit 8d295164 authored by Gregor Michalicek's avatar Gregor Michalicek

Connect Wannier code to main program

Note: There is still some additional work required in fleur.F and maybe also
in other files.
parent 729088f4
......@@ -133,10 +133,10 @@ MODULE m_fleur
! USE m_jcoff
! USE m_jcoff2
! USE m_ssomat
#ifdef CPP_WANN
USE m_wann_optional
USE m_wannier
#endif
! USE m_mixedbasis
! USE m_coulomb
USE m_gen_map
......@@ -187,7 +187,7 @@ MODULE m_fleur
! .. Local Scalars ..
INTEGER :: eig_id
INTEGER :: i,it,ithf,jspin,n,pc
LOGICAL :: stop80,reap,l_endit,l_opti,l_cont
LOGICAL :: stop80,reap,l_endit,l_opti,l_cont,l_real
!--- J<
INTEGER :: phn
REAL, PARAMETER :: tol = 1.e-8
......@@ -235,15 +235,16 @@ MODULE m_fleur
IF (obsolete%l_u2f) CALL juDFT_end("conversion to formatted",mpi%irank)
IF (input%l_bmt) CALL juDFT_end('"cdnbmt" written',mpi%irank)
#ifdef CPP_WANN
!+Wannier
input%l_wann = .FALSE.
INQUIRE (file='wann_inp',exist=input%l_wann)
IF (input%l_wann.AND.(mpi%irank==0).AND.(.NOT.wann%l_bs_comf)) THEN
CALL wann_optional(input,atoms,sym,cell,oneD,noco,wann)
END IF
IF (wann%l_gwf) input%itmax = 1
#endif
l_real = (sym%invs).AND.(.NOT.noco%l_noco) ! Is this right? I took it from eigen.
!-Wannier
ALLOCATE (eig_idList(wann%nparampts))
l_restart = .TRUE.
......@@ -708,18 +709,15 @@ MODULE m_fleur
!
! ----> charge density
!+Wannier functions
#ifdef CPP_WANN
!+Wannier functions
input%l_wann = .FALSE.
INQUIRE (file='wann_inp',exist=input%l_wann)
IF (input%l_wann) THEN
CALL wannier(mpi,atoms,noco,&
dimension,sym,obsolete,cell,kpts,&
stars,oneD,vacuum,sphhar,input,&
sliceplot,results)
CALL wannier(DIMENSION,mpi,input,sym,atoms,stars,vacuum,sphhar,oneD,&
wann,noco,cell,enpara,banddos,sliceplot,results,&
eig_idList,l_real,kpts%nkpt)
END IF
#endif
!-Wannier
!-Wannier
CALL timestart("generation of new charge density (total)")
......
......@@ -20,7 +20,7 @@ c*******************************************c
CONTAINS
SUBROUTINE wann_uHu(
> DIMENSION,stars,vacuum,atoms,sphhar,input,sym,mpi,banddos,
> lapw,oneD,noco,cell,wann,
> oneD,noco,cell,wann,
> eig_idList,l_real,l_dulo,l_noco,l_ss,lmaxd,ntypd,
> neigd,natd,nop,nvd,jspd,nbasfcn,llod,nlod,ntype,
> omtil,nlo,llo,lapw_l,invtab,mrot,ngopr,neq,lmax,
......@@ -80,7 +80,6 @@ c*******************************************c
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_mpi),INTENT(IN) :: mpi
TYPE(t_banddos),INTENT(IN) :: banddos
TYPE(t_lapw),INTENT(IN) :: lapw
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_cell),INTENT(IN) :: cell
......@@ -1080,17 +1079,22 @@ c***********************************************************
call cpu_time(t0)
lapw_b = lapw
ALLOCATE(lapw_b%k1(SIZE(k1_b,1),SIZE(k1_b,2)))
ALLOCATE(lapw_b%k2(SIZE(k1_b,1),SIZE(k1_b,2)))
ALLOCATE(lapw_b%k3(SIZE(k1_b,1),SIZE(k1_b,2)))
lapw_b%k1 = k1_b
lapw_b%k2 = k2_b
lapw_b%k3 = k3_b
lapw_b%nmat = nmat_b
lapw_b%nv = nv_b
! I think the other variables of lapw are not needed here.
CALL abcof(input,atoms,noccbd_b,sym,cell,bkpt_b,lapw_b,
+ noccbd_b,usdus,noco,jspin,kveclo_b,oneD,
+ acof_b,bcof_b,ccof_b,zMat_b)
DEALLOCATE(lapw_b%k1,lapw_b%k2,lapw_b%k3)
call wann_abinv(
> ntypd,natd,noccbd_b,lmaxd,lmd,llod,nlod,ntype,neq,
> noccbd_b,lmax,nlo,llo,invsat,invsatnr,bkpt_b,taual,
......@@ -1195,17 +1199,23 @@ c***********************************************************
call cpu_time(t0)
lapw_b2 = lapw
ALLOCATE(lapw_b2%k1(SIZE(k1_b2,1),SIZE(k1_b2,2)))
ALLOCATE(lapw_b2%k2(SIZE(k1_b2,1),SIZE(k1_b2,2)))
ALLOCATE(lapw_b2%k3(SIZE(k1_b2,1),SIZE(k1_b2,2)))
lapw_b2%k1 = k1_b2
lapw_b2%k2 = k2_b2
lapw_b2%k3 = k3_b2
lapw_b2%nmat = nmat_b2
lapw_b2%nv = nv_b2
! I think the other variables of lapw are not needed here.
CALL abcof(input,atoms,noccbd_b2,sym,cell,bkpt_b2,lapw_b2,
+ noccbd_b2,usdus,noco,jspin_b,kveclo_b2,oneD,
+ acof_b2,bcof_b2,ccof_b2,zMat_b2)
DEALLOCATE(lapw_b2%k1,lapw_b2%k2,lapw_b2%k3)
call wann_abinv(
> ntypd,natd,noccbd_b2,lmaxd,lmd,llod,nlod,ntype,neq,
> noccbd_b2,lmax,nlo,llo,invsat,invsatnr,bkpt_b2,taual,
......
......@@ -20,7 +20,7 @@ c*******************************************c
CONTAINS
SUBROUTINE wann_uHu_dmi(
> DIMENSION,stars,vacuum,atoms,sphhar,input,sym,mpi,banddos,
> lapw,oneD,noco,cell,wann,
> oneD,noco,cell,wann,
> eig_idList,l_real,l_dulo,l_noco,l_ss,lmaxd,ntypd,
> neigd,natd,nop,nvd,jspd,nbasfcn,llod,nlod,ntype,
> omtil,nlo,llo,lapw_l,invtab,mrot,ngopr,neq,lmax,
......@@ -81,7 +81,6 @@ c*******************************************c
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_mpi),INTENT(IN) :: mpi
TYPE(t_banddos),INTENT(IN) :: banddos
TYPE(t_lapw),INTENT(IN) :: lapw
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_cell),INTENT(IN) :: cell
......@@ -1052,17 +1051,22 @@ c***********************************************************
call cpu_time(t0)
lapw_b = lapw
ALLOCATE(lapw_b%k1(SIZE(k1_b,1),SIZE(k1_b,2)))
ALLOCATE(lapw_b%k2(SIZE(k1_b,1),SIZE(k1_b,2)))
ALLOCATE(lapw_b%k3(SIZE(k1_b,1),SIZE(k1_b,2)))
lapw_b%k1 = k1_b
lapw_b%k2 = k2_b
lapw_b%k3 = k3_b
lapw_b%nmat = nmat_b
lapw_b%nv = nv_b
! I think the other variables of lapw are not needed here.
CALL abcof(input,atoms,noccbd_b,sym,cell,bkpt_b,lapw_b,
+ noccbd_b,usdus,noco,jspin,kveclo_b,oneD,
+ acof_b,bcof_b,ccof_b,zMat_b)
DEALLOCATE(lapw_b%k1,lapw_b%k2,lapw_b%k3)
call wann_abinv(
> ntypd,natd,noccbd_b,lmaxd,lmd,llod,nlod,ntype,neq,
> noccbd_b,lmax,nlo,llo,invsat,invsatnr,bkpt_b,taual,
......@@ -1179,17 +1183,22 @@ c***********************************************************
call cpu_time(t0)
lapw_b2 = lapw
ALLOCATE(lapw_b2%k1(SIZE(k1_b2,1),SIZE(k1_b2,2)))
ALLOCATE(lapw_b2%k2(SIZE(k1_b2,1),SIZE(k1_b2,2)))
ALLOCATE(lapw_b2%k3(SIZE(k1_b2,1),SIZE(k1_b2,2)))
lapw_b2%k1 = k1_b2
lapw_b2%k2 = k2_b2
lapw_b2%k3 = k3_b2
lapw_b2%nmat = nmat_b2
lapw_b2%nv = nv_b2
! I think the other variables of lapw are not needed here.
CALL abcof(input,atoms,noccbd_b2,sym,cell,bkpt_b2,lapw_b2,
+ noccbd_b2,usdus,noco,jspin_b,kveclo_b2,oneD,
+ acof_b2,bcof_b2,ccof_b2,zMat_b2)
DEALLOCATE(lapw_b2%k1,lapw_b2%k2,lapw_b2%k3)
call wann_abinv(
> ntypd,natd,noccbd_b2,lmaxd,lmd,llod,nlod,ntype,neq,
> noccbd_b2,lmax,nlo,llo,invsat,invsatnr,bkpt_b2,taual,
......
......@@ -7,10 +7,7 @@
module m_wann_optional
use m_juDFT
contains
subroutine wann_optional(
> input,atoms,sym,cell,oneD,noco,wann,
> l_ms,l_sgwf,l_socgwf,
> aux_latt_const,param_file,l_dim)
subroutine wann_optional(input,atoms,sym,cell,oneD,noco,wann)
c**************************************************
c Make preparations for the calculation of
c Wannier functions.
......@@ -37,15 +34,9 @@ c**************************************************
TYPE(t_noco), INTENT(IN) :: noco
TYPE(t_wann), INTENT(INOUT) :: wann
real,intent(in) :: aux_latt_const
character(len=20),intent(in) :: param_file
integer :: num_wann(2)
logical :: l_nocosoc
logical, intent(in) :: l_ms,l_sgwf,l_socgwf
logical,intent(in) :: l_dim(3)
l_nocosoc=noco%l_noco.or.noco%l_soc
c-----read the input file to determine what to do
......@@ -92,8 +83,8 @@ c-----generate WF1.win and bkpts
> input%jspins,cell%amat,cell%bmat,
> atoms%nat,atoms%taual,atoms%zatom,atoms%ntype,
> atoms%ntype,atoms%neq,wann%l_bzsym,input%film,
> oneD%odi%d1,l_ms,l_sgwf,l_socgwf,aux_latt_const,
> param_file,l_dim)
> oneD%odi%d1,wann%l_ms,wann%l_sgwf,wann%l_socgwf,
> wann%aux_latt_const,wann%param_file,wann%l_dim)
endif
c-----calculate polarization, if not wannierize
......
......@@ -8,7 +8,7 @@
use m_juDFT
CONTAINS
SUBROUTINE wann_updown(
> mpi,input,sym,atoms,stars,vacuum,sphhar,lapw,oneD,noco,cell,
> mpi,input,sym,atoms,stars,vacuum,sphhar,oneD,noco,cell,
> enpara,
> eig_id,mpi_comm,l_dulo,l_noco,l_ss,lmaxd,ntypd,
> neigd,natd,nop,nvd,jspd,nbasfcn,llod,nlod,ntype,
......@@ -80,7 +80,6 @@ c****************************************************************************
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_vacuum),INTENT(IN) :: vacuum
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_lapw),INTENT(IN) :: lapw
TYPE(t_oneD),INTENT(IN) :: oneD
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_cell),INTENT(IN) :: cell
......@@ -263,7 +262,8 @@ c..wf-hamiltonian in real space (hopping in the same unit cell)
integer :: spinloop1,spinloop2,ilop
TYPE(t_usdus) :: usdus
TYPE(t_zmat) :: zMat(2),zzMat(2)
TYPE(t_zmat) :: zMat(2),zzMat(2)
TYPE(t_lapw) :: lapw
IF(l_ss) CALL juDFT_error("spin-spiral not yet in this version"
+ ,calledby ="wann_updown")
......@@ -832,6 +832,16 @@ c...the overlap matrix Mmn which is computed for each k- and b-point
c...generation the A,B,C coefficients in the spheres
c...for the lapws and local orbitals, summed by the basis functions
ALLOCATE(lapw%k1(SIZE(k1,1),SIZE(k1,2)))
ALLOCATE(lapw%k2(SIZE(k1,1),SIZE(k1,2)))
ALLOCATE(lapw%k3(SIZE(k1,1),SIZE(k1,2)))
lapw%nv = nv
lapw%nmat = nmat
lapw%k1 = k1
lapw%k2 = k2
lapw%k3 = k3
! I think the other variables of lapw are not needed here.
call cpu_time(delta)
do jspin=1,wannierspin
......@@ -847,6 +857,7 @@ c...for the lapws and local orbitals, summed by the basis functions
< ccof(-llod,1,1,1,jspin))
enddo !jspin
DEALLOCATE(lapw%k1,lapw%k2,lapw%k3)
jspin=1
call cpu_time(delta1)
......
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