Commit 656013e7 authored by Gregor Michalicek's avatar Gregor Michalicek

Add eig array to t_results type

parent 9d12850f
......@@ -308,9 +308,12 @@ CONTAINS
! Synchronizes the RMA operations
CALL MPI_BARRIER(mpi%mpi_comm,ie)
#endif
!IF (l_evp.AND.(isize.GT.1)) THEN
! eig(1:noccbd) = eig(n_start:n_end)
!ENDIF
IF (noco%l_noco) THEN
eig(1:noccbd) = results%eig(n_start:n_end,ikpt,1)
ELSE
eig(1:noccbd) = results%eig(n_start:n_end,ikpt,jspin)
END IF
IF (vacuum%nstm.EQ.3.AND.input%film) THEN
CALL nstm3(sym,atoms,vacuum,stars,ikpt,lapw%nv(jspin),input,jspin,kpts,&
......@@ -351,13 +354,13 @@ CONTAINS
IF ((sliceplot%e1s.EQ.0.0) .AND. (sliceplot%e2s.EQ.0.0)) THEN
IF (mpi%irank==0) WRITE (16,FMT='(a,i5,f10.5)') 'slice: eigenvalue nr.',&
sliceplot%nnne,eig(sliceplot%nnne)
nslibd = nslibd + 1
eig(nslibd) = eig(sliceplot%nnne)
we(nslibd) = we(sliceplot%nnne)
nslibd = 1
eig(1) = eig(sliceplot%nnne)
we(1) = we(sliceplot%nnne)
if (zmat%l_real) Then
zMat%z_r(:,nslibd) = zMat%z_r(:,sliceplot%nnne)
zMat%z_r(:,1) = zMat%z_r(:,sliceplot%nnne)
else
zMat%z_c(:,nslibd) = zMat%z_c(:,sliceplot%nnne)
zMat%z_c(:,1) = zMat%z_c(:,sliceplot%nnne)
endif
ELSE
DO i = 1,nbands
......
......@@ -94,22 +94,13 @@ CONTAINS
!
INTEGER nn,n
INTEGER ierr(3)
INTEGER intBuffer(kpts%nkpt,input%jspins)
INTEGER :: neigBuffer(kpts%nkpt,input%jspins)
! .. variables for HF or hybrid functional calculation ..
!
INTEGER :: comm(kpts%nkpt),irank2(kpts%nkpt),isize2(kpts%nkpt)
!
!
! --> Allocate
!
call ud%init(atoms,DIMENSION%jspd)
ALLOCATE ( eig(DIMENSION%neigd),bkpt(3) )
!
! --> some parameters first
ALLOCATE (eig(DIMENSION%neigd),bkpt(3))
l_real=sym%invs.AND..NOT.noco%l_noco
!check if z-reflection trick can be used
......@@ -137,8 +128,9 @@ CONTAINS
!
CALL mt_setup(atoms,sym,sphhar,input,noco,enpara,inden,v,mpi,results,DIMENSION,td,ud)
intBuffer = 0
neigBuffer = 0
results%neig = 0
results%eig = 1.0e300
DO jsp = 1,MERGE(1,input%jspins,noco%l_noco)
k_loop:DO nk = mpi%n_start,kpts%nkpt,mpi%n_stride
......@@ -190,7 +182,7 @@ CONTAINS
ENDIF
CALL write_eig(eig_id, nk,jsp,ne_found,ne_all,&
eig(:ne_found),n_start=mpi%n_size,n_end=mpi%n_rank,zmat=zMat)
intBuffer(nk,jsp) = ne_found
neigBuffer(nk,jsp) = ne_found
#if defined(CPP_MPI)
!RMA synchronization
CALL MPI_BARRIER(mpi%MPI_COMM,ierr)
......@@ -200,11 +192,24 @@ CONTAINS
END DO ! spin loop ends
#ifdef CPP_MPI
CALL MPI_ALLREDUCE(intBuffer,results%neig,kpts%nkpt*input%jspins,MPI_INTEGER,MPI_SUM,mpi%sub_comm,ierr)
CALL MPI_ALLREDUCE(neigBuffer,results%neig,kpts%nkpt*input%jspins,MPI_INTEGER,MPI_SUM,mpi%sub_comm,ierr)
CALL MPI_BARRIER(mpi%MPI_COMM,ierr)
#else
results%neig(:,:) = intBuffer(:,:)
results%neig(:,:) = neigBuffer(:,:)
#endif
! Sorry for the following strange workaround to fill the results%eig array.
! At some point someone should have a closer look at how the eigenvalues are
! distributed and fill the array without using the eigenvalue-IO.
DO jsp = 1,MERGE(1,input%jspins,noco%l_noco)
DO nk = 1,kpts%nkpt
CALL read_eig(eig_id,nk,jsp,results%neig(nk,jsp),results%eig(:,nk,jsp))
#ifdef CPP_MPI
CALL MPI_BARRIER(mpi%MPI_COMM,ierr)
#endif
END DO
END DO
!IF (hybrid%l_hybrid.OR.hybrid%l_calhf) CALL close_eig(eig_id)
IF( input%jspins .EQ. 1 .AND. hybrid%l_hybrid ) THEN
......
......@@ -62,6 +62,7 @@ IMPLICIT NONE
TYPE(t_energy_hf) :: te_hfex
REAL :: te_hfex_loc(2)
REAL, ALLOCATABLE :: w_iks(:,:,:)
REAL, ALLOCATABLE :: eig(:,:,:)
INTEGER, ALLOCATABLE :: neig(:,:) ! neig(nkpts,jspins) number of calculated eigenvalues for each k point, spin
CONTAINS
......@@ -147,18 +148,21 @@ SUBROUTINE results_init(thisResults,dimension,input,atoms,kpts,noco)
thisResults%bandgap = 0.0
thisResults%ef = 0.0
neigd2 = dimension%neigd
IF (noco%l_soc.AND.(.NOT.noco%l_noco)) neigd2 = 2*DIMENSION%neigd
neigd2 = MIN(dimension%neigd,dimension%nbasfcn)
! neigd2 = dimension%neigd
IF (noco%l_soc.AND.(.NOT.noco%l_noco)) neigd2 = 2*neigd2
ALLOCATE (thisResults%force(3,atoms%ntype,input%jspins))
ALLOCATE (thisResults%force_old(3,atoms%ntype))
ALLOCATE (thisResults%w_iks(neigd2,kpts%nkpt,input%jspins))
ALLOCATE (thisResults%neig(kpts%nkpt,input%jspins))
ALLOCATE (thisResults%eig(neigd2,kpts%nkpt,input%jspins))
thisResults%force = 0.0
thisResults%force_old = 0.0
thisResults%w_iks = 0.0
thisResults%neig = 0
thisResults%eig = 0.0
END SUBROUTINE results_init
......
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