2021-05-28 13:36:39 +02:00
|
|
|
# TREXIO - TREX Input/Output library
|
|
|
|
#
|
|
|
|
# BSD 3-Clause License
|
|
|
|
#
|
|
|
|
# Copyright (c) 2020, TREX Center of Excellence
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of source code must retain the above copyright notice, this
|
|
|
|
# list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
# this list of conditions and the following disclaimer in the documentation
|
|
|
|
# and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# 3. Neither the name of the copyright holder nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived from
|
|
|
|
# this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
# =============== SETTINGS =============== #
|
|
|
|
|
2021-05-28 13:36:39 +02:00
|
|
|
ACLOCAL_AMFLAGS = -I m4
|
2021-06-02 18:45:05 +02:00
|
|
|
CLEANFILES = trexio.mod
|
2022-09-06 11:52:36 +02:00
|
|
|
if HAVE_FORTRAN
|
2021-06-22 17:55:56 +02:00
|
|
|
BUILT_SOURCES = trexio.mod
|
2022-09-06 11:52:36 +02:00
|
|
|
else
|
2023-05-07 16:03:57 +02:00
|
|
|
BUILT_SOURCES =
|
2022-09-06 11:52:36 +02:00
|
|
|
endif
|
2021-11-08 19:41:17 +01:00
|
|
|
EXTRA_DIST = .git_hash
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2022-02-17 11:59:20 +01:00
|
|
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
2021-11-08 19:41:17 +01:00
|
|
|
SUBDIRS =
|
2021-05-28 13:36:39 +02:00
|
|
|
|
|
|
|
pkgconfigdir = $(libdir)/pkgconfig
|
|
|
|
pkgconfig_DATA = pkgconfig/trexio.pc
|
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
# =============== BUILD =============== #
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2022-09-10 21:16:43 +02:00
|
|
|
trexio_h = include/trexio.h
|
|
|
|
include_HEADERS = $(trexio_h)
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2022-09-06 11:52:36 +02:00
|
|
|
if HAVE_FORTRAN
|
2022-09-10 21:16:43 +02:00
|
|
|
trexio_f = include/trexio_f.f90
|
2022-09-06 11:52:36 +02:00
|
|
|
include_HEADERS += $(trexio_f)
|
|
|
|
endif
|
2021-05-28 13:36:39 +02:00
|
|
|
|
|
|
|
AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include
|
|
|
|
|
|
|
|
lib_LTLIBRARIES = src/libtrexio.la
|
|
|
|
|
|
|
|
|
|
|
|
SOURCES = \
|
2021-06-22 16:04:25 +02:00
|
|
|
src/trexio.c \
|
|
|
|
src/trexio_private.h \
|
|
|
|
src/trexio_s.h \
|
|
|
|
src/trexio_text.c \
|
|
|
|
src/trexio_text.h
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2021-11-08 19:41:17 +01:00
|
|
|
if HAVE_HDF5
|
2021-11-01 11:55:34 +01:00
|
|
|
SOURCES += src/trexio_hdf5.c \
|
2021-11-08 19:41:17 +01:00
|
|
|
src/trexio_hdf5.h
|
2021-11-01 11:55:34 +01:00
|
|
|
endif
|
|
|
|
|
2021-05-28 13:36:39 +02:00
|
|
|
ORG_FILES = \
|
|
|
|
src/templates_front/templator_front.org \
|
|
|
|
src/templates_text/templator_text.org \
|
|
|
|
src/templates_hdf5/templator_hdf5.org \
|
|
|
|
trex.org
|
|
|
|
|
|
|
|
|
2022-09-10 21:16:43 +02:00
|
|
|
src_libtrexio_la_SOURCES = $(trexio_h) $(SOURCES)
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2021-11-16 18:11:42 +01:00
|
|
|
# Include CMake-related files in the distribution.
|
2021-11-18 14:34:19 +01:00
|
|
|
EXTRA_DIST += CMakeLists.txt \
|
|
|
|
src/CMakeLists.txt \
|
|
|
|
tests/CMakeLists.txt \
|
|
|
|
cmake/cmake_uninstall.cmake.in \
|
|
|
|
cmake/FindTREXIO.cmake
|
2021-11-16 18:11:42 +01:00
|
|
|
|
2022-02-16 18:02:45 +01:00
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
# =============== TESTS =============== #
|
2021-06-17 17:20:01 +02:00
|
|
|
|
|
|
|
TESTS_C = \
|
2021-06-22 16:04:25 +02:00
|
|
|
tests/open_text \
|
2021-06-21 12:55:16 +02:00
|
|
|
tests/io_num_text \
|
|
|
|
tests/io_dset_float_text \
|
|
|
|
tests/io_dset_int_text \
|
2021-11-30 16:33:30 +01:00
|
|
|
tests/io_dset_sparse_text \
|
2022-04-11 09:26:54 +02:00
|
|
|
tests/io_determinant_text \
|
2023-01-03 19:28:00 +01:00
|
|
|
tests/io_jastrow_text \
|
2021-07-28 10:19:45 +02:00
|
|
|
tests/io_safe_dset_float_text \
|
2021-06-21 12:55:16 +02:00
|
|
|
tests/io_str_text \
|
|
|
|
tests/io_dset_str_text \
|
2022-01-24 10:12:44 +01:00
|
|
|
tests/delete_group_text \
|
2021-06-21 12:55:16 +02:00
|
|
|
tests/overwrite_all_text \
|
2022-03-31 13:53:57 +02:00
|
|
|
tests/io_all \
|
|
|
|
tests/pre_close
|
2021-06-17 17:20:01 +02:00
|
|
|
|
2021-11-08 19:41:17 +01:00
|
|
|
if HAVE_HDF5
|
2021-11-01 11:55:34 +01:00
|
|
|
TESTS_C += \
|
|
|
|
tests/open_hdf5 \
|
|
|
|
tests/io_num_hdf5 \
|
|
|
|
tests/io_dset_float_hdf5 \
|
|
|
|
tests/io_dset_int_hdf5 \
|
2021-12-08 17:24:16 +01:00
|
|
|
tests/io_dset_sparse_hdf5 \
|
2023-05-07 16:03:57 +02:00
|
|
|
tests/io_dset_external_hdf5 \
|
2022-04-12 00:45:59 +02:00
|
|
|
tests/io_determinant_hdf5 \
|
2023-01-03 19:28:00 +01:00
|
|
|
tests/io_jastrow_hdf5 \
|
2021-11-01 11:55:34 +01:00
|
|
|
tests/io_safe_dset_float_hdf5 \
|
|
|
|
tests/io_str_hdf5 \
|
|
|
|
tests/io_dset_str_hdf5 \
|
2022-01-24 10:12:44 +01:00
|
|
|
tests/delete_group_hdf5 \
|
2021-11-08 19:41:17 +01:00
|
|
|
tests/overwrite_all_hdf5
|
2021-11-01 11:55:34 +01:00
|
|
|
endif
|
|
|
|
|
2022-09-10 21:16:43 +02:00
|
|
|
TESTS = $(TESTS_C)
|
|
|
|
|
2022-09-06 11:52:36 +02:00
|
|
|
if HAVE_FORTRAN
|
2022-09-10 21:16:43 +02:00
|
|
|
TESTS_F = tests/test_f
|
2022-09-06 11:52:36 +02:00
|
|
|
TESTS += $(TESTS_F)
|
|
|
|
endif
|
2021-06-17 17:20:01 +02:00
|
|
|
|
2021-06-01 15:03:37 +02:00
|
|
|
check_PROGRAMS = $(TESTS)
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2021-06-22 17:55:56 +02:00
|
|
|
# specify common LDADD options for all tests
|
2021-06-17 17:20:01 +02:00
|
|
|
LDADD = src/libtrexio.la
|
2021-06-22 14:46:39 +02:00
|
|
|
|
2022-09-06 11:52:36 +02:00
|
|
|
if HAVE_FORTRAN
|
2022-09-10 21:16:43 +02:00
|
|
|
test_trexio_f = tests/trexio_f.f90
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2021-06-04 18:14:45 +02:00
|
|
|
$(test_trexio_f): $(trexio_f)
|
2021-06-02 11:39:35 +02:00
|
|
|
cp $(trexio_f) $(test_trexio_f)
|
|
|
|
|
2021-06-22 17:55:56 +02:00
|
|
|
trexio.mod: tests/trexio_f.o
|
|
|
|
|
2021-06-17 17:20:01 +02:00
|
|
|
tests_test_f_SOURCES = $(test_trexio_f) tests/test_f.f90
|
2022-09-06 11:52:36 +02:00
|
|
|
endif
|
2021-06-17 17:20:01 +02:00
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
clean-local:
|
2021-08-05 16:55:34 +02:00
|
|
|
-rm -rf -- *.dir/ *.h5 __pycache__/
|
2021-06-22 16:04:25 +02:00
|
|
|
|
2022-07-28 14:14:42 +02:00
|
|
|
# =============== GUIX MANIFEST =============== #
|
|
|
|
|
|
|
|
trexio_scm = $(srcdir)/tools/trexio.scm
|
|
|
|
EXTRA_DIST += $(trexio_scm)
|
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
# =============== DOCUMENTATION =============== #
|
2021-06-02 18:45:05 +02:00
|
|
|
|
2021-11-02 21:52:32 +01:00
|
|
|
HTML_TANGLED = docs/index.html \
|
2021-12-16 00:11:36 +01:00
|
|
|
docs/examples.html \
|
2021-11-02 21:52:32 +01:00
|
|
|
docs/templator_hdf5.html \
|
|
|
|
docs/trex.html \
|
|
|
|
docs/README.html \
|
|
|
|
docs/templator_front.html \
|
|
|
|
docs/templator_text.html
|
2021-06-18 12:04:03 +02:00
|
|
|
|
|
|
|
htmldir = $(docdir)
|
2021-11-02 21:52:32 +01:00
|
|
|
# This $(htmlizer) file and the corresponding target rule allow to avoid circular dependency,
|
|
|
|
# which was introduced before to force htmlization of org-mode files.
|
2021-11-03 10:25:09 +01:00
|
|
|
# The circular dependency did not impose issues on GNU make but produced errors on bmake.
|
|
|
|
htmlizer = docs/.htmlizer
|
2021-11-02 21:52:32 +01:00
|
|
|
|
|
|
|
HTML_FILES = $(HTML_TANGLED) \
|
|
|
|
docs/trexio.css \
|
2021-11-03 10:25:09 +01:00
|
|
|
docs/tutorial_benzene.html \
|
|
|
|
$(htmlizer)
|
2021-11-02 21:52:32 +01:00
|
|
|
|
2021-06-18 12:04:03 +02:00
|
|
|
dist_html_DATA = $(HTML_FILES)
|
|
|
|
|
2021-11-02 21:52:32 +01:00
|
|
|
$(HTML_TANGLED): $(htmlizer)
|
|
|
|
|
2021-11-18 13:59:34 +01:00
|
|
|
html-local: $(dist_html_DATA)
|
|
|
|
doc: html-local
|
2021-11-04 12:02:14 +01:00
|
|
|
|
2021-06-22 16:04:25 +02:00
|
|
|
# =============== DEVELOPER MODE =============== #
|
2021-06-02 18:45:05 +02:00
|
|
|
|
2021-11-08 19:41:17 +01:00
|
|
|
SWIG = @SWIG@
|
|
|
|
HDF5_LDFLAGS = @HDF5_LDFLAGS@
|
|
|
|
HDF5_CFLAGS = @HDF5_CFLAGS@
|
|
|
|
HDF5_CPPFLAGS = @HDF5_CPPFLAGS@
|
2021-08-20 14:21:49 +02:00
|
|
|
|
2021-05-28 13:36:39 +02:00
|
|
|
if TREXIO_DEVEL
|
|
|
|
|
2022-09-10 21:16:43 +02:00
|
|
|
CLEANFILES += $(SOURCES) $(trexio_h) $(HTML_TANGLED) $(htmlizer) .git_hash
|
|
|
|
|
|
|
|
BUILT_SOURCES += $(SOURCES) $(trexio_h)
|
2021-05-28 13:36:39 +02:00
|
|
|
|
2022-09-10 21:16:43 +02:00
|
|
|
if HAVE_FORTRAN
|
|
|
|
CLEANFILES += $(trexio_f)
|
|
|
|
BUILT_SOURCES += $(trexio_f) $(test_trexio_f)
|
|
|
|
$(trexio_f): $(trexio_h)
|
|
|
|
endif
|
2021-06-01 15:03:37 +02:00
|
|
|
|
2021-11-08 20:08:42 +01:00
|
|
|
.git_hash: FORCE
|
2021-11-08 19:41:17 +01:00
|
|
|
git log | head -1 | cut -d ' ' -f 2 > .git_hash
|
|
|
|
|
2021-11-08 20:08:42 +01:00
|
|
|
all: .git_hash
|
|
|
|
|
2021-12-01 09:54:09 +01:00
|
|
|
GENERATOR_FILES = $(srcdir)/tools/generator.py \
|
|
|
|
$(srcdir)/tools/generator_tools.py
|
2021-06-18 12:04:03 +02:00
|
|
|
|
2022-09-10 21:16:43 +02:00
|
|
|
$(SOURCES): $(trexio_h)
|
2021-05-28 13:36:39 +02:00
|
|
|
src/trexio.c: $(trexio_h)
|
|
|
|
|
2022-09-10 21:16:43 +02:00
|
|
|
$(trexio_h): $(ORG_FILES) $(GENERATOR_FILES)
|
2021-05-28 13:36:39 +02:00
|
|
|
cd $(srcdir)/tools && ./build_trexio.sh
|
|
|
|
|
2021-11-02 21:52:32 +01:00
|
|
|
$(htmlizer): $(ORG_FILES) $(srcdir)/src/README.org
|
|
|
|
touch $(htmlizer)
|
2021-11-03 10:25:09 +01:00
|
|
|
cd $(srcdir)/tools && ./build_doc.sh
|
2021-06-22 11:30:46 +02:00
|
|
|
|
2021-05-28 13:36:39 +02:00
|
|
|
cppcheck: cppcheck.out
|
|
|
|
cat cppcheck.out
|
|
|
|
|
|
|
|
cppcheck.out: $(trexio_h)
|
|
|
|
cd src/ && \
|
|
|
|
cppcheck --addon=cert -q --error-exitcode=0 \
|
|
|
|
--enable=all \
|
|
|
|
--language=c --std=c99 -rp --platform=unix64 \
|
|
|
|
-I../include *.c *.h 2>../$@
|
|
|
|
|
2022-07-01 15:06:19 +02:00
|
|
|
#################
|
|
|
|
# OCaml binding #
|
|
|
|
#################
|
|
|
|
|
|
|
|
ocaml/trexio/_build/default/lib/trexio.cma:
|
|
|
|
$(MAKE) -C ocaml/trexio
|
|
|
|
|
2022-07-01 15:17:50 +02:00
|
|
|
ocaml: ocaml/trexio/_build/default/lib/trexio.cma
|
2022-07-01 15:06:19 +02:00
|
|
|
|
2022-07-01 15:17:50 +02:00
|
|
|
ocaml-install: ocaml/trexio/_build/default/lib/trexio.cma
|
2022-07-01 15:06:19 +02:00
|
|
|
opam install ocaml/trexio
|
|
|
|
|
|
|
|
##################
|
|
|
|
# Python binding #
|
|
|
|
##################
|
|
|
|
|
2021-08-18 14:02:54 +02:00
|
|
|
setup_py = $(srcdir)/python/setup.py
|
|
|
|
setup_cfg = $(srcdir)/python/setup.cfg
|
2021-08-18 14:40:42 +02:00
|
|
|
pytrexio_py = $(srcdir)/python/pytrexio/pytrexio.py
|
|
|
|
trexio_py = $(srcdir)/python/trexio.py
|
2021-08-30 17:23:24 +02:00
|
|
|
TEST_PY = python/test/test_api.py
|
2021-08-18 14:02:54 +02:00
|
|
|
pytrexio_c = $(srcdir)/src/pytrexio_wrap.c
|
|
|
|
pytrexio_i = $(srcdir)/src/pytrexio.i
|
|
|
|
numpy_i = $(srcdir)/src/numpy.i
|
2021-08-05 09:34:16 +02:00
|
|
|
|
|
|
|
|
2021-08-18 14:02:54 +02:00
|
|
|
python-test: $(TEST_PY)
|
2022-06-01 17:42:30 +02:00
|
|
|
python3 -m pytest -v $(TEST_PY)
|
2021-08-05 16:55:34 +02:00
|
|
|
$(RM) -r -- __pycache__
|
2022-06-01 17:42:30 +02:00
|
|
|
$(RM) -f -- test_file_py.h5 unsafe_test_file_py.h5
|
2021-07-28 15:57:42 +02:00
|
|
|
|
2021-08-05 16:55:34 +02:00
|
|
|
python-install: $(pytrexio_py) $(setup_py) $(setup_cfg)
|
2021-08-20 14:21:49 +02:00
|
|
|
cd python && \
|
2021-09-10 13:36:51 +02:00
|
|
|
./install_pytrexio.sh $(HDF5_CFLAGS) $(HDF5_CPPFLAGS) $(HDF5_LDFLAGS)
|
2021-07-28 10:30:23 +02:00
|
|
|
|
2021-09-09 15:06:16 +02:00
|
|
|
python-sdist: $(pytrexio_py) $(setup_py) $(setup_cfg)
|
|
|
|
cd python && \
|
2022-01-07 18:47:23 +01:00
|
|
|
python3 -m build --sdist
|
2021-09-09 15:06:16 +02:00
|
|
|
|
2021-11-08 19:41:17 +01:00
|
|
|
$(pytrexio_py): $(pytrexio_c)
|
2021-08-05 16:55:34 +02:00
|
|
|
cd tools && ./prepare_python.sh
|
2021-07-28 10:30:23 +02:00
|
|
|
|
2021-08-05 16:55:34 +02:00
|
|
|
# Build Python module and C wrapper code for TREXIO using SWIG
|
|
|
|
# [?] swig -python -threads pytrexio.i ----> Add thread support for all the interface
|
2021-12-01 09:54:09 +01:00
|
|
|
$(pytrexio_c): $(ORG_FILES) $(GENERATOR_FILES) $(trexio_h) $(pytrexio_i) $(numpy_i)
|
2022-03-31 14:19:41 +02:00
|
|
|
@if [[ $(SWIG).x != ".x" ]] ; then \
|
|
|
|
cp $(trexio_h) src/ ; \
|
2021-08-20 14:21:49 +02:00
|
|
|
cd src/ && \
|
2022-03-31 14:19:41 +02:00
|
|
|
$(SWIG) -python -py3 -o pytrexio_wrap.c pytrexio.i ; \
|
|
|
|
$(RM) -- src/trexio.h ;\
|
|
|
|
else echo "Error: SWIG is not installed" ; \
|
|
|
|
exit 1 ; \
|
|
|
|
fi
|
|
|
|
|
2021-07-20 14:57:48 +02:00
|
|
|
|
2021-08-05 16:55:34 +02:00
|
|
|
$(numpy_i):
|
2021-11-08 19:41:17 +01:00
|
|
|
wget https://raw.githubusercontent.com/numpy/numpy/main/tools/swig/numpy.i -O $(numpy_i)
|
2021-08-05 16:55:34 +02:00
|
|
|
|
2021-08-10 14:43:24 +02:00
|
|
|
check-numpy:
|
|
|
|
cd tools && ./check_numpy_i.sh
|
2021-07-19 17:58:50 +02:00
|
|
|
|
2022-09-27 13:54:54 +02:00
|
|
|
# Include files needed to produce the debian package.
|
|
|
|
DEB_FILES = \
|
|
|
|
helpers-debian/changelog \
|
|
|
|
helpers-debian/compat \
|
|
|
|
helpers-debian/control \
|
|
|
|
helpers-debian/copyright \
|
|
|
|
helpers-debian/rules \
|
|
|
|
helpers-debian/source \
|
|
|
|
helpers-debian/libtrexio0.install \
|
|
|
|
helpers-debian/libtrexio-dev.install \
|
|
|
|
helpers-debian/source \
|
2023-05-07 16:03:57 +02:00
|
|
|
helpers-debian/README.source
|
2022-09-27 13:54:54 +02:00
|
|
|
|
|
|
|
debian_from_dist: $(DEB_FILES) $(SOURCES) $(trexio_h)
|
|
|
|
cp ../trexio-$(PACKAGE_VERSION).tar.gz ../libtrexio_$(PACKAGE_VERSION).orig.tar.gz
|
|
|
|
debuild
|
|
|
|
|
|
|
|
|
2021-08-18 14:02:54 +02:00
|
|
|
CLEANFILES += $(pytrexio_c) \
|
|
|
|
$(pytrexio_py) \
|
2021-08-18 14:40:42 +02:00
|
|
|
$(trexio_py) \
|
2021-08-18 14:02:54 +02:00
|
|
|
python/src/*.c \
|
|
|
|
python/src/*.h
|
2021-07-19 17:58:50 +02:00
|
|
|
|
2022-07-01 15:06:19 +02:00
|
|
|
.PHONY: cppcheck python-test python-install python-sdist check-numpy FORCE ocaml
|
2021-05-28 13:36:39 +02:00
|
|
|
|
|
|
|
endif
|