Commit 597c372b authored by Matthias Redies's avatar Matthias Redies

kpts%pe == 0 works again

parent e34fe56c
......@@ -30,12 +30,9 @@ CONTAINS
USE m_eigen_hssetup
USE m_pot_io
USE m_eigen_diag
USE m_add_vnonlocal
USE m_subvxc
!USE m_hsefunctional
USE m_mt_setup
USE m_util
USE m_io_hybinp
!USE m_icorrkeys
USE m_eig66_io, ONLY : open_eig, write_eig, read_eig
USE m_xmlOutput
......@@ -134,26 +131,11 @@ CONTAINS
! Set up lapw list
CALL lapw%init(fi%input,fi%noco,nococonv, fi%kpts,fi%atoms,fi%sym,nk,fi%cell,l_zref, fmpi)
call timestart("Setup of H&S matrices")
CALL eigen_hssetup(jsp,fmpi,fi%hybinp,enpara,fi%input,fi%vacuum,fi%noco,nococonv,fi%sym,&
stars,fi%cell,sphhar,fi%atoms,ud,td,v,lapw,l_real,smat,hmat)
CALL eigen_hssetup(jsp,fmpi,fi,mpdata,results,vx,xcpot,enpara,nococonv,stars,sphhar,hybdat,ud,td,v,lapw,l_real,nk,smat,hmat)
CALL timestop("Setup of H&S matrices")
nvBuffer(nk,jsp) = lapw%nv(jsp)
IF(fi%hybinp%l_hybrid.OR.fi%input%l_rdmft) THEN
CALL write_eig(eig_id, nk,jsp, smat=smat)
END IF
IF(fi%hybinp%l_hybrid) THEN
IF (hybdat%l_addhf) CALL add_Vnonlocal(nk,lapw,fi,hybdat,jsp,results,xcpot,fmpi,nococonv,hmat)
IF(hybdat%l_subvxc) THEN
CALL subvxc(lapw,fi%kpts%bk(:,nk),fi%input,jsp,v%mt(:,0,:,:),fi%atoms,ud,&
mpdata,fi%hybinp,hybdat,enpara%el0,enpara%ello0,fi%sym,&
fi%cell,sphhar,stars,xcpot,fmpi,fi%oneD,hmat,vx)
END IF
END IF ! fi%hybinp%l_hybrid
l_wu=.FALSE.
ne_all=fi%input%neig
IF(ne_all < 0) ne_all = lapw%nmat
......
......@@ -9,14 +9,14 @@ CONTAINS
!> The setup of the Hamiltonian and Overlap matrices are performed here
!!
!! The following steps are executed:
!! 1. The matrices are a allocated (in the noco-case these are 2x2-arrays of matrices)
!! 1. The matrices are a allocated (in the fi%noco-case these are 2x2-arrays of matrices)
!! 2. The Interstitial contribution is calculated (in hs_int())
!! 3. The MT-part is calculated (in hsmt() )
!! 4. The vacuum part is added (in hsvac())
!! 5. The matrices are copied to the final matrix, in the noco-case the full matrix is constructed from the 4-parts.
!! 5. The matrices are copied to the final matrix, in the fi%noco-case the full matrix is constructed from the 4-parts.
SUBROUTINE eigen_hssetup(isp,fmpi,hybinp,enpara,input,vacuum,noco,nococonv,sym,&
stars,cell,sphhar,atoms,ud,td,v,lapw,l_real,smat_final,hmat_final)
SUBROUTINE eigen_hssetup(isp,fmpi,fi,mpdata,results,vx,xcpot,enpara,nococonv,stars,sphhar,hybdat,&
ud,td,v,lapw,l_real,nk,smat_final,hmat_final)
USE m_types
USE m_types_mpimat
USE m_types_gpumat
......@@ -25,25 +25,26 @@ CONTAINS
USE m_od_hsvac
USE m_hsmt
USE m_eigen_redist_matrix
USE m_add_vnonlocal
USE m_subvxc
USE m_eig66_io, ONLY : open_eig, write_eig, read_eig
IMPLICIT NONE
INTEGER,INTENT(IN) :: isp
TYPE(t_mpi),INTENT(IN) :: fmpi
TYPE(t_hybinp),INTENT(IN) :: hybinp
TYPE(t_enpara),INTENT(IN) :: enpara
TYPE(t_input),INTENT(IN) :: input
TYPE(t_vacuum),INTENT(IN) :: vacuum
TYPE(t_noco),INTENT(IN) :: noco
TYPE(t_nococonv),INTENT(IN) :: nococonv
TYPE(t_sym),INTENT(IN) :: sym
type(t_fleurinput), intent(in) :: fi
type(t_mpdata), intent(inout):: mpdata
type(t_results),intent(inout):: results
class(t_xcpot), intent(in) :: xcpot
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_cell),INTENT(IN) :: cell
TYPE(t_enpara),INTENT(IN) :: enpara
TYPE(t_nococonv),INTENT(IN) :: nococonv
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_usdus),INTENT(IN) :: ud
type(t_hybdat), intent(inout):: hybdat
TYPE(t_usdus),INTENT(INout) :: ud
TYPE(t_tlmplm),INTENT(IN) :: td
TYPE(t_lapw),INTENT(IN) :: lapw
TYPE(t_potden),INTENT(IN) :: v
TYPE(t_potden),INTENT(IN) :: v, vx
integer, intent(in) :: nk
CLASS(t_mat),ALLOCATABLE,INTENT(INOUT) :: smat_final,hmat_final
LOGICAL,INTENT(IN) :: l_real
......@@ -53,8 +54,8 @@ CONTAINS
INTEGER :: i,j,ispin,nspins
!Matrices for Hamiltonian and Overlapp
!In noco case we need 4-matrices for each spin channel
nspins=MERGE(2,1,noco%l_noco)
!In fi%noco case we need 4-matrices for each spin channel
nspins=MERGE(2,1,fi%noco%l_noco)
IF (fmpi%n_size==1) THEN
ALLOCATE(t_mat::smat(nspins,nspins),hmat(nspins,nspins))
ELSE
......@@ -62,7 +63,7 @@ CONTAINS
ENDIF
DO i=1,nspins
DO j=1,nspins
CALL smat(i,j)%init(l_real,lapw%nv(i)+atoms%nlotot,lapw%nv(j)+atoms%nlotot,fmpi%sub_comm,.false.)
CALL smat(i,j)%init(l_real,lapw%nv(i)+fi%atoms%nlotot,lapw%nv(j)+fi%atoms%nlotot,fmpi%sub_comm,.false.)
CALL hmat(i,j)%init(smat(i,j))
ENDDO
ENDDO
......@@ -70,14 +71,14 @@ CONTAINS
CALL timestart("Interstitial part")
!Generate interstitial part of Hamiltonian
CALL hs_int(input,noco,stars,lapw,fmpi,cell,isp,v%pw_w,smat,hmat)
CALL hs_int(fi%input,fi%noco,stars,lapw,fmpi,fi%cell,isp,v%pw_w,smat,hmat)
CALL timestop("Interstitial part")
CALL timestart("MT part")
!MT-part of Hamiltonian. In case of noco, we need an loop over the local spin of the atoms
!MT-part of Hamiltonian. In case of fi%noco, we need an loop over the local spin of the fi%atoms
DO i=1,nspins;DO j=1,nspins
!$acc enter data copyin(hmat(i,j),smat(i,j),hmat(i,j)%data_r,smat(i,j)%data_r,hmat(i,j)%data_c,smat(i,j)%data_c)
ENDDO;ENDDO
CALL hsmt(atoms,sym,enpara,isp,input,fmpi,noco,nococonv,cell,lapw,ud,td,smat,hmat)
CALL hsmt(fi%atoms,fi%sym,enpara,isp,fi%input,fmpi,fi%noco,nococonv,fi%cell,lapw,ud,td,smat,hmat)
DO i=1,nspins;DO j=1,nspins;if (hmat(1,1)%l_real) THEN
!$acc exit data copyout(hmat(i,j)%data_r,smat(i,j)%data_r)
ELSE
......@@ -86,21 +87,41 @@ CONTAINS
CALL timestop("MT part")
!Vacuum contributions
IF (input%film) THEN
IF (fi%input%film) THEN
CALL timestart("Vacuum part")
CALL hsvac(vacuum,stars,fmpi,isp,input,v,enpara%evac,cell,&
lapw,sym, noco,nococonv,hmat,smat)
CALL hsvac(fi%vacuum,stars,fmpi,isp,fi%input,v,enpara%evac,fi%cell,&
lapw,fi%sym, fi%noco,nococonv,hmat,smat)
CALL timestop("Vacuum part")
ENDIF
!Deal with hybrid code
IF(fi%hybinp%l_hybrid.OR.fi%input%l_rdmft) THEN
if(any(shape(smat) /= 1)) then
call judft_error("Hybrid doesn't do noco.")
endif
CALL write_eig(hybdat%eig_id, nk,isp, smat=smat(1,1))
END IF
IF(fi%hybinp%l_hybrid) THEN
IF (hybdat%l_addhf) CALL add_Vnonlocal(nk,lapw,fi,hybdat,isp,results,xcpot,fmpi,nococonv,hmat(1,1))
IF(hybdat%l_subvxc) THEN
CALL subvxc(lapw,fi%kpts%bk(:,nk),fi%input,isp,v%mt(:,0,:,:),fi%atoms,ud,&
mpdata,fi%hybinp,hybdat,enpara%el0,enpara%ello0,fi%sym,&
fi%cell,sphhar,stars,xcpot,fmpi,fi%oneD,hmat(1,1),vx)
END IF
END IF ! fi%hybinp%l_hybrid
!Now copy the data into final matrix
! Collect the four noco parts into a single matrix
! Collect the four fi%noco parts into a single matrix
! In collinear case only a copy is done
! In the parallel case also a redistribution happens
ALLOCATE(smat_final,mold=smat(1,1))
ALLOCATE(hmat_final,mold=smat(1,1))
CALL timestart("Matrix redistribution")
CALL eigen_redist_matrix(fmpi,lapw,atoms,smat,smat_final)
CALL eigen_redist_matrix(fmpi,lapw,atoms,hmat,hmat_final,smat_final)
CALL eigen_redist_matrix(fmpi,lapw,fi%atoms,smat,smat_final)
CALL eigen_redist_matrix(fmpi,lapw,fi%atoms,hmat,hmat_final,smat_final)
CALL timestop("Matrix redistribution")
END SUBROUTINE eigen_hssetup
......
......@@ -28,7 +28,6 @@ CONTAINS
call hybdat%free()
call hybdat%allocate(fi, mpdata%num_radfun_per_l)
hybdat%eig_id = eig_id
! pre-calculate gaunt coefficients
hybdat%fac(0) = 1
hybdat%sfac(0) = 1
......
......@@ -196,6 +196,7 @@ CONTAINS
l_olap = fi%hybinp%l_hybrid .OR. fi%input%l_rdmft
eig_id=open_eig(fmpi%mpi_comm,lapw_dim_nbasfcn,fi%input%neig,fi%kpts%nkpt,wannierspin,&
fi%noco%l_noco,.NOT.fi%INPUT%eig66(1),l_real,fi%noco%l_soc,fi%INPUT%eig66(1),l_olap,fmpi%n_size)
hybdat%eig_id = eig_id
!Rotate cdn to local frame if specified.
#ifdef CPP_CHASE
......
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