From 3b679814f0cd9a8b480a43e6e3178678b556fb42 Mon Sep 17 00:00:00 2001
From: kamischi <karl-michael.schindler@web.de>
Date: Mon, 23 Jan 2023 17:37:36 +0100
Subject: [PATCH] Initial try.

doesn't work on macOS.
Test on linux.
---
 source/f90/gprof/.gitignore |  2 +
 source/f90/gprof/Makefile   | 89 +++++++++++++++++++++++++++++++++++++
 source/f90/gprof/bosin      |  6 +++
 source/f90/gprof/eelsin     | 16 +++++++
 4 files changed, 113 insertions(+)
 create mode 100644 source/f90/gprof/.gitignore
 create mode 100644 source/f90/gprof/Makefile
 create mode 100644 source/f90/gprof/bosin
 create mode 100644 source/f90/gprof/eelsin

diff --git a/source/f90/gprof/.gitignore b/source/f90/gprof/.gitignore
new file mode 100644
index 0000000..5fe92b4
--- /dev/null
+++ b/source/f90/gprof/.gitignore
@@ -0,0 +1,2 @@
+eelsou
+bosou
diff --git a/source/f90/gprof/Makefile b/source/f90/gprof/Makefile
new file mode 100644
index 0000000..62033e5
--- /dev/null
+++ b/source/f90/gprof/Makefile
@@ -0,0 +1,89 @@
+.SUFFIXES: .f90 .F90 .o
+
+# fortran compiler
+FC = gfortran 
+
+# fortran compiler options
+FFLAGS = -g -gdwarf-2 -fbounds-check -fcheck=all -pg
+# gfortran version 4.8 does not know -fdiagnostics-color
+# safeguard for major version >= 5
+GFORTAN_VERSION_GE_5 := $(shell echo `gcc -dumpversion | cut -f1 -d. ` \>= 5 | bc)
+ifeq "$(GFORTAN_VERSION_GE_5)" "1"
+	FFLAGS += -fdiagnostics-color=auto
+endif
+
+# implicit rules for compiling fortran files
+%.o:       ../%.f90 ; $(FC) $(FFLAGS) -c $< 
+%_mod.mod: ../%.f90 ; $(FC) $(FFLAGS) -c $<
+
+all: boson eels eels-boson
+
+bosonmods = sicot_mod.mod sintr_mod.mod rcffi_mod.mod
+doboson.o: ../doboson.f90 $(bosonmods)
+
+sicot_mod.mod: sintr_mod.mod
+
+bosonsubs = doboson.o respon.o sicot.o sintr.o rcffi.o o1.o o2.o
+boson: ../boson.f90 change_working_dir.o $(bosonsubs) $(bosonmods)
+	$(FC) $(FFLAGS) -o bosonf90 ../boson.f90 change_working_dir.o $(bosonsubs) 
+
+eelsmods = quanc8_mod.mod queels_mod.mod seteps_mod.mod
+doeels.o: ../doeels.f90 $(eelsmods)
+
+queels_mod.mod: quanc8_mod.mod fint1_mod.mod fint2_mod.mod fint3_mod.mod
+quanc8_mod.mod: fun_mod.mod
+fint1_mod.mod: surlos_mod.mod
+fint2_mod.mod: surlos_mod.mod
+fint3_mod.mod: surlos_mod.mod
+
+eelssubs = doeels.o usurlo.o quanc8.o fun.o queels.o fint1.o fint2.o fint3.o surlos.o seteps.o phint.o qrat.o
+eels: ../eels.f90 change_working_dir.o $(eelssubs) $(eelsmods)
+	$(FC) $(FFLAGS) -o eelsf90 ../eels.f90 change_working_dir.o $(eelssubs)
+
+eels-boson: ../eels-boson.f90 change_working_dir.o $(eelssubs) $(eelsmods) $(bosonsubs) $(bosonmods)
+	$(FC) $(FFLAGS) -o eels-boson ../eels-boson.f90 change_working_dir.o $(eelssubs) $(bosonsubs)
+
+profile: boson eels eels-boson
+	./eelsf90
+	./bosonf90
+	./eels-boson
+	
+	 change_working_dir
+
+	gprof bosonf90-boson
+	gprof doboson
+	gprof sicot
+	gprof sintr
+	gprof rcffi
+	gprof respon
+
+	gprof eelsf90-eels
+	gprof doeels
+	gprof fint1
+	gprof fint2
+	gprof fint3
+	gprof fun
+	gprof o1
+	gprof o2
+	gprof phint
+	gprof qrat
+	gprof quanc8
+	gprof queels
+	gprof seteps
+	gprof surlos
+	gprof usurlo
+
+	gprof eels-boson-eels-boson
+
+clean:
+	rm -f *.o
+	rm -rf *.dSYM
+	rm -f *.mod
+	rm -f *.so
+	rm -f gmon.out
+	rm -f eelsou bosou
+	rm -f bosonf90   bosonf90.exe
+	rm -f eelsf90    eelsf90.exe
+	rm -f eels-boson eels-boson.exe
+
+.PHONY: all clean profile
diff --git a/source/f90/gprof/bosin b/source/f90/gprof/bosin
new file mode 100644
index 0000000..7dd3315
--- /dev/null
+++ b/source/f90/gprof/bosin
@@ -0,0 +1,6 @@
+ 300.0      t
+  25.0      width
+   0.5      gauss
+   0.3      asym
+-500.0      emin
+1200.0      emax
diff --git a/source/f90/gprof/eelsin b/source/f90/gprof/eelsin
new file mode 100644
index 0000000..1db7dba
--- /dev/null
+++ b/source/f90/gprof/eelsin
@@ -0,0 +1,16 @@
+   4.0      E0                                                          ABTI0002
+  60.0      THETA                                                       ABTI0003
+   1.8      PHIA                                                        ABTI0004
+   1.8      PHIB                                                        ABTI0005
+  50.0      WMIN                                                        ABTI0006
+ 700.0      WMAX                                                        ABTI0007
+   2.0      DW                                                          ABTI0008
+WFW: MnO layer on metal
+                                                                        ABTI0010
+    2    1                                          No-layers  NPER No-periodic
+MnO            994.00D+00                           LAYER 1  name thickness
+    4.95      1                                              epsinf No-Osc.
+   269.0          16.000        5.00000E-02                  wto, Q, lambda
+Platinum      1000.00D+00                           LAYER 2             ABTI0012
+    8.90      1                                                         ABTI0013
+160000.0          -1            12.0000E-02                             ABTI0014
-- 
GitLab