From e032b14ea99f2f14c6964a7fa800c949537fc8fb Mon Sep 17 00:00:00 2001
From: Karl-Michael Schindler <karl-michael.schindler@web.de>
Date: Wed, 16 Oct 2024 17:16:36 +0200
Subject: [PATCH] improvements

- get number of periodic layers
- calculate size of xout and yout
---
 source/f90/eels-boson.f90    | 12 ++++++++----
 source/f90/getOscillator.f90 | 14 +++++++-------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/source/f90/eels-boson.f90 b/source/f90/eels-boson.f90
index 6904453..4eaf3d8 100644
--- a/source/f90/eels-boson.f90
+++ b/source/f90/eels-boson.f90
@@ -49,7 +49,7 @@ program eels_boson
   
   character (len = :), allocatable :: eelsin_name, bosonout_name
 
-  ! the default names
+  ! the default file names
   eelsin_name    = 'eelsin.yaml'
   bosonout_name  = 'bosonout.txt'
   
@@ -119,6 +119,12 @@ program eels_boson
     print *, io_err%message
     stop 1
   endif
+  nper = root%get_integer("NumberOfPeriodicLayers", error = io_err)
+  if (allocated(io_err)) then
+    print *, io_err%message
+    stop 1
+  endif
+
 
     layerList => root%get_list('Layers', required = .true., error = io_err)
     if (allocated(io_err)) then
@@ -148,7 +154,6 @@ program eels_boson
 
   layers = layerList%size()
   user = layers == 0
-  nper = 1
   if (.not. user) then
     neps = layers
     if (nper == -1) then
@@ -303,8 +308,7 @@ program eels_boson
   write(*,'(a, i6, a, g15.7, a, g15.7)') ' read', nw, ' values of pcl from', wmin, ' to', wmax
 
 ! length calculation for xout, yout.
-! not done yet.
-  nout = 2**14
+  nout = nint((emax - emin) / dw ) + 1
   allocate (xout(nout))
   allocate (yout(nout))
   
diff --git a/source/f90/getOscillator.f90 b/source/f90/getOscillator.f90
index ed5a91f..21091f3 100644
--- a/source/f90/getOscillator.f90
+++ b/source/f90/getOscillator.f90
@@ -28,23 +28,23 @@ module getOscillator_mod
       select case (oscType(jos))
       case (Lorentz)
         osc(1,jos) = oscillatorTerm%get_real('wTO', error = io_err)
-        osc(2,jos) = oscillatorTerm%get_real('Q', error = io_err)
-        osc(3,jos) = oscillatorTerm%get_real('Gamma', error = io_err)
+        osc(2,jos) = oscillatorTerm%get_real('Qk', error = io_err)
+        osc(3,jos) = oscillatorTerm%get_real('yk', error = io_err)
         osc(4,jos) = 0.0
       case (Kurosawa)
         osc(1,jos) = oscillatorTerm%get_real('wTO', error = io_err)
-        osc(2,jos) = oscillatorTerm%get_real('GammaTO', error = io_err)
+        osc(2,jos) = oscillatorTerm%get_real('yTO', error = io_err)
         osc(3,jos) = oscillatorTerm%get_real('wLO', error = io_err)
-        osc(4,jos) = oscillatorTerm%get_real('GammaLO', error = io_err)
+        osc(4,jos) = oscillatorTerm%get_real('yLO', error = io_err)
       case (Drude)
         osc(1,jos) = oscillatorTerm%get_real('wP', error = io_err)
-        osc(2,jos) = oscillatorTerm%get_real('Gamma', error = io_err)
+        osc(2,jos) = oscillatorTerm%get_real('y', error = io_err)
         osc(3,jos) = 0.0
         osc(4,jos) = 0.0
       case (extendedDrude)
         osc(1,jos) = oscillatorTerm%get_real('wP', error = io_err)
-        osc(2,jos) = oscillatorTerm%get_real('Gamma0', error = io_err)
-        osc(3,jos) = oscillatorTerm%get_real('GammaP', error = io_err)
+        osc(2,jos) = oscillatorTerm%get_real('yp', error = io_err)
+        osc(3,jos) = oscillatorTerm%get_real('yP', error = io_err)
         osc(4,jos) = 0.0
       end select
     end select
-- 
GitLab