From ecd05260be4c3fa5b754a4b3ea1e76b62745d08f Mon Sep 17 00:00:00 2001 From: Daniel Wortmann Date: Fri, 24 May 2019 14:16:48 +0200 Subject: [PATCH] Reactivating Wannier code --- external/libxc-git | 2 +- main/fleur.F90 | 24 +++---- wannier/CMakeLists.txt | 2 +- wannier/init_wannier_defaults.f90 | 2 +- wannier/wann_optional.f | 115 ------------------------------ wannier/wann_optional.f90 | 103 ++++++++++++++++++++++++++ 6 files changed, 115 insertions(+), 133 deletions(-) delete mode 100644 wannier/wann_optional.f create mode 100644 wannier/wann_optional.f90 diff --git a/external/libxc-git b/external/libxc-git index 3cb2231a..ca6f7114 160000 --- a/external/libxc-git +++ b/external/libxc-git @@ -1 +1 @@ -Subproject commit 3cb2231abf1d47fbd8b3e21c8478e9f26a73ce5f +Subproject commit ca6f7114b9fffe0964ca9e8d24e09ef15b300316 diff --git a/main/fleur.F90 b/main/fleur.F90 index a4d8287b..1a568a77 100644 --- a/main/fleur.F90 +++ b/main/fleur.F90 @@ -103,7 +103,7 @@ CONTAINS ! local scalars INTEGER :: eig_id,archiveType INTEGER :: n,iter,iterHF - LOGICAL :: l_opti,l_cont,l_qfix,l_wann_inp,l_real + LOGICAL :: l_opti,l_cont,l_qfix,l_real REAL :: fix #ifdef CPP_MPI INCLUDE 'mpif.h' @@ -124,16 +124,11 @@ CONTAINS IF (l_opti) CALL optional(mpi,atoms,sphhar,vacuum,dimension,& stars,input,sym,cell,sliceplot,obsolete,xcpot,noco,oneD) - !+Wannier (start) - INQUIRE (file='wann_inp',exist=l_wann_inp) - input%l_wann = input%l_wann.OR.l_wann_inp IF (input%l_wann.AND.(mpi%irank==0).AND.(.NOT.wann%l_bs_comf)) THEN IF(mpi%isize.NE.1) CALL juDFT_error('No Wannier+MPI at the moment',calledby = 'fleur') CALL wann_optional(input,kpts,atoms,sym,cell,oneD,noco,wann) END IF - IF (wann%l_gwf) input%itmax = 1 - !-Wannier (end) - + iter = 0 iterHF = 0 l_cont = (iter < input%itmax) @@ -335,14 +330,13 @@ CONTAINS ENDIF -!!$ !+Wannier functions -!!$ IF ((input%l_wann).AND.(.NOT.wann%l_bs_comf)) THEN -!!$ CALL wannier(DIMENSION,mpi,input,kpts,sym,atoms,stars,vacuum,sphhar,oneD,& -!!$ wann,noco,cell,enpara,banddos,sliceplot,vTot,results,& -!!$ eig_idList,(sym%invs).AND.(.NOT.noco%l_soc).AND.(.NOT.noco%l_noco),kpts%nkpt) -!!$ END IF -!!$ IF (wann%l_gwf) CALL juDFT_error("provide wann_inp if l_gwf=T", calledby = "fleur") -!!$ !-Wannier + !+Wannier functions + IF ((input%l_wann).AND.(.NOT.wann%l_bs_comf)) THEN + CALL wannier(DIMENSION,mpi,input,kpts,sym,atoms,stars,vacuum,sphhar,oneD,& + wann,noco,cell,enpara,banddos,sliceplot,vTot,results,& + (/eig_id/),(sym%invs).AND.(.NOT.noco%l_soc).AND.(.NOT.noco%l_noco),kpts%nkpt) + END IF + !-Wannier ! charge density generation CALL timestart("generation of new charge density (total)") diff --git a/wannier/CMakeLists.txt b/wannier/CMakeLists.txt index fd0c41d3..1c09c532 100644 --- a/wannier/CMakeLists.txt +++ b/wannier/CMakeLists.txt @@ -52,7 +52,6 @@ wannier/wann_mmnk_symm.f wannier/wann_nabla_pauli_rs.f wannier/wann_nabla_rs.f wannier/wann_nocoplot.F -wannier/wann_optional.f wannier/wann_orbcomp.f #wannier/wann_orbmag.F wannier/wann_pauli_rs.F @@ -99,4 +98,5 @@ wannier/bs_comfort.F set(fleur_F90 ${fleur_F90} wannier/init_wannier_defaults.f90 wannier/wann_read_inp.f90 +wannier/wann_optional.f90 ) diff --git a/wannier/init_wannier_defaults.f90 b/wannier/init_wannier_defaults.f90 index 19f03d1e..445fe6d6 100644 --- a/wannier/init_wannier_defaults.f90 +++ b/wannier/init_wannier_defaults.f90 @@ -23,7 +23,7 @@ SUBROUTINE initWannierDefaults(wann) TYPE(t_wann), INTENT(INOUT) :: wann - wann%wan90version = 2 ! Set the standard to Wannier90-1.2 + wann%wan90version = 3 ! Set the standard to Wannier90-1.2 wann%oc_num_orbs = 0 ! integer,allocatable :: oc_orbs(:) diff --git a/wannier/wann_optional.f b/wannier/wann_optional.f deleted file mode 100644 index eab769fd..00000000 --- a/wannier/wann_optional.f +++ /dev/null @@ -1,115 +0,0 @@ -!-------------------------------------------------------------------------------- -! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany -! This file is part of FLEUR and available as free software under the conditions -! of the MIT license as expressed in the LICENSE file in more detail. -!-------------------------------------------------------------------------------- - - module m_wann_optional - use m_juDFT - contains - subroutine wann_optional(input,kpts,atoms,sym,cell,oneD,noco,wann) -c************************************************** -c Make preparations for the calculation of -c Wannier functions. -c Frank Freimuth -c************************************************** - use m_types - use m_wann_read_inp - use m_wann_projgen - use m_wann_kpointgen - use m_wann_w90kpointgen - use m_wann_kptsreduc - use m_wann_kptsreduc2 - use m_wann_wan90prep - use m_wann_dipole3 - use m_wann_dipole - - implicit none - - TYPE(t_input), INTENT(IN) :: input - TYPE(t_kpts), INTENT(IN) :: kpts - TYPE(t_atoms), INTENT(IN) :: atoms - TYPE(t_sym), INTENT(IN) :: sym - TYPE(t_cell), INTENT(IN) :: cell - TYPE(t_oneD), INTENT(IN) :: oneD - TYPE(t_noco), INTENT(IN) :: noco - TYPE(t_wann), INTENT(INOUT) :: wann - - integer :: num_wann(2) - logical :: l_nocosoc - - l_nocosoc=noco%l_noco.or.noco%l_soc - -c-----read the input file to determine what to do - call wann_read_inp(input,.true.,wann) - -c-----generate projection-definition-file - if(wann%l_projgen) then - call wann_projgen( - > atoms%ntype,atoms%neq,atoms%nat,atoms%zatom,l_nocosoc,wann) - wann%l_stopopt=.true. - endif - -c-----generate k-point-files - if(wann%l_kpointgen) then - call wann_kpointgen() - wann%l_stopopt=.true. - endif - if(wann%l_w90kpointgen) then - call wann_w90kpointgen() - wann%l_stopopt=.true. - endif - -c-----find Wannier-irreducible part of BZ - if(wann%l_kptsreduc)then - call wann_kptsreduc( - > sym%nop,sym%mrot,cell%bmat,sym%tau,input%film, - > oneD%odi%d1,l_nocosoc) - wann%l_stopopt=.true. - endif - -c-----find Wannier-irreducible part of BZ - if(wann%l_kptsreduc2)then - call wann_kptsreduc2( - > wann%mhp, - > sym%nop,sym%mrot,cell%bmat,sym%tau,input%film, - > oneD%odi%d1,l_nocosoc) - wann%l_stopopt=.true. - endif - -c-----generate WF1.win and bkpts - if(wann%l_prepwan90)then - call wann_wan90prep(input,kpts, - > 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,wann%l_ms,wann%l_sgwf,wann%l_socgwf, - > wann%aux_latt_const,wann%param_file,wann%l_dim, - > wann%wan90version) - endif - -c-----calculate polarization, if not wannierize -c-----if wannierize, then calculate polarization later (after wannierize) - if(wann%l_dipole3.and..not.wann%l_wannierize)then - num_wann(1)=wann%band_max(1)-wann%band_min(1)+1 - num_wann(2)=wann%band_max(2)-wann%band_min(2)+1 - call wann_dipole3( - > input%jspins,cell%omtil,atoms%nat,atoms%pos, - > cell%amat,cell%bmat,atoms%taual,num_wann, - > atoms%ntype,atoms%neq,atoms%zatom,l_nocosoc) - wann%l_stopopt=.true. - endif - -c-----calculate polarization, if not wannierize -c-----if wannierize, then calculate polarization later (after wannierize) - if(wann%l_dipole.and..not.wann%l_wannierize)then - call wann_dipole( - > input%jspins,cell%omtil,atoms%nat,atoms%pos, - > cell%amat,atoms%ntype,atoms%neq,atoms%zatom) - wann%l_stopopt=.true. - endif - - IF(wann%l_stopopt) CALL juDFT_end("wann_optional done",1) ! The 1 is temporarily. Should be mpi%irank. - - end subroutine wann_optional - end module m_wann_optional diff --git a/wannier/wann_optional.f90 b/wannier/wann_optional.f90 new file mode 100644 index 00000000..d2612126 --- /dev/null +++ b/wannier/wann_optional.f90 @@ -0,0 +1,103 @@ +!-------------------------------------------------------------------------------- +! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany +! This file is part of FLEUR and available as free software under the conditions +! of the MIT license as expressed in the LICENSE file in more detail. +!-------------------------------------------------------------------------------- + +MODULE m_wann_optional + USE m_juDFT +CONTAINS + SUBROUTINE wann_optional(input,kpts,atoms,sym,cell,oneD,noco,wann) + !************************************************** + ! Make preparations for the calculation of + ! Wannier functions. + ! Frank Freimuth + !************************************************** + USE m_types + USE m_wann_read_inp + USE m_wann_projgen + USE m_wann_kpointgen + USE m_wann_w90kpointgen + USE m_wann_kptsreduc + USE m_wann_kptsreduc2 + USE m_wann_wan90prep + USE m_wann_dipole3 + USE m_wann_dipole + + IMPLICIT NONE + + TYPE(t_input), INTENT(IN) :: input + TYPE(t_kpts), INTENT(IN) :: kpts + TYPE(t_atoms), INTENT(IN) :: atoms + TYPE(t_sym), INTENT(IN) :: sym + TYPE(t_cell), INTENT(IN) :: cell + TYPE(t_oneD), INTENT(IN) :: oneD + TYPE(t_noco), INTENT(IN) :: noco + TYPE(t_wann), INTENT(INOUT) :: wann + + INTEGER :: num_wann(2) + LOGICAL :: l_nocosoc + + l_nocosoc=noco%l_noco.OR.noco%l_soc + + !-----read the input file to determine what to do + CALL wann_read_inp(input,.TRUE.,wann) + + !-----generate projection-definition-file + IF(wann%l_projgen) THEN + CALL wann_projgen(atoms%ntype,atoms%neq,atoms%nat,atoms%zatom,l_nocosoc,wann) + wann%l_stopopt=.TRUE. + ENDIF + + !-----generate k-point-files + IF(wann%l_kpointgen) THEN + CALL wann_kpointgen() + wann%l_stopopt=.TRUE. + ENDIF + IF(wann%l_w90kpointgen) THEN + CALL wann_w90kpointgen() + wann%l_stopopt=.TRUE. + ENDIF + + !-----find Wannier-irreducible part of BZ + IF(wann%l_kptsreduc)THEN + CALL wann_kptsreduc(sym%nop,sym%mrot,cell%bmat,sym%tau,input%film, oneD%odi%d1,l_nocosoc) + wann%l_stopopt=.TRUE. + ENDIF + + !-----find Wannier-irreducible part of BZ + IF(wann%l_kptsreduc2)THEN + CALL wann_kptsreduc2(wann%mhp, sym%nop,sym%mrot,cell%bmat,sym%tau,input%film, oneD%odi%d1,l_nocosoc) + wann%l_stopopt=.TRUE. + ENDIF + + !-----generate WF1.win and bkpts + IF(wann%l_prepwan90)THEN + CALL wann_wan90prep(input,kpts, 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,& + wann%l_ms,wann%l_sgwf,wann%l_socgwf, wann%aux_latt_const,wann%param_file,wann%l_dim, & + wann%wan90version) + ENDIF + + !-----calculate polarization, if not wannierize + !-----if wannierize, then calculate polarization later (after wannierize) + IF(wann%l_dipole3.AND..NOT.wann%l_wannierize)THEN + num_wann(1)=wann%band_max(1)-wann%band_min(1)+1 + num_wann(2)=wann%band_max(2)-wann%band_min(2)+1 + CALL wann_dipole3(input%jspins,cell%omtil,atoms%nat,atoms%pos, cell%amat,cell%bmat,atoms%taual,& + num_wann, atoms%ntype,atoms%neq,atoms%zatom,l_nocosoc) + wann%l_stopopt=.TRUE. + ENDIF + + !-----calculate polarization, if not wannierize + !-----if wannierize, then calculate polarization later (after wannierize) + IF(wann%l_dipole.AND..NOT.wann%l_wannierize)THEN + CALL wann_dipole(input%jspins,cell%omtil,atoms%nat,atoms%pos, cell%amat,atoms%ntype,& + atoms%neq,atoms%zatom) + wann%l_stopopt=.TRUE. + ENDIF + + IF(wann%l_stopopt) CALL juDFT_end("wann_optional done",1) ! The 1 is temporarily. Should be mpi%irank. + + END SUBROUTINE wann_optional +END MODULE m_wann_optional -- GitLab