Commit 337e9427 authored by Daniel Wortmann's avatar Daniel Wortmann

Merge branch 'develop' of iffgit.fz-juelich.de:fleur/fleur into develop

Conflicts:
	main/fleur_init.F90
parents 598c51a1 41c649b8
......@@ -16,7 +16,7 @@ build-gfortran-hdf5:
paths:
- build
script:
- cd /builds/fleur/fleur; ./configure.sh GITLAB; cd build; make
- cd /builds/fleur/fleur; ./configure.sh GITLAB; cd build; make -j 4
# only:
# - schedules
# - triggers
......@@ -100,7 +100,7 @@ build-intel:
- build.intel
script:
- set +e && source compilervars.sh intel64 && set -e ; ulimit -s unlimited
- cd /builds/fleur/fleur; FC=mpiifort FLEUR_LIBRARIES="-lmkl_scalapack_lp64;-lmkl_blacs_intelmpi_lp64" ./configure.sh -t -l intel INTEL_MPI ; cd build.intel; make
- cd /builds/fleur/fleur; FC=mpiifort FLEUR_LIBRARIES="-lmkl_scalapack_lp64;-lmkl_blacs_intelmpi_lp64" ./configure.sh -t -l intel INTEL_MPI ; cd build.intel; make -j 4
only:
- schedules
- triggers
......@@ -133,7 +133,7 @@ gfortran-coverage:
paths:
- build
script:
- cd /builds/fleur/fleur; ./configure.sh -l coverage -flags --coverage GITLAB; cd build.coverage; make
- cd /builds/fleur/fleur; ./configure.sh -l coverage -flags --coverage GITLAB; cd build.coverage; make -j 4
- lcov --capture --initial -d CMakeFiles -o baseline.info
- ulimit -s unlimited ;export juDFT_MPI="mpirun -n 2 --allow-run-as-root ";ctest
- lcov --capture -d CMakeFiles -o after.info
......
......@@ -62,7 +62,6 @@ CONTAINS
ENDIF
!$OMP PARALLEL DEFAULT(none) &
!$OMP SHARED(usdus,rho,moments,qmtl) &
!$OMP SHARED(atoms,jsp_start,jsp_end,enpara,vr,denCoeffs,sphhar)&
!$OMP SHARED(orb,noco,denCoeffsOffdiag,jspd)&
......
MODULE m_cored
CONTAINS
SUBROUTINE cored(&
& input,jspin,atoms,&
& rho,DIMENSION,&
& sphhar,&
& vr,&
& qint,rhc,tec,seig)
SUBROUTINE cored(&
& input,jspin,atoms,&
& rho,DIMENSION,&
& sphhar,&
& vr,&
& qint,rhc,tec,seig)
! *******************************************************
! ***** set up the core densities for compounds. *****
! ***** d.d.koelling *****
! *******************************************************
USE m_juDFT
USE m_intgr, ONLY : intgr3,intgr0,intgr1
USE m_constants, ONLY : c_light,sfp_const
USE m_setcor
USE m_differ
USE m_types
USE m_xmlOutput
IMPLICIT NONE
TYPE(t_dimension),INTENT(IN) :: DIMENSION
TYPE(t_input),INTENT(IN) :: input
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_atoms),INTENT(IN) :: atoms
!
! .. Scalar Arguments ..
INTEGER, INTENT (IN) :: jspin
REAL, INTENT (OUT) :: seig
! ..
! .. Array Arguments ..
REAL, INTENT(IN) :: vr(atoms%jmtd,atoms%ntype)
REAL, INTENT(INOUT) :: rho(atoms%jmtd,0:sphhar%nlhd,atoms%ntype,input%jspins)
REAL, INTENT(INOUT) :: rhc(DIMENSION%msh,atoms%ntype,input%jspins)
REAL, INTENT(INOUT) :: qint(atoms%ntype,input%jspins)
REAL, INTENT(INOUT) :: tec(atoms%ntype,input%jspins)
! ..
! .. Local Scalars ..
REAL e,fj,fl,fn,q,rad,rhos,rhs,sea,sume,t2
REAL d,dxx,rn,rnot,z,t1,rr,r,lambd,c,bmu,weight
INTEGER i,j,jatom,korb,n,ncmsh,nm,nm1,nst ,l,ierr
! ..
! .. Local Arrays ..
REAL rhcs(DIMENSION%msh),rhoc(DIMENSION%msh),rhoss(DIMENSION%msh),vrd(DIMENSION%msh),f(0:3)
REAL occ(DIMENSION%nstd),a(DIMENSION%msh),b(DIMENSION%msh),ain(DIMENSION%msh),ahelp(DIMENSION%msh)
REAL occ_h(DIMENSION%nstd,2)
INTEGER kappa(DIMENSION%nstd),nprnc(DIMENSION%nstd)
CHARACTER(LEN=20) :: attributes(6)
REAL stateEnergies(29)
! ..
c = c_light(1.0)
seig = 0.
!
IF (input%frcor) THEN
DO n = 1,atoms%ntype
rnot = atoms%rmsh(1,n) ; dxx = atoms%dx(n)
ncmsh = NINT( LOG( (atoms%rmt(n)+10.0)/rnot ) / dxx + 1 )
ncmsh = MIN( ncmsh, DIMENSION%msh )
! ---> update spherical charge density
DO i = 1,atoms%jri(n)
rhoc(i) = rhc(i,n,jspin)
rho(i,0,n,jspin) = rho(i,0,n,jspin) + rhoc(i)/sfp_const
ENDDO
! ---> for total energy calculations, determine the sum of the
! ---> eigenvalues by requiring that the core kinetic energy
! ---> remains constant.
DO i = 1,atoms%jri(n)
rhoc(i) = rhoc(i)*vr(i,n)/atoms%rmsh(i,n)
ENDDO
nm = atoms%jri(n)
CALL intgr3(rhoc,atoms%rmsh(1,n),atoms%dx(n),nm,rhos)
sea = tec(n,jspin) + rhos
WRITE (16,FMT=8030) n,jspin,tec(n,jspin),sea
WRITE (6,FMT=8030) n,jspin,tec(n,jspin),sea
seig = seig + atoms%neq(n)*sea
ENDDO
RETURN
END IF
! *******************************************************
! ***** set up the core densities for compounds. *****
! ***** d.d.koelling *****
! *******************************************************
USE m_juDFT
USE m_intgr, ONLY : intgr3,intgr0,intgr1
USE m_constants, ONLY : c_light,sfp_const
USE m_setcor
USE m_differ
USE m_types
USE m_xmlOutput
IMPLICIT NONE
TYPE(t_dimension),INTENT(IN) :: DIMENSION
TYPE(t_input),INTENT(IN) :: input
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_atoms),INTENT(IN) :: atoms
!
! .. Scalar Arguments ..
INTEGER, INTENT (IN) :: jspin
REAL, INTENT (OUT) :: seig
! ..
! .. Array Arguments ..
REAL, INTENT(IN) :: vr(atoms%jmtd,atoms%ntype)
REAL, INTENT(INOUT) :: rho(atoms%jmtd,0:sphhar%nlhd,atoms%ntype,input%jspins)
REAL, INTENT(INOUT) :: rhc(DIMENSION%msh,atoms%ntype,input%jspins)
REAL, INTENT(INOUT) :: qint(atoms%ntype,input%jspins)
REAL, INTENT(INOUT) :: tec(atoms%ntype,input%jspins)
! ..
! .. Local Scalars ..
REAL e,fj,fl,fn,q,rad,rhos,rhs,sea,sume,t2
REAL d,dxx,rn,rnot,z,t1,rr,r,lambd,c,bmu,weight
INTEGER i,j,jatom,korb,n,ncmsh,nm,nm1,nst ,l,ierr
! ..
! .. Local Arrays ..
! ---> set up densities
DO jatom = 1,atoms%ntype
sume = 0.
z = atoms%zatom(jatom)
! rn = rmt(jatom)
dxx = atoms%dx(jatom)
bmu = 0.0
CALL setcor(jatom,input%jspins,atoms,input,bmu,nst,kappa,nprnc,occ_h)
IF ((bmu > 99.)) THEN
occ(1:nst) = input%jspins * occ_h(1:nst,jspin)
ELSE
occ(1:nst) = occ_h(1:nst,1)
ENDIF
rnot = atoms%rmsh(1,jatom)
d = EXP(atoms%dx(jatom))
ncmsh = NINT( LOG( (atoms%rmt(jatom)+10.0)/rnot ) / dxx + 1 )
ncmsh = MIN( ncmsh, DIMENSION%msh )
rn = rnot* (d** (ncmsh-1))
WRITE (6,FMT=8000) z,rnot,dxx,atoms%jri(jatom)
WRITE (16,FMT=8000) z,rnot,dxx,atoms%jri(jatom)
DO j = 1,atoms%jri(jatom)
rhoss(j) = 0.
vrd(j) = vr(j,jatom)
ENDDO
!
IF (input%l_core_confpot) THEN
!---> linear extension of the potential with slope t1 / a.u.
t1=0.125
t1 = MAX( (vrd(atoms%jri(jatom)) - vrd(atoms%jri(jatom)-1)*d)*&
d / (atoms%rmt(jatom)**2 * (d-1) ) , t1)
t2=vrd(atoms%jri(jatom))/atoms%rmt(jatom)-atoms%rmt(jatom)*t1
rr = atoms%rmt(jatom)
ELSE
t2 = vrd(atoms%jri(jatom)) / ( atoms%jri(jatom) - ncmsh )
ENDIF
IF ( atoms%jri(jatom) < ncmsh) THEN
DO i = atoms%jri(jatom) + 1,ncmsh
rhoss(i) = 0.
IF (input%l_core_confpot) THEN
rr = d*rr
vrd(i) = rr*( t2 + rr*t1 )
! vrd(i) = 2*vrd(jri(jatom)) - rr*( t2 + rr*t1 )
ELSE
vrd(i) = vrd(atoms%jri(jatom)) + t2* (i-atoms%jri(jatom))
ENDIF
!
ENDDO
END IF
REAL rhcs(DIMENSION%msh),rhoc(DIMENSION%msh),rhoss(DIMENSION%msh),vrd(DIMENSION%msh),f(0:3)
REAL occ(DIMENSION%nstd),a(DIMENSION%msh),b(DIMENSION%msh),ain(DIMENSION%msh),ahelp(DIMENSION%msh)
REAL occ_h(DIMENSION%nstd,2)
INTEGER kappa(DIMENSION%nstd),nprnc(DIMENSION%nstd)
CHARACTER(LEN=20) :: attributes(6)
REAL stateEnergies(29)
! ..
c = c_light(1.0)
seig = 0.
!
IF (input%frcor) THEN
DO n = 1,atoms%ntype
rnot = atoms%rmsh(1,n) ; dxx = atoms%dx(n)
ncmsh = NINT( LOG( (atoms%rmt(n)+10.0)/rnot ) / dxx + 1 )
ncmsh = MIN( ncmsh, DIMENSION%msh )
! ---> update spherical charge density
DO i = 1,atoms%jri(n)
rhoc(i) = rhc(i,n,jspin)
rho(i,0,n,jspin) = rho(i,0,n,jspin) + rhoc(i)/sfp_const
ENDDO
! ---> for total energy calculations, determine the sum of the
! ---> eigenvalues by requiring that the core kinetic energy
! ---> remains constant.
DO i = 1,atoms%jri(n)
rhoc(i) = rhoc(i)*vr(i,n)/atoms%rmsh(i,n)
ENDDO
nm = atoms%jri(n)
CALL intgr3(rhoc,atoms%rmsh(1,n),atoms%dx(n),nm,rhos)
sea = tec(n,jspin) + rhos
WRITE (16,FMT=8030) n,jspin,tec(n,jspin),sea
WRITE (6,FMT=8030) n,jspin,tec(n,jspin),sea
seig = seig + atoms%neq(n)*sea
ENDDO
RETURN
END IF
nst = atoms%ncst(jatom) ! for lda+U
! ---> set up densities
DO jatom = 1,atoms%ntype
sume = 0.
z = atoms%zatom(jatom)
! rn = rmt(jatom)
dxx = atoms%dx(jatom)
bmu = 0.0
CALL setcor(jatom,input%jspins,atoms,input,bmu,nst,kappa,nprnc,occ_h)
IF ((bmu > 99.)) THEN
occ(1:nst) = input%jspins * occ_h(1:nst,jspin)
ELSE
occ(1:nst) = occ_h(1:nst,1)
ENDIF
rnot = atoms%rmsh(1,jatom)
d = EXP(atoms%dx(jatom))
ncmsh = NINT( LOG( (atoms%rmt(jatom)+10.0)/rnot ) / dxx + 1 )
ncmsh = MIN( ncmsh, DIMENSION%msh )
rn = rnot* (d** (ncmsh-1))
WRITE (6,FMT=8000) z,rnot,dxx,atoms%jri(jatom)
WRITE (16,FMT=8000) z,rnot,dxx,atoms%jri(jatom)
DO j = 1,atoms%jri(jatom)
rhoss(j) = 0.
vrd(j) = vr(j,jatom)
ENDDO
!
IF (input%l_core_confpot) THEN
!---> linear extension of the potential with slope t1 / a.u.
t1=0.125
t1 = MAX( (vrd(atoms%jri(jatom)) - vrd(atoms%jri(jatom)-1)*d)*&
d / (atoms%rmt(jatom)**2 * (d-1) ) , t1)
t2=vrd(atoms%jri(jatom))/atoms%rmt(jatom)-atoms%rmt(jatom)*t1
rr = atoms%rmt(jatom)
ELSE
t2 = vrd(atoms%jri(jatom)) / ( atoms%jri(jatom) - ncmsh )
ENDIF
IF ( atoms%jri(jatom) < ncmsh) THEN
DO i = atoms%jri(jatom) + 1,ncmsh
rhoss(i) = 0.
IF (input%l_core_confpot) THEN
rr = d*rr
vrd(i) = rr*( t2 + rr*t1 )
! vrd(i) = 2*vrd(jri(jatom)) - rr*( t2 + rr*t1 )
ELSE
vrd(i) = vrd(atoms%jri(jatom)) + t2* (i-atoms%jri(jatom))
ENDIF
!
ENDDO
END IF
IF (input%gw==1 .OR. input%gw==3)&
& WRITE(15) nst,atoms%rmsh(1:atoms%jri(jatom),jatom)
nst = atoms%ncst(jatom) ! for lda+U
stateEnergies = 0.0
DO korb = 1,nst
IF (occ(korb) /= 0.0) THEN
fn = nprnc(korb)
fj = iabs(kappa(korb)) - .5e0
weight = 2*fj + 1.e0
IF (bmu > 99.) weight = occ(korb)
fl = fj + (.5e0)*isign(1,kappa(korb))
e = -2* (z/ (fn+fl))**2
CALL differ(fn,fl,fj,c,z,dxx,rnot,rn,d,ncmsh,vrd, e, a,b,ierr)
stateEnergies(korb) = e
WRITE (6,FMT=8010) fn,fl,fj,e,weight
WRITE (16,FMT=8010) fn,fl,fj,e,weight
IF (ierr/=0) CALL juDFT_error("error in core-level routine" ,calledby ="cored")
IF (input%gw==1 .OR. input%gw==3) WRITE (15) NINT(fl),weight,e,&
a(1:atoms%jri(jatom)),b(1:atoms%jri(jatom))
IF (input%gw==1 .OR. input%gw==3)&
& WRITE(15) nst,atoms%rmsh(1:atoms%jri(jatom),jatom)
sume = sume + weight*e/input%jspins
DO j = 1,ncmsh
rhcs(j) = weight* (a(j)**2+b(j)**2)
rhoss(j) = rhoss(j) + rhcs(j)
ENDDO
ENDIF
ENDDO
stateEnergies = 0.0
DO korb = 1,nst
IF (occ(korb) /= 0.0) THEN
fn = nprnc(korb)
fj = iabs(kappa(korb)) - .5e0
weight = 2*fj + 1.e0
IF (bmu > 99.) weight = occ(korb)
fl = fj + (.5e0)*isign(1,kappa(korb))
e = -2* (z/ (fn+fl))**2
CALL differ(fn,fl,fj,c,z,dxx,rnot,rn,d,ncmsh,vrd, e, a,b,ierr)
stateEnergies(korb) = e
WRITE (6,FMT=8010) fn,fl,fj,e,weight
WRITE (16,FMT=8010) fn,fl,fj,e,weight
IF (ierr/=0) CALL juDFT_error("error in core-level routine" ,calledby ="cored")
IF (input%gw==1 .OR. input%gw==3) WRITE (15) NINT(fl),weight,e,&
a(1:atoms%jri(jatom)),b(1:atoms%jri(jatom))
sume = sume + weight*e/input%jspins
DO j = 1,ncmsh
rhcs(j) = weight* (a(j)**2+b(j)**2)
rhoss(j) = rhoss(j) + rhcs(j)
ENDDO
ENDIF
ENDDO
! ---->update spherical charge density rho with the core density.
! ---->for spin-polarized (jspins=2), take only half the density
nm = atoms%jri(jatom)
DO j = 1,nm
rhoc(j) = rhoss(j)/input%jspins
rho(j,0,jatom,jspin) = rho(j,0,jatom,jspin) + rhoc(j)/sfp_const
ENDDO
! ---->update spherical charge density rho with the core density.
! ---->for spin-polarized (jspins=2), take only half the density
nm = atoms%jri(jatom)
DO j = 1,nm
rhoc(j) = rhoss(j)/input%jspins
rho(j,0,jatom,jspin) = rho(j,0,jatom,jspin) + rhoc(j)/sfp_const
ENDDO
rhc(1:ncmsh,jatom,jspin) = rhoss(1:ncmsh) / input%jspins
rhc(ncmsh+1:DIMENSION%msh,jatom,jspin) = 0.0
rhc(1:ncmsh,jatom,jspin) = rhoss(1:ncmsh) / input%jspins
rhc(ncmsh+1:DIMENSION%msh,jatom,jspin) = 0.0
seig = seig + atoms%neq(jatom)*sume
DO i = 1,nm
rhoc(i) = rhoc(i)*vr(i,jatom)/atoms%rmsh(i,jatom)
ENDDO
CALL intgr3(rhoc,atoms%rmsh(1,jatom),atoms%dx(jatom),nm,rhs)
tec(jatom,jspin) = sume - rhs
WRITE (6,FMT=8030) jatom,jspin,tec(jatom,jspin),sume
WRITE (16,FMT=8030) jatom,jspin,tec(jatom,jspin),sume
seig = seig + atoms%neq(jatom)*sume
DO i = 1,nm
rhoc(i) = rhoc(i)*vr(i,jatom)/atoms%rmsh(i,jatom)
ENDDO
CALL intgr3(rhoc,atoms%rmsh(1,jatom),atoms%dx(jatom),nm,rhs)
tec(jatom,jspin) = sume - rhs
WRITE (6,FMT=8030) jatom,jspin,tec(jatom,jspin),sume
WRITE (16,FMT=8030) jatom,jspin,tec(jatom,jspin),sume
! ---> simpson integration
rad = atoms%rmt(jatom)
q = rad*rhoss(nm)/2.
DO nm1 = nm + 1,ncmsh - 1,2
rad = d*rad
q = q + 2*rad*rhoss(nm1)
rad = d*rad
q = q + rad*rhoss(nm1+1)
ENDDO
q = 2*q*dxx/3
!+sb
WRITE (6,FMT=8020) q/input%jspins
WRITE (16,FMT=8020) q/input%jspins
!-sb
qint(jatom,jspin) = q*atoms%neq(jatom)
attributes = ''
WRITE(attributes(1),'(i0)') jatom
WRITE(attributes(2),'(i0)') NINT(z)
WRITE(attributes(3),'(i0)') jspin
WRITE(attributes(4),'(f18.10)') tec(jatom,jspin)
WRITE(attributes(5),'(f18.10)') sume
WRITE(attributes(6),'(f9.6)') q/input%jspins
CALL openXMLElementForm('coreStates',(/'atomType ','atomicNumber ','spin ','kinEnergy ',&
'eigValSum ','lostElectrons'/),&
attributes,RESHAPE((/8,12,4,9,9,13,6,3,1,18,18,9/),(/6,2/)))
DO korb = 1, atoms%ncst(jatom)
fj = iabs(kappa(korb)) - .5e0
weight = 2*fj + 1.e0
IF (bmu > 99.) weight = occ(korb)
fl = fj + (.5e0)*isign(1,kappa(korb))
attributes = ''
WRITE(attributes(1),'(i0)') nprnc(korb)
WRITE(attributes(2),'(i0)') NINT(fl)
WRITE(attributes(3),'(f4.1)') fj
WRITE(attributes(4),'(f20.10)') stateEnergies(korb)
WRITE(attributes(5),'(f15.10)') weight
CALL writeXMLElementForm('state',(/'n ','l ','j ','energy','weight'/),&
attributes(1:5),RESHAPE((/1,1,1,6,6,2,2,4,20,15/),(/5,2/)))
END DO
CALL closeXMLElement('coreStates')
ENDDO
! ---> simpson integration
rad = atoms%rmt(jatom)
q = rad*rhoss(nm)/2.
DO nm1 = nm + 1,ncmsh - 1,2
rad = d*rad
q = q + 2*rad*rhoss(nm1)
rad = d*rad
q = q + rad*rhoss(nm1+1)
ENDDO
q = 2*q*dxx/3
!+sb
WRITE (6,FMT=8020) q/input%jspins
WRITE (16,FMT=8020) q/input%jspins
!-sb
qint(jatom,jspin) = q*atoms%neq(jatom)
attributes = ''
WRITE(attributes(1),'(i0)') jatom
WRITE(attributes(2),'(i0)') NINT(z)
WRITE(attributes(3),'(i0)') jspin
WRITE(attributes(4),'(f18.10)') tec(jatom,jspin)
WRITE(attributes(5),'(f18.10)') sume
WRITE(attributes(6),'(f9.6)') q/input%jspins
CALL openXMLElementForm('coreStates',(/'atomType ','atomicNumber ','spin ','kinEnergy ',&
'eigValSum ','lostElectrons'/),&
attributes,RESHAPE((/8,12,4,9,9,13,6,3,1,18,18,9/),(/6,2/)))
DO korb = 1, atoms%ncst(jatom)
fj = iabs(kappa(korb)) - .5e0
weight = 2*fj + 1.e0
IF (bmu > 99.) weight = occ(korb)
fl = fj + (.5e0)*isign(1,kappa(korb))
attributes = ''
WRITE(attributes(1),'(i0)') nprnc(korb)
WRITE(attributes(2),'(i0)') NINT(fl)
WRITE(attributes(3),'(f4.1)') fj
WRITE(attributes(4),'(f20.10)') stateEnergies(korb)
WRITE(attributes(5),'(f15.10)') weight
CALL writeXMLElementForm('state',(/'n ','l ','j ','energy','weight'/),&
attributes(1:5),RESHAPE((/1,1,1,6,6,2,2,4,20,15/),(/5,2/)))
END DO
CALL closeXMLElement('coreStates')
ENDDO
RETURN
RETURN
8000 FORMAT (/,/,10x,'z=',f4.0,5x,'r(1)=',e14.6,5x,'dx=',f9.6,5x,&
& 'm.t.index=',i4,/,15x,'n',4x,'l',5x,'j',4x,'energy',7x,&
& 'weight')
8010 FORMAT (12x,2f5.0,f6.1,f10.4,f12.4)
8020 FORMAT (f20.8,' electrons lost from core.')
8030 FORMAT (10x,'atom type',i3,' (spin',i2,') ',/,10x,&
& 'kinetic energy=',e20.12,5x,'sum of the eigenvalues=',&
& e20.12)
END SUBROUTINE cored
8000 FORMAT (/,/,10x,'z=',f4.0,5x,'r(1)=',e14.6,5x,'dx=',f9.6,5x,&
& 'm.t.index=',i4,/,15x,'n',4x,'l',5x,'j',4x,'energy',7x,&
& 'weight')
8010 FORMAT (12x,2f5.0,f6.1,f10.4,f12.4)
8020 FORMAT (f20.8,' electrons lost from core.')
8030 FORMAT (10x,'atom type',i3,' (spin',i2,') ',/,10x,&
& 'kinetic energy=',e20.12,5x,'sum of the eigenvalues=',&
& e20.12)
END SUBROUTINE cored
END MODULE m_cored
......@@ -66,6 +66,7 @@ CONTAINS
USE m_types_gpumat
USE m_matrix_copy
USE m_cusolver_diag
USE m_judft_usage
IMPLICIT NONE
#ifdef CPP_MPI
include 'mpif.h'
......@@ -108,6 +109,7 @@ CONTAINS
CALL timestart("Diagonalization")
!Select the solver
CALL add_usage_data("diag-solver", priv_select_solver(parallel))
SELECT CASE (priv_select_solver(parallel))
CASE (diag_elpa)
CALL elpa_diag(hmat,smat,ne,eig,ev)
......
......@@ -88,7 +88,6 @@ CONTAINS
#else
CALL get_elpa_row_col_comms(hmat%blacsdata%mpi_com, hmat%blacsdata%myrow, hmat%blacsdata%mycol,mpi_comm_rows, mpi_comm_cols)
#endif
!print *,"creating ELPA comms -- done"
num2=ne !no of states solved for
......@@ -130,13 +129,16 @@ CONTAINS
print *, "elpa uses " // elpa_int_value_to_string("complex_kernel", kernel) // " kernel"
endif
#endif
!print *,"Before elpa"
!ELPA -start here
! Solive generalized preblem
! Solve generalized problem
!
! 1. Calculate Cholesky factorization of Matrix S = U**T * U
! and invert triangular matrix U
! and invert triangular matrix U.
! Cholesky factorization:
! Only upper triangle needs to be set. On return, the upper triangle contains
! the Cholesky factor and the lower triangle is set to 0.
! invert_triangular:
! Inverts an upper triangular real or complex matrix.
!
! Please note: cholesky_complex/invert_trm_complex are not trimmed for speed.
! The only reason having them is that the Scalapack counterpart
......@@ -183,6 +185,7 @@ CONTAINS
! H is only set in the upper half, solve_evp_real needs a full matrix
! Set lower half from upper half
! Set the lower half of the H matrix to zeros.
DO i=1,hmat%matsize2
! Get global column corresponding to i and number of local rows up to
! and including the diagonal, these are unchanged in H
......@@ -195,7 +198,7 @@ CONTAINS
ENDIF
ENDDO
! Use the ev_dist array to store the calculated values for the lower part.
IF (hmat%l_real) THEN
CALL pdtran(hmat%global_size1,hmat%global_size1,1.d0,hmat%data_r,1,1,&
hmat%blacsdata%blacs_desc,0.d0,ev_dist%data_r,1,1,ev_dist%blacsdata%blacs_desc)
......@@ -204,7 +207,7 @@ CONTAINS
hmat%blacsdata%blacs_desc,cmplx(0.d0,0.d0),ev_dist%data_c,1,1,ev_dist%blacsdata%blacs_desc)
ENDIF
! Copy the calculated values to the lower part of the H matrix
DO i=1,hmat%matsize2
! Get global column corresponding to i and number of local rows up to
! and including the diagonal, these are unchanged in H
......@@ -254,7 +257,7 @@ CONTAINS
ENDIF
#endif
! 2b. tmp2 = eigvec**T
! 2b. tmp2 = ev_dist**T
IF (hmat%l_real) THEN
CALL pdtran(ev_dist%global_size1,ev_dist%global_size1,1.d0,ev_dist%data_r,1,1,&
ev_dist%blacsdata%blacs_desc,0.d0,tmp2_r,1,1,ev_dist%blacsdata%blacs_desc)
......@@ -325,7 +328,7 @@ CONTAINS
ENDDO
! 3. Calculate eigenvalues/eigenvectors of U**-T * A * U**-1
! Eigenvectors go to eigvec
! Eigenvectors go to ev_dist
#if defined (CPP_ELPA_201705003)
IF (hmat%l_real) THEN
CALL elpa_obj%eigenvectors(hmat%data_r, eig2, ev_dist%data_r, err)
......@@ -389,7 +392,7 @@ CONTAINS
#endif
! 4. Backtransform eigenvectors: Z = U**-1 * eigvec
! 4. Backtransform eigenvectors: Z = U**-1 * ev_dist
! mult_ah_b_complex needs the transpose of U**-1, thus tmp2 = (U**-1)**T
IF (hmat%l_real) THEN
......