From a0205a12ed2e2caebae5a0f218150eee331a1ae4 Mon Sep 17 00:00:00 2001
From: kamischi <karl-michael.schindler@web.de>
Date: Fri, 5 Jul 2024 18:50:11 +0200
Subject: [PATCH] combine o1 and o2

---
 source/f90/Makefile    |  8 ++++----
 source/f90/doboson.f90 | 16 ++++------------
 source/f90/o1.f90      | 16 ----------------
 source/f90/o2.f90      | 17 -----------------
 4 files changed, 8 insertions(+), 49 deletions(-)
 delete mode 100644 source/f90/o1.f90
 delete mode 100644 source/f90/o2.f90

diff --git a/source/f90/Makefile b/source/f90/Makefile
index 26057a7..e722a8d 100644
--- a/source/f90/Makefile
+++ b/source/f90/Makefile
@@ -22,11 +22,11 @@ PYTHON3 = python3
 all: boson eels eels-boson
 
 bosonmods = sicot_mod.mod sintr_mod.mod rcffi_mod.mod
-doboson.o: doboson.f90 $(bosonmods)
+doboson.o: doboson.f90 $(bosonmods) o.o
 
 sicot_mod.mod: sintr_mod.mod
 
-bosonsubs = doboson.o respon.o sicot.o sintr.o rcffi.o o1.o o2.o
+bosonsubs = doboson.o respon.o sicot.o sintr.o rcffi.o o.o
 boson: boson.f90 change_working_dir.o $(bosonsubs) $(bosonmods)
 	$(FC) $(FFLAGS) -o bosonf90 boson.f90 change_working_dir.o $(bosonsubs) 
 
@@ -79,8 +79,8 @@ pylibs: doeels-py doboson-py
 doeels-py: doeels.f90 quanc8.f90 surlos.f90 fint1.f90 fint2.f90 fint3.f90 queels.f90 phint.f90 qrat.f90 usurlo.f90
 	$(PYTHON3) -m numpy.f2py -c seteps.f90 doeels.f90 quanc8.f90 surlos.f90 fint1.f90 fint2.f90 fint3.f90 queels.f90 phint.f90 qrat.f90 usurlo.f90 -m doeels
 
-doboson-py: doboson.f90 sicot.f90 sintr.f90 rcffi.f90 respon.f90 o1.f90 o2.f90
-	$(PYTHON3) -m numpy.f2py -c o1.f90 o2.f90 sintr.f90 rcffi.f90 respon.f90 sicot.f90 doboson.f90 -m doboson
+doboson-py: doboson.f90 sicot.f90 sintr.f90 rcffi.f90 respon.f90 o.f90
+	$(PYTHON3) -m numpy.f2py -c o.90 sintr.f90 rcffi.f90 respon.f90 sicot.f90 doboson.f90 -m doboson
 
 clean:
 	rm -f *.o
diff --git a/source/f90/doboson.f90 b/source/f90/doboson.f90
index c920ac5..31a989b 100644
--- a/source/f90/doboson.f90
+++ b/source/f90/doboson.f90
@@ -41,9 +41,9 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug,
   double precision :: fm, fm0, fm1, fp1, fmpic, fp, fp0, fppic, fr, g1, g2
   double precision :: h, pi, sigma, sp2, test, u
   double precision :: wmpic, wppic, wn, x, x1, x2, x3
-  double precision :: o1, o2, respon
+  double precision :: o, respon
 
-  external o1, o2
+  external o
 
   integer :: i, imax, imin, istep, j, jmin, jmax, m, n
   logical :: picm, picp
@@ -178,11 +178,7 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug,
           fr = a1 * dexp(-x1)
         endif
         if (a1 /= a2) then
-          if (x1 <= 1.3d0) then
-            fi = a1 * o1(x1)
-          else
-            fi = a1 * o2(x1)
-          endif
+          fi = a1 * o(x1)
         endif
       endif
       if (a2 /= 0.0d0) then
@@ -191,11 +187,7 @@ subroutine doboson(t, width, gauss, asym, emin, emax, wmin, wmax, np, p, debug,
           fr = fr + a2 * dexp(-x2)
         endif
         if (a2 /= a1) then
-          if (x2 <= 1.3d0) then
-            fi = fi - a2 * o1(x2)
-          else
-            fi = fi - a2 * o2(x2)
-          endif
+          fi = fi - a2 * o(x2)
         endif
       endif
       if (gauss /= 0.0d0) then
diff --git a/source/f90/o1.f90 b/source/f90/o1.f90
deleted file mode 100644
index 16c9bf0..0000000
--- a/source/f90/o1.f90
+++ /dev/null
@@ -1,16 +0,0 @@
-double precision function o1(u)
-
-! *** rational approximations for ei(u) * exp(-u) + e1(u) * exp(+u)
-! *** in the intervals (0, 1.3) and (1.3, infinity) <accuracy : 4.e-04>
-! *** used for fourier transforming half-lorentzian functions
-
-  implicit none
-
-  double precision, intent(in) :: u
-  double precision :: u2
-
-  u2 = u**2
-  o1 = -dsinh(u) * dlog(u2) + u * ((0.03114d0 * u2 + 0.41666d0) * u2 + 0.84557d0)
-
-  return
-end function o1
diff --git a/source/f90/o2.f90 b/source/f90/o2.f90
deleted file mode 100644
index 76c562b..0000000
--- a/source/f90/o2.f90
+++ /dev/null
@@ -1,17 +0,0 @@
-double precision function o2(u)
-
-! *** rational approximations for ei(u) * exp(-u) + e1(u) * exp(+u)
-! *** in the intervals (0, 1.3) and (1.3, infinity) <accuracy : 4.e-04>
-! *** used for fourier transforming half-lorentzian functions
-
-  implicit none
-
-  double precision, intent(in) :: u
-  double precision :: u2
-
-  u2 = 1 / u**2
-  o2 = (((202.91d0 * u2 + 932.21d0) * u2 + 41.740d0) * u2 + 2.0d0) /  &
-       (((540.88d0 * u2 + 345.67d0) * u2 + 18.961d0) * u2 + 1.0d0) / u
-
-  return
-end function o2
-- 
GitLab