Commit adbdac84 authored by Gregor Michalicek's avatar Gregor Michalicek

Change in hybrid/coulombmatrix.F90 to obtain better agreement with ancient fleur

Recently an old subroutine to calculate spherical harmonics, harmonicsr, was
replaced in the hybrid functionals code by the more commonly used ylm4
subroutine. It turns out that there is a case in which these subroutines yield
differing results:

The theta and phi angles in the routines are calculated from a vector that is
passed to them. But at some places this vector has a length of 0.0. In ylm4
this leads to the assumption that the vector points in z direction. This leads
to all m=0 Y_lm(theta,phi) having finite values. In the old subroutine a
vanishing vector length lead to an averaging over all angles. For l=0, m=0
this is the same as in ylm4. But for all other l,m combinations the
Y_lm(theta,phi) values vanish.

In most cases these different behaviors are irrelevant. But there seem to
be places where this leads to non-negligible differences in out-file values.
parent 3a94e1e4
......@@ -2009,6 +2009,7 @@ CONTAINS
IF (ishell > conv(maxl) .AND. maxl /= 0) maxl = maxl - 1
call timestart("harmonics")
call ylm4(maxl, ka, y)
IF(ALL(ka(:).EQ.0.0)) y(2:(maxl+1)**2)=CMPLX(0.0,0.0)
call timestop("harmonics")
cdum = 1.0
lm = 0
......
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