diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..c29b256b3 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,19 @@ +name: CI + +on: + workflow_dispatch: + pull_request: + branches: [ develop ] + push: + branches: [ develop ] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + uses: ./.github/workflows/step_test.yaml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 4d850d6f2..000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: CI - -on: - pull_request: - push: - branches: - - develop - -jobs: - pre-commit: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.0 - - build: - runs-on: ubuntu-20.04 - strategy: - matrix: - w90-binary-parallel: [ 'false', 'true' ] - name: Build and test `parallel=${{ matrix.w90-binary-parallel }}` - steps: - - name: checkout - uses: actions/checkout@v2 - - name: setup python - uses: actions/setup-python@v2 - with: - python-version: 3.6 - - name: install dependencies - run: | - sudo apt-get update - sudo apt-get install \ - gfortran \ - libblas-dev \ - liblapack-dev \ - openmpi-bin \ - libopenmpi-dev - pip install --upgrade pip - pip install \ - numpy \ - matplotlib \ - - name: build - env: - W90BINARYPARALLEL: ${{ matrix.w90-binary-parallel }} - run: | - if [ "$W90BINARYPARALLEL" == "true" ] ; then - cp ./.github/workflows/config/make.inc.gfort+openmpi ./make.inc - else - cp ./.github/workflows/config/make.inc.gfort ./make.inc - fi - #make -j default w90chk2chk libs - make all - - name: run tests - env: - W90BINARYPARALLEL: ${{ matrix.w90-binary-parallel }} - run: | - ./.github/workflows/run_tests.sh - - name: compute coverage - uses: codecov/codecov-action@v1 - - name: archive test results - if: ${{ always() }} - uses: actions/upload-artifact@v2 - with: - name: test-results_parallel=${{ matrix.w90-binary-parallel }} - path: | - test-suite/tests/test*/test.err* - test-suite/tests/test*/test.out* diff --git a/.github/workflows/run_tests.sh b/.github/workflows/run_tests.sh deleted file mode 100755 index 55dd3df9a..000000000 --- a/.github/workflows/run_tests.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -set -e - -TESTDIR=$(pwd)/test-suite/ -echo $TESTDIR -cd "$TESTDIR" - -echo "****************************************" -echo "* RUNNING SERIAL TEST FOR LIBRARY MODE *" -echo "****************************************" -cd library-mode-test -# Create the binary for testing -make -# remove the output file from old runs, if there -rm -f results.dat -# Run it - if it crashes it should give a non-zero error -./test_library_serial.x -# Check the output values -./compare_results.py - -## Going back to the test dir -cd "$TESTDIR" - -# Default: serial, no mpirun. Run these in any case -echo "************************" -echo "* RUNNING SERIAL TESTS *" -echo "************************" -./run_tests --category=default - -if [ "$W90BINARYPARALLEL" == "true" ] -then - # If running in parallel: run also the tests in parallel - echo "" - echo "**************************" - echo "* RUNNING PARALLEL TESTS *" - echo "**************************" - # I hardcode the numprocs to four, in case change it or set it as an ENV - # var in the .travis.yml - ./run_tests --category=par --numprocs=2 -fi diff --git a/.github/workflows/step_test.yaml b/.github/workflows/step_test.yaml new file mode 100644 index 000000000..3ce7d5095 --- /dev/null +++ b/.github/workflows/step_test.yaml @@ -0,0 +1,100 @@ +name: test +run-name: Run tests + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +on: + workflow_call: + +permissions: + contents: read + +jobs: + pre-commit: + name: Check pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 + + tests: + name: Check on ${{ matrix.toolchain }} toolchain ${{ matrix.mpi }} + runs-on: ${{ matrix.os || 'ubuntu-latest' }} + container: ${{ !matrix.os && 'ghcr.io/lecrisut/dev-env:main' || '' }} + needs: [ pre-commit ] + continue-on-error: ${{ matrix.experimental || false }} + strategy: + fail-fast: false + matrix: + toolchain: [ gcc, llvm, intel ] + mpi: ['', openmpi, mpich, intel] + include: + # flang is missing features in 16.0.6 + - toolchain: llvm + experimental: true + steps: + - name: Install missing packages + run: dnf install -y bzip2 python-unversioned-command + - name: Load mpi module ${{ matrix.mpi }} + run: | + # Get interactive profile to be able to load modules + source /etc/profile + + # Save the current environment since we only want the added difference + printenv > orig_env + + # Load the relevant mpi module + module load mpi/${{ matrix.mpi }} + printenv > module_env + + diff orig_env module_env | sed -n 's/> //p' >> $GITHUB_ENV + + # Set MPI flag on + echo "WITH_MPI=ON" >> $GITHUB_ENV + if: ${{ matrix.mpi }} + - name: Enable msvc toolchain on windows + uses: ilammy/msvc-dev-cmd@v1 + if: contains(matrix.os, 'windows') + - name: Activate Intel compilers + run: | + source /etc/profile + printenv > orig_env + module load compiler + printenv > module_env + diff orig_env module_env | sed -n 's/> //p' >> $GITHUB_ENV + echo $PATH >> $GITHUB_PATH + if: matrix.toolchain == 'intel' + - uses: actions/checkout@v3 + - uses: lukka/get-cmake@latest + - name: Run CMake configuration for ${{ matrix.toolchain }} toolchain + uses: lukka/run-cmake@v10.3 + with: + workflowPreset: "${{ matrix.toolchain }}-ci" + + coverage: + name: Check test coverage + runs-on: ubuntu-latest + needs: [ tests ] + steps: + - uses: actions/checkout@v3 + - uses: lukka/get-cmake@latest + - name: Get test coverage + uses: lukka/run-cmake@v10.3 + with: + workflowPreset: ci-coverage + - name: Get lcov data + uses: danielealbano/lcov-action@v3 + with: + # Note lcov-action prepends and appends wild-cards *. Account for those + # https://github.com/danielealbano/lcov-action/issues/11 + remove_patterns: /test/,/cmake-build*/ + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + name: ${{ matrix.coverage }} coverage + files: coverage.info + flags: ${{ matrix.coverage }} + verbose: true diff --git a/.gitignore b/.gitignore index 4e7318d5a..f3d70e966 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,31 @@ -wannier90.x -postw90.x -.DS_Store -make.inc -w90chk2chk.x -w90spn2spn.x -libwannier.a -libwan2.a -libwannier.so -libwannier.dylib -*~ -*.x.dSYM +### Build system +cmake-build-*/ +build/ +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + + +### Other +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +### IDE files .vscode +/.idea + +### Project files +/CMakeUserPresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..f6b8a345e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,177 @@ +cmake_minimum_required(VERSION 3.18) + +#[==============================================================================================[ +# Basic project definition # +]==============================================================================================] + +project(Wannier90 + VERSION 4.0.0 + DESCRIPTION "Compute maximally-localised Wannier functions." + HOMEPAGE_URL https://www.wannier90.org + LANGUAGES Fortran + ) + +# Back-porting to PROJECT_IS_TOP_LEVEL to older cmake +# TODO: Remove when requiring cmake >= 3.21 +if (NOT DEFINED Spglib_IS_TOP_LEVEL) + if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + set(PROJECT_IS_TOP_LEVEL ON) + else () + set(PROJECT_IS_TOP_LEVEL OFF) + endif () +endif () +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif () + +#[==============================================================================================[ +# Options # +]==============================================================================================] + +option(WANNIER90_WITH_MPI "Wannier90: Build library as a shared library" OFF) +option(WANNIER90_SHARED_LIBS "Wannier90: Build library as a shared library" ${PROJECT_IS_TOP_LEVEL}) +option(WANNIER90_INSTALL "Wannier90: Install files" ${PROJECT_IS_TOP_LEVEL}) +option(WANNIER90_TEST "Wannier90: Build unit tests" ${PROJECT_IS_TOP_LEVEL}) + +#[==============================================================================================[ +# Project configuration # +]==============================================================================================] + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif () +if (NOT CMAKE_Fortran_MODULE_DIRECTORY) + set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fortran_mods) +endif () +set(BUILD_SHARED_LIBS ${WANNIER90_SHARED_LIBS}) + +if (WANNIER90_INSTALL) + include(GNUInstallDirs) + include(CMakePackageConfigHelpers) + + # TODO: Remove when requiring cmake >= 3.20 + if (NOT COMMAND cmake_path) + # Note: This is not an actual replacement of cmake_path, just a minimal implementation for + # this project + include(cmake/compat/cmake_path.cmake) + endif () + + # CMake does not properly support fortran module installation paths. + # Adapting the standard from fortran-stdlib + # https://gitlab.kitware.com/cmake/cmake/-/issues/19608 + # https://discourse.cmake.org/t/api-design-c-modules-source-listings-and-interface-properties/5389/14 + cmake_path(APPEND CMAKE_INSTALL_INCLUDEDIR ${PROJECT_NAME} "${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}" + OUTPUT_VARIABLE _DEFAULT_CMAKE_INSTALL_MODULEDIR) + set(CMAKE_INSTALL_MODULEDIR ${_DEFAULT_CMAKE_INSTALL_MODULEDIR} + CACHE STRING + "Fortran module installation path (Not a cmake native variable)" + ) + cmake_path(IS_ABSOLUTE CMAKE_INSTALL_MODULEDIR _is_absolute) + if (_is_absolute) + set(CMAKE_INSTALL_FULL_MODULEDIR ${CMAKE_INSTALL_MODULEDIR}) + else () + cmake_path(APPEND CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_MODULEDIR} + OUTPUT_VARIABLE CMAKE_INSTALL_FULL_MODULEDIR) + endif () +endif () + +#[==============================================================================================[ +# External packages # +]==============================================================================================] + +## Third-party libraries +find_package(BLAS REQUIRED) +find_package(LAPACK REQUIRED) +if (WANNIER90_WITH_MPI) + find_package(MPI REQUIRED) +endif () + +#[==============================================================================================[ +# Main definition # +]==============================================================================================] + +## Main targets +add_executable(Wannier90_exe) +set_target_properties(Wannier90_exe PROPERTIES + OUTPUT_NAME wannier90.x + EXPORT_NAME exe) +add_executable(Wannier90::exe ALIAS Wannier90_exe) +add_executable(Wannier90_post) +set_target_properties(Wannier90_post PROPERTIES + OUTPUT_NAME postw90.x + EXPORT_NAME post) +add_executable(Wannier90::post ALIAS Wannier90_post) +add_library(Wannier90_lib) +set_target_properties(Wannier90_lib PROPERTIES + OUTPUT_NAME wannier90 + EXPORT_NAME wannier90 + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR}) +add_library(Wannier90::wannier90 ALIAS Wannier90_lib) + +## Main implementations +add_subdirectory(src) + +## Testing +if (WANNIER90_TEST) + enable_testing() + add_executable(w90chk2chk.x) + add_executable(w90spn2spn.x) + add_subdirectory(test-suite) +endif () + +#[==============================================================================================[ +# Install or Export # +]==============================================================================================] + +## Installs +if (WANNIER90_INSTALL) + configure_file(cmake/wannier90.pc.in wannier90.pc) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/wannier90.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig + COMPONENT Wannier90_Development) + write_basic_package_version_file( + ${CMAKE_CURRENT_BINARY_DIR}/Wannier90ConfigVersion.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion) + configure_package_config_file( + cmake/Wannier90Config.cmake.in + Wannier90Config.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Wannier90) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Wannier90ConfigVersion.cmake + ${CMAKE_CURRENT_BINARY_DIR}/Wannier90Config.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Wannier90 + COMPONENT Spglib_Development) + install(EXPORT Wannier90Targets + FILE Wannier90Targets.cmake + NAMESPACE Wannier90:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Wannier90 + COMPONENT Wannier90_Development) + export(EXPORT Wannier90Targets + FILE Wannier90Targets.cmake + NAMESPACE Wannier90::) +endif () + +## Make project available to FetchContent +if (NOT PROJECT_IS_TOP_LEVEL) + # Propagate variables for FetchContent + # All variables have to be consistent with CMakeExtraUtilsConfig.cmake + set(Wannier90_MPI ${WANNIER90_WITH_MPI}) + if (CMAKE_VERSION VERSION_LESS 3.25) + # TODO: Remove when cmake 3.25 is commonly distributed + set(Wannier90_VERSION ${Wannier90_VERSION} PARENT_SCOPE) + set(Wannier90_VERSION_MAJOR ${Wannier90_VERSION_MAJOR} PARENT_SCOPE) + set(Wannier90_VERSION_MINOR ${Wannier90_VERSION_MINOR} PARENT_SCOPE) + set(Wannier90_VERSION_PATCH ${Wannier90_VERSION_PATCH} PARENT_SCOPE) + set(Wannier90_VERSION_TWEAK ${Wannier90_VERSION_TWEAK} PARENT_SCOPE) + set(Wannier90_MPI ${Wannier90_MPI} PARENT_SCOPE) + endif () + return(PROPAGATE + Wannier90_VERSION + Wannier90_VERSION_MAJOR + Wannier90_VERSION_MINOR + Wannier90_VERSION_PATCH + Wannier90_VERSION_TWEAK + Wannier90_MPI + ) +endif () diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..6d55c7c1c --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,12 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "include": [ + "cmake/CMakePresets-defaults.json", + "cmake/CMakePresets-CI.json" + ] +} \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index fdde004f9..000000000 --- a/Makefile +++ /dev/null @@ -1,232 +0,0 @@ -ifndef ROOTDIR -ROOTDIR=. -endif - -REALMAKEFILE=../Makefile.2 - -TAR := $(shell if which gnutar 1>/dev/null 2> /dev/null; then echo gnutar; else echo tar; fi ) - -default: wannier post - -PREFIX ?= /usr - -VERSION_MAJOR = 3 -VERSION_MINOR = 1 -VERSION_PATCH = 0 - -VERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) -VERSION_SHORT = $(VERSION_MAJOR).$(VERSION_MINOR) - -install: default - install -d $(DESTDIR)$(PREFIX)/bin/ - for x in wannier90.x postw90.x w90chk2chk.x w90spn2spn.x ; do \ - if [ -f "$$x" ]; then install -m755 "$$x" "$(DESTDIR)$(PREFIX)/bin/$$x"; fi; \ - done - if [ -f "utility/w90pov/w90pov" ]; then install -m755 "utility/w90pov/w90pov" "$(DESTDIR)$(PREFIX)/bin/w90pov"; fi; - if [ -f "utility/w90vdw/w90vdw.x" ]; then install -m755 "utility/w90vdw/w90vdw.x" "$(DESTDIR)$(PREFIX)/bin/w90vdw.x"; fi; - install -d $(DESTDIR)$(PREFIX)/lib/ - if [ -f "libwannier.a" ]; then install -m644 "libwannier.a" "$(DESTDIR)$(PREFIX)/lib/libwannier.a"; fi; - if [ -f "libwannier.a" ]; then $(MAKE) pkgconfig; fi; - -all: wannier lib post w90chk2chk w90pov w90vdw w90spn2spn - -doc: thedoc - -w90chk2chk: objdir - (cd $(ROOTDIR)/src/obj && $(MAKE) -f $(REALMAKEFILE) w90chk2chk) - -w90spn2spn: objdir - (cd $(ROOTDIR)/src/obj && $(MAKE) -f $(REALMAKEFILE) w90spn2spn) - -wannier: objdir - (cd $(ROOTDIR)/src/obj && $(MAKE) -f $(REALMAKEFILE) wannier) - -lib: objdir - (cd $(ROOTDIR)/src/obj && $(MAKE) -f $(REALMAKEFILE) libs) - -dynlib: objdir - (cd $(ROOTDIR)/src/obj && $(MAKE) -f $(REALMAKEFILE) dynlibs) - -w90pov: - (cd $(ROOTDIR)/utility/w90pov && $(MAKE) ) - -w90vdw: - (cd $(ROOTDIR)/utility/w90vdw && $(MAKE) ) - -libs: lib - -PKGCONFIG_FILENAME = wannier.pc -pkgconfig: - $(file > $(PKGCONFIG_FILENAME),prefix=$(DESTDIR)$(PREFIX)) - $(file >> $(PKGCONFIG_FILENAME),exec_prefix=$(DESTDIR)$(PREFIX)/bin) - $(file >> $(PKGCONFIG_FILENAME),libdir=$(DESTDIR)$(PREFIX)/lib) - $(file >> $(PKGCONFIG_FILENAME),includedir=$(DESTDIR)$(PREFIX)/include) - $(file >> $(PKGCONFIG_FILENAME),) - $(file >> $(PKGCONFIG_FILENAME),Name: wannier) - $(file >> $(PKGCONFIG_FILENAME),Description: Compute maximally-localised Wannier functions.) - $(file >> $(PKGCONFIG_FILENAME),Requires: ) - $(file >> $(PKGCONFIG_FILENAME),Version: $(VERSION)) - $(file >> $(PKGCONFIG_FILENAME),Libs: -L$${libdir} -lwannier) - $(file >> $(PKGCONFIG_FILENAME),Cflags: -I$${includedir}) - install -D -m644 "$(PKGCONFIG_FILENAME)" "$(DESTDIR)$(PREFIX)/lib/pkgconfig/$(PKGCONFIG_FILENAME)" - cd $(ROOTDIR) && rm -f $(PKGCONFIG_FILENAME) - -post: objdir - (cd $(ROOTDIR)/src/obj && $(MAKE) -f $(REALMAKEFILE) post) - -clean: - cd $(ROOTDIR) && rm -f *~ - cd $(ROOTDIR) && rm -f src/*~ - cd $(ROOTDIR) && rm -f $(PKGCONFIG_FILENAME) - @( cd $(ROOTDIR) && if [ -d src/obj ] ; \ - then cd src/obj && \ - $(MAKE) -f $(REALMAKEFILE) clean && \ - cd ../ && rm -rf obj ; \ - fi ) - $(MAKE) -C $(ROOTDIR)/doc/user_guide clean - $(MAKE) -C $(ROOTDIR)/doc/tutorial clean - $(MAKE) -C $(ROOTDIR)/utility/w90pov clean - $(MAKE) -C $(ROOTDIR)/utility/w90vdw clean - cd $(ROOTDIR)/test-suite && ./clean_tests - -veryclean: clean - cd $(ROOTDIR) && rm -f wannier90.x postw90.x libwannier.a libwan2.a w90chk2chk.x w90spn2spn.x - cd $(ROOTDIR)/doc && rm -f user_guide.pdf tutorial.pdf - cd $(ROOTDIR)/doc/user_guide && rm -f user_guide.ps - cd $(ROOTDIR)/doc/tutorial && rm -f tutorial.ps - cd $(ROOTDIR)/test-suite && ./clean_tests -i - -thedoc: - $(MAKE) -C $(ROOTDIR)/doc/user_guide - $(MAKE) -C $(ROOTDIR)/doc/tutorial - -# For now hardcoded to 3.1.0, and using HEAD -# Better to get the version from the io.F90 file and use -# the tag (e.g. v3.1.0) instead of HEAD -dist: - cd $(ROOTDIR) && git archive HEAD --prefix=wannier90-3.1.0/ -o wannier90-3.1.0.tar.gz - -dist-legacy: - @(cd $(ROOTDIR) && $(TAR) -cz --transform='s,^\./,wannier90-3.1/,' -f wannier90-3.1.tar.gz \ - ./src/*.?90 \ - ./src/postw90/*.?90 \ - ./autodoc/README.txt \ - ./autodoc/*.md \ - ./autodoc/media/favicon*png \ - ./examples/README \ - ./examples/example01/UNK* \ - ./examples/*/*.win \ - ./examples/example0[2-4]/*.eig \ - ./examples/example0[1-4]/*.*mn \ - ./examples/example0[5-9]/*.scf \ - ./examples/example1[0-3]/*.scf \ - ./examples/example0[5-9]/*.nscf \ - ./examples/example1[0-3]/*.nscf \ - ./examples/example0[5-9]/*.pw2wan \ - ./examples/example1[0-3]/*.pw2wan \ - ./examples/example1[4-5]/defected/*.scf \ - ./examples/example1[4-5]/defected/*.nscf \ - ./examples/example1[4-5]/defected/*.win \ - ./examples/example1[4-5]/defected/*.pw2wan \ - ./examples/example1[4-5]/periodic/*.scf \ - ./examples/example1[4-5]/periodic/*.nscf \ - ./examples/example1[4-5]/periodic/*.win \ - ./examples/example1[4-5]/periodic/*.pw2wan \ - ./examples/example16-noqe/Si.amn \ - ./examples/example16-noqe/Si.mmn \ - ./examples/example16-noqe/Si.eig \ - ./examples/example16-withqe/Si.scf \ - ./examples/example16-withqe/Si.nscf \ - ./examples/example16-withqe/Si.pw2wan \ - ./examples/example1[7-9]/*.scf \ - ./examples/example1[7-9]/*.nscf \ - ./examples/example1[7-9]/*.pw2wan \ - ./examples/example20/*.scf \ - ./examples/example20/*.nscf \ - ./examples/example20/*.pw2wan \ - ./examples/example20/SrMnO3/SrMnO3-d.pw2wan \ - ./examples/example20/SrMnO3/SrMnO3-d.win \ - ./examples/example20/SrMnO3/SrMnO3-eg.pw2wan \ - ./examples/example20/SrMnO3/SrMnO3-eg.win \ - ./examples/example20/SrMnO3/SrMnO3.nscf \ - ./examples/example20/SrMnO3/SrMnO3.scf \ - ./examples/example20/SrMnO3/SrMnO3-t2g.pw2wan \ - ./examples/example20/SrMnO3/SrMnO3-t2g.win \ - ./examples/example2[1-2]/README \ - ./examples/example2[1-2]/*/*.scf \ - ./examples/example2[1-2]/*/*.nscf \ - ./examples/example2[1-2]/*/*.win \ - ./examples/example2[1-2]/*/*.sym \ - ./examples/example2[1-2]/*/*.pw2wan \ - ./pseudo/*.UPF \ - ./pwscf/README \ - ./pwscf/v*/*.f90 \ - ./pwscf/v*/README \ - ./config/make.inc* \ - ./utility/*.pl \ - ./utility/PL_assessment/*.f90 \ - ./utility/PL_assessment/README \ - ./utility/w90vdw/w90vdw.f90 \ - ./utility/w90vdw/README \ - ./utility/w90vdw/doc/Makefile \ - ./utility/w90vdw/doc/w90vdw.tex \ - ./utility/w90vdw/examples/benzene_s_val/benzene_s_val.* \ - ./utility/w90vdw/examples/benzene_s_val/ref/benzene_s_val.* \ - ./utility/w90vdw/examples/benzene_s_cond/benzene_s_cond.* \ - ./utility/w90vdw/examples/benzene_s_cond/ref/benzene_s_cond.* \ - ./utility/w90pov/doc/*.tex \ - ./utility/w90pov/doc/*.pdf \ - ./utility/w90pov/doc/figs/*.png \ - ./utility/w90pov/src/*.f90 \ - ./utility/w90pov/src/*.c \ - ./utility/w90pov/examples/*/*.gz \ - ./utility/w90pov/examples/*/*.inp \ - ./utility/w90pov/examples/*/*.inc \ - ./utility/w90pov/examples/*/*.pov \ - ./utility/w90pov/examples/*/ref/*.png \ - ./utility/w90pov/README \ - ./utility/w90chk2chk/README \ - ./doc/*/*.tex \ - ./doc/*/*.eps \ - ./doc/*/*.fig \ - ./doc/wannier90.bib \ - ./*/Makefile \ - ./*/Makefile.2 \ - ./*/*/Makefile \ - ./Makefile \ - ./LICENSE \ - ./README* \ - ./CHANGE.log \ - ) - -test-serial: w90chk2chk wannier post - (cd $(ROOTDIR)/test-suite && ./run_tests --category=default ) - -test-parallel: w90chk2chk wannier post - (cd $(ROOTDIR)/test-suite && ./run_tests --category=par --numprocs=4 ) - -# Alias -tests: test-serial test-parallel - -dist-lite: - @(cd $(ROOTDIR) && $(TAR) -cz --transform='s,^\./,wannier90/,' -f wannier90.tar.gz \ - ./src/*.?90 \ - ./src/postw90/*.?90 \ - ./config/* \ - ./*/Makefile \ - ./utility/*.pl \ - ./*/Makefile \ - ./*/Makefile.2 \ - ./*/*/Makefile \ - ./Makefile \ - ./LICENSE \ - ./README.* \ - ./CHANGE.log \ - ) - -objdir: - @( cd $(ROOTDIR) && if [ ! -d src/obj ] ; \ - then mkdir src/obj ; \ - fi ) ; - -.PHONY: wannier default all doc lib libs post clean veryclean thedoc dist test-serial test-parallel dist-lite objdir objdirp tests w90spn2spn install pkgconfig diff --git a/cmake/CMakePresets-CI.json b/cmake/CMakePresets-CI.json new file mode 100644 index 000000000..e2979c3c4 --- /dev/null +++ b/cmake/CMakePresets-CI.json @@ -0,0 +1,197 @@ +{ + "version": 6, + "include": [ + "CMakePresets-defaults.json" + ], + "configurePresets": [ + { + "name": "ci-base", + "hidden": true, + "generator": "Ninja", + "inherits": [ + "default" + ], + "cacheVariables": { + "WANNIER90_TEST": { + "type": "BOOL", + "value": true + }, + "WANNIER90_WITH_MPI": { + "type": "BOOL", + "value": "$env{WITH_MPI}" + } + }, + "errors": { + "deprecated": true + } + }, + { + "name": "gcc-ci", + "displayName": "Configure preset for GCC toolchain", + "inherits": [ + "ci-base" + ], + "binaryDir": "cmake-build-gcc", + "cacheVariables": { + "CMAKE_Fortran_COMPILER": { + "type": "FILEPATH", + "value": "gfortran" + } + } + }, + { + "name": "llvm-ci", + "displayName": "Configure preset for LLVM toolchain", + "inherits": [ + "ci-base" + ], + "binaryDir": "cmake-build-gcc", + "cacheVariables": { + "CMAKE_Fortran_COMPILER": { + "type": "FILEPATH", + "value": "flang-new" + } + } + }, + { + "name": "intel-ci", + "displayName": "Configure preset for Intel toolchain", + "inherits": [ + "ci-base" + ], + "binaryDir": "cmake-build-intel", + "cacheVariables": { + "CMAKE_Fortran_COMPILER": { + "type": "FILEPATH", + "value": "ifx" + } + } + } + ], + "buildPresets": [ + { + "name": "ci-base", + "hidden": true, + "inherits": [ + "default" + ], + "cleanFirst": true + }, + { + "name": "gcc-ci", + "displayName": "Build preset for GCC toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "gcc-ci" + }, + { + "name": "llvm-ci", + "displayName": "Build preset for LLVM toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "llvm-ci" + }, + { + "name": "intel-ci", + "displayName": "Build preset for Intel toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "intel-ci" + } + ], + "testPresets": [ + { + "name": "ci-base", + "hidden": true, + "inherits": [ + "default" + ], + "output": { + "outputOnFailure": true + } + }, + { + "name": "gcc-ci", + "displayName": "Test preset for GCC toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "gcc-ci" + }, + { + "name": "llvm-ci", + "displayName": "Test preset for LLVM toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "llvm-ci" + }, + { + "name": "intel-ci", + "displayName": "Test preset for Intel toolchain", + "inherits": [ + "ci-base" + ], + "configurePreset": "intel-ci" + } + ], + "workflowPresets": [ + { + "name": "gcc-ci", + "displayName": "CI test for GCC toolchain", + "steps": [ + { + "type": "configure", + "name": "gcc-ci" + }, + { + "type": "build", + "name": "gcc-ci" + }, + { + "type": "test", + "name": "gcc-ci" + } + ] + }, + { + "name": "llvm-ci", + "displayName": "CI test for LLVM toolchain", + "steps": [ + { + "type": "configure", + "name": "llvm-ci" + }, + { + "type": "build", + "name": "llvm-ci" + }, + { + "type": "test", + "name": "llvm-ci" + } + ] + }, + { + "name": "intel-ci", + "displayName": "CI test for Intel toolchain", + "steps": [ + { + "type": "configure", + "name": "intel-ci" + }, + { + "type": "build", + "name": "intel-ci" + }, + { + "type": "test", + "name": "intel-ci" + } + ] + } + ] +} diff --git a/cmake/CMakePresets-defaults.json b/cmake/CMakePresets-defaults.json new file mode 100644 index 000000000..759e4d9b6 --- /dev/null +++ b/cmake/CMakePresets-defaults.json @@ -0,0 +1,89 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default", + "displayName": "Default configuration preset", + "binaryDir": "cmake-build-release", + "cacheVariables": { + "CMAKE_BUILD_TYPE": { + "type": "STRING", + "value": "Release" + } + } + }, + { + "name": "mpi", + "displayName": "MPI configuration preset", + "binaryDir": "cmake-build-mpi", + "cacheVariables": { + "WANNIER90_WITH_MPI": { + "type": "BOOL", + "value": true + } + } + } + ], + "buildPresets": [ + { + "name": "default", + "displayName": "Default build preset", + "configurePreset": "default" + }, + { + "name": "mpi", + "displayName": "MPI build preset", + "configurePreset": "mpi" + } + ], + "testPresets": [ + { + "name": "default", + "displayName": "Default test preset", + "configurePreset": "default" + }, + { + "name": "mpi", + "displayName": "MPI test preset", + "configurePreset": "mpi" + } + ], + "workflowPresets": [ + { + "name": "default", + "displayName": "Default workflow", + "steps": [ + { + "type": "configure", + "name": "default" + }, + { + "type": "build", + "name": "default" + }, + { + "type": "test", + "name": "default" + } + ] + }, + { + "name": "mpi", + "displayName": "MPI workflow", + "steps": [ + { + "type": "configure", + "name": "mpi" + }, + { + "type": "build", + "name": "mpi" + }, + { + "type": "test", + "name": "mpi" + } + ] + } + ] +} \ No newline at end of file diff --git a/cmake/Wannier90Config.cmake.in b/cmake/Wannier90Config.cmake.in new file mode 100644 index 000000000..5718d5214 --- /dev/null +++ b/cmake/Wannier90Config.cmake.in @@ -0,0 +1,8 @@ +@PACKAGE_INIT@ + + +## Define basic variables +set(Wannier90_MPI @WANNIER90_WITH_MPI@) + +## Parse find_package request +include(${CMAKE_CURRENT_LIST_DIR}/Wannier90Targets.cmake) diff --git a/cmake/compat/cmake_path.cmake b/cmake/compat/cmake_path.cmake new file mode 100644 index 000000000..2c71cbfa0 --- /dev/null +++ b/cmake/compat/cmake_path.cmake @@ -0,0 +1,20 @@ +# Note: This is not an actual replacement of cmake_path, just a minimal implementation for +# Wannier90 project +function(cmake_path operator path_var) + if (NOT ${operator} STREQUAL APPEND) + message(FATAL_ERROR Unsupported operator) + endif () + + set(ARGS_Options) + set(ARGS_OneValue "OUTPUT_VARIABLE") + set(ARGS_MultiValue) + cmake_parse_arguments(ARGS "${ARGS_Options}" "${ARGS_OneValue}" "${ARGS_MultiValue}" ${ARGN}) + + if(NOT DEFINED ARGS_OUTPUT_VARIABLE) + set(ARGS_OUTPUT_VARIABLE ${path_var}) + endif () + set(${ARGS_OUTPUT_VARIABLE} ${${path_var}}) + foreach (path IN LISTS ARGS_UNPARSED_ARGUMENTS) + set(${ARGS_OUTPUT_VARIABLE} "${${ARGS_OUTPUT_VARIABLE}}/${path}") + endforeach () +endfunction() diff --git a/cmake/wannier90.pc.in b/cmake/wannier90.pc.in new file mode 100644 index 000000000..35b293d1f --- /dev/null +++ b/cmake/wannier90.pc.in @@ -0,0 +1,8 @@ +Name: wannier +Version: @PROJECT_VERSION@ +Description: @PROJECT_DESCRIPTION@ +URL: @PROJECT_HOMEPAGE_URL@ + +Libdir: @CMAKE_INSTALL_FULL_LIBDIR@ +Cflags: -I@CMAKE_INSTALL_FULL_MODULEDIR@ -I@CMAKE_INSTALL_FULL_INCLUDEDIR@ +Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lwannier90 diff --git a/config/make.inc.alpha b/config/make.inc.alpha deleted file mode 100644 index 878e8de96..000000000 --- a/config/make.inc.alpha +++ /dev/null @@ -1,8 +0,0 @@ -#====== -# Alpha -#====== - -F90 = f90 -FCOPTS = -fast -LDOPTS = -fast -LIBS = -lcxml diff --git a/config/make.inc.g95 b/config/make.inc.g95 deleted file mode 100644 index 211ff4a8f..000000000 --- a/config/make.inc.g95 +++ /dev/null @@ -1,20 +0,0 @@ -#=================== -# g95 -#=================== -F90 = g95 -FCOPTS = -O2 -LDOPTS = -O2 - - -#======================= -# ATLAS Blas and LAPACK -#======================= -#LIBDIR = /usr/local/lib -#LIBS = -L$(LIBDIR) -llapack -lf77blas -lcblas -latlas - - -#======================= -# NETLIB LAPACK and BLAS -#======================= -#LIBDIR = /usr/local/lib -#LIBS = -L$(LIBDIR) -llapack -lblas diff --git a/config/make.inc.gfort b/config/make.inc.gfort deleted file mode 100644 index 1b61fb641..000000000 --- a/config/make.inc.gfort +++ /dev/null @@ -1,37 +0,0 @@ -#=================== -# gfortran -#=================== -F90 = gfortran - -#Add next two lines for parallel postw90. Choose the correct name of the mpi f90 wrapper -#COMMS = mpi -#MPIF90 = mpgfortran #mpif90 - -FCOPTS = -O3 -LDOPTS = - -#Next two lines are good for debugging -#FCOPTS = -fstrict-aliasing -fno-omit-frame-pointer -fno-realloc-lhs -fcheck=bounds,do,recursion,pointer -ffree-form -Wall -Waliasing -Wsurprising -Wline-truncation -Wno-tabs -Wno-uninitialized -Wno-unused-dummy-argument -Wno-unused -Wno-character-truncation -O1 -g -fbacktrace -#LDOPTS = -fstrict-aliasing -fno-omit-frame-pointer -fno-realloc-lhs -fcheck=bounds,do,recursion,pointer -ffree-form -Wall -Waliasing -Wsurprising -Wline-truncation -Wno-tabs -Wno-uninitialized -Wno-unused-dummy-argument -Wno-unused -Wno-character-truncation -O1 -g -fbacktrace - - -#======================= -# ATLAS Blas and LAPACK -#======================= -#LIBDIR = /usr/local/lib -#LIBS = -L$(LIBDIR) -llapack -lf77blas -lcblas -latlas - - -#======================= -# NETLIB LAPACK and BLAS -#======================= -#LIBDIR = /rscratch/jry20/LIB/gfortran -#LIBS = -L$(LIBDIR) -llapack -lblas - -#======================= -# System LAPACK and BLAS -# e.g. use -# sudo apt-get install libblas-dev liblapack-dev -# on Ubuntu -#======================= -LIBS = -llapack -lblas diff --git a/config/make.inc.gfort.dynlib b/config/make.inc.gfort.dynlib deleted file mode 100644 index 4f711bd38..000000000 --- a/config/make.inc.gfort.dynlib +++ /dev/null @@ -1,37 +0,0 @@ -#=================== -# gfortran -#=================== -F90 = gfortran - -#Add next two lines for parallel postw90. Choose the correct name of the mpi f90 wrapper -#COMMS = mpi -#MPIF90 = mpgfortran #mpif90 - -FCOPTS = -O3 -fPIC -LDOPTS = -fPIC - -#Next two lines are good for debugging -#FCOPTS = -fstrict-aliasing -fno-omit-frame-pointer -fno-realloc-lhs -fcheck=bounds,do,recursion,pointer -ffree-form -Wall -Waliasing -Wsurprising -Wline-truncation -Wno-tabs -Wno-uninitialized -Wno-unused-dummy-argument -Wno-unused -Wno-character-truncation -O1 -g -fbacktrace -#LDOPTS = -fstrict-aliasing -fno-omit-frame-pointer -fno-realloc-lhs -fcheck=bounds,do,recursion,pointer -ffree-form -Wall -Waliasing -Wsurprising -Wline-truncation -Wno-tabs -Wno-uninitialized -Wno-unused-dummy-argument -Wno-unused -Wno-character-truncation -O1 -g -fbacktrace - - -#======================= -# ATLAS Blas and LAPACK -#======================= -#LIBDIR = /usr/local/lib -#LIBS = -L$(LIBDIR) -llapack -lf77blas -lcblas -latlas - - -#======================= -# NETLIB LAPACK and BLAS -#======================= -#LIBDIR = /rscratch/jry20/LIB/gfortran -#LIBS = -L$(LIBDIR) -llapack -lblas - -#======================= -# System LAPACK and BLAS -# e.g. use -# sudo apt-get install libblas-dev liblapack-dev -# on Ubuntu -#======================= -LIBS = -llapack -lblas diff --git a/config/make.inc.gfort.travisci b/config/make.inc.gfort.travisci deleted file mode 100644 index 21d4b040d..000000000 --- a/config/make.inc.gfort.travisci +++ /dev/null @@ -1,20 +0,0 @@ -#=================================== -# gfortran for the travis-ci service -#=================================== -F90 = gfortran - -# Keep these committed - we test for the time being only the serial version -#COMMS = mpi -#MPIF90 = mpgfortran #mpif90 - -# Options for debugging When we move to 4.9 add -fsanitize=leak -FCOPTS = -fprofile-arcs -ftest-coverage -fstrict-aliasing -fno-omit-frame-pointer -fno-realloc-lhs -fcheck=bounds,do,recursion,pointer -ffree-form -Wall -Waliasing -Wsurprising -Wline-truncation -Wno-tabs -Wno-uninitialized -Wno-unused-dummy-argument -Wno-unused -Wno-character-truncation -O1 -g -fbacktrace -LDOPTS = -fprofile-arcs -ftest-coverage -fstrict-aliasing -fno-omit-frame-pointer -fno-realloc-lhs -fcheck=bounds,do,recursion,pointer -ffree-form -Wall -Waliasing -Wsurprising -Wline-truncation -Wno-tabs -Wno-uninitialized -Wno-unused-dummy-argument -Wno-unused -Wno-character-truncation -O1 -g -fbacktrace - -#======================= -# System LAPACK and BLAS -# e.g. use -# sudo apt-get install libblas-dev liblapack-dev -# on Ubuntu -#======================= -LIBS = -llapack -lblas diff --git a/config/make.inc.ifort b/config/make.inc.ifort deleted file mode 100644 index d4a4fab76..000000000 --- a/config/make.inc.ifort +++ /dev/null @@ -1,22 +0,0 @@ - -#===================================================== -# For Linux with intel version 11/12 on 64bit machines -#===================================================== -F90 = ifort -COMMS=mpi -MPIF90=mpiifort -FCOPTS=-O2 -LDOPTS=-O2 - -#======================================================== -# Intel mkl libraries. Set LIBPATH if not in default path -#======================================================== - -LIBDIR = /opt/intel/mkl/lib/intel64 -LIBS = -L$(LIBDIR) -lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lpthread - -#======================= -# ATLAS Blas and LAPACK -#======================= -#LIBDIR = /usr/local/lib -#LIBS = -L$(LIBDIR) -llapack -lf77blas -lcblas -latlas diff --git a/config/make.inc.ifort_tcm b/config/make.inc.ifort_tcm deleted file mode 100644 index 09c449ad8..000000000 --- a/config/make.inc.ifort_tcm +++ /dev/null @@ -1,26 +0,0 @@ - -#===================================================== -# For Linux with intel version 11/12 on 64bit machines -# Setup for the machines in TCM Group, Cambridge -#===================================================== -F90 = ifort -COMMS=mpi -MPIF90=mpifort -FCOPTS = -O3 -LDOPTS = - -#useful debuf options -#FCOPTS=-Ddebug -O0 -g -fno-omit-frame-pointer -debug extended -traceback -C -Ddebug -stand f95 -warn all -#LDOPTS=-Ddebug -O0 -g -fno-omit-frame-pointer -debug extended -traceback -C -Ddebug -stand f95 -warn all - -#======================================================== -# Intel mkl libraries. Set LIBPATH if not in default path -#======================================================== - -LIBS = -L$(LIBDIR) -Bstatic -lmkl - -#======================= -# ATLAS Blas and LAPACK -#======================= -#LIBDIR = /usr/local/lib -#LIBS = -L$(LIBDIR) -llapack -lf77blas -lcblas -latlas diff --git a/config/make.inc.macosx.homebrew b/config/make.inc.macosx.homebrew deleted file mode 100644 index ab1f5ee96..000000000 --- a/config/make.inc.macosx.homebrew +++ /dev/null @@ -1,43 +0,0 @@ -#================================================= -# For Mac Os X (tested on 10.12 Sierra) -#================================================= -## The following requires a working gfortran compiler. -## You can use for instance HomeBrew to obtain it -## (https://brew.sh). -## After installation and configuration of HomeBrew, -## install a recent version of gcc to get (also) -## gfortran. -## For instance: -## brew install gcc -F90 = gfortran -CC = cc - - -## The next two lines are needed if you want a -## parallel version of postw90.x. If you are OK -## with a serial version, simply comment the next -## two lines. -## To get openmpi with HomeBrew, use for instance -## brew install openmpi -COMMS=mpi -MPIF90=mpifort - -## These two lines define mac-specific flags for -## the dynamic library (.dylib, while on linux it's .so) -DYNLIBRARYEXTENSION=dylib -SHAREDLIBFLAGS=-dynamiclib - -## Note: we could use -framework Accelerate, but we should -## then compile with the -ff2c option to gfortran to use -## C-style conventions for functions returning complex values - -## otherwise, we get sigsev... however, -ff2c is not compatible -## with openmpi from brew!!! (at least on March 2017). -## This is because -ff2c implies -fsecond-underscore -## (see https://gcc.gnu.org/onlinedocs/gfortran/Code-Gen-Options.html) -## -## Therefore, you need first to install blas/lapack libraries from -## brew install homebrew/science/openblas -## and then use the following options -FCOPTS=-O2 -LDOPTS=-O2 -LIBS = -L/usr/local/opt/openblas/lib -lblas -llapack diff --git a/config/make.inc.macosx.macports b/config/make.inc.macosx.macports deleted file mode 100644 index 10b0e18a9..000000000 --- a/config/make.inc.macosx.macports +++ /dev/null @@ -1,63 +0,0 @@ -#================================================= -# For Mac Os X (tested on 10.10 Yosemite) -#================================================= -## The following requires a working gfortran compiler. -## You can use for instance MacPorts to obtain it -## (http://www.macports.org/). -## After installation and configuration of MacPorts, -## install a recent version of gcc to get (also) -## gfortran. -## For instance: -## sudo port install gcc5 -## Note: update version number in port and F90 below as necessary -## -F90 = gfortran-mp-5 -CC = cc - - -## The next two lines are needed if you want a -## parallel version of postw90.x. If you are OK -## with a serial version, simply comment the next -## two lines. -## To get openmpi with MacPorts, use for instance -## sudo port install openmpi-default -## Note that with MacPorts, the -## 'mpirun' executable needed to run the code -## is called 'mpirun-openmpirun-mp' -## (You could also use mpich instead of openmpi.) -## -COMMS=mpi -MPIF90=mpif90-openmpi-mp - -## These two lines define mac-specific flags for -## the dynamic library (.dylib, while on linux it's .so) -DYNLIBRARYEXTENSION=dylib -SHAREDLIBFLAGS=-dynamiclib - -## IMPORTANT!! the -ff2c is needed if one wants to -## use the BLAS and LAPACK libraries shipped with -## Apple Mac OS X (using -framework Accelerate). -## (at least on recent Mac OS X versions). -## This is beacause some routines (as ZDOTC) in the -## libraries provided by Apple are compiled with the -## C interface instead of the Fortran interface. -## Instead, remove the -ff2c flags (both from FCOPTS -## and from LDOPTS) if you have downloaded and -## compiled the BLAS and LAPACK libraries from netlib.org. -## -## IF YOU DON'T DO THE CORRECT THING, THE CODE COMPILES BUT -## THEN EITHER CRASHES OR GIVES WRONG RESULTS! -## -## THUS: ALWAYS TRY AT LEAST THE PROVIDED TEST EXAMPLES -## TO SEE IF YOUR EXECUTABLE IS PROVIDING SENSIBLE RESULTS! -## (i.e.: run -## make test -## and then compare the results) -FCOPTS=-O2 -ff2c -LDOPTS=-O2 -ff2c -LIBS = -framework Accelerate - -# other options: do not use -ff2c but instead: -# port vecLibfort (wrapper to Accelerate): LIBS = -L/opt/local/lib -lvecLibFort -# port atlas: LIBS = -L/opt/local/lib -lsatlas -# port openblas +lapack: LIBS = -L/opt/local/lib -lopenblas diff --git a/config/make.inc.nag b/config/make.inc.nag deleted file mode 100644 index c8d10afb8..000000000 --- a/config/make.inc.nag +++ /dev/null @@ -1,23 +0,0 @@ -#======================= -# NAG -#======================= - -F90 = nagfor -FCOPTS = -DNAG - -#======================= -# ATLAS Blas and LAPACK -#======================= -LIBDIR = /usr/local/lib -LIBS = -L$(LIBDIR) -llapack -lf77blas -lcblas -latlas - -#======================= -# NETLIB LAPACK and BLAS -#======================= - -#LIBDIR = /usr/local/lib -#LIBS = -L$(LIBDIR) -llapack -lblas - - -# ACML for blas and lapack -LIBS = -lacml diff --git a/config/make.inc.pathscale b/config/make.inc.pathscale deleted file mode 100644 index b979150d2..000000000 --- a/config/make.inc.pathscale +++ /dev/null @@ -1,8 +0,0 @@ -#Pathscale -#========= -F90= pathf90 -FCOPTS = -O3 -LDOPTS = -LIBS = -lacml - -# ACML libraries are freely available from http://www.amd.com diff --git a/config/make.inc.pgf90 b/config/make.inc.pgf90 deleted file mode 100644 index fdd5953f6..000000000 --- a/config/make.inc.pgf90 +++ /dev/null @@ -1,17 +0,0 @@ -#===== -#pgf90 -#===== - -F90 = pgf90 - -#Add next two lines for parallel postw90. Choose the correct name of the mpi f90 wrapper -#COMMS = mpi -#MPIF90 = mppgf90 # mpif90 - -FCOPTS = -fast -LDOPTS = - -# Debug options -#FCOPTS = -g -Mbounds -Mchkptr -Minform=warn -Mstandard -#LDOPTS = -g -Mbounds -Mchkptr -Minform=warn -Mstandard -LIBS = -llapack -lblas diff --git a/config/make.inc.qe b/config/make.inc.qe deleted file mode 100644 index 73bb4cfb6..000000000 --- a/config/make.inc.qe +++ /dev/null @@ -1,19 +0,0 @@ -#======================================= -# For use inside a Quantum Espresso Dist -#======================================= - -# read in the QE config - -include ../../make.inc - -# rewrite to our variable names - -F90=$(MPIF90) -FCOPTS=$(F90FLAGS) - -# here we use sed to re-write the library paths. This is only relevant -# if we are using the Q-E internal lapack and blas. Q-E refers to them -# as ../flib/*.a, when what we need is ../../flib*.a - -LIBS = `echo $(LAPACK_LIBS) | sed -e "s/..\/flib/..\/..\/flib/g"` \ - `echo $(BLAS_LIBS) | sed -e "s/..\/flib/..\/..\/flib/g"` $(MASS_LIBS) diff --git a/config/make.inc.sun b/config/make.inc.sun deleted file mode 100644 index fff6d0cf2..000000000 --- a/config/make.inc.sun +++ /dev/null @@ -1,20 +0,0 @@ -#=========================== -# Sun f90 / Solaris or linux -#=========================== - -# Default name of compiler if f90, but some admins rename it -F90 = sunf90 #f90 - - -#Add next two lines for parallel postw90. Choose the correct name of the mpi f90 wrapper -#COMMS = mpi -MPIF90 = mpsunf90 #mpif90 - -#FCOPTS = -g -C -w2 -xlic_lib=sunperf -#LDOPTS = -g -C -w2 -xlic_lib=sunperf - -FCOPTS = -fast -xO3 -xlic_lib=sunperf -LDOPTS = -fast -xO3 -xlic_lib=sunperf - -# Leave blank if asking for sun performance libraries -LIBS = diff --git a/config/make.inc.xlf b/config/make.inc.xlf deleted file mode 100644 index 3bee7f9a3..000000000 --- a/config/make.inc.xlf +++ /dev/null @@ -1,19 +0,0 @@ -#======================= -# IBM Power series AIX -# PowerPc AIX / Linux -#======================= -# - -F90= xlf95_r -FCOPTS = -qfree=f90 -qsuffix=f=f90 -qsuffix=cpp=F90 -qarch=auto -O3 -LDOPTS = -qfree=f90 -qsuffix=f=f90 -qsuffix=cpp=F90 -qarch=auto -LIBDIR = -LIBS = -L$(LIBDIR) -llapack -lessl - -# Notes: This will compile with the default addressing (either 64 or 32) -# To explicitly specify the adressing use -q64 or -q32 -# -# If you machine does not have a LAPACK library build the netlib LAPACK -# http://www.netlib.org/lapack/ -# and (optionally) the essl wrappers -# http://www.netlib.org/lapack/essl/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..731105b35 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,62 @@ +## Source files definitions +target_sources(Wannier90_lib PRIVATE + comms.F90 + constants.F90 + disentangle.F90 + error.F90 + error_base.F90 + hamiltonian.F90 + io.F90 + kmesh.F90 + overlap.F90 + plot.F90 + readwrite.F90 + sitesym.F90 + transport.F90 + types.F90 + utility.F90 + wannier90_readwrite.F90 + wannier90_types.F90 + wannier_lib.F90 + wannierise.F90 + ws_distance.F90 + ) +target_sources(Wannier90_exe PRIVATE + wannier_prog.F90 + ) + +## Linking targets +target_link_libraries(Wannier90_exe PRIVATE + Wannier90_lib) +target_link_libraries(Wannier90_lib PRIVATE + BLAS::BLAS LAPACK::LAPACK) +target_include_directories(Wannier90_lib PUBLIC + "$") +if (WANNIER90_WITH_MPI) + target_link_libraries(Wannier90_lib PUBLIC MPI::MPI_Fortran) +endif () + +add_subdirectory(postw90) + +## Installs +if (WANNIER90_INSTALL) + target_include_directories(Wannier90_lib PUBLIC + "$") + install(TARGETS Wannier90_lib + EXPORT Wannier90Targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Wannier90_Runtime NAMELINK_COMPONENT Wannier90_Development + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Wannier90_Development + ) + install(FILES ${CMAKE_Fortran_MODULE_DIRECTORY}/w90_helper_types.mod + DESTINATION ${CMAKE_INSTALL_MODULEDIR} + COMPONENT Wannier90_Development + ) + install(TARGETS Wannier90_exe + EXPORT Wannier90Targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Wannier90_Runtime + ) + install(TARGETS Wannier90_post + EXPORT Wannier90Targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Wannier90_Runtime + ) +endif () diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 76ce58b7d..000000000 --- a/src/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -ROOTDIR=.. - -include ../Makefile diff --git a/src/Makefile.2 b/src/Makefile.2 deleted file mode 100644 index 4e5fb1234..000000000 --- a/src/Makefile.2 +++ /dev/null @@ -1,200 +0,0 @@ -# -*- MakeFile -*- -# Should be no need to change below this line -# - -include ../../make.inc - -# Contains definition of OBJS, OBJS_POST, LIBRARY, DYNLIBRARY -include ../Makefile.header - -POSTDIR = ../postw90/ - -ifdef COMMS -COMMS := $(strip $(COMMS)) -else -COMMS = serial -endif - -ifeq ($(COMMS),mpi08) -TEMP1 = -DMPI -DMPI08 -TEMP2 = $(MPIF90) -else ifeq ($(COMMS),mpih) -TEMP1 = -DMPI -DMPIH -TEMP2 = $(MPIF90) -else ifeq ($(COMMS),mpi90) -TEMP1 = -DMPI -DMPI90 -TEMP2 = $(MPIF90) -else ifeq ($(COMMS),mpi) -# default to f90 style "use mpi" -TEMP1 = -DMPI -DMPI90 -TEMP2 = $(MPIF90) -else -TEMP1 = -TEMP2 = $(F90) -endif - - -wannier libs dynlibs w90chk2chk w90spn2spn: POSTOPTS = $(TEMP1) -wannier libs dynlibs w90chk2chk w90spn2spn: COMPILER = $(TEMP2) -wannier: ../../wannier90.x -w90chk2chk: ../../w90chk2chk.x -w90spn2spn: ../../w90spn2spn.x - -../../w90chk2chk.x: $(OBJS) ../w90chk2chk.F90 - $(COMPILER) $(POSTOPTS) $(FCOPTS) ../w90chk2chk.F90 $(LDOPTS) $(OBJS) $(LIBS) -o ../../w90chk2chk.x - -../../w90spn2spn.x: $(OBJS) ../w90spn2spn.F90 - $(COMPILER) $(POSTOPTS) $(FCOPTS) ../w90spn2spn.F90 $(LDOPTS) $(OBJS) $(LIBS) -o ../../w90spn2spn.x - -../../wannier90.x: $(LIBRARYV2) ../wannier_prog.F90 - $(COMPILER) $(POSTOPTS) $(FCOPTS) ../wannier_prog.F90 $(LDOPTS) $(LIBRARYV2) $(LIBS) -o ../../wannier90.x - -$(LIBRARYV2): $(OBJS) - $(AR) $(ARFLAGS) $(LIBRARYV2) $(OBJS) - -post: POSTOPTS = $(TEMP1) -post: COMPILER = $(TEMP2) -post: mpi_test ../../postw90.x - -../../postw90.x: $(OBJS_POST) $(POSTDIR)postw90.F90 - $(COMPILER) $(POSTOPTS) $(FCOPTS) $(POSTDIR)postw90.F90 $(LDOPTS) $(OBJS_POST) $(LIBS) -o ../../postw90.x - -mpi_test : -ifeq ($(COMMS),mpi) - -ifndef MPIF90 - - $(info ) \ - $(info ********************* STOP **********************) \ - $(info * COMMS=mpi but MPIF90 is not set in make.inc *) \ - $(info * Set MPIF90 to your parallel fortran compiler *) \ - $(info * On many systems MPIF90=mpif90 will work *) \ - $(info ********************* STOP **********************) \ - $(info ) \ - $(error MPIF90 is not set) - -endif - -endif - - - -libs: $(LIBRARY) $(LIBRARYV2) - -dynlibs: $(DYNLIBRARY) - -$(LIBRARY): $(OBJS) $(OBJS_LIBV1) - $(AR) $(ARFLAGS) $(LIBRARY) $(OBJS) $(OBJS_LIBV1) - -$(DYNLIBRARY): $(OBJS) $(OBJS) $(OBJS_LIBV1) - echo $(COMPILER) - $(COMPILER) $(SHAREDLIBFLAGS) $(POSTOPTS) $(LDOPTS) $(OBJS) $(OBJS_LIBV1) $(LIBS) -o $@ - -clean: - rm -f *.o *.mod *.MOD *.obj - -constants.o: ../constants.F90 - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../constants.F90 - -io.o: ../io.F90 types.o constants.o error.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../io.F90 - -utility.o: ../utility.F90 constants.o io.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../utility.F90 - -wannier90_types.o: ../wannier90_types.F90 constants.o io.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../wannier90_types.F90 - -wannier90_readwrite.o: ../wannier90_readwrite.F90 constants.o io.o types.o wannier90_types.o readwrite.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../wannier90_readwrite.F90 - -readwrite.o: ../readwrite.F90 types.o constants.o io.o utility.o comms.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../readwrite.F90 - -types.o: ../types.F90 constants.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../types.F90 - -hamiltonian.o: ../hamiltonian.F90 ws_distance.o constants.o io.o utility.o types.o wannier90_types.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../hamiltonian.F90 - -overlap.o: ../overlap.F90 constants.o io.o utility.o types.o sitesym.o wannier90_types.o comms.o error.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../overlap.F90 - -kmesh.o: ../kmesh.F90 constants.o io.o utility.o types.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../kmesh.F90 - -error_base.o: ../error_base.F90 - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../error_base.F90 - -error.o: ../error.F90 error_base.o comms.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../error.F90 - -disentangle.o: ../disentangle.F90 constants.o io.o types.o sitesym.o comms.o wannier90_types.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../disentangle.F90 - -wannierise.o: ../wannierise.F90 hamiltonian.o constants.o io.o utility.o types.o sitesym.o comms.o wannier90_types.o wannier90_readwrite.o error.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../wannierise.F90 - -plot.o: ../plot.F90 constants.o io.o utility.o types.o hamiltonian.o ws_distance.o wannier90_types.o comms.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../plot.F90 - -ws_distance.o: ../ws_distance.F90 constants.o io.o types.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../ws_distance.F90 - -transport.o: ../transport.F90 constants.o io.o types.o hamiltonian.o wannier90_types.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../transport.F90 - -sitesym.o : ../sitesym.F90 utility.o types.o constants.o wannier90_types.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../sitesym.F90 - -comms.o: ../comms.F90 constants.o error_base.o ../../make.inc - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../comms.F90 - -boltzwann.o: $(POSTDIR)boltzwann.F90 constants.o types.o io.o utility.o postw90_common.o get_oper.o wan_ham.o comms.o spin.o dos.o postw90_types.o ws_distance.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)boltzwann.F90 - -geninterp.o: $(POSTDIR)geninterp.F90 constants.o types.o io.o get_oper.o postw90_common.o comms.o utility.o wan_ham.o postw90_types.o ws_distance.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)geninterp.F90 - -get_oper.o: $(POSTDIR)get_oper.F90 types.o constants.o comms.o postw90_common.o io.o utility.o postw90_types.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)get_oper.F90 - -spin.o: $(POSTDIR)spin.F90 comms.o types.o constants.o utility.o postw90_common.o get_oper.o io.o wan_ham.o postw90_types.o ws_distance.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)spin.F90 - -dos.o: $(POSTDIR)dos.F90 comms.o types.o postw90_types.o constants.o utility.o io.o wan_ham.o postw90_common.o get_oper.o spin.o ws_distance.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)dos.F90 - -kpath.o: $(POSTDIR)kpath.F90 comms.o types.o constants.o io.o spin.o berry.o postw90_types.o ws_distance.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)kpath.F90 - -kslice.o: $(POSTDIR)kslice.F90 comms.o types.o constants.o io.o spin.o berry.o postw90_types.o ws_distance.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)kslice.F90 - -berry.o: $(POSTDIR)berry.F90 comms.o types.o constants.o utility.o postw90_common.o get_oper.o io.o spin.o wan_ham.o postw90_types.o ws_distance.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)berry.F90 - -gyrotropic.o: $(POSTDIR)gyrotropic.F90 comms.o types.o constants.o utility.o postw90_common.o get_oper.o io.o spin.o wan_ham.o berry.o postw90_types.o ws_distance.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)gyrotropic.F90 - -wan_ham.o: $(POSTDIR)wan_ham.F90 types.o postw90_types.o constants.o utility.o postw90_common.o get_oper.o ws_distance.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)wan_ham.F90 - -postw90_common.o: $(POSTDIR)postw90_common.F90 postw90_types.o ws_distance.o comms.o types.o utility.o constants.o io.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)postw90_common.F90 - -postw90_types.o: $(POSTDIR)postw90_types.F90 comms.o types.o utility.o constants.o io.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)postw90_types.F90 - -postw90_readwrite.o: $(POSTDIR)postw90_readwrite.F90 comms.o postw90_types.o types.o utility.o constants.o io.o error.o - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c $(POSTDIR)postw90_readwrite.F90 - -wannier_lib.o: ./constants.o ./io.o ./utility.o ./types.o \ - ./hamiltonian.o ./kmesh.o ./overlap.o ./disentangle.o \ - ./wannierise.o ./plot.o ./transport.o ./wannier90_types.o \ - ./wannier90_readwrite.o ../wannier_lib.F90 - $(COMPILER) $(POSTOPTS) $(FCOPTS) -c ../wannier_lib.F90 - - -.PHONY: wannier libs post clean mpi_test w90spn2spn - diff --git a/src/Makefile.header b/src/Makefile.header deleted file mode 100644 index aa81469f8..000000000 --- a/src/Makefile.header +++ /dev/null @@ -1,26 +0,0 @@ -OBJS = constants.o io.o utility.o types.o hamiltonian.o overlap.o kmesh.o disentangle.o \ - ws_distance.o wannierise.o plot.o transport.o sitesym.o comms.o wannier90_types.o \ - wannier90_readwrite.o readwrite.o error.o error_base.o - -OBJS_LIBV1 = wannier_lib.o - -OBJS_POST = ws_distance.o types.o kmesh.o io.o comms.o utility.o get_oper.o constants.o \ - postw90_common.o wan_ham.o spin.o dos.o berry.o gyrotropic.o kpath.o kslice.o \ - boltzwann.o geninterp.o postw90_types.o postw90_readwrite.o readwrite.o \ - error.o error_base.o - -LIBRARY = ../../libwannier.a -LIBRARYV2 = ../../libwan2.a - -## Dynamic library section -## Define some defaults (good for linux) if none is defined in the make.inc -## Different flags are needed depending on the compiler and on the OS -## (e.g. on Mac, it's -dynamiclib and the extension if .dylib - even if -## calling it .so and using -shared often works equally well) -## NOTE: if you want to compile the dynamic library, you have to compile -## everything with -fPIC usually, on 64bit systems -DYNLIBRARYEXTENSION ?= so -SHAREDLIBFLAGS ?= '-shared' - -## Define the filename -DYNLIBRARY = ../../libwannier.$(DYNLIBRARYEXTENSION) diff --git a/src/postw90/CMakeLists.txt b/src/postw90/CMakeLists.txt new file mode 100644 index 000000000..c2cf87633 --- /dev/null +++ b/src/postw90/CMakeLists.txt @@ -0,0 +1,22 @@ +target_sources(Wannier90_post PRIVATE + berry.F90 + boltzwann.F90 + dos.F90 + geninterp.F90 + get_oper.F90 + gyrotropic.F90 + kpath.F90 + kslice.F90 + postw90.F90 + postw90_common.F90 + postw90_readwrite.F90 + postw90_types.F90 + spin.F90 + wan_ham.F90 + ) +# TODO: Not buildable yet +#target_sources(Wannier90_lib PRIVATE +# pw90_library.F90 +# ) +target_link_libraries(Wannier90_post PRIVATE + Wannier90_lib BLAS::BLAS LAPACK::LAPACK) diff --git a/src/version b/src/version new file mode 100644 index 000000000..22b67f8b2 --- /dev/null +++ b/src/version @@ -0,0 +1,4 @@ +# this version information could be better stored elsewhere +WANNIER90_MAJOR_VERSION 4 +WANNIER90_MINOR_VERSION 0 +WANNIER90_MICRO_VERSION 0 diff --git a/src/w90chk2chk.F90 b/src/w90chk2chk.F90 index 753aa5a55..f8c8accd1 100644 --- a/src/w90chk2chk.F90 +++ b/src/w90chk2chk.F90 @@ -72,26 +72,14 @@ module w90chk_parameters end module w90chk_parameters module wannchk_data - use w90_constants, only: dp - use w90_wannier90_types implicit none public - - type(w90_calculation_type), save :: w90_calcs - !type(plot_type), save :: plot - !type(disentangle_type), save :: dis_data - ! RS: symmetry-adapted Wannier functions + logical, save :: eig_found logical, save :: lsitesymmetry = .false. real(kind=dp), save :: symmetrize_eps = 1.d-3 - type(fermi_surface_plot_type), save :: fermi_surface_data - type(transport_type), save :: tran - type(select_projection_type), save :: select_proj - - logical, save :: eig_found - ! a_matrix, m_matrix in disentangle and overlap complex(kind=dp), allocatable, save :: a_matrix(:, :, :) complex(kind=dp), allocatable, save :: m_matrix_orig(:, :, :, :) @@ -100,9 +88,7 @@ module wannchk_data complex(kind=dp), allocatable, save :: m_matrix(:, :, :, :) ! in disentangle and overlap complex(kind=dp), allocatable, save :: m_matrix_local(:, :, :, :) - real(kind=dp), save :: omega_invariant - end module wannchk_data module w90_conv diff --git a/src/wannier_lib.F90 b/src/wannier_lib.F90 index eb5d92900..c9d3e8eab 100644 --- a/src/wannier_lib.F90 +++ b/src/wannier_lib.F90 @@ -199,25 +199,14 @@ subroutine wannier_setup(seed__name, mp_grid_loc, num_kpts_loc, real_lattice_loc use w90_wannier90_libv1_types use w90_error, only: w90_error_type -#ifdef MPI -# if !(defined(MPI08) || defined(MPI90) || defined(MPIH)) -# error "You need to define which MPI interface you are using" -# endif -#endif - -#ifdef MPI08 +#ifdef MPI_Fortran_HAVE_F08_MODULE use mpi_f08 ! use f08 interface if possible #endif -#ifdef MPI90 +#ifdef MPI_Fortran_HAVE_F90_MODULE use mpi ! next best, use fortran90 interface #endif implicit none - -#ifdef MPIH - include 'mpif.h' ! worst case, use legacy interface -#endif - type(w90_physical_constants_type) :: physics character(len=*), intent(in) :: seed__name integer, dimension(3), intent(in) :: mp_grid_loc @@ -443,25 +432,15 @@ subroutine wannier_run(seed__name, mp_grid_loc, num_kpts_loc, real_lattice_loc, use w90_readwrite, only: w90_readwrite_lib_set_atoms use w90_error -#ifdef MPI -# if !(defined(MPI08) || defined(MPI90) || defined(MPIH)) -# error "You need to define which MPI interface you are using" -# endif -#endif - -#ifdef MPI08 +#ifdef MPI_Fortran_HAVE_F08_MODULE use mpi_f08 ! use f08 interface if possible #endif -#ifdef MPI90 +#ifdef MPI_Fortran_HAVE_F90_MODULE use mpi ! next best, use fortran90 interface #endif implicit none -#ifdef MPIH - include 'mpif.h' ! worst case, use legacy interface -#endif - type(w90_physical_constants_type) :: physics character(len=*), intent(in) :: seed__name integer, dimension(3), intent(in) :: mp_grid_loc diff --git a/test-suite/CMakeLists.txt b/test-suite/CMakeLists.txt new file mode 100644 index 000000000..495075fc2 --- /dev/null +++ b/test-suite/CMakeLists.txt @@ -0,0 +1,107 @@ +find_package(Python3 REQUIRED) + +set(test_names + testpostw90_boltzwann + testpostw90_example04_dos + testpostw90_example04_pdos + testpostw90_fe_ahc + testpostw90_fe_ahc_adaptandfermi + testpostw90_fe_dos_spin + testpostw90_fe_kpathcurv + testpostw90_fe_kpathmorbcurv + testpostw90_fe_kpathmorbcurv_ws + testpostw90_fe_kslicecurv + testpostw90_fe_kslicemorb + testpostw90_fe_kubo_Axy + testpostw90_fe_kubo_Szz + testpostw90_fe_kubo_jdos + testpostw90_fe_morb + testpostw90_fe_morbandahc + testpostw90_fe_spin + testpostw90_gaas_kdotp + testpostw90_gaas_sc_eta_corr + testpostw90_gaas_sc_xyz + testpostw90_gaas_sc_xyz_scphase2 + testpostw90_gaas_sc_xyz_scphase2_ws + testpostw90_gaas_sc_xyz_ws + testpostw90_gaas_shc + testpostw90_pt_kpathbandsshc + testpostw90_pt_kpathshc + testpostw90_pt_ksliceshc + testpostw90_pt_shc + testpostw90_pt_shc_ryoo + testpostw90_si_geninterp + testpostw90_si_geninterp_wsdistance + testpostw90_te_gyrotropic + testpostw90_te_gyrotropic_C + testpostw90_te_gyrotropic_D0 + testpostw90_te_gyrotropic_Dw + testpostw90_te_gyrotropic_K + testpostw90_te_gyrotropic_NOA + testpostw90_te_gyrotropic_dos + testw90_basic1 + testw90_basic2 + testw90_benzene_gamma_val + testw90_benzene_gamma_val_hexcell + testw90_benzene_gamma_valcond + testw90_bvec + testw90_cube_format + testw90_disentanglement_sawfs + testw90_example01 + testw90_example02 + testw90_example02_restart + testw90_example03 + testw90_example03_labelinfo + testw90_example03_optmem + testw90_example04 + testw90_example05 + testw90_example07 + testw90_example11_1 + testw90_example11_2 + testw90_example21_As_sp + testw90_example26 + testw90_gaas_disentanglement_issue192 + testw90_lavo3_dissphere + testw90_na_chain_gamma + testw90_nnkpt1 + testw90_nnkpt2 + testw90_nnkpt3 + testw90_nnkpt4 + testw90_nnkpt5 + testw90_precond_1 + testw90_precond_2 + testw90_write_u_matrices +) +if (WANNIER90_WITH_MPI) + list(APPEND test_names + partestw90_mpierr + ) +endif () +set(extra_files + checkpoints + run_tests + testcode + tests + tools +) + +## Prepare test environment +foreach (extra IN LISTS extra_files) + file(COPY ${extra} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +endforeach () +target_link_libraries(w90chk2chk.x PRIVATE Wannier90_lib) +target_sources(w90chk2chk.x PRIVATE + ${PROJECT_SOURCE_DIR}/src/w90chk2chk.F90 +) +target_link_libraries(w90spn2spn.x PRIVATE Wannier90_lib) +target_sources(w90spn2spn.x PRIVATE + ${PROJECT_SOURCE_DIR}/src/w90spn2spn.F90 +) + +## Define tests +foreach (test IN LISTS test_names) + add_test(NAME ${test} + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/run_tests -c ${test} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) +endforeach ()