Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • e3qnc/EELS2
1 result
Show changes
Commits on Source (2)
No preview for this file type
...@@ -50,16 +50,26 @@ program boson ...@@ -50,16 +50,26 @@ program boson
np = 0 np = 0
do do
read(12, *, IOSTAT = ioStatus) wmax, y read(12, *, IOSTAT = ioStatus) wmax, y
if (ioStatus /= 0) exit if (ioStatus /= 0) then
if (wmax < 0.0d0) cycle exit
endif
if (wmax < 0.0d0) then
cycle
endif
np = np + 1 np = np + 1
p2(np) = y p2(np) = y
if (np == 1) wmin = wmax if (np == 1) then
if (np < nmax) cycle wmin = wmax
endif
if (np < nmax) then
cycle
endif
enddo enddo
close(unit = 12) close(unit = 12)
if (np <= 0) stop '*** no input values for pcl ***' if (np <= 0) then
stop '*** no input values for pcl ***'
endif
write(*,*) comment(2) write(*,*) comment(2)
write(*,'(a, i6, a, g15.7, a, g15.7)') ' read', np, ' values of pcl from', wmin, ' to', wmax write(*,'(a, i6, a, g15.7, a, g15.7)') ' read', np, ' values of pcl from', wmin, ' to', wmax
......
...@@ -76,7 +76,9 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug, ...@@ -76,7 +76,9 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug,
do m = 2, mmax do m = 2, mmax
n = 2 * n n = 2 * n
wmax = n * dwn wmax = n * dwn
if (wmax >= test) exit if (wmax >= test) then
exit
endif
enddo enddo
if (wmax < test) then if (wmax < test) then
m = mmax m = mmax
...@@ -226,9 +228,13 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug, ...@@ -226,9 +228,13 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug,
endif endif
do i = imin, n do i = imin, n
j = n - i j = n - i
if (mod(j, istep) > 0) cycle if (mod(j, istep) > 0) then
cycle
endif
x = -j * dwn x = -j * dwn
if (x > emax) exit if (x > emax) then
exit
endif
nout = nout + 1 nout = nout + 1
xout(nout)= x xout(nout)= x
yout(nout)= p2(j + 1) yout(nout)= p2(j + 1)
...@@ -242,9 +248,13 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug, ...@@ -242,9 +248,13 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug,
endif endif
if (imax >= 2) then if (imax >= 2) then
do i = 2, imax do i = 2, imax
if (mod(i - 1, istep) > 0) cycle if (mod(i - 1, istep) > 0) then
cycle
endif
x = (i - 1) * dwn x = (i - 1) * dwn
if (x < emin) cycle if (x < emin) then
cycle
endif
nout = nout + 1 nout = nout + 1
xout(nout) = x xout(nout) = x
yout(nout) = p1(i) yout(nout) = p1(i)
...@@ -272,7 +282,9 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug, ...@@ -272,7 +282,9 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug,
fp1 = fp fp1 = fp
fm = p2(i) fm = p2(i)
fp = p1(i) fp = p1(i)
if (i == 2) cycle if (i == 2) then
cycle
endif
picm = .false. picm = .false.
picp = .false. picp = .false.
wn = (i - 1) * dwn wn = (i - 1) * dwn
......
...@@ -91,7 +91,9 @@ subroutine doeels (e0, theta, phia, phib, wmin, wmax, dw, comment, comment_size, ...@@ -91,7 +91,9 @@ subroutine doeels (e0, theta, phia, phib, wmin, wmax, dw, comment, comment_size,
user = layers == 0 user = layers == 0
if (user) then if (user) then
if (layers == 1) rational = .true. if (layers == 1) then
rational = .true.
endif
if (contrl == 'image') then if (contrl == 'image') then
! *** image-charge screening factor ! *** image-charge screening factor
if (layers == 1 .and. neps == 2) then if (layers == 1 .and. neps == 2) then
...@@ -150,7 +152,9 @@ subroutine doeels (e0, theta, phia, phib, wmin, wmax, dw, comment, comment_size, ...@@ -150,7 +152,9 @@ subroutine doeels (e0, theta, phia, phib, wmin, wmax, dw, comment, comment_size,
c1 = c1 * c2 c1 = c1 * c2
xmin = wmin / (2 * ener * psia) xmin = wmin / (2 * ener * psia)
xmax = wmax / (2 * ener * psia) xmax = wmax / (2 * ener * psia)
if (xmin <= 0.0d0) xmin = 0.0d0 if (xmin <= 0.0d0) then
xmin = 0.0d0
endif
dx = dmax1(0.02d0, (xmax - xmin) / nt) dx = dmax1(0.02d0, (xmax - xmin) / nt)
z1 = 0.0d0 z1 = 0.0d0
z2 = 0.0d0 z2 = 0.0d0
...@@ -159,9 +163,13 @@ subroutine doeels (e0, theta, phia, phib, wmin, wmax, dw, comment, comment_size, ...@@ -159,9 +163,13 @@ subroutine doeels (e0, theta, phia, phib, wmin, wmax, dw, comment, comment_size,
call queels(x, f, aerr, rerr, facru, eps, thick, layers, nper) call queels(x, f, aerr, rerr, facru, eps, thick, layers, nper)
table(i) = f table(i) = f
f = f * (1.0d0 + alpha * x)**2 f = f * (1.0d0 + alpha * x)**2
if (dabs(c2 * f - c1) < c2 * rerr) cycle if (dabs(c2 * f - c1) < c2 * rerr) then
cycle
endif
z = (1.0d0 - f) / (c2 * f - c1) z = (1.0d0 - f) / (c2 * f - c1)
if (z <= 0.0d0) cycle if (z <= 0.0d0) then
cycle
endif
z1 = z1 + x * z * (x**2 - z) z1 = z1 + x * z * (x**2 - z)
z2 = z2 + (x * z)**2 z2 = z2 + (x * z)**2
enddo enddo
...@@ -196,18 +204,7 @@ subroutine doeels (e0, theta, phia, phib, wmin, wmax, dw, comment, comment_size, ...@@ -196,18 +204,7 @@ subroutine doeels (e0, theta, phia, phib, wmin, wmax, dw, comment, comment_size,
wn = wmin + (iw - 1) * dw wn = wmin + (iw - 1) * dw
! if (debug) write (*,*) 'wn: ', wn ! if (debug) write (*,*) 'wn: ', wn
if (wn >= 0.0d0) then if (wn >= 0.0d0) then
if (wn /= 0.0d0) then q
if (.not. user) call seteps(neps, nos, oscType, osc, epsinf, wn, eps, layers)
x = wn / (2 * ener * psia)
if (rational) then
f = qrat(x, alpha, beta, c1, c2) * dimag(-2 / (1.0d0 + eps(1)))
else
call queels(x, f, aerr, rerr, facru, eps, thick, layers, nper)
endif
f = prefac * f / wn
endif ! wn /= 0.0d0
wn_array(iw) = wn wn_array(iw) = wn
f_array(iw) = f f_array(iw) = f
......
...@@ -88,8 +88,12 @@ program eels ...@@ -88,8 +88,12 @@ program eels
read(11, *) epsinf(l), nos(l) read(11, *) epsinf(l), nos(l)
write(6, 103) write(6, 103)
if (nos(l) <= 0) then if (nos(l) <= 0) then
if (l <= layers) write(6, 104) l, name(l), thick(l), epsinf(l) if (l <= layers) then
if (l > layers) write(6, 105) epsinf(l) write(6, 104) l, name(l), thick(l), epsinf(l)
endif
if (l > layers) then
write(6, 105) epsinf(l)
endif
else else
do j = 1, nos(l) do j = 1, nos(l)
if (.not. allocated(osc)) then if (.not. allocated(osc)) then
......
...@@ -37,14 +37,20 @@ double precision function fint3(u, eps, thick, layers, nper, eps_size) ...@@ -37,14 +37,20 @@ double precision function fint3(u, eps, thick, layers, nper, eps_size)
endif endif
rac = dsign(1.0d0, acoef) * cospsi * dsqrt((1.0d0 - elleps) * acoef * (um - u) * (um + u)) rac = dsign(1.0d0, acoef) * cospsi * dsqrt((1.0d0 - elleps) * acoef * (um - u) * (um + u))
arg = (bcoef - rac) / (u * acoef) arg = (bcoef - rac) / (u * acoef)
if (dabs(arg) > 1.0d0) arg = dsign(1.0d0, arg) if (dabs(arg) > 1.0d0) then
arg = dsign(1.0d0, arg)
endif
phi2 = dacos(arg) phi2 = dacos(arg)
fint3 = phint(phi2, tanpsi, u) fint3 = phint(phi2, tanpsi, u)
arg = (bcoef + rac) / (u * acoef) arg = (bcoef + rac) / (u * acoef)
if (dabs(arg) > 1.0d0) arg = dsign(1.0d0, arg) if (dabs(arg) > 1.0d0) then
arg = dsign(1.0d0, arg)
endif
phi1 = dacos(arg) phi1 = dacos(arg)
fint3 = fint3 - phint(phi1, tanpsi, u) fint3 = fint3 - phint(phi1, tanpsi, u)
if (rational) return if (rational) then
return
endif
if (user) then if (user) then
fint3 = fint3 * usurlo(ru * u, wn) fint3 = fint3 * usurlo(ru * u, wn)
else else
......
...@@ -88,7 +88,9 @@ subroutine quanc8(fun, a, b, abserr, relerr, result, errest, nofun, flag, eps, t ...@@ -88,7 +88,9 @@ subroutine quanc8(fun, a, b, abserr, relerr, result, errest, nofun, flag, eps, t
errest = 0.0d0 errest = 0.0d0
area = 0.0d0 area = 0.0d0
nofun = 0 nofun = 0
if (a == b) return if (a == b) then
return
endif
! *** stage 2 *** initialization for first interval ! *** stage 2 *** initialization for first interval
...@@ -193,7 +195,9 @@ subroutine quanc8(fun, a, b, abserr, relerr, result, errest, nofun, flag, eps, t ...@@ -193,7 +195,9 @@ subroutine quanc8(fun, a, b, abserr, relerr, result, errest, nofun, flag, eps, t
enddo enddo
nim = nim + 1 nim = nim + 1
if (lev <= 0) exit if (lev <= 0) then
exit
endif
! assemble elements required for the next interval. ! assemble elements required for the next interval.
qprev = qright(lev) qprev = qright(lev)
......
...@@ -80,7 +80,9 @@ subroutine queels(x, f, aerr, rerr, facru, eps, thick, layers, nper) ...@@ -80,7 +80,9 @@ subroutine queels(x, f, aerr, rerr, facru, eps, thick, layers, nper)
flag(3) = 0.0d0 flag(3) = 0.0d0
endif endif
do ie = 1, 3 do ie = 1, 3
if (flag(ie) == 0.0d0) cycle if (flag(ie) == 0.0d0) then
cycle
endif
write(*,*) ' +++ flag(', ie, ') =', flag(ie), ', error =', error(ie), ' +++' write(*,*) ' +++ flag(', ie, ') =', flag(ie), ', error =', error(ie), ' +++'
if (flag(ie) - aint(flag(ie)) > 0.5d-02) then if (flag(ie) - aint(flag(ie)) > 0.5d-02) then
stop '*** execution aborted ***' stop '*** execution aborted ***'
......
...@@ -104,7 +104,9 @@ subroutine rcffi(ar, ai, msign, h) ...@@ -104,7 +104,9 @@ subroutine rcffi(ar, ai, msign, h)
ai(i + 1) = ai(i) - ti ai(i + 1) = ai(i) - ti
ai(i) = ai(i) + ti ai(i) = ai(i) + ti
enddo enddo
if (m == 1) return if (m == 1) then
return
endif
c = 0.0d0 c = 0.0d0
s = dble(isign(1, msign)) s = dble(isign(1, msign))
le = 2 le = 2
......
...@@ -52,8 +52,8 @@ subroutine seteps(neps, nos, oscType, osc, epsinf, wn, eps, layers) ...@@ -52,8 +52,8 @@ subroutine seteps(neps, nos, oscType, osc, epsinf, wn, eps, layers)
yTO = osc(2,k) yTO = osc(2,k)
wLO = osc(3,k) wLO = osc(3,k)
yLO = osc(4,k) yLO = osc(4,k)
nomi = nomi * dcmplx(wLO**2 - wn2, yLO * wn) nomi = nomi * dcmplx(wLO**2 - wn2, -yLO * wn)
deno = deno * dcmplx(wTO**2 - wn2, yTO * wn) deno = deno * dcmplx(wTO**2 - wn2, -yTO * wn)
case (Drude)! Lambin 1990, equ. 8 case (Drude)! Lambin 1990, equ. 8
wp = osc(1,k) wp = osc(1,k)
y = osc(2,k) y = osc(2,k)
...@@ -62,7 +62,7 @@ subroutine seteps(neps, nos, oscType, osc, epsinf, wn, eps, layers) ...@@ -62,7 +62,7 @@ subroutine seteps(neps, nos, oscType, osc, epsinf, wn, eps, layers)
wp = osc(1,k) wp = osc(1,k)
y0 = osc(2,k) y0 = osc(2,k)
yp = osc(3,k) yp = osc(3,k)
addDrude = addDrude - dcmplx(wp**2, (yp - y0) * wn) / dcmplx(wn2, wn * y0) addDrude = addDrude - dcmplx(wp**2, (y0 - yp) * wn) / dcmplx(wn2, wn * y0)
case default case default
write (*,'(A)') '*** Error in oscillator type! ***' write (*,'(A)') '*** Error in oscillator type! ***'
end select end select
......