# Copyright © 2022 - Rennes Physics Institute # # This file is part of MsSpec-DFM. # # MsSpec-DFM is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # MsSpec-DFM is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with MsSpec-DFM. If not, see . # # Source file : src/Makefile # Last modified: Fri, 25 Feb 2022 17:27:18 +0100 # Committed by : Sylvain Tricot 1645806435 +0100 # # Type 'make help' for some help # ############################################################################### # OPTIONS # ############################################################################### DEBUG = 0 BUILDDIR = build EXE = eps SO = $(EXE).so FC = gfortran PREFIX = $(HOME)/.local AUTHORS = Didier Sébilleau , \ Aditi Mandal , \ Sylvain Tricot ################################################################################ # /!\ DO NOT EDIT BELOW THAT LINE (unlesss you know what you're doing...) # # CORE CONFIGURATION # ################################################################################ PYTHON_PKG_NAME = msspec_dfm VERSION = $(shell cd python && python -c 'from $(PYTHON_PKG_NAME) import __version__; print(__version__)') SRCDIR = fortran/DFM_library PYPKG = python/$(PYTHON_PKG_NAME) ifeq ($(DEBUG),0) FFLAGS = else FFLAGS = -g -fbounds-check -fbacktrace -ffpe-trap=zero,overflow,underflow,invalid,denormal endif # Use f2py of the virtualenv if possible ifdef VIRTUAL_ENV F2PY = $(VIRTUAL_ENV)/bin/f2py else F2PY = $(shell which f2py) endif F2PY += --f77exec=$(FC) --f90exec=$(FC) # Source files MANPAGE := man/eps.1 cmn_DEPS:=$(SRCDIR)/ACCURACY_LIBRARY/accuracy.f90 \ $(SRCDIR)/INPUT_OUTPUT_LIBRARY/input_values.f90 \ $(SRCDIR)/DIMENSIONS_LIBRARY/dimensions.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/simple_numbers.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/powers_of_ten.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/mathematical_constants.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/physical_constants.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/factorials.f90 \ $(SRCDIR)/ERROR_HANDLING_LIBRARY/error_caltech.f90 \ $(SRCDIR)/PRINT_LIBRARY/printfiles.f90 \ $(SRCDIR)/STRUCTURE_FACTOR_LIBRARY/utic_values.f90 \ $(SRCDIR)/DAMPING_LIBRARY/external_damping.f90 \ $(SRCDIR)/PHYSICAL_PROPERTIES_LIBRARY/Fermi_values.f90 tool_SRCS:=$(cmn_DEPS) \ $(SRCDIR)/VARIOUS_FUNCTIONS_LIBRARY/external_functions.f90 \ $(SRCDIR)/VARIOUS_FUNCTIONS_LIBRARY/Lindhard_function.f90 \ $(SRCDIR)/VARIOUS_FUNCTIONS_LIBRARY/gamma.f90 \ $(SRCDIR)/VARIOUS_FUNCTIONS_LIBRARY/digamma.f90 \ $(SRCDIR)/VARIOUS_FUNCTIONS_LIBRARY/2F1_real.f90 \ $(SRCDIR)/VARIOUS_FUNCTIONS_LIBRARY/mod_mlf_garrappa.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/derivation.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/smoothing.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/interpolation.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/integration.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/integration4.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/transforms.f90 \ $(SRCDIR)/VARIOUS_FUNCTIONS_LIBRARY/basic_functions.f90 \ $(SRCDIR)/VARIOUS_FUNCTIONS_LIBRARY/bessel.f90 util_SRCS:=$(cmn_DEPS) \ $(SRCDIR)/UTILITIES_LIBRARY/utilities_1.f90 \ $(SRCDIR)/SPECIFIC_INTEGRALS_LIBRARY/specific_int_1.f90 \ $(SRCDIR)/SPECIFIC_INTEGRALS_LIBRARY/specific_int_4.f90 \ $(SRCDIR)/SPECIFIC_INTEGRALS_LIBRARY/specific_int_6.f90 \ $(SRCDIR)/SPECIFIC_INTEGRALS_LIBRARY/specific_int_7.f90 \ $(SRCDIR)/SPECIFIC_INTEGRALS_LIBRARY/specific_int_8.f90 \ $(SRCDIR)/SPECIFIC_INTEGRALS_LIBRARY/specific_int_9.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/find_zero.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/polynomial_equations.f90 prop_SRCS:=$(cmn_DEPS) \ $(SRCDIR)/PHYSICAL_PROPERTIES_LIBRARY/calc_Fermi.f90 \ $(SRCDIR)/PLASMON_LIBRARY/plasmon_ene.f90 \ $(SRCDIR)/SCALE_PARAMETERS_LIBRARY/scale_parameters.f90 \ $(SRCDIR)/ENERGIES_LIBRARY/correlation_energies.f90 \ $(SRCDIR)/ENERGIES_LIBRARY/delta_t.f90 \ $(SRCDIR)/PHYSICAL_PROPERTIES_LIBRARY/thermodynamic_properties.f90 \ $(SRCDIR)/SCREENING_LIBRARY/screening_vec1.f90 \ $(SRCDIR)/CONFINEMENT_LIBRARY/confinement_ff.f90 \ $(SRCDIR)/CONFINEMENT_LIBRARY/coulomb.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/utilities_3.f90 \ $(SRCDIR)/PHYSICAL_PROPERTIES_LIBRARY/material_properties.f90 \ $(SRCDIR)/THERMAL_PROPERTIES_LIBRARY/thermal_properties.f90 \ $(SRCDIR)/ENERGIES_LIBRARY/xc_energies.f90 \ $(SRCDIR)/ENERGIES_LIBRARY/exchange_energies.f90 \ $(SRCDIR)/ENERGIES_LIBRARY/kinetic_energies.f90 \ $(SRCDIR)/PHYSICAL_PROPERTIES_LIBRARY/thermodynamic_quantities.f90 \ $(SRCDIR)/THERMAL_PROPERTIES_LIBRARY/chemical_potential.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/utilities_4.f90 \ $(SRCDIR)/PHYSICAL_PROPERTIES_LIBRARY/calc_energies.f90 # # Read input data file: # read_SRCS:=$(tool_SRCS) $(util_SRCS) $(prop_SRCS) \ $(SRCDIR)/INPUT_OUTPUT_LIBRARY/read_data.f90 io_SRCS:=$(SRCDIR)/INPUT_OUTPUT_LIBRARY/filenames.f90 \ $(SRCDIR)/INPUT_OUTPUT_LIBRARY/outfiles.f90 \ $(SRCDIR)/INPUT_OUTPUT_LIBRARY/change_filenames.f90 \ $(SRCDIR)/INPUT_OUTPUT_LIBRARY/store_coef.f90 \ $(SRCDIR)/INPUT_OUTPUT_LIBRARY/open_files.f90 \ $(SRCDIR)/PRINT_LIBRARY/print_headers.f90 \ $(SRCDIR)/PRINT_LIBRARY/print_calc_type.f90 \ $(SRCDIR)/PRINT_LIBRARY/print_Fermi.f90 \ $(SRCDIR)/PRINT_LIBRARY/print_plasmons.f90 \ $(SRCDIR)/PRINT_LIBRARY/print_scale_param.f90 \ $(SRCDIR)/PRINT_LIBRARY/print_material_lengths.f90 \ $(SRCDIR)/PRINT_LIBRARY/print_thermal.f90 \ $(SRCDIR)/PRINT_LIBRARY/print_thermodynamics.f90 \ $(SRCDIR)/PRINT_LIBRARY/print_energies.f90 \ $(SRCDIR)/INPUT_OUTPUT_LIBRARY/close_files.f90 calc_DEPS:=$(cmn_DEPS) \ $(SRCDIR)/DIELECTRIC_FUNCTIONS_LIBRARY/dfuncl_static.f90 \ $(SRCDIR)/ASYMPTOTIC_VALUES_LIBRARY/gr_asymptotic.f90 \ $(SRCDIR)/ASYMPTOTIC_VALUES_LIBRARY/sq_asymptotic.f90 \ $(SRCDIR)/CONFINEMENT_LIBRARY/confinement_wf.f90 \ $(SRCDIR)/LOCAL_FIELD_LIBRARY/iq_functions_1.f90 \ $(SRCDIR)/MOMENTS_LIBRARY/loss_moments.f90 \ $(SRCDIR)/PAIR_DISTRIBUTION_FUNCTION/pair_distribution.f90 \ $(SRCDIR)/PAIR_CORRELATION_LIBRARY/pair_correlation.f90 \ $(SRCDIR)/STRUCTURE_FACTOR_LIBRARY/structure_factor_static.f90 \ $(SRCDIR)/LOCAL_FIELD_LIBRARY/iq_functions_2.f90 \ $(SRCDIR)/SPECIFIC_INTEGRALS_LIBRARY/specific_int_2.f90 \ $(SRCDIR)/ASYMPTOTIC_VALUES_LIBRARY/gamma_asymptotic.f90 \ $(SRCDIR)/ASYMPTOTIC_VALUES_LIBRARY/calc_asymptotic.f90 \ $(SRCDIR)/LOCAL_FIELD_LIBRARY/local_field_static.f90 \ $(SRCDIR)/LOCAL_FIELD_LIBRARY/local_field_static_2.f90 \ $(SRCDIR)/STRUCTURE_FACTOR_LIBRARY/structure_factor_static_2.f90 \ $(SRCDIR)/NEVANLINNA_FUNCTIONS_LIBRARY/Nevanlinna_functions.f90 \ $(SRCDIR)/MEMORY_FUNCTIONS_LIBRARY/memory_functions.f90 \ $(SRCDIR)/SCREENING_LIBRARY/screening_vec2.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/velocities.f90 \ $(SRCDIR)/SCALE_PARAMETERS_LIBRARY/scale_parameters.f90 \ $(SRCDIR)/MOMENTS_LIBRARY/moments.f90 \ $(SRCDIR)/SPECIFIC_INTEGRALS_LIBRARY/specific_int_3.f90 \ $(SRCDIR)/SPECIFIC_INTEGRALS_LIBRARY/specific_int_10.f90 \ $(SRCDIR)/VARIOUS_FUNCTIONS_LIBRARY/coulomb_log.f90 \ $(SRCDIR)/DAMPING_LIBRARY/packing_fraction.f90 \ $(SRCDIR)/DAMPING_LIBRARY/classical_fluid.f90 \ $(SRCDIR)/DAMPING_LIBRARY/diffusion_coefficient.f90 \ $(SRCDIR)/DAMPING_LIBRARY/electron_phonon_int.f90 \ $(SRCDIR)/DAMPING_LIBRARY/scattering_length.f90 \ $(SRCDIR)/DAMPING_LIBRARY/lifetime.f90 \ $(SRCDIR)/DAMPING_LIBRARY/viscosity.f90 \ $(SRCDIR)/DAMPING_LIBRARY/relaxation_time_static.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/utic_parameters.f90 \ $(SRCDIR)/DAMPING_LIBRARY/decay_rate.f90 \ $(SRCDIR)/DAMPING_LIBRARY/calc_damping.f90 \ $(SRCDIR)/DAMPING_LIBRARY/diffusion_coefficient_2.f90 \ $(SRCDIR)/PLASMON_LIBRARY/plasmon_dispersion.f90 \ $(SRCDIR)/PLASMON_LIBRARY/q_bounds.f90 \ $(SRCDIR)/DAMPING_LIBRARY/plasmon_damping.f90 \ $(SRCDIR)/PHYSICAL_PROPERTIES_LIBRARY/calc_energies.f90 \ $(SRCDIR)/PHYSICAL_PROPERTIES_LIBRARY/grand_partition.f90 \ $(SRCDIR)/UTILITIES_LIBRARY/utilities_2.f90 \ $(SRCDIR)/LANDAU_PARAMETERS_LIBRARY/landau.f90 \ $(SRCDIR)/VARIOUS_FUNCTIONS_LIBRARY/phi_function.f90 \ $(SRCDIR)/DIELECTRIC_FUNCTIONS_LIBRARY/dfuncl_stan_dynamic.f90 \ $(SRCDIR)/DIELECTRIC_FUNCTIONS_LIBRARY/dfuncl_magn_dynamic.f90 \ $(SRCDIR)/DIELECTRIC_FUNCTIONS_LIBRARY/dfunct_dynamic.f90 \ $(SRCDIR)/STRUCTURE_FACTOR_LIBRARY/structure_factor_dynamic_2.f90 \ $(SRCDIR)/INTERACTION_POTENTIALS_LIBRARY/interaction_potentials_r.f90 \ $(SRCDIR)/INTERACTION_POTENTIALS_LIBRARY/interaction_potentials_k.f90 \ $(SRCDIR)/DAMPING_LIBRARY/decay_rate.f90 \ $(SRCDIR)/STRUCTURE_FACTOR_LIBRARY/structure_factor_dynamic.f90 \ $(SRCDIR)/DIELECTRIC_FUNCTIONS_LIBRARY/dfuncl_stan_dynamic_2.f90 \ $(SRCDIR)/DAMPING_LIBRARY/mean_free_path.f90 \ $(SRCDIR)/SPECTRAL_FUNCTION_LIBRARY/spectral_function.f90 \ $(SRCDIR)/LOCAL_FIELD_LIBRARY/local_field_dynamic.f90 \ $(SRCDIR)/PRINT_LIBRARY/print_asymptotic.f90 \ $(SRCDIR)/POST_PROCESSING_LIBRARY/re_eps_0_treatment.f90 \ $(SRCDIR)/MOMENTS_LIBRARY/moments_loss.f90 \ $(SRCDIR)/SPECIFIC_INTEGRALS_LIBRARY/specific_int_5.f90 # # Calculators: # calc_SRCS:=$(SRCDIR)/CALCULATORS_LIBRARY/calculators_1.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/calculators_2.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/calculators_3.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/calculators_5.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/calculators_7.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/calculators_8.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/calculators_9.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/call_calc_1.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/call_calc_2.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/call_calc_3.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/call_calc_5.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/call_calc_7.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/call_calc_8.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/call_calc_9.f90 # # Test_integrals: # calc_TEST:=$(SRCDIR)/TEST_LIBRARY/test_integrals_2.f90 \ $(SRCDIR)/TEST_LIBRARY/test_integrals_3.f90 \ $(SRCDIR)/TEST_LIBRARY/test_integrals_8.f90 \ $(SRCDIR)/TEST_LIBRARY/test_int_Hubbard.f90 # # Post-processing: # calc_POST:=$(SRCDIR)/PLASMON_LIBRARY/plasmon_dispersion_2.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/calculators_p.f90 \ $(SRCDIR)/CALCULATORS_LIBRARY/call_calc_p.f90 SRCS:= $(read_SRCS) $(io_SRCS) $(calc_DEPS) $(calc_SRCS) $(calc_TEST) $(calc_POST) OBJS:=$(addprefix $(BUILDDIR)/,$(patsubst %.f90,%.o,$(SRCS))) .PHONY: all obj exe so pypkg install uninstall clean help all: so obj: $(OBJS) #exe: $(BUILDDIR)/$(EXE) so: python/$(PYTHON_PKG_NAME)/$(SO) pypkg: python/dist/$(PYTHON_PKG_NAME)-$(VERSION).tar.gz python/VERSION: @cat $(VERSION) > $@ python/dist/$(PYTHON_PKG_NAME)-$(VERSION).tar.gz: python/$(PYTHON_PKG_NAME)/$(SO) python/dist/$(PYTHON_PKG_NAME)-$(VERSION).tar.gz: python/man/$(EXE).1.gz python/dist/$(PYTHON_PKG_NAME)-$(VERSION).tar.gz: python/MANIFEST.in python/setup.py python/pip.freeze $(shell find python/$(PYTHON_PKG_NAME) -name '*.py') @cd python && python setup.py sdist python/$(PYTHON_PKG_NAME)/$(SO): $(OBJS) $(SRCDIR)/../epsilon.f90 @echo "Building $@ shared object..." @mkdir -p $(BUILDDIR) @sed -e 's/END PROGRAM.*/END SUBROUTINE/' -e 's/PROGRAM/SUBROUTINE/' $(SRCDIR)/../epsilon.f90 > $(BUILDDIR)/_dfm.f90 @$(F2PY) -m $(BUILDDIR).$(basename $(@F)) -c $(filter-out $(lastword $^), $^) $(BUILDDIR)/_dfm.f90 && mv $(BUILDDIR)/*.so $@ #$(BUILDDIR)/$(EXE): $(OBJS) $(SRCDIR)/../epsilon.f90 # @echo "building main $@..." # @$(FC) $(FFLAGS) $(LDFLAGS) $(LDLIBS) -J $(BUILDDIR) -o $@ $^ python/man/$(EXE).1.gz: python/man/manpage.txt @sed -e 's/^\.TH.*/\.TH man 1 \"$(shell date)\" \"$(VERSION)\" \"$(EXE) man page\"/' \ -e 's/^$$AUTHORS$$.*/$(AUTHORS)/' $^ > $@ @gzip $@ $(BUILDDIR)/%.o: %.f90 @echo "Compiling $@..." @mkdir -p $(BUILDDIR)/$(dir $^) @$(FC) $(FFLAGS) -J $(BUILDDIR) -I $(BUILDDIR) -fPIC -o $@ -c $< install: python/dist/$(PYTHON_PKG_NAME)-$(VERSION).tar.gz @echo "Installing $^" @pip install $^ uninstall: @pip uninstall -y $(PYTHON_PKG_NAME) clean: @rm -rf $(BUILDDIR) @rm -f python/$(PYTHON_PKG_NAME)/*.so @rm -rf python/dist @rm -rf python/*.egg-info @rm -f python/VERSION @rm -f python/man/*.gz help: @echo "Type 'make' or 'make all' to build the executable and the Python shared library" @echo "Type 'make install' to install the code." @echo "By default, this installation is located in $(PREFIX)." @echo "The installation prefix can be changed with the 'PREFIX' variable" @echo "It is also possible to add debugging symbols with the 'DEBUG' variable." @echo "For example, to install in another (writable) location with debugging options:" @echo " make DEBUG=1 && make install PREFIX=/opt"