Skip to content

Commit

Permalink
Fixing non-standard Fortran issues
Browse files Browse the repository at this point in the history
To make it gnu compatible
  • Loading branch information
Trovemaster committed Jun 30, 2022
1 parent 809f562 commit ddc5951
Show file tree
Hide file tree
Showing 8 changed files with 287 additions and 151 deletions.
3 changes: 2 additions & 1 deletion F1_hyperfine.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@ function Wigner6j(j1, j2, j3, J_1, J_2, J_3) result(w6j)

contains
REAL(rk) function log_()
real(rk) :: log_gamma
log_ = log_gamma(t + 2.0_rk) &
- log_gamma(t - j1 - j2 - j3 + 1.0_rk) &
- log_gamma(t - j1 - J_2 - J_3 + 1.0_rk) &
Expand All @@ -1047,7 +1048,7 @@ end function log_
function triangle_coefficient(a, b, c) result(tri)
implicit none
REAL(rk), INTENT(IN) :: a, b, c
REAL(rk) :: tri
REAL(rk) :: tri,log_gamma
integer(ik) :: xa

tri = 0
Expand Down
102 changes: 39 additions & 63 deletions MAKEFILES/makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
goal: duo.x
goal: duo

tarball:
tar cfz duo$(PLAT).tar.gz makefile *.f90
Expand All @@ -9,10 +9,10 @@ checkin:

#FPATH =

PLAT = 2210_gf
EXE = j-duo-v1206.x

##FOR = ifort # Fortran compiler
FOR = gfortran
FOR = ifort # Fortran compiler
##FOR = gfortran

# Lorenzo Lodi ---- meaning of some flags used by the Intel fortran compiler
# see (e.g.) file:https:///opt/intel/composer_xe_2011_sp1.8.273/Documentation/en_US/compiler_f/main_for/index.htm
Expand Down Expand Up @@ -50,79 +50,55 @@ FOR = gfortran

#NOTE: -fpe0 will stop on floating-point exceptions. Do not use this flag because LAPACK makes use of divide by zero etc.
#
####FFLAGS = -O0 -fpe0 -fltconsistency -stand f03 -check all -warn all -traceback -fp-stack-check # debugging options
##FFLAGS = -O0 -fpe0 -fltconsistency -stand f03 -check all -warn all -traceback -fp-stack-check # debugging options

''FFLAGS = -O3 -ip -qopenmp -mkl=parallel ## -xHost -fast
FFLAGS = -O3 -ipo -qopenmp -mkl=parallel # -xHost -fast

##FFLAGS = -C -check bounds -g -gen-interfaces -warn interfaces -check arg_temp_created -prof-value-profiling=all -warn all
##FFLAGS = -O3 -ip -openmp # no optimization -- fast compilation
##FFLAGS = -W -Wall -fbounds-check -pedantic-errors -std=f2003 -Wunderflow -O0 -fbacktrace -g -Wextra

FFLAGS = -W -fbounds-check -pedantic-errors -std=f2003 -Wunderflow -O0 -fbacktrace -g -Wextra

#-Wall

#ARPACK = ~/libraries/ARPACK/libarpack_omp_64.a

LAPACK =

#LAPACK = -mkl=parallel
LAPACK = -mkl=parallel -static
#LAPACK = -mkl=parallel -static

LIB = $(LAPACK)

###############################################################################

OBJ = atomic_and_nuclear_data.o grids.o accuracy.o lapack.o timer.o input.o diatom.o refinement.o functions.o symmetry.o dipole.o header_info.o Lobatto.o
#compilation_details.o

duo.x: $(OBJ) duo.o
$(FOR) -o j-duo$(PLAT).x $(OBJ) $(FFLAGS) duo.o $(LIB)

duo.o: duo.f90 $(OBJ)
$(FOR) -c duo.f90 $(FFLAGS)

grids.o: grids.f90 accuracy.o input.o Lobatto.o
$(FOR) -c grids.f90 $(FFLAGS)

diatom.o: diatom.f90 accuracy.o input.o lapack.o functions.o symmetry.o atomic_and_nuclear_data.o Lobatto.o
$(FOR) -c diatom.f90 $(FFLAGS)

refinement.o: refinement.f90 accuracy.o input.o lapack.o diatom.o
$(FOR) -c refinement.f90 $(FFLAGS)

functions.o: functions.f90 accuracy.o input.o lapack.o
$(FOR) -c functions.f90 $(FFLAGS)

dipole.o: dipole.f90 accuracy.o input.o lapack.o diatom.o
$(FOR) -c dipole.f90 $(FFLAGS)

accuracy.o: accuracy.f90
$(FOR) -c accuracy.f90 $(FFLAGS)

symmetry.o: symmetry.f90
$(FOR) -c symmetry.f90 $(FFLAGS)

lapack.o: lapack.f90 accuracy.o timer.o
$(FOR) -c lapack.f90 $(FFLAGS)

timer.o: timer.f90
$(FOR) -c timer.f90 $(FFLAGS)

input.o: input.f90
$(FOR) -c input.f90 $(FFLAGS)

#compilation_details.o: compilation_details.f90
# $(FOR) -c compilation_details.f90 $(FFLAGS)

header_info.o: accuracy.o
$(FOR) -c header_info.f90 $(FFLAGS)

atomic_and_nuclear_data.o: atomic_and_nuclear_data.f90
$(FOR) -c atomic_and_nuclear_data.f90 $(FFLAGS)

Lobatto.o: Lobatto.f90 timer.o
$(FOR) -c Lobatto.f90 $(FFLAGS)
OBJ = F1_hyperfine.o F1_intensity.o grids.o accuracy.o lapack.o timer.o input.o diatom.o refinement.o functions.o symmetry.o dipole.o quadrupole.o header_info.o atomic_and_nuclear_data.o Lobatto.o me_numer.o RWF.o

diatom.o: symmetry.o functions.o input.o lapack.o Lobatto.o timer.o atomic_and_nuclear_data.o accuracy.o me_numer.o
dipole.o: timer.o accuracy.o diatom.o symmetry.o
quadrupole.o: timer.o accuracy.o diatom.o symmetry.o
duo.o: header_info.o diatom.o accuracy.o refinement.o timer.o dipole.o F1_hyperfine.o F1_intensity.o
functions.o: accuracy.o timer.o
grids.o: accuracy.o Lobatto.o
header_info.o: accuracy.o
F1_hyperfine.o: accuracy.o diatom.o lapack.o symmetry.o
F1_intensity.o: F1_hyperfine.o accuracy.o diatom.o
me_numer.o : accuracy.o lapack.o timer.o
lapack.o: accuracy.o timer.o
Lobatto.o: accuracy.o timer.o
refinement.o: timer.o accuracy.o diatom.o
symmetry.o: accuracy.o
timer.o: accuracy.o
RWF.o: accuracy.o diatom.o timer.o symmetry.o lapack.o

# clear internal suffix rules
.SUFFIXES:
# specify our own suffix rules
.SUFFIXES: .f90 .o
.f90.o:
$(FOR) -c -o $@ $< $(FFLAGS)

duo: $(OBJ) duo.o
$(FOR) -o $(EXE) $(OBJ) $(FFLAGS) duo.o $(LIB)

clean:
rm -f $(OBJ) *.mod *__genmod.f90 duo.o duo_test_0* eigen_vectors.chk eigen_vib.chk Bob-Rot_centrifugal_functions.dat _Lp__functions.dat Spin-Orbit.dat Spin-spin_functions.dat Dipole_moment_functions.dat Potential_functions.dat Spin-rotation_functions.dat Spin-spin-o__non-diagonal__functions.dat
rm -f $(OBJ) *.mod *__genmod.f90 duo.o duo_test_0* eigen_vectors.chk eigen_vib.chk Bob-Rot_centrifugal_functions.dat _Lp__functions.dat Spin-Orbit.dat Spin-spin_functions.dat Dipole_moment_functions.dat Potential_functions.dat Spin-rotation_functions.dat Spin-spin-o__non-diagonal__functions.dat

test: test_duo.f90
$(FOR) -O0 test_duo.f90 -o duo_test.exe
153 changes: 88 additions & 65 deletions MAKEFILES/makefile_gfortran
Original file line number Diff line number Diff line change
@@ -1,84 +1,107 @@
goal: duo.x
goal: duo

tarball:
tar cf duo.tar makefile *.f90
tar cfz duo$(PLAT).tar.gz makefile *.f90

checkin:
ci -l Makefile *.f90

PLAT = _0506

FOR = gfortran

#FPATH =

EXE = j-duo-gnu.x

FOR = gfortran

# Lorenzo Lodi ---- meaning of some flags used by the Intel fortran compiler
# see (e.g.) file:https:///opt/intel/composer_xe_2011_sp1.8.273/Documentation/en_US/compiler_f/main_for/index.htm
# -O0 removes compiler optimization of the code. Code is slower in execution but compilation is much faster.
# -fltconsistency disables some optimisations which may lead to very small numerical roundoff errors
# -stand f95 gives warnings if non-Fortran95-compliant features are used
# -stand f03 gives warnings if non-Fortran03-compliant features are used
# -check all enables the following run-time checks:
# arg_temp_created => Determines whether checking occurs for actual arguments before routine calls.
# bounds => checks if accessing an out-of-bounds array element (e.g., x(0) when x is defined as x(1:NMAX)
# format => mismatch in the output format, e.g. write(*,'(F10.5)') i , and i is an integer
# output_conversion => output error, e.g. the number won't fit in the given spaces
# pointer => checks for disassociated/uninitialized pointers
# uninit => checks for uninitialized variables
# -warn all enables the following compile-time diagnostic checks:
# alignments => data that is not naturally aligned
# declarations => undeclared names
# errors => warnings are changed to errors
# general => various things
# ignore_loc => %LOC is stripped from an actual argument. (?)
# interfaces => compiler checks the interfaces
# stderrors => Fortran standard violations are changed to errors.
# truncated_source => source exceeds the maximum column width
# uncalled => statement function is never called
# unused => declared variables that are never used.
# usage => questionable programming practices.
# -traceback ***GOLDEN OPTION*** when a run-time error occurs it'll tell you the line in the source code responsible
# -fp-stack-check stops the program immediately when a NaN (Not-a-numeber) error occurs
# Other options:
# -O3 most agressive general optimization setting
# -ip enables additional interprocedural optimizations
# -g generate full debugging information in the object file
# -C compile only (=make .o files), but do not link .o files to produce executable
# -prof-value-profiling=all All value profile types are enabled and value profiling is performed.

#NOTE: -fpe0 will stop on floating-point exceptions. Do not use this flag because LAPACK makes use of divide by zero etc.
#
##FFLAGS = -O0 -fpe0 -fltconsistency -stand f03 -check all -warn all -traceback -fp-stack-check # debugging options

##FFLAGS = -O3 -ipo -qopenmp -mkl=parallel # -xHost -fast

##FFLAGS = -C -check bounds -g -gen-interfaces -warn interfaces -check arg_temp_created -prof-value-profiling=all -warn all
##FFLAGS = -O3 -ip -openmp # no optimization -- fast compilation
##FFLAGS = -W -Wall -fbounds-check -pedantic-errors -std=f2003 -Wunderflow -O0 -fbacktrace -g -Wextra

FFLAGS = -W -Wall -fbounds-check -pedantic-errors -std=f2003 -Wunderflow -O -fbacktrace -ffpe-trap=zero,overflow,underflow -g #Debug options for gfortran
#FFLAGS = -std=f2003 -O2 -march=native #Production options for gfortran
FFLAGS = -fbounds-check -O0 -std=f2003

LAPACK = -llapack -lblas -L./

LIB = $(LAPACK)

###############################################################################

OBJ = atomic_and_nuclear_data.o grids.o accuracy.o lapack.o timer.o input.o diatom.o refinement.o functions.o symmetry.o dipole.o quadrupole.o header_info.o RWF.o Lobatto.o
#compilation_details.o

duo.x: $(OBJ) duo.o
$(FOR) -o j-duo$(PLAT).x $(OBJ) $(FFLAGS) duo.o $(LIB)

duo.o: duo.f90 $(OBJ)
$(FOR) -c duo.f90 $(FFLAGS)

grids.o: grids.f90 accuracy.o input.o Lobatto.o
$(FOR) -c grids.f90 $(FFLAGS)

diatom.o: diatom.f90 accuracy.o input.o lapack.o functions.o symmetry.o atomic_and_nuclear_data.o Lobatto.o me_numer.o
$(FOR) -c diatom.f90 $(FFLAGS)

refinement.o: refinement.f90 accuracy.o input.o lapack.o diatom.o
$(FOR) -c refinement.f90 $(FFLAGS)

functions.o: functions.f90 accuracy.o input.o lapack.o
$(FOR) -c functions.f90 $(FFLAGS)

dipole.o: dipole.f90 accuracy.o input.o lapack.o diatom.o
$(FOR) -c dipole.f90 $(FFLAGS)

quadrupole.o: quadrupole.f90 accuracy.o input.o lapack.o diatom.o
$(FOR) -c quadrupole.f90 $(FFLAGS)
#ARPACK = ~/libraries/ARPACK/libarpack_omp_64.a

accuracy.o: accuracy.f90
$(FOR) -c accuracy.f90 $(FFLAGS)
#LAPACK = -mkl=parallel -static

symmetry.o: symmetry.f90
$(FOR) -c symmetry.f90 $(FFLAGS)

me_numer.o: me_numer.f90 accuracy.o lapack.o timer.o
$(FOR) -c me_numer.f90 $(FFLAGS)

lapack.o: lapack.f90 accuracy.o timer.o
$(FOR) -c lapack.f90 $(FFLAGS)

timer.o: timer.f90
$(FOR) -c timer.f90 $(FFLAGS)

input.o: input.f90
$(FOR) -c input.f90 $(FFLAGS)

#compilation_details.o: compilation_details.f90
# $(FOR) -c compilation_details.f90 $(FFLAGS)

header_info.o: accuracy.o
$(FOR) -c header_info.f90 $(FFLAGS)

atomic_and_nuclear_data.o: atomic_and_nuclear_data.f90
$(FOR) -c atomic_and_nuclear_data.f90 $(FFLAGS)
LIB = $(LAPACK)

Lobatto.o: Lobatto.f90 timer.o
$(FOR) -c Lobatto.f90 $(FFLAGS)
###############################################################################

RWF.o: RWF.f90 accuracy.o diatom.o timer.o symmetry.o lapack.o
$(FOR) -c RWF.f90 $(FFLAGS)
OBJ = F1_hyperfine.o F1_intensity.o grids.o accuracy.o lapack.o timer.o input.o diatom.o refinement.o functions.o symmetry.o dipole.o quadrupole.o header_info.o atomic_and_nuclear_data.o Lobatto.o me_numer.o RWF.o

diatom.o: symmetry.o functions.o input.o lapack.o Lobatto.o timer.o atomic_and_nuclear_data.o accuracy.o me_numer.o
dipole.o: timer.o accuracy.o diatom.o symmetry.o
quadrupole.o: timer.o accuracy.o diatom.o symmetry.o
duo.o: header_info.o diatom.o accuracy.o refinement.o timer.o dipole.o F1_hyperfine.o F1_intensity.o
functions.o: accuracy.o timer.o
grids.o: accuracy.o Lobatto.o
header_info.o: accuracy.o
F1_hyperfine.o: accuracy.o diatom.o lapack.o symmetry.o
F1_intensity.o: F1_hyperfine.o accuracy.o diatom.o
me_numer.o : accuracy.o lapack.o timer.o
lapack.o: accuracy.o timer.o
Lobatto.o: accuracy.o timer.o
refinement.o: timer.o accuracy.o diatom.o
symmetry.o: accuracy.o
timer.o: accuracy.o
RWF.o: accuracy.o diatom.o timer.o symmetry.o lapack.o

# clear internal suffix rules
.SUFFIXES:
# specify our own suffix rules
.SUFFIXES: .f90 .o
.f90.o:
$(FOR) -c -o $@ $< $(FFLAGS)

duo: $(OBJ) duo.o
$(FOR) -o $(EXE) $(OBJ) $(FFLAGS) duo.o $(LIB)

clean:
rm -f $(OBJ) *.mod *__genmod.f90 duo.o
rm -f $(OBJ) *.mod *__genmod.f90 duo.o duo_test_0* eigen_vectors.chk eigen_vib.chk Bob-Rot_centrifugal_functions.dat _Lp__functions.dat Spin-Orbit.dat Spin-spin_functions.dat Dipole_moment_functions.dat Potential_functions.dat Spin-rotation_functions.dat Spin-spin-o__non-diagonal__functions.dat

test: test_duo.f90
$(FOR) -O0 test_duo.f90 -o duo_test.exe
Loading

0 comments on commit ddc5951

Please sign in to comment.