Commit 1b03568c authored by Gregor Michalicek's avatar Gregor Michalicek

Fix segmentation fault for setups in which numbands is larger than the basis set size

parent bdff1618
......@@ -74,7 +74,7 @@ CONTAINS
INTEGER,INTENT(IN) :: eig_id
! Local Scalars
INTEGER jsp,nk,nred,ne_all,ne_found
INTEGER jsp,nk,nred,ne_all,ne_found,neigd2
INTEGER ne, nk_i
INTEGER isp,i,j,err
LOGICAL l_wu,l_file,l_real,l_zref
......@@ -257,18 +257,19 @@ CONTAINS
END DO k_loop
END DO ! spin loop ends
neigd2 = MIN(dimension%neigd,dimension%nbasfcn)
#ifdef CPP_MPI
IF (banddos%unfoldband) THEN
results%unfolding_weights = CMPLX(0.0,0.0)
CALL MPI_ALLREDUCE(unfoldingBuffer,results%unfolding_weights,SIZE(results%unfolding_weights,1)*SIZE(results%unfolding_weights,2)*SIZE(results%unfolding_weights,3),CPP_MPI_COMPLEX,MPI_SUM,mpi%mpi_comm,ierr)
END IF
CALL MPI_ALLREDUCE(neigBuffer,results%neig,kpts%nkpt*input%jspins,MPI_INTEGER,MPI_SUM,mpi%mpi_comm,ierr)
CALL MPI_ALLREDUCE(eigBuffer(:dimension%neigd,:,:),results%eig(:dimension%neigd,:,:),dimension%neigd*kpts%nkpt*input%jspins,MPI_DOUBLE_PRECISION,MPI_MIN,mpi%mpi_comm,ierr)
CALL MPI_ALLREDUCE(eigBuffer(:neigd2,:,:),results%eig(:neigd2,:,:),neigd2*kpts%nkpt*input%jspins,MPI_DOUBLE_PRECISION,MPI_MIN,mpi%mpi_comm,ierr)
CALL MPI_BARRIER(mpi%MPI_COMM,ierr)
#else
results%neig(:,:) = neigBuffer(:,:)
results%eig(:dimension%neigd,:,:) = eigBuffer(:dimension%neigd,:,:)
results%eig(:neigd2,:,:) = eigBuffer(:neigd2,:,:)
results%unfolding_weights(:,:,:) = unfoldingBuffer(:,:,:)
#endif
......
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