diff --git a/.gitignore b/.gitignore index 188e2add8d6b17f3067d89745c6d92fa12d3dc42..115ea6718ac9fbdf62689077956fa9f929f8c72f 100644 --- a/.gitignore +++ b/.gitignore @@ -19,7 +19,7 @@ autom4te.cache autogen* INSTALL configure -config.h.in +/config.h.in build-aux build-stamp semantic.cache @@ -141,7 +141,7 @@ src/.fortran_dependencies/ /share/recipes/da/varinfo /share/recipes/da/varinfo_orig /share/recipes/da/variables -/share/recipes/da/variables.xml +/share/recipes/da/variables.xml # /share/recipes/en/ /share/recipes/en/varinfo @@ -223,3 +223,96 @@ src/.fortran_dependencies/ # /testsuite/photo_electron/ /testsuite/photo_electron/.log + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### CMake template +CMakeLists.txt.user +CMakeCache.txt +CMakeFiles +CMakeScripts +Testing +Makefile +cmake_install.cmake +install_manifest.txt +compile_commands.json +CTestTestfile.cmake +_deps + + +### Custom development +/venv +/_build-pre-commit +/.idea/ +/compile_commands.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..f621b7a26bfc6d18194b1d8180f5ec6d01662d71 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "third_party/Libxc"] + path = third_party/Libxc + url = https://gitlab.com/libxc/libxc +[submodule "third_party/Spglib"] + path = third_party/Spglib + url = https://github.com/spglib/spglib.git diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e203acf12b5bd5bff919070abbc6cb7a383f8a16 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,76 @@ +default_stages: [push, manual] +exclude: | + (?x)^( + external_libs/| + third_party/| + liboct_parser/| + share/ + ) +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + - id: check-toml + - id: trailing-whitespace + stages: [commit, push, manual] + - id: no-commit-to-branch + args: [ --branch=main ] + stages: [commit, push, manual] + - id: mixed-line-ending + args: [ --fix=lf ] + - id: end-of-file-fixer + stages: [commit, push, manual] + - id: check-case-conflict + - id: check-added-large-files + - repo: https://github.com/Takishima/cmake-pre-commit-hooks + rev: v1.7.0 + hooks: + - id: clang-format + exclude: | + (?x)( + ^external_libs/| + ^third_party/| + ^liboct_parser/| + ^share/| + ^.idea/| + global\.h$ + ) + args: + - '-B_build-pre-commit' + - '-DUSE_BUNDLED=ON' + - '-i' + stages: [push, manual] + - id: clang-tidy + exclude: | + (?x)( + ^external_libs/| + ^third_party/| + ^liboct_parser/| + ^share/| + ^.idea/| + global\.h$ + ) + args: + - '-B_build-pre-commit' + - '-DUSE_BUNDLED=ON' + # TODO: This should be enforced at push. Please fix the issues + stages: [manual] + - id: lizard + exclude: | + (?x)( + ^external_libs/| + ^third_party/| + ^liboct_parser/| + ^share/| + ^.idea/| + global\.h$ + ) + stages: [manual] + # TODO: Disabled because it is too aggressive + # https://github.com/cphyc/fortran-linter/issues/19 +# - repo: https://github.com/cphyc/fortran-linter +# rev: v1.1.2 +# hooks: +# - id: fortran-linter +# args: [--syntax-only] diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..88faae31401067580e7c01fc5f78138a1e14a8df --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,128 @@ +cmake_minimum_required(VERSION 3.13) +project(Octopus VERSION 12.1 + HOMEPAGE_URL https://www.octopus-code.org + DESCRIPTION "real-space, real-time, TDDFT code" + LANGUAGES C Fortran CXX) + +# Upstream: TODO: Add the other language standards used +# Currently Fortran standards are not defined in cmake +set(CMAKE_CXX_STANDARD 14) + +# Basic setup +# Add custom/third-party cmake modules +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") +# Build all fortran modules in a common module directory for simpler loading +if (NOT CMAKE_Fortran_MODULE_DIRECTORY) + set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fortran_mods) +endif() +include_directories(${CMAKE_Fortran_MODULE_DIRECTORY}) + +# Add options +include(cmake/helpers.cmake) +include(FetchContent) +set(max-dim 3 CACHE STRING + "maximum number of dimensions Octopus can use; [default=3;must be>=3]") +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +option(WITH_DOCS "Build Doxygen documentation" ON) +option(USE_BUNDLED "Use all bundled external libraries" OFF) +oct_add_external_library(Libxc GIT_REPO https://gitlab.com/libxc/libxc VERSION 5.2.3) +oct_add_external_library(Spglib GIT_REPO https://github.com/spglib/spglib VERSION v2.1.0) + +# Build flags for the bundled cmake projects +# Upstream: TODO: Should be namespaced upstream. Please report them +## Libxc +if (USE_BUNDLED OR USE_BUNDLED_Libxc OR USE_EXTERNAL_Libxc) + set(ENABLE_FORTRAN ON) +endif() + +# Set namespaced build flags +set(SPGLIB_WITH_Fortran ON) + +# Temporary fix for missing namespaces in bundled libraries +# Upstream: TODO: Report together with issues above +oct_fix_target_namespace(Libxc xcf03) + +# Build tools +find_package(PkgConfig REQUIRED) + +# Compute libraries +## #641 TODO: Specify the supported versions + +## Cmake supported +find_package(MPI) +find_package(OpenMP) +find_package(BLAS REQUIRED) +find_package(LAPACK REQUIRED) +## Bundled Find.cmake +find_package(FFTW REQUIRED) +## Native upstream support +find_package(GSL REQUIRED) +find_package(Libxc 5.0 REQUIRED) +find_package(Spglib REQUIRED) + +# Upstream: TODO: Libxc does not set Libxc_VERSION properly +if (USE_BUNDLED OR USE_BUNDLED_Libxc OR USE_EXTERNAL_Libxc) + if (USE_EXTERNAL_Libxc) + set(Libxc_VERSION ${USE_Libxc_VERSION}) + else() + set(Libxc_VERSION 5.2.3) + endif() +endif() + +if(Libxc_VERSION VERSION_GREATER_EQUAL 5) + set(HAVE_LIBXC5 1) +endif() +if(Libxc_VERSION VERSION_GREATER 6) + message(WARNING "Libxc version ${Libxc_VERSION} is not officially supported. Use it at your own risk.\n + Please report any issues in the build and execution to the official repository so we can support it as quickly as possible.") +endif() + +# Define the main targets (binaries, libraries, virtual targets/interfaces) +# Note: other targets (e.g. oct-help) are defined in src/MakeLists.txt +# Common octopus base included in all targets +add_library(base_octopus STATIC) +# #640 TODO: Switch to CMake native method or equivalent so that it can be indexed +#configure_file(include/options.h.in include/options.h) +#configure_file(include/defaults.h.in include/defaults.h) +# TODO: Move away from header re-generation of mk_varinfo.pl. Use static lists and dictionaries instead +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/tmp_generated) +add_custom_target(VarInfo + COMMAND ${PROJECT_SOURCE_DIR}/scripts/mk_varinfo.pl + -s ${PROJECT_SOURCE_DIR} + -b ${PROJECT_BINARY_DIR}/tmp_generated + COMMENT "Generating variable information") +# Define target ChecksumCopy that copies from ${PROJECT_BINARY_DIR}/tmp_generated to ${PROJECT_BINARY_DIR} only if +# contents changed. This guarantees VarInfo is always called, but dependent targets do not rebuild unnecessarily if +# src/include/options.h and src/include/defaults.h is not *really* changed. +oct_add_checksum_copy(${PROJECT_BINARY_DIR}/tmp_generated ${PROJECT_BINARY_DIR}) +add_dependencies(ChecksumCopy VarInfo) +add_dependencies(base_octopus ChecksumCopy) + +# Auxiliary files +file(COPY share DESTINATION ${PROJECT_BINARY_DIR} + PATTERN *.am EXCLUDE) + +# Helper target for all fortran CLI executables +add_library(fortran_cli STATIC) +# Octopus library that we wish to expose +# #641 TODO: Figure out the libraries we want to export +#add_library(liboctopus) +# Main octopus executable +add_executable(octopus) + +# Mimic autotools +include(cmake/mock_autotools.cmake) + +# Include necessary third-party libs +add_subdirectory(external_libs) + +# Main project +add_subdirectory(src) + +# Generate documentation +if (WITH_DOCS) + add_subdirectory(doc) +endif () diff --git a/Contributing.md b/Contributing.md new file mode 100644 index 0000000000000000000000000000000000000000..d48c26844f2ee079fedcbdda70ac83704abb9747 --- /dev/null +++ b/Contributing.md @@ -0,0 +1,3 @@ +# Contributing + +TBD diff --git a/Development.md b/Development.md new file mode 100644 index 0000000000000000000000000000000000000000..e1fefa94c2225a59627d5f7841a9206eac92e48e --- /dev/null +++ b/Development.md @@ -0,0 +1,19 @@ +# Developing octopus + +## Development environment + +We recommend to setup the following development environments: + +- [`pre-commit`](#pre-commit) + +### Pre-commit + +Most of our coding standards are automatically resolved using `pre-commit`. To set it up simply run: + +```console +$ pip install pre-commit +$ pre-commit install +``` + +This installs commit hooks to various git commands, e.g. `git commit`, `git push`. We strongly +encourage developers to setup these hooks locally. diff --git a/README b/README deleted file mode 100644 index 62d7d3902b1552b182a87ff3d882f4eb91bdb78e..0000000000000000000000000000000000000000 --- a/README +++ /dev/null @@ -1,8 +0,0 @@ -Octopus is a scientific program aimed at the ab initio virtual experimentation on a hopefully ever-increasing range of system types. -Electrons are described quantum-mechanically within density-functional theory (DFT), in its time-dependent form (TDDFT) when doing simulations in time. -Nuclei are described classically as point particles. Electron-nucleus interaction is described within the pseudopotential approximation. - -For optimal execution performance Octopus is parallelized using MPI and OpenMP and can scale to tens of thousands of processors. -It also has support for graphical processing units (GPUs) through OpenCL and CUDA. - -Octopus is free software, released under the GPL license, so you are free to download it, use it and modify it. diff --git a/README b/README new file mode 120000 index 0000000000000000000000000000000000000000..42061c01a1c70097d1e4579f29a5adf40abdec95 --- /dev/null +++ b/README @@ -0,0 +1 @@ +README.md \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9d6e23f346a23d8cb18b4f86720dcb5bd9559adf --- /dev/null +++ b/README.md @@ -0,0 +1,79 @@ +# Octopus + +Octopus is a scientific program for performing *ab-initio* simulations on a real-time, real-space grid. +The main function is to perform Time-Dependent Density Functional Theory (TD-DFT) calculations of electronic +systems, but it can also do classical simulations to extend these calculations. + + +* [Octopus](#octopus) + * [Building octopus](#building-octopus) + * [Running octopus](#running-octopus) + * [Contributing](#contributing) + * [Supported integrations](#supported-integrations) + * [License](#license) + + +## Building octopus + +The main building method for octopus going forward is using cmake, i.e.: + +```console +$ mkdir build && cd build +$ cmake .. +$ cmake --build . +``` + +For more details on how to configure the octopus build, check the [cmake documentation](cmake/README.md). + +## Running octopus + +The main interface of octopus are the `inp` files. Such a file HAS to be present in the work +directory for octopus to run, after which simply run `octopus`: + +```console +$ cat inp +CalculationMode = gs +PeriodicDimensions = 3 +a = 10.2 +BoxShape = parallelepiped +%LatticeParameters + a | a | a +% +%LatticeVectors + 0. | 0.5 | 0.5 + 0.5 | 0. | 0.5 + 0.5 | 0.5 | 0.0 +% +%ReducedCoordinates + "Si" | 0.0 | 0.0 | 0.0 + "Si" | 1/4 | 1/4 | 1/4 +% +Spacing = 0.5 +%KPointsGrid + 4 | 4 | 4 +% +Preconditioner = pre_multigrid +ConvEigenError = yes +ConvRelDens = 1e-9 +EigensolverTolerance = 1e-9 +$ octopus +``` + +Currently, there are no plans of expanding or refactoring this interface. + +## Contributing + +This project is primarily developed on gitlab.com, at [octopus-code/octopus](https://gitlab.com/octopus-code/octopus). +Issues and merge requests are welcome. See [Contributing.md](Contributing.md) for general guidelines for contributions +and [Development.md](Development.md) for recommendations on how to setup your development environment. + +## Supported integrations + +- MPI and OpenMP +- GPU computation via OpenCL and CUDA +- [Postopus](https://gitlab.com/octopus-code/postopus) + +## License + +Octopus is free software, released under the GPL license version 2 or higher. You are free to download it and use it. +You can freely modify it granted you follow the license terms and respect the attributions. diff --git a/cmake/CheckFortranTypeSizes.cmake b/cmake/CheckFortranTypeSizes.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4657a910cbe37a617942778c550102da2adf8309 --- /dev/null +++ b/cmake/CheckFortranTypeSizes.cmake @@ -0,0 +1,56 @@ +# This module performs several try-compiles to determine the default integer +# size being used by the fortran compiler +# +# After execution, the following variables are set. If they are un set then +# size detection was not possible +# +# SIZEOF_INTEGER - Number of bytes used to store the default INTEGER type +# SIZEOF_REAL - Number of bytes used to store the default REAL type +# SIZEOF_LOGICAL - Number of bytes used to store the default LOGICAL type +# SIZEOF_CHARACTER - Number of bytes used to store the default CHARACTER type +# +#============================================================================= +# Author: Chuck Atkins +# Copyright 2011 +# Original code: https://github.com/Reference-LAPACK/lapack/blob/f8fb0842d55c34ad2c26da58e9f55a3f10e52d0b/CMAKE/CheckFortranTypeSizes.cmake +# Additional changes by: Cristian Le +#============================================================================= + +# Check the size of a single fortran type +macro( _CHECK_FORTRAN_TYPE_SIZE _TYPE_NAME _TEST_SIZES ) + + foreach( __TEST_SIZE ${_TEST_SIZES} ) + set( __TEST_FILE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortran${_TYPE_NAME}Size${__TEST_SIZE}.f90 ) + file( WRITE ${__TEST_FILE} + " + PROGRAM check_size + ${_TYPE_NAME}*${__TEST_SIZE}, TARGET :: a + ${_TYPE_NAME}, POINTER :: pa + pa => a + END PROGRAM +") + try_compile( SIZEOF_${_TYPE_NAME} ${CMAKE_BINARY_DIR} ${__TEST_FILE} ) + if( SIZEOF_${_TYPE_NAME} ) + message( STATUS "Testing default ${_TYPE_NAME}*${__TEST_SIZE} - found" ) +# set( SIZEOF_${_TYPE_NAME} ${__TEST_SIZE} CACHE INTERNAL "Size of the default ${_TYPE_NAME} type" FORCE ) + set( SIZEOF_Fortran_${_TYPE_NAME} ${__TEST_SIZE} CACHE INTERNAL "Size of the default ${_TYPE_NAME} type" FORCE ) + break() + else() + message( STATUS "Testing default ${_TYPE_NAME}*${__TEST_SIZE} -" ) + endif() + endforeach() + +endmacro() + + +macro( CHECK_FORTRAN_TYPE_SIZES ) + if( NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90 ) + message( FATAL_ERROR "Type size tests require Fortran 90 support" ) + endif() + + _CHECK_FORTRAN_TYPE_SIZE( "INTEGER" "2;4;8;16" ) + _CHECK_FORTRAN_TYPE_SIZE( "REAL" "4;8;12;16" ) + _CHECK_FORTRAN_TYPE_SIZE( "LOGICAL" "1;2;4;8;16" ) + _CHECK_FORTRAN_TYPE_SIZE( "CHARACTER" "1;2;4;8;16" ) +endmacro() + diff --git a/cmake/ChecksumCopy.cmake b/cmake/ChecksumCopy.cmake new file mode 100644 index 0000000000000000000000000000000000000000..2791509580c502289de5986806ccee0e0b8b9ef4 --- /dev/null +++ b/cmake/ChecksumCopy.cmake @@ -0,0 +1,23 @@ +# Script to be called by the target in `oct_add_checksum_copy` in `helpers.cmake` +# Check the checksums of all the files in `checksum_src` and copy the files if they differ from `checksum_dest` + +# Variables:: +# checksum_src (path): location of the source to copy from +# checksum_dest (path): location of the source to copy to + +# Check if directory does not exist +if (NOT EXISTS ${checksum_dest}) + # If doesn't exist can just copy everything + message(VERBOSE + "ChecksumCopy: Destination folder not found. Copying everything\n" + "${checksum_src} -> ${checksum_dest}") + file(COPY ${checksum_src} ${checksum_dest}) + return() +endif () + +# Check each file +file(GLOB_RECURSE src_files RELATIVE ${checksum_src} ${checksum_src}/*) +foreach (file IN LISTS src_files) + file(COPY_FILE ${checksum_src}/${file} ${checksum_dest}/${file} + ONLY_IF_DIFFERENT) +endforeach () diff --git a/cmake/FindFFTW.cmake b/cmake/FindFFTW.cmake new file mode 100644 index 0000000000000000000000000000000000000000..fa9a548c0ed4bc3300b855a12f51168762b81ee8 --- /dev/null +++ b/cmake/FindFFTW.cmake @@ -0,0 +1,421 @@ +# Upstream version: https://github.com/egpbos/findFFTW +# Removed TODOs to not interfere with local development. Otherwise the following is a direct copy of +# ac788529392825067c9118f9f099aaa1efb77589 +# Additional changes by: Cristian Le +# ---------------------------------------------------------------------------------------------------------------------- +# - Find the FFTW library +# +# Original version of this file: +# Copyright (c) 2015, Wenzel Jakob +# https://github.com/wjakob/layerlab/blob/master/cmake/FindFFTW.cmake, commit 4d58bfdc28891b4f9373dfe46239dda5a0b561c6 +# Modifications: +# Copyright (c) 2017, Patrick Bos +# +# Usage: +# find_package(FFTW [REQUIRED] [QUIET] [COMPONENTS component1 ... componentX] ) +# +# It sets the following variables: +# FFTW_FOUND ... true if fftw is found on the system +# FFTW_[component]_LIB_FOUND ... true if the component is found on the system (see components below) +# FFTW_LIBRARIES ... full paths to all found fftw libraries +# FFTW_[component]_LIB ... full path to one of the components (see below) +# FFTW_INCLUDE_DIRS ... fftw include directory paths +# +# The following variables will be checked by the function +# FFTW_USE_STATIC_LIBS ... if true, only static libraries are found, otherwise both static and shared. +# FFTW_ROOT ... if set, the libraries are exclusively searched +# under this path +# +# This package supports the following components: +# FLOAT_LIB +# DOUBLE_LIB +# LONGDOUBLE_LIB +# FLOAT_THREADS_LIB +# DOUBLE_THREADS_LIB +# LONGDOUBLE_THREADS_LIB +# FLOAT_OPENMP_LIB +# DOUBLE_OPENMP_LIB +# LONGDOUBLE_OPENMP_LIB +# + + +if( NOT FFTW_ROOT AND DEFINED ENV{FFTWDIR} ) + set( FFTW_ROOT $ENV{FFTWDIR} ) +endif() + +# Check if we can use PkgConfig +find_package(PkgConfig) + +#Determine from PKG +if( PKG_CONFIG_FOUND AND NOT FFTW_ROOT ) + pkg_check_modules( PKG_FFTW QUIET "fftw3" ) +endif() + +#Check whether to search static or dynamic libs +set( CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + +if( ${FFTW_USE_STATIC_LIBS} ) + set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} ) +else() + set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} ) +endif() + +if( FFTW_ROOT ) + # find libs + + find_library( + FFTW_DOUBLE_LIB + NAMES "fftw3" libfftw3-3 + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_DOUBLE_THREADS_LIB + NAMES "fftw3_threads" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_DOUBLE_OPENMP_LIB + NAMES "fftw3_omp" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_DOUBLE_MPI_LIB + NAMES "fftw3_mpi" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_FLOAT_LIB + NAMES "fftw3f" libfftw3f-3 + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_FLOAT_THREADS_LIB + NAMES "fftw3f_threads" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_FLOAT_OPENMP_LIB + NAMES "fftw3f_omp" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_FLOAT_MPI_LIB + NAMES "fftw3f_mpi" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_LONGDOUBLE_LIB + NAMES "fftw3l" libfftw3l-3 + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_LONGDOUBLE_THREADS_LIB + NAMES "fftw3l_threads" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_LONGDOUBLE_OPENMP_LIB + NAMES "fftw3l_omp" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + find_library( + FFTW_LONGDOUBLE_MPI_LIB + NAMES "fftw3l_mpi" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "lib" "lib64" + NO_DEFAULT_PATH + ) + + #find includes + find_path(FFTW_INCLUDE_DIRS + NAMES "fftw3.h" + PATHS ${FFTW_ROOT} + PATH_SUFFIXES "include" + NO_DEFAULT_PATH + ) + +else() + + find_library( + FFTW_DOUBLE_LIB + NAMES "fftw3" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTW_DOUBLE_THREADS_LIB + NAMES "fftw3_threads" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTW_DOUBLE_OPENMP_LIB + NAMES "fftw3_omp" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTW_DOUBLE_MPI_LIB + NAMES "fftw3_mpi" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTW_FLOAT_LIB + NAMES "fftw3f" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTW_FLOAT_THREADS_LIB + NAMES "fftw3f_threads" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTW_FLOAT_OPENMP_LIB + NAMES "fftw3f_omp" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTW_FLOAT_MPI_LIB + NAMES "fftw3f_mpi" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTW_LONGDOUBLE_LIB + NAMES "fftw3l" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library( + FFTW_LONGDOUBLE_THREADS_LIB + NAMES "fftw3l_threads" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library(FFTW_LONGDOUBLE_OPENMP_LIB + NAMES "fftw3l_omp" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_library(FFTW_LONGDOUBLE_MPI_LIB + NAMES "fftw3l_mpi" + PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR} + ) + + find_path(FFTW_INCLUDE_DIRS + NAMES "fftw3.h" + PATHS ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR} + ) + +endif( FFTW_ROOT ) + +#--------------------------------------- components + +if (FFTW_DOUBLE_LIB) + set(FFTW_DOUBLE_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_DOUBLE_LIB}) + add_library(FFTW::Double INTERFACE IMPORTED) + set_target_properties(FFTW::Double + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_DOUBLE_LIB}" + ) +else() + set(FFTW_DOUBLE_LIB_FOUND FALSE) +endif() + +if (FFTW_FLOAT_LIB) + set(FFTW_FLOAT_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_FLOAT_LIB}) + add_library(FFTW::Float INTERFACE IMPORTED) + set_target_properties(FFTW::Float + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_FLOAT_LIB}" + ) +else() + set(FFTW_FLOAT_LIB_FOUND FALSE) +endif() + +if (FFTW_LONGDOUBLE_LIB) + set(FFTW_LONGDOUBLE_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_LONGDOUBLE_LIB}) + add_library(FFTW::LongDouble INTERFACE IMPORTED) + set_target_properties(FFTW::LongDouble + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_LONGDOUBLE_LIB}" + ) +else() + set(FFTW_LONGDOUBLE_LIB_FOUND FALSE) +endif() + +if (FFTW_DOUBLE_THREADS_LIB) + set(FFTW_DOUBLE_THREADS_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_DOUBLE_THREADS_LIB}) + add_library(FFTW::DoubleThreads INTERFACE IMPORTED) + set_target_properties(FFTW::DoubleThreads + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_DOUBLE_THREADS_LIB}" + ) +else() + set(FFTW_DOUBLE_THREADS_LIB_FOUND FALSE) +endif() + +if (FFTW_FLOAT_THREADS_LIB) + set(FFTW_FLOAT_THREADS_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_FLOAT_THREADS_LIB}) + add_library(FFTW::FloatThreads INTERFACE IMPORTED) + set_target_properties(FFTW::FloatThreads + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_FLOAT_THREADS_LIB}" + ) +else() + set(FFTW_FLOAT_THREADS_LIB_FOUND FALSE) +endif() + +if (FFTW_LONGDOUBLE_THREADS_LIB) + set(FFTW_LONGDOUBLE_THREADS_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_LONGDOUBLE_THREADS_LIB}) + add_library(FFTW::LongDoubleThreads INTERFACE IMPORTED) + set_target_properties(FFTW::LongDoubleThreads + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_LONGDOUBLE_THREADS_LIB}" + ) +else() + set(FFTW_LONGDOUBLE_THREADS_LIB_FOUND FALSE) +endif() + +if (FFTW_DOUBLE_OPENMP_LIB) + set(FFTW_DOUBLE_OPENMP_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_DOUBLE_OPENMP_LIB}) + add_library(FFTW::DoubleOpenMP INTERFACE IMPORTED) + set_target_properties(FFTW::DoubleOpenMP + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_DOUBLE_OPENMP_LIB}" + ) +else() + set(FFTW_DOUBLE_OPENMP_LIB_FOUND FALSE) +endif() + +if (FFTW_FLOAT_OPENMP_LIB) + set(FFTW_FLOAT_OPENMP_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_FLOAT_OPENMP_LIB}) + add_library(FFTW::FloatOpenMP INTERFACE IMPORTED) + set_target_properties(FFTW::FloatOpenMP + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_FLOAT_OPENMP_LIB}" + ) +else() + set(FFTW_FLOAT_OPENMP_LIB_FOUND FALSE) +endif() + +if (FFTW_LONGDOUBLE_OPENMP_LIB) + set(FFTW_LONGDOUBLE_OPENMP_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_LONGDOUBLE_OPENMP_LIB}) + add_library(FFTW::LongDoubleOpenMP INTERFACE IMPORTED) + set_target_properties(FFTW::LongDoubleOpenMP + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_LONGDOUBLE_OPENMP_LIB}" + ) +else() + set(FFTW_LONGDOUBLE_OPENMP_LIB_FOUND FALSE) +endif() + +if (FFTW_DOUBLE_MPI_LIB) + set(FFTW_DOUBLE_MPI_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_DOUBLE_MPI_LIB}) + add_library(FFTW::DoubleMPI INTERFACE IMPORTED) + set_target_properties(FFTW::DoubleMPI + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_DOUBLE_MPI_LIB}" + ) +else() + set(FFTW_DOUBLE_MPI_LIB_FOUND FALSE) +endif() + +if (FFTW_FLOAT_MPI_LIB) + set(FFTW_FLOAT_MPI_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_FLOAT_MPI_LIB}) + add_library(FFTW::FloatMPI INTERFACE IMPORTED) + set_target_properties(FFTW::FloatMPI + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_FLOAT_MPI_LIB}" + ) +else() + set(FFTW_FLOAT_MPI_LIB_FOUND FALSE) +endif() + +if (FFTW_LONGDOUBLE_MPI_LIB) + set(FFTW_LONGDOUBLE_MPI_LIB_FOUND TRUE) + set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTW_LONGDOUBLE_MPI_LIB}) + add_library(FFTW::LongDoubleMPI INTERFACE IMPORTED) + set_target_properties(FFTW::LongDoubleMPI + PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${FFTW_LONGDOUBLE_MPI_LIB}" + ) +else() + set(FFTW_LONGDOUBLE_MPI_LIB_FOUND FALSE) +endif() + +#--------------------------------------- end components + +set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} ) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(FFTW + REQUIRED_VARS FFTW_INCLUDE_DIRS + HANDLE_COMPONENTS + ) + +mark_as_advanced( + FFTW_INCLUDE_DIRS + FFTW_LIBRARIES + FFTW_FLOAT_LIB + FFTW_DOUBLE_LIB + FFTW_LONGDOUBLE_LIB + FFTW_FLOAT_THREADS_LIB + FFTW_DOUBLE_THREADS_LIB + FFTW_LONGDOUBLE_THREADS_LIB + FFTW_FLOAT_OPENMP_LIB + FFTW_DOUBLE_OPENMP_LIB + FFTW_LONGDOUBLE_OPENMP_LIB + FFTW_FLOAT_MPI_LIB + FFTW_DOUBLE_MPI_LIB + FFTW_LONGDOUBLE_MPI_LIB +) diff --git a/cmake/README.md b/cmake/README.md new file mode 100644 index 0000000000000000000000000000000000000000..65c4521d15605736c1ccc2b2761760e4d0b6f9b6 --- /dev/null +++ b/cmake/README.md @@ -0,0 +1,37 @@ +# CMake configuration + +## CMake options + +Octopus exposes the following options to configure the compilation: + +| Option | Default | Description | +|:---------------------|:-----------------:|:-----------------------------------------------------------------| +| `USE_BUNDLED` | `OFF` | Use only the bundled external libraries | +| `USE_BUNDLED_` | `OFF` | Use the bundled `` library | +| `USE_EXTERNAL_` | `OFF` | Download `` library | +| `USE__VERSION` | (see main README) | Specify the `` version to dowload when `USE_EXTERNAL_` | +| `max-dim` | 3 | Maximum number of dimensions Octopus can use | + +See [Supported package flags](#supported-package-flags) for more information of the `` options. +To configure octopus with such options pass them as a cmake option (prefix them with `-D`, e.g. `-DUSE_BUNDLED=ON`) at +the configuration stage: + +```console +$ mkdir build && cd build +$ cmake .. ${CMAKE_OPTIONS} +$ cmake --build . +``` + +When using `USE_BUNDLED_` or `USE_EXTERNAL_` you may also pass additional configuration flags to configure +the `` library, e.g. `-DSPGLIB_USE_OMP=ON` + +## Supported package flags + +Not all configurations of `USE_BUNDLED_` and `USE_EXTERNAL_` are supported due to licensing, distribution or +build issues. + +| Package | Bundled | External | System | +|:--------|:-------:|:--------:|:------:| +| Libxc | ❌ | ✅ | ✅ | +| Spglib | ❌ | ✅ | ✅ | + diff --git a/cmake/helpers.cmake b/cmake/helpers.cmake new file mode 100644 index 0000000000000000000000000000000000000000..fe13375d59bac692536da6116ad1c04ac2d32c1f --- /dev/null +++ b/cmake/helpers.cmake @@ -0,0 +1,127 @@ +macro(oct_add_external_library _name) + # Add options to build Octopus with either bundled or external/downloaded library + # + # Macro variables:: + # _name (string): Name of the external library to be included + # Named arguments:: + # GIT_REPO (string): Git repository of the library + # VERSION (string): Git tag/commitish to be checked-out + # Example:: + # oct_add_external_library(Libxc GIT_REPO https://gitlab.com/libxc/libxc GIT_TAG 6.0.0) + # Description:: + # This macro adds the options `USE_EXTERNAL_`, and, if bundled in `third_party`, it also adds + # `USE_BUNDLED_`, all default option to `OFF` to prioritize the available libraries on the system. + # + # Note: Has to be macro so that the variables are not limited to current scope + + cmake_parse_arguments(ARGS + "" # Options + "GIT_REPO;VERSION" # Single-value arguments + "" # Multiple-value arguments + ${ARGN}) + + # Basic checks + if (NOT DEFINED ARGS_GIT_REPO OR NOT DEFINED ARGS_VERSION) + message(FATAL_ERROR + "Missing arguments\n" + "ARGS_GIT_REPO = ${ARGS_GIT_REPO}\n" + "ARGS_VERSION = ${ARGS_VERSION}") + endif () + + if (EXISTS ${PROJECT_SOURCE_DIR}/third_party/${_name}) + # If the external library is bundled + option(USE_BUNDLED_${_name} "Use bundled ${_name}" OFF) + elseif (DEFINED USE_BUNDLED_${_name}) + message(WARNING "USE_BUNDLED_${_name} was defined, but ${_name} is not bundled with octopus.") + unset(USE_BUNDLED_${_name}) + endif () + option(USE_EXTERNAL_${_name} "Use external ${_name}" OFF) + # Check if we are asking for both external and bundled version which is ambiguous + if (USE_EXTERNAL_${_name} AND USE_BUNDLED_${_name}) + message(FATAL_ERROR + "Requesting both external and bundled version of ${_name}.\n" + "Please only set ONE of the options to ON: USE_EXTERNAL_${_name} or USE_BUNDLED_${_name}") + endif () + set(USE_${_name}_VERSION ${ARGS_VERSION} CACHE STRING "${_name} version to download and use. [default=${ARGS_VERSION}]") + if (USE_EXTERNAL_${_name} OR (DEFINED USE_BUNDLED_${_name} AND (USE_BUNDLED OR USE_BUNDLED_${_name}))) + FetchContent_Declare(${_name} + GIT_REPOSITORY ${ARGS_GIT_REPO} + GIT_TAG ${USE_${_name}_VERSION} + OVERRIDE_FIND_PACKAGE) + if (NOT USE_EXTERNAL_${_name}) + # If we want the bundled version specifically + string(TOUPPER ${_name} ${_name}_UPPER) + set(FETCHCONTENT_SOURCE_DIR_${${_name}_UPPER} ${PROJECT_SOURCE_DIR}/third_party/${_name}) + endif () + endif () +endmacro() + +# Temporary workaround for lack of namespace. Follow +# https://gitlab.kitware.com/cmake/cmake/-/issues/16414 +# https://gitlab.kitware.com/cmake/cmake/-/issues/22687 +function(oct_fix_target_namespace _name _target) + # Append namespace to target if not using bundled version + # + # Macro variables:: + # _name (string): Name of the external library to be included + # _target (string): Target name to append namespace + # Named arguments:: + # NAMESPACE (string) [${_name}]: Namespace to use + # Example:: + # oct_fix_target_namespace(Libxc xcf03) + # + # Note: Please raise an issue upstream to include namespaced alias targets + # See [comment](https://gitlab.com/libxc/libxc/-/merge_requests/604#note_1269227160) for good practice + + cmake_parse_arguments(ARGS + "" # Options + "NAMESPACE" # Single-value arguments + "" # Multiple-value arguments + ${ARGN}) + if (NOT DEFINED ARGS_NAMESPACE) + set(ARGS_NAMESPACE ${_name}) + endif () + + if (USE_BUNDLED OR USE_BUNDLED_${_name} OR USE_EXTERNAL_${_name}) + set(${_name}_${_target}_TARGET "${_target}" PARENT_SCOPE) + else () + set(${_name}_${_target}_TARGET "${ARGS_NAMESPACE}::${_target}" PARENT_SCOPE) + endif () +endfunction() + +function(oct_add_checksum_copy _src _dest) + # Add a custom target that copies the files from _src to _dest only if checksums are different + # + # Macro variables:: + # _src (path): Name of the external library to be included + # _dest (path): Target name to append namespace + # Named arguments:: + # TARGET (string) [ChecksumCopy]: Custom target that runs ChecksumCopy.cmake + # Example:: + # oct_add_checksum_copy(/path/to/generated/root /path/to/final/root) + # + # Note: This should not be necessary if we separate header and source files properly + + cmake_parse_arguments(ARGS + "" # Options + "TARGET" # Single-value arguments + "" # Multiple-value arguments + ${ARGN}) + + if (NOT DEFINED ARGS_TARGET) + set(ARGS_TARGET ChecksumCopy) + endif () + + if (CMAKE_VERSION VERSION_LESS 3.26) + add_custom_target(${ARGS_TARGET} + COMMAND ${CMAKE_COMMAND} + -Dchecksum_src=${_src} + -Dchecksum_dest=${_dest} + -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/ChecksumCopy.cmake + COMMENT "Checking and copying files") + else () + add_custom_target(${ARGS_TARGET} + COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${_src} ${_dest} + COMMENT "Checking and copying files") + endif () +endfunction() diff --git a/cmake/mock_autotools.cmake b/cmake/mock_autotools.cmake new file mode 100644 index 0000000000000000000000000000000000000000..de93b8a80561e699ef07b4bd00a33ab1d29d3e94 --- /dev/null +++ b/cmake/mock_autotools.cmake @@ -0,0 +1,96 @@ +# #639 TODO: When removing autotools, replace flags with target_compile_define + +string(TIMESTAMP BUILD_TIME) +execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + OUTPUT_VARIABLE GIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +if(CMAKE_BUILD_TYPE MATCHES Debug.*) + set(SHARE_DIR ${CMAKE_CURRENT_BINARY_DIR}/share) +else() + set(SHARE_DIR ${CMAKE_INSTALL_DATADIR}) +endif() + +include(CheckTypeSize) +check_type_size(size_t SIZEOF_SIZE_T LANGUAGE C) +check_type_size("unsigned int" SIZEOF_UNSIGNED_INT LANGUAGE C) +check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG LANGUAGE C) +check_type_size("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG LANGUAGE C) +check_type_size(uint32_t UINT32_T LANGUAGE C) +check_type_size(uint64_t UINT64_T LANGUAGE C) +include(cmake/CheckFortranTypeSizes.cmake) +check_fortran_type_sizes() +include(CheckIncludeFile) +include(CheckFunctionExists) +check_include_file(dirent.h HAVE_DIRENT_H) +check_include_file(errno.h HAVE_ERRNO_H) +check_include_file(signal.h HAVE_SIGNAL_H) +check_include_file(stdint.h HAVE_STDINT_H) +check_include_file(string.h HAVE_STRING_H) +check_include_file(windows.h HAVE_WINDOWS_H) +#check_include_file(iotcl.h HAVE_IOCTL) +# #642 TODO: Eliminate unnecessary function checks in code +# NOTE: Some files do not have checks +check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) +check_function_exists(nanosleep HAVE_NANOSLEEP) +check_function_exists(closedir HAVE_CLOSEDIR) +check_function_exists(readdir HAVE_READDIR) +check_function_exists(strchr HAVE_STRCHR) +check_function_exists(strtod HAVE_STRTOD) +check_function_exists(alphasort HAVE_ALPHASORT) +check_function_exists(scandir HAVE_SCANDIR) +check_function_exists(getopt_long HAVE_GETOPT_LONG) +check_function_exists(getpid HAVE_GETPID) +check_function_exists(perror HAVE_PERROR) +check_function_exists(sbrk HAVE_SBRK) +check_function_exists(sigaction HAVE_SIGACTION) +check_function_exists(strcasestr HAVE_STRCASESTR) +check_function_exists(strndup HAVE_STRNDUP) +check_function_exists(strsignal HAVE_STRSIGNAL) +check_function_exists(sysconf HAVE_SYSCONF) +check_function_exists(tcgetpgrp HAVE_TCGETPGRP) +check_function_exists(uname HAVE_UNAME) + + +if (MPI_Fortran_FOUND) + set(MPI_MOD 1) + set(HAVE_MPI 1) +endif () +if (OpenMP_Fortran_FOUND) + set(HAVE_OPENMP 1) +endif () +#message(FATAL_ERROR +# "PKG_FFTW_LIBRARY_DIRS = ${PKG_FFTW_LIBRARY_DIRS} +# LIB_INSTALL_DIR = ${LIB_INSTALL_DIR} +# FFTW_DOUBLE_LIB_FOUND = ${FFTW_DOUBLE_LIB_FOUND} +# FFTW_DOUBLE_THREADS_LIB_FOUND = ${FFTW_DOUBLE_THREADS_LIB_FOUND} +# FFTW_DOUBLE_MPI_LIB_FOUND = ${FFTW_DOUBLE_MPI_LIB_FOUND}") +if (FFTW_DOUBLE_LIB_FOUND_FOUND) + set(HAVE_FFTW3 1) + if (FFTW_DOUBLE_THREADS_LIB_FOUND) + set(HAVE_FFTW3_THREADS 1) + endif () + if (FFTW_DOUBLE_MPI_LIB_FOUND) + set(HAVE_FFTW3_MPI 1) + endif () +endif () + +# Currently long lines have to be supported to avoid preprocess.pl +if (CMAKE_Fortran_COMPILER_ID MATCHES GNU) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-none") +endif () +set(LONG_LINES 1) + +try_compile(FC_Test_SUCCESS ${CMAKE_CURRENT_BINARY_DIR} + SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/test_compiler.F90 + OUTPUT_VARIABLE FC_Test_OUTPUT) +if (FC_Test_SUCCESS) +else () + message(SEND_ERROR "Failed to build test fortran file cmake/test_compiler.F90 with: + CMAKE_Fortran_COMPILER: ${CMAKE_Fortran_COMPILER} + CMAKE_Fortran_FLAGS: ${CMAKE_Fortran_FLAGS}") + message(FATAL_ERROR ${FC_Test_OUTPUT}) +endif () \ No newline at end of file diff --git a/cmake/test_compiler.F90 b/cmake/test_compiler.F90 new file mode 100644 index 0000000000000000000000000000000000000000..00aa94c13202fae1ff614e20cc2030e18c23abe7 --- /dev/null +++ b/cmake/test_compiler.F90 @@ -0,0 +1,4 @@ +program test_compiler + ! Test long lines are supported (beyond 132) + print *, "Testing if the fortran file compiles with long lines. Here we are just filling up the space until it surpasses the standard limit of 132 characters. We are just continuing to add to this file way beyond the 132 character, approaching 400 characters, to make sure there is not another higher limit that we are not taking into account. Realistically we don't need this high of a limit, but we just want to be sure." +end program test_compiler \ No newline at end of file diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9e25e428895650c095b5101178ab751a9e5cf2d --- /dev/null +++ b/doc/CMakeLists.txt @@ -0,0 +1,5 @@ +find_package(Doxygen REQUIRED) +set(DOXYGEN_OPTIMIZE_FOR_FORTRAN YES) +set(DOXYGEN_FILE_PATTERNS "*.F90") +doxygen_add_docs(docs ${PROJECT_SOURCE_DIR}/src + ALL) diff --git a/external_libs/CMakeLists.txt b/external_libs/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6e5b159a5ee2c28eb44b9be0c19b3ba99ab604bb --- /dev/null +++ b/external_libs/CMakeLists.txt @@ -0,0 +1,32 @@ +# !1888 TODO: To be removed and switched to submodules + +add_library(bpdn STATIC + bpdn/expmm.c + bpdn/heap.c + bpdn/oneProjectorCore.c + bpdn/spgl1_projector.c + bpdn/bpdn.f90) +target_include_directories(bpdn PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../src/include) +target_include_directories(bpdn INTERFACE + ${CMAKE_CURRENT_BINARY_DIR}) +add_library(dftd3 STATIC + dftd3/api.f90 + dftd3/common.f90 + dftd3/core.f90 + dftd3/pars.f90 + dftd3/sizes.f90) +target_include_directories(dftd3 PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../src/include) +target_include_directories(dftd3 INTERFACE + ${CMAKE_CURRENT_BINARY_DIR}) +add_library(qshep STATIC + qshep/qshep2d.f90 + qshep/qshep3d.f90) +target_include_directories(qshep PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/../src/include) +target_include_directories(qshep INTERFACE + ${CMAKE_CURRENT_BINARY_DIR}) + +add_library(rapidxml INTERFACE) +target_include_directories(rapidxml INTERFACE rapidxml) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..c0c717af6238d4e5a0a3a3730505c44001134c45 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,17 @@ +[project] +name = "octopus-devtools" +version = "0.0.0" +requires-python = ">=3.7" +description = "This is currently a dummy octopus project to install the necessary environment requirements. Python bindings: TBD" +readme = "README" +license = { text = "GPL-v2" } +authors = [ ] +maintainers = [ + {name="Cristian Le", email="cristian.le@mpsd.mpg.de"}, +] + +[project.optional-dependencies] +testing = [ ] +doc = [ ] +benchmark = [ ] +dev = [ "pre-commit" ] diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000000000000000000000000000000000000..416634f5288f7f60a9b9f68eb63afd0bed3443a2 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1 @@ +pre-commit diff --git a/scripts/mk_varinfo.pl b/scripts/mk_varinfo.pl index 53669bb444b31491fd20193c6b45771c6d751d45..2ff4df92b75e16590af6e8f0721b41817255f450 100755 --- a/scripts/mk_varinfo.pl +++ b/scripts/mk_varinfo.pl @@ -21,6 +21,7 @@ use Getopt::Std; use File::Find; +use File::Path qw(make_path); getopts "hs:b:"; if($opt_h) { @@ -44,10 +45,10 @@ $src = "$top_srcdir/src"; $share = "$top_builddir/share"; $include = "$top_builddir/src/include"; -if(!-d $src && !-d $share) { +if(!-d $src || !-d $top_builddir) { print stderr <<"EndOfErrorMsg"; -The src and share directory could not be found. Please run +The src or build directory could not be found. Please run this script from the octopus toplevel directory or set -s and -b options appropriately. @@ -56,6 +57,14 @@ EndOfErrorMsg exit 1; } +# Make missing build directories if missing +if(!-d $share) { + make_path($share) +} +if(!-d $include) { + make_path($include) +} + # get all files named *.F90 recursively @F90 = (); finddepth (sub{ push @F90, $File::Find::name if /\.F90$/ }, "$src"); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9b0fa07b7d4872a537f6c598837ec6dae7be813a --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,26 @@ +# Define additional helper interface targets + +list(APPEND OctopusInternalLibs + atomic_orbital basic_accel batch box box_factory classical_particles cube derivatives ext_partner_list grid + hamiltonian_elec interaction interactions_factory ion_dynamics ions kick kpoints math math_adv math_fft maxwell + mesh multibox multigrid multisystem multisystem_debug orbitalset output poisson projector scf species + species_pot states_elec symmetries system wfs_elec xc_oct v_ks density photon_mode eigensolver linear_solver + exponential sternheimer scf_tol mix perturbation elf fourier_shell maxwell_boundary states_elec_io orbitalset_utils + td td_write electrons forces born_charges excited_states classical_particle electrons_ground_state lcao pes + opt_control spectrum) +list(APPEND sourceSubDirs + classical ions math multisystem species interactions basic scf grid boxes states electrons + poisson hamiltonian basis_set maxwell output sternheimer td opt_control main utils include) + +foreach (int_lib IN LISTS OctopusInternalLibs) + add_library(${int_lib} STATIC) +endforeach () + +# Specify directories containing CMakeLists.txt and source code +foreach (subdir IN LISTS sourceSubDirs) + add_subdirectory(${subdir}) +endforeach () + +## Unused sources +# boxes/box_intersection.F90 +# scf/mixing_metric.F90 diff --git a/src/basic/CMakeLists.txt b/src/basic/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..481d79bfefcc4d13ce9ff47fed5d851b07ca9035 --- /dev/null +++ b/src/basic/CMakeLists.txt @@ -0,0 +1,89 @@ +target_sources(base_octopus PRIVATE + ../../liboct_parser/gsl_userdef.c + ../../liboct_parser/parse.c + ../../liboct_parser/parse_exp.c + ../../liboct_parser/parser_f.c + ../../liboct_parser/symbols.c + blacs.F90 + calc_mode_par.F90 + clock.F90 + comm.F90 + debug.F90 + distributed.F90 + getopt_f.c + global.F90 + hardware.F90 + iihash.F90 + iihash_low.cc + io.F90 + io_binary.c + io_binary_f.F90 + io_csv.c + io_csv_f.F90 + kind.F90 + linked_list.F90 + list_node.F90 + loct.F90 + messages.F90 + mpi.F90 + mpi_debug.F90 + mpi_lib.F90 + multicomm.F90 + namespace.F90 + nvtx.F90 + nvtx_low.cc + oct_f.c + parser.F90 + profiling.F90 + recipes.c + signals.c + sihash.F90 + sihash_low.cc + sort.F90 + sort_low.cc + sphash.F90 + sphash_low.cc + string.F90 + types.F90 + unit.F90 + unit_system.F90 + utils.F90 + varia.c + varinfo.F90 + varinfo_low.c + walltimer.F90 + write_iter.F90 + write_iter_low.cc + ) +target_sources(basic_accel PRIVATE + accel.F90 + alloc_cache.F90 + alloc_cache_low.cc + cuda.F90 + cuda_low.cc + ) +target_sources(fortran_cli PRIVATE + command_line.F90) + +# These should be on object target. See previous comment on object and interface separation +target_link_libraries(basic_accel PUBLIC base_octopus) +target_link_libraries(fortran_cli PUBLIC base_octopus) + +target_include_directories(base_octopus PUBLIC + $ + ../include) +# #643 TODO: Not sure why this is not in /src +target_include_directories(base_octopus PUBLIC + ../../liboct_parser) +target_link_libraries(base_octopus PUBLIC + PRIVATE GSL::gsl) + +if (OpenMP_Fortran_FOUND) + target_link_libraries(base_octopus PRIVATE OpenMP::OpenMP_Fortran) +endif () + + +if (MPI_FORTRAN_FOUND) +# target_link_libraries(base_octopus_obj PUBLIC +# MPI::MPI_Fortran) +endif () \ No newline at end of file diff --git a/src/basic/messages.F90 b/src/basic/messages.F90 index f504894fadb9544fae2594a9ebea27554b70af09..c351fa7002814720fb79bbcc86834a8b2c46bc43 100644 --- a/src/basic/messages.F90 +++ b/src/basic/messages.F90 @@ -49,8 +49,10 @@ module messages_oct_m alloc_error, & dealloc_error, & messages_input_error, & +#ifndef NDEBUG push_sub, & pop_sub, & +#endif messages_print_stress, & messages_print_var_info, & messages_print_var_option, & diff --git a/src/basis_set/CMakeLists.txt b/src/basis_set/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6edb559515bf9fe8acc0f4df2e61ed766af2a72e --- /dev/null +++ b/src/basis_set/CMakeLists.txt @@ -0,0 +1,16 @@ +target_sources(atomic_orbital PRIVATE + atomic_orbital.F90 + ) +target_sources(orbitalset PRIVATE + orbitalset.F90 + ) +target_sources(orbitalset_utils PRIVATE + orbitalset_utils.F90) + +target_link_libraries(atomic_orbital PUBLIC + ions orbitalset box_factory) +target_link_libraries(orbitalset PUBLIC + poisson) +target_link_libraries(orbitalset_utils PUBLIC + atomic_orbital) + diff --git a/src/boxes/CMakeLists.txt b/src/boxes/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1a8b317a7a79c54540d0142c5539012465337f8 --- /dev/null +++ b/src/boxes/CMakeLists.txt @@ -0,0 +1,29 @@ +target_sources(box PRIVATE + box.F90 + box_minimum.F90 + box_shape.F90 + ../basic/lookup.F90 # used by box_minimum only + ) +target_sources(multibox PRIVATE + multibox.F90 + ) +target_sources(box_factory PRIVATE + box_factory.F90 + box_cgal.F90 + ../basic/cgal_polyhedra.F90 # used by box_cgal and a few other + ../basic/cgal_polyhedra_low.cc + ../basic/gdlib.F90 # used by box_image only + ../basic/gdlib_f.c + box_cylinder.F90 + box_image.F90 + box_parallelepiped.F90 + box_sphere.F90 + box_user_defined.F90 + ) + +target_link_libraries(box PUBLIC + math_adv) +target_link_libraries(multibox PUBLIC + box) +target_link_libraries(box_factory PUBLIC + box) diff --git a/src/classical/CMakeLists.txt b/src/classical/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..20295f4c55da0db4ea03c93e9a5296ca9a725c14 --- /dev/null +++ b/src/classical/CMakeLists.txt @@ -0,0 +1,12 @@ +target_sources(classical_particles PRIVATE + classical_particles.F90 + propagator_data_classical_particles.F90 + ) +target_sources(classical_particle PRIVATE + classical_particle.F90 + ) + +target_link_libraries(classical_particles PUBLIC + system math_adv) +target_link_libraries(classical_particle PUBLIC + interactions_factory) diff --git a/src/electrons/CMakeLists.txt b/src/electrons/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..1d99acbbbc32f577d3da8e62dcea4afce654bb4b --- /dev/null +++ b/src/electrons/CMakeLists.txt @@ -0,0 +1,64 @@ +add_library(preconditioners STATIC + preconditioners.F90) + +target_sources(kpoints PRIVATE + kpoints.F90) +target_sources(v_ks PRIVATE + ../hamiltonian/pcm_potential.F90 # Only used by v_ks + ../hamiltonian/vdw_ts.F90 # Used together with v_ks + ../hamiltonian/vdw_ts_low.c + ../hamiltonian/hirshfeld.F90 # Used by vdw_ts and partial_charges, which is only called with v_ks + ../poisson/photon_mode_mf.F90 # Only used by v_ks and td + current.F90 + v_ks.F90 + xc_ks_inversion.F90 + xc_sic.F90 + xc_oep.F90 + partial_charges.F90 + ) +target_sources(eigensolver PRIVATE + eigensolver.F90 + eigen_cg.F90 + eigen_rmmdiis.F90 + subspace.F90 + ) +target_sources(linear_solver PRIVATE + linear_solver.F90) +target_sources(exponential PRIVATE + exponential.F90) +target_sources(perturbation PRIVATE + ../ions/vibrations.F90 # can be consolidated + perturbation.F90 + perturbation_electric.F90 + perturbation_ionic.F90 + perturbation_kdotp.F90 + perturbation_magnetic.F90 + perturbation_none.F90) +target_sources(elf PRIVATE + elf.F90) +target_sources(electrons PRIVATE + electrons.F90) +target_sources(forces PRIVATE + forces.F90) + +target_link_libraries(kpoints PUBLIC + math symmetries) +target_link_libraries(v_ks PUBLIC + density linear_solver photon_mode scf_tol eigensolver + PRIVATE dftd3) +target_link_libraries(eigensolver PUBLIC + xc_oct preconditioners exponential) +target_link_libraries(linear_solver PUBLIC + preconditioners) +target_link_libraries(preconditioners PUBLIC + hamiltonian_elec) +target_link_libraries(exponential PUBLIC + hamiltonian_elec) +target_link_libraries(perturbation PUBLIC + hamiltonian_elec) +target_link_libraries(elf PUBLIC + density states_elec) +target_link_libraries(electrons PUBLIC + td) +target_link_libraries(forces PUBLIC + v_ks born_charges) diff --git a/src/grid/CMakeLists.txt b/src/grid/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1e7bf5463b9cbdab7d0edc59850615863103238 --- /dev/null +++ b/src/grid/CMakeLists.txt @@ -0,0 +1,95 @@ +add_library(coordinate_system STATIC + coordinate_system.F90 + affine_coordinates.F90) +add_library(mesh_init STATIC + ../basic/heap.F90 # Used by mesh_init only + ../basic/merge_sorted.F90 # Used by mesh_init only + ../math/accel_blas.F90 # Used by mesh_batch (other dependencies depend on it as well) + ../math/checksum.c + ../math/checksum_interface.F90 # Used by mesh_init only + ../math/metis.F90 + ../math/metis_f.c + ../math/root_solver.F90 # Used by grid and species_pot (depends on mesh_function, etc.) + io_function.F90 + mesh_batch.F90 + mesh_init.F90 + mesh_partition.F90 + nl_operator.F90 + operate.c + operate_f.F90 + restart.F90 + stencil_star.F90 + vtk.F90 + ) + +target_sources(batch PRIVATE + allocate_hardware_aware.cc + allocate_hardware_aware_f.F90 + batch.F90 + batch_ops.F90 + ) +target_sources(grid PRIVATE + curv_briggs.F90 + curv_gygi.F90 + curv_modine.F90 + grid.F90 + ../hamiltonian/absorbing_boundaries.F90 + ) +target_sources(derivatives PRIVATE + derivatives.F90 + cartesian.F90 + stencil_cube.F90 + stencil_starplus.F90 + stencil_stargeneral.F90 + stencil_variational.F90 + transfer_table.F90 + ) +target_sources(mesh PRIVATE + ../math/qshep.F90 # Used by mesh_function only + ../math/quickrnd.F90 + basis_set_abst.F90 + index.F90 + hilbert.c + mesh.F90 + mesh_function.F90 + par_vec.F90 + partition.F90 + stencil.F90 + symmetrizer.F90 + mesh_interpolation.F90 + ) +target_sources(multigrid PRIVATE + multigrid.F90) +target_sources(cube PRIVATE + cube.F90 + mesh_cube_map.F90 + cube_function.F90 + mesh_cube_parallel_map.F90 + partition_transfer.F90 + submesh.F90 + boundaries.F90 + fourier_space.F90 + ) +target_sources(fourier_shell PRIVATE + fourier_shell.F90) + +target_link_libraries(batch PUBLIC + basic_accel math) +target_link_libraries(grid PUBLIC + derivatives) +target_link_libraries(multigrid PUBLIC + derivatives) +target_link_libraries(derivatives PUBLIC + mesh_init) +target_link_libraries(mesh_init PUBLIC + cube box_factory ions kpoints) +target_link_libraries(cube PUBLIC + mesh math_fft batch wfs_elec) +target_link_libraries(mesh PUBLIC + species box coordinate_system basic_accel symmetries + qshep) +target_link_libraries(coordinate_system PUBLIC + math_adv) +target_link_libraries(fourier_shell PUBLIC + cube) + diff --git a/src/hamiltonian/CMakeLists.txt b/src/hamiltonian/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..43769d73f91d25cd9f81a2c67ffa6347063ba3cd --- /dev/null +++ b/src/hamiltonian/CMakeLists.txt @@ -0,0 +1,71 @@ +target_sources(xc_oct PRIVATE + ../interactions/xc_interaction.F90 + exchange_operator.F90 + libvdwxc.F90 + xc.F90 + xc_functional.F90 + ) +target_sources(hamiltonian_elec PRIVATE + hamiltonian_elec.F90 + hamiltonian_elec_base.F90 + hamiltonian_abst.F90 + epot.F90 + projector_matrix.F90 + energy.F90 + ../interactions/ion_electron_local_potential.F90 + ../interactions/external_potential.F90 + lda_u.F90 + lda_u_io.F90 + ../basis_set/loewdin.F90 # Only used by lda_u + ../basis_set/orbitalbasis.F90 # Only used by lda_u + magnetic_constrain.F90 + ../electrons/magnetic.F90 + ../interactions/nlcc.F90 # Only used by hamiltonian_elec + ../electrons/energy_calc.F90 # Only used together with hamiltonian_elec + oct_exchange.F90 + scissor.F90 + ) +target_sources(projector PRIVATE + projector.F90 + hgh_projector.F90 + kb_projector.F90 + rkb_projector.F90 + ) +target_sources(species_pot PRIVATE + species_pot.F90 + ../grid/volume.F90 # Used only by species_pot + ) +target_sources(ext_partner_list PRIVATE + ext_partner_list.F90 + gauge_field.F90 + lasers.F90 + ) +target_sources(kick PRIVATE + kick.F90 + pcm.F90 + pcm_eom.F90 + ) +target_sources(scf_tol PRIVATE + scf_tol.F90) + +target_link_libraries(xc_oct + PUBLIC states_elec poisson + PUBLIC ${Libxc_xcf03_TARGET}) +target_link_libraries(hamiltonian_elec + PUBLIC xc_oct projector species_pot ext_partner_list kick orbitalset_utils) +target_link_libraries(projector + PUBLIC ions states_elec) +target_link_libraries(species_pot + PUBLIC species atomic_orbital) +target_link_libraries(ext_partner_list + PUBLIC interactions_factory) +target_link_libraries(kick + PUBLIC ion_dynamics poisson states_elec) +target_link_libraries(scf_tol + PUBLIC base_octopus) + + + + + + diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b1ad36516c3c9bc20aeb445b918a89c66dbad8ba --- /dev/null +++ b/src/include/CMakeLists.txt @@ -0,0 +1,5 @@ +configure_file(config.h.in config_F90.h) +configure_file(config.h.in config.h) +target_include_directories(base_octopus PUBLIC + $ + ${CMAKE_CURRENT_SOURCE_DIR}) \ No newline at end of file diff --git a/src/include/config.h.in b/src/include/config.h.in new file mode 100644 index 0000000000000000000000000000000000000000..2f05c86986964576219c1af9a03540919ac56ea6 --- /dev/null +++ b/src/include/config.h.in @@ -0,0 +1,157 @@ +#define BUILD_TIME "@BUILD_TIME@" +#define PACKAGE_VERSION "@CMAKE_PROJECT_VERSION@" +/* TODO: Implement a search function via $OCTOPUS_DIR/share:$(pwd)/share:/usr/share/octopus */ +#define SHARE_DIR "@SHARE_DIR@" +#define MAX_DIM @max-dim@ + +#define CC "@CMAKE_C_COMPILER@" +#define CFLAGS "@CMAKE_C_FLAGS@" +#define CFLAGS_EXTRA "" +#define CXX "@CMAKE_CXX_COMPILER@" +#define CXXFLAGS "@CMAKE_CXX_FLAGS@" +#define CXXFLAGS_EXTRA "" + +#define FC "@CMAKE_Fortran_COMPILER@" +#define FCFLAGS "@CMAKE_Fortran_FLAGS@" +#define FCFLAGS_EXTRA "" + +/* TODO: Deprecate old Fortran: Remove code */ +#define FC_COMMAND_LINE_ARGUMENTS 2003 +/* #undef FC_COMMAND_LINE_IMPLICIT */ +/* #undef FC_COMMAND_LINE_INCLUDE */ +/* #undef FC_COMMAND_LINE_INTRINSIC */ +/* #undef FC_COMMAND_LINE_MODULE */ + +/* TODO: Deprecate old Fortran: Use ISO_C_BINDING */ +#ifdef __GFORTRAN__ +#define FC_FUNC(name,NAME) name/**/_ +#define FC_FUNC_(name,NAME) name/**/_ +#else +#define FC_FUNC(name,NAME) name ## _ +#define FC_FUNC_(name,NAME) name ## _ +#endif +#define GIT_COMMIT "@GIT_HASH@" + +/* TODO: Might not need in modern compilers */ +#define SIZEOF_VOIDP @CMAKE_SIZEOF_VOID_P@ +#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@ +#define SIZEOF_UNSIGNED_INT @SIZEOF_UNSIGNED_INT@ +#define SIZEOF_UNSIGNED_LONG @SIZEOF_UNSIGNED_LONG@ +#define SIZEOF_UNSIGNED_LONG_LONG @SIZEOF_UNSIGNED_LONG_LONG@ + +/* TODO: Deprecate old C: Remove check */ +#cmakedefine HAVE_UINT32_T +#cmakedefine HAVE_UINT64_T + + +#define FC_INTEGER_SIZE @SIZEOF_Fortran_INTEGER@ + +/* TODO: Deprecate old Fortran: Always assume long_lines are accepted. Use appropriate flags */ +#define LONG_LINES 1 +/* TODO: Deprecate old Fortran: Remove check */ +#define HAVE_FC_COMPILER_VERSION 1 +#define HAVE_FC_SIZEOF 1 +#define HAVE_FLUSH 1 +#define F90_ACCEPTS_LINE_NUMBERS 1 +#define HAVE_FORTRAN_LOC 1 + +/* TODO: Deprecate old C: Remove check */ +#cmakedefine HAVE_DIRENT_H +#cmakedefine HAVE_CLOSEDIR +#cmakedefine HAVE_READDIR +#cmakedefine HAVE_STRCHR +#cmakedefine HAVE_STRTOD +#cmakedefine HAVE_GETTIMEOFDAY +#cmakedefine HAVE_NANOSLEEP +#cmakedefine HAVE_SCANDIR +#cmakedefine HAVE_ALPHASORT +#cmakedefine HAVE_ERRNO_H +#cmakedefine HAVE_GETOPT_LONG +#cmakedefine HAVE_GETPID +#define HAVE_IOCTL 1 +#cmakedefine HAVE_PERROR +#cmakedefine HAVE_SBRK +#cmakedefine HAVE_SIGACTION +#cmakedefine HAVE_SIGNAL_H +#cmakedefine HAVE_STDINT_H +#cmakedefine HAVE_STRCASESTR +#cmakedefine HAVE_STRING_H + +#cmakedefine HAVE_STRNDUP +#cmakedefine HAVE_STRSIGNAL +#cmakedefine HAVE_SYSCONF +#cmakedefine HAVE_TCGETPGRP +#cmakedefine HAVE_UNAME +#cmakedefine HAVE_WINDOWS_H +#define HAVE_VEC 1 + +#cmakedefine MPI_MOD +#cmakedefine HAVE_MPI +#cmakedefine HAVE_OPENMP +#cmakedefine HAVE_FFTW3_MPI +#cmakedefine HAVE_FFTW3_THREADS + + +#cmakedefine HAVE_LIBXC5 +/* TODO: Extract the configuration */ +#define HAVE_LIBXC_FXC 1 +#define HAVE_LIBXC_KXC 1 + +/* Introduced in C11 */ +/* TODO: C++11 Uses thread_local instead */ +/* TODO: C23 Uses common thread_local instead */ +#define TLS_SPECIFIER _Thread_local + + +#define OCT_ARCH x86_64 "@CMAKE_SYSTEM_PROCESSOR@" + +/* TODO: To implement */ +/* #undef HAVE_FMA3 */ +/* #undef HAVE_FMA4 */ + +/* TODO: To remove */ +/* #undef MPI_H */ /* Should not have any setups using it */ + +/* TODO: Connect */ +/* #undef HAVE_BERKELEYGW */ +/* #undef HAVE_CGAL */ +/* #undef HAVE_CLBLAS */ +/* #undef HAVE_CLFFT */ +/* #undef HAVE_PFFT */ +/* #undef HAVE_PNFFT */ +/* #undef HAVE_CUDA */ +/* #undef HAVE_CUDA_MPI */ +/* #undef HAVE_DFTBPLUS */ +/* #undef HAVE_DFTBPLUS_DEVEL */ +/* #undef HAVE_ELPA */ +/* #undef HAVE_ETSF_IO */ +/* #undef HAVE_GDLIB */ +/* #undef HAVE_GD_GIF */ +/* #undef HAVE_GD_JPEG */ +/* #undef HAVE_GD_PNG */ +/* #undef HAVE_LIBFM */ +/* #undef HAVE_LIBISF */ +/* #undef HAVE_LIBVDWXC */ +/* #undef HAVE_LIBVDWXC_MPI */ +/* #undef HAVE_LIKWID */ +/* #undef HAVE_METIS */ +/* #undef HAVE_PARMETIS */ +/* #define METIS_IDXTYPEWIDTH 32 */ +/* #undef HAVE_NETCDF */ +/* #undef HAVE_NFFT */ +/* #undef HAVE_NLOPT */ +/* #undef HAVE_NVTX */ +/* #undef HAVE_OPENCL */ +/* #undef HAVE_OPENCL_CL_H */ +/* #undef HAVE_POKE */ +/* #undef HAVE_PSOLVER */ +/* #undef HAVE_PSPIO */ +/* #undef HAVE_SCALAPACK */ +/* #undef HAVE_SPARSKIT */ + +/* TODO: To discuss */ +/* #undef HAVE_BLUE_GENE */ /* Can replace with stl? */ +/* #undef HAVE_BLUE_GENE_Q */ +/* #define HAVE_M128D 1 */ +/* #undef HAVE_M256D */ +/* #undef HAVE_M512D */ \ No newline at end of file diff --git a/src/include/global.h b/src/include/global.h index fdbadb070070000afc27194da1ebea5512987541..60586e9264c37f63bdcc664c6ad936237ed51883 100644 --- a/src/include/global.h +++ b/src/include/global.h @@ -246,6 +246,7 @@ ! and finish it with the PUSH_SUB and POP_SUB macros, which are these ! pieces of code that call the push_sub and pop_sub routines defined ! in the messages_m module. +#ifndef NDEBUG #define PUSH_SUB(routine) \ if(debug%trace) then; if(not_in_openmp()) then; CARDINAL \ call push_sub(__FILE__+"." ACARDINAL +TOSTRING(routine)); CARDINAL \ @@ -256,6 +257,10 @@ call pop_sub(__FILE__+"." ACARDINAL +TOSTRING(routine)); CARDINAL \ endif; endif; \ CARDINAL +#else +#define PUSH_SUB(routine) +#define POP_SUB(routine) +#endif !! Local Variables: !! mode: f90 diff --git a/src/interactions/CMakeLists.txt b/src/interactions/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..55ef8b2d0d692d669aa63ca8fac0c171b2814993 --- /dev/null +++ b/src/interactions/CMakeLists.txt @@ -0,0 +1,15 @@ +target_sources(interactions_factory PRIVATE + ../grid/regridding.F90 + ../multisystem/interactions_factory_abst.F90 + ../states/states_mxll.F90 + coulomb_force.F90 + current_to_mxll_field.F90 + gravity.F90 + interactions_factory.F90 + linear_medium_to_em_field.F90 + lorentz_force.F90 + mxll_field_to_medium.F90 + ) + +target_link_libraries(interactions_factory PUBLIC + interaction multisystem grid poisson states_elec) diff --git a/src/ions/CMakeLists.txt b/src/ions/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..12f86afa07eef0a8a3211040c222c20f040e9e5b --- /dev/null +++ b/src/ions/CMakeLists.txt @@ -0,0 +1,28 @@ +target_sources(ions PRIVATE + ions.F90 + atom.F90 + ../basic/distributed.F90 + ../hamiltonian/ion_interaction.F90 + read_coords.F90 + ../math/tdfunction.F90 + ) +target_sources(symmetries PRIVATE + symmetries.F90 + symmetries_finite.c + ../math/symm_op.F90 + ) +target_sources(ion_dynamics PRIVATE + ion_dynamics.F90) +target_sources(born_charges PRIVATE + born_charges.F90) + +target_link_libraries(ions PUBLIC + species classical_particles math_fft symmetries) +target_link_libraries(symmetries PUBLIC + math) +target_link_libraries(ion_dynamics PUBLIC + ions mesh_init) +target_link_libraries(born_charges PUBLIC + states_elec) + +target_link_libraries(symmetries PRIVATE Spglib::fortran) \ No newline at end of file diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..4caefe9b7cd5ed98f186b174865564c43ce4b092 --- /dev/null +++ b/src/main/CMakeLists.txt @@ -0,0 +1,29 @@ +target_sources(octopus PRIVATE + ../basic/mpi_test.F90 + ../classical/charged_particle.F90 + ../math/gauss_legendre.F90 + ../sternheimer/em_resp.F90 + ../sternheimer/em_resp_calc.F90 + ../sternheimer/phonons_lr.F90 + ../sternheimer/vdw.F90 + ../sternheimer/kdotp.F90 + ../sternheimer/kdotp_calc.F90 + ../scf/unocc.F90 + ../dftbplus/dftb.F90 + ../electrons/matter.F90 + casida.F90 + ground_state.F90 + invert_ks.F90 + main.F90 + geom_opt.F90 + phonons_fd.F90 + pulpo.F90 + run.F90 + static_pol.F90 + system_factory.F90 + test.F90 + time_dependent.F90 + ) + +target_link_libraries(octopus PRIVATE + opt_control maxwell sternheimer spectrum fortran_cli) \ No newline at end of file diff --git a/src/math/CMakeLists.txt b/src/math/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..def8ada5b489a96a9a18c5b3851ca7ee1ec63865 --- /dev/null +++ b/src/math/CMakeLists.txt @@ -0,0 +1,44 @@ +target_sources(math PRIVATE + ../basic/lattice_vectors.F90 + ../basic/space.F90 + blas.F90 + lalg_basic.F90 + loct_math.F90 + math.F90 + minimizer.F90 + minimizer_low.c + oct_gsl_f.c + dablas.c + solvers.F90 + ylm.c + ) +target_sources(math_adv PRIVATE + ../basic/blacs_proc_grid.F90 + lalg_adv.F90 + lapack.F90 + scalapack.F90 + basis_vectors.F90 + ) +target_sources(math_fft PRIVATE + fft.F90 + pfft.F90 + pnfft.F90 + fftw.F90 + fftw_low.c + ) + +target_link_libraries(math PUBLIC + base_octopus + PRIVATE BLAS::BLAS) +target_link_libraries(math_fft PUBLIC + math basic_accel + PRIVATE FFTW::Double) +target_link_libraries(math_adv PUBLIC + math + PRIVATE LAPACK::LAPACK) + + +#if (HAVE_CUDA) +# target_sources(octopus PRIVATE +# math/cufft.cc) +#endif () \ No newline at end of file diff --git a/src/maxwell/CMakeLists.txt b/src/maxwell/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..42588c0e3c4e6feca164eac24c72180550e94f7d --- /dev/null +++ b/src/maxwell/CMakeLists.txt @@ -0,0 +1,18 @@ +target_sources(maxwell PRIVATE + dispersive_medium.F90 + linear_medium.F90 + maxwell.F90 + ) +target_sources(maxwell_boundary PRIVATE + maxwell_boundary_op.F90 + ../math/maxwell_function.F90 + ../math/helmholtz_decomposition.F90 + ../states/modelmb_density_matrix.F90 + ../grid/modelmb_1part.F90 + ../grid/hypercube.F90 + ) + +target_link_libraries(maxwell PUBLIC + electrons) +target_link_libraries(maxwell_boundary PUBLIC + interactions_factory) diff --git a/src/multisystem/CMakeLists.txt b/src/multisystem/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7b13d0861abae07cd8c1e00217e6e0d5c331c202 --- /dev/null +++ b/src/multisystem/CMakeLists.txt @@ -0,0 +1,35 @@ +target_sources(multisystem PRIVATE + multisystem.F90 + multisystem_basic.F90 + system_factory_abst.F90 + ) +target_sources(system PRIVATE + ghost_interaction.F90 + system.F90 + propagator.F90 + propagator_beeman.F90 + propagator_exp_mid.F90 + propagator_static.F90 + propagator_verlet.F90 + ) +target_sources(interaction PRIVATE + interaction.F90 + interaction_partner.F90 + interaction_with_partner.F90 + ../interactions/force_interaction.F90 + ../interactions/density_interaction.F90 + ../interactions/potential_interaction.F90 + quantity.F90) +target_sources(multisystem_debug PRIVATE + algorithm.F90 + multisystem_debug.F90 + ) + +target_link_libraries(multisystem PUBLIC + system) +target_link_libraries(multisystem_debug PUBLIC + base_octopus) +target_link_libraries(system PUBLIC + interaction) +target_link_libraries(interaction PUBLIC + math multisystem_debug) diff --git a/src/opt_control/CMakeLists.txt b/src/opt_control/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..bffe59aa465daafffc8aab515abbb18c98d7ca96 --- /dev/null +++ b/src/opt_control/CMakeLists.txt @@ -0,0 +1,13 @@ +target_sources(opt_control PRIVATE + opt_control.F90 + opt_control_global.F90 + opt_control_iter.F90 + propagation.F90 + controlfunction.F90 + filter.F90 + target.F90 + initst.F90 + ) + +target_link_libraries(opt_control PUBLIC + electrons) diff --git a/src/output/CMakeLists.txt b/src/output/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..51cb1c14604915acf87382cbd6d96498a7aab21e --- /dev/null +++ b/src/output/CMakeLists.txt @@ -0,0 +1,17 @@ +target_sources(output PRIVATE + ../grid/basins.F90 # used only by output and local_multipoles + output.F90 + output_me.F90 + output_berkeleygw.F90 + output_modelmb.F90 + output_mxll.F90 + output_linear_medium.F90 + ../electrons/dos.F90 + ../maxwell/external_densities.F90 # used only by output and maxwell which depends on output + ../maxwell/hamiltonian_mxll.F90 # Other depend on output as well + ../maxwell/energy_mxll.F90 + ../math/young.F90 # used by otuput and modelmb_exchange_syms + ) + +target_link_libraries(output PUBLIC + v_ks elf fourier_shell maxwell_boundary states_elec_io) diff --git a/src/poisson/CMakeLists.txt b/src/poisson/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..912054e369c5434bcb597ec6e94febf0819bee28 --- /dev/null +++ b/src/poisson/CMakeLists.txt @@ -0,0 +1,25 @@ +target_sources(poisson PRIVATE + poisson.F90 + photon_mode.F90 + poisson_cg.F90 + poisson_isf.F90 + ../math/sgfft.F90 # Used by poisson_isf only + poisson_fft.F90 + poisson_fmm.F90 + poisson_psolver.F90 + poisson_multigrid.F90 + poisson_no.F90 + poisson_cutoff.F90 + poisson_cutoffs.c + poisson_corrections.F90 + scaling_function.F90 + ) +target_sources(photon_mode PRIVATE + photon_mode.F90 + ) + +target_link_libraries(poisson PUBLIC + cube derivatives multigrid) +target_link_libraries(photon_mode PUBLIC + mesh) + diff --git a/src/scf/CMakeLists.txt b/src/scf/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d61f0e642e5a4843e0c9a9408ca570c1002184d --- /dev/null +++ b/src/scf/CMakeLists.txt @@ -0,0 +1,30 @@ +target_sources(scf PRIVATE + lda_u_mixer.F90 + scf.F90 + ../hamiltonian/berry.F90 + ../multisystem/convergence_criterion.F90 + criteria_factory.F90 + eigenval_criterion.F90 + density_criterion.F90 + energy_criterion.F90 + ../states/modelmb_exchange_syms.F90 + ../math/permutations.F90 + ../electrons/stress.F90 + ) +target_sources(mix PRIVATE + mix.F90) +target_sources(electrons_ground_state PRIVATE + electrons_ground_state.F90 + rdmft.F90) +target_sources(lcao PRIVATE + lcao.F90) + +target_link_libraries(scf PUBLIC + output mix forces lcao) +target_link_libraries(mix PUBLIC + mesh derivatives) +target_link_libraries(electrons_ground_state PUBLIC + scf) +target_link_libraries(lcao PUBLIC + v_ks states_elec_io) + diff --git a/src/species/CMakeLists.txt b/src/species/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..60021832b660767aa7a677f33268726afa262c3e --- /dev/null +++ b/src/species/CMakeLists.txt @@ -0,0 +1,32 @@ +target_sources(species PRIVATE + ../math/spline_filter.F90 + ../math/spline_low.cc + ../math/splines.F90 + atomic.F90 + element.F90 + element_low.cc + logrid.F90 + ps.F90 + ps_cpi.F90 + ps_cpi_file.F90 + ps_fhi.F90 + ps_fhi_file.F90 + ps_hgh.F90 + ps_in_grid.F90 + ps_psf.F90 + ps_psf_file.F90 + ps_xml.F90 + pseudo.F90 + pseudo_low.cc + spline.cc + pseudo_set.F90 + pseudo_set_low.cc + share_directory.F90 + share_directory_low.cc + species.F90 + ) + +target_link_libraries(species PUBLIC + math_adv) +target_link_libraries(species PRIVATE + rapidxml ${Libxc_xcf03_TARGET}) diff --git a/src/species/share_directory.hpp b/src/species/share_directory.hpp index bfe94ffaee0ea4bb3bb3732feb8138a114bcef66..e3bbbceb9ebfe410dce8a55dc846e3a1e304ebd1 100644 --- a/src/species/share_directory.hpp +++ b/src/species/share_directory.hpp @@ -20,6 +20,7 @@ */ #include +#include "config.h" namespace pseudopotential { diff --git a/src/states/CMakeLists.txt b/src/states/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..75df18a3b6b64439e37411880899eaab5a2f3b5b --- /dev/null +++ b/src/states/CMakeLists.txt @@ -0,0 +1,37 @@ +target_sources(wfs_elec PRIVATE + wfs_elec.F90) +target_sources(states_elec PRIVATE + ../hamiltonian/singularity.F90 + ../math/pblas.F90 # Only used by states_elec_calc + linear_response.F90 + modelmb_particles.F90 + physics_op.F90 + smear.F90 + states_abst.F90 + states_elec.F90 + states_elec_calc.F90 + states_elec_dim.F90 + states_elec_group.F90 + states_elec_parallel.F90 + states_elec_restart.F90 + ) +target_sources(density PRIVATE + density.F90 + ) +target_sources(states_elec_io PRIVATE + states_elec_io.F90 + ) +target_sources(excited_states PRIVATE + excited_states.F90) + +target_link_libraries(states_elec PUBLIC + poisson grid) +target_link_libraries(wfs_elec PUBLIC + batch) +target_link_libraries(density PUBLIC + states_elec) +target_link_libraries(states_elec_io PUBLIC + states_elec orbitalset_utils) +target_link_libraries(excited_states PUBLIC + states_elec) + diff --git a/src/sternheimer/CMakeLists.txt b/src/sternheimer/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..43e141aad497fba687a78a6f9d7bac935cd0cbbd --- /dev/null +++ b/src/sternheimer/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(sternheimer PRIVATE + sternheimer.F90) + +target_link_libraries(sternheimer PUBLIC + density scf_tol linear_solver mix perturbation) diff --git a/src/td/CMakeLists.txt b/src/td/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..056664d853a8d543f7ff1c688c97e2ac9e8b1dfd --- /dev/null +++ b/src/td/CMakeLists.txt @@ -0,0 +1,42 @@ +target_sources(td_write PRIVATE + td_write.F90 + td_calc.F90 + ../states/states_mxll_restart.F90 + ../maxwell/propagator_mxll.F90 + ) +target_sources(td PRIVATE + td.F90 + propagator_elec.F90 + propagator_base.F90 + propagator_cn.F90 + propagator_rk.F90 + propagator_etrs.F90 + propagator_expmid.F90 + propagator_magnus.F90 + propagator_qoct.F90 + propagation_ops_elec.F90 + potential_interpolation.F90 + ../math/sparskit.F90 + ../states/opt_control_state.F90 + ) +target_sources(pes PRIVATE + pes.F90 + pes_mask.F90 + pes_flux.F90 + pes_spm.F90 + ) +target_sources(spectrum PRIVATE + spectrum.F90 + ../math/compressed_sensing.F90) + +target_link_libraries(td_write PUBLIC + output excited_states forces perturbation) +target_link_libraries(td PUBLIC + td_write classical_particle electrons_ground_state pes) +target_link_libraries(pes PUBLIC + output) +target_link_libraries(spectrum PUBLIC + kick + PRIVATE bpdn) + + diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..0e7b9b25f3a353cf6ef09fb30a25c67cf63ffbf4 --- /dev/null +++ b/src/utils/CMakeLists.txt @@ -0,0 +1,83 @@ +add_executable(oct-casida_spectrum casida_spectrum.F90) +target_link_libraries(oct-casida_spectrum PRIVATE + ions fortran_cli) + +add_executable(oct-center-geom centergeom.F90) +target_link_libraries(oct-center-geom PRIVATE + ions fortran_cli) + +add_executable(oct-conductivity conductivity.F90) +target_link_libraries(oct-conductivity PRIVATE + spectrum fortran_cli) + +add_executable(oct-convert convert.F90) +target_link_libraries(oct-convert PRIVATE + electrons spectrum fortran_cli) + +add_executable(oct-dielectric-function dielectric_function.F90) +target_link_libraries(oct-dielectric-function PRIVATE + spectrum fortran_cli) + +add_executable(oct-floquet floquet.F90) +target_link_libraries(oct-floquet PRIVATE + electrons fortran_cli) + +add_executable(oct-harmonic-spectrum harmonic_spectrum.F90) +target_link_libraries(oct-harmonic-spectrum PRIVATE + math_fft spectrum fortran_cli) + +add_executable(oct-help help.F90) +target_link_libraries(oct-help PRIVATE + fortran_cli) + +add_executable(oct-infrared_spectrum infrared.F90) +target_link_libraries(oct-infrared_spectrum PRIVATE + math fortran_cli) + +add_executable(oct-local_multipoles local_multipoles.F90) +target_sources(oct-local_multipoles PRIVATE + ../boxes/box_union.F90 + ../boxes/multibox.F90 + local_write.F90) +target_link_libraries(oct-local_multipoles PRIVATE + electrons fortran_cli) + +add_executable(oct-oscillator-strength oscillator_strength.F90) +target_link_libraries(oct-oscillator-strength PRIVATE + spectrum fortran_cli) + +add_executable(oct-photoelectron_spectrum photoelectron_spectrum.F90) +target_sources(oct-photoelectron_spectrum PRIVATE + ../td/pes_out.F90) +target_link_libraries(oct-photoelectron_spectrum PRIVATE + states_elec pes fortran_cli) + +add_executable(oct-propagation_spectrum propagation_spectrum.F90) +target_link_libraries(oct-propagation_spectrum PRIVATE + spectrum fortran_cli) + +add_executable(oct-spin_susceptibility spin_susceptibility.F90) +target_link_libraries(oct-spin_susceptibility PRIVATE + ions spectrum fortran_cli) + +add_executable(oct-tdtdm tdtdm.F90) +target_link_libraries(oct-tdtdm PRIVATE + electrons spectrum fortran_cli) + +add_executable(oct-unfold unfold.F90) +target_link_libraries(oct-unfold PRIVATE + fourier_shell electrons fortran_cli) + +add_executable(oct-vibrational_spectrum vibrational.F90) +target_link_libraries(oct-vibrational_spectrum PRIVATE + spectrum fortran_cli) + +add_executable(oct-wannier90 wannier90_interface.F90) +target_sources(oct-wannier90 PRIVATE + ../math/ylm_wannier.F90) +target_link_libraries(oct-wannier90 PRIVATE + states_elec orbitalset electrons fortran_cli) + +add_executable(oct-xyz-anim xyzanim.F90) +target_link_libraries(oct-xyz-anim PRIVATE + ions fortran_cli) \ No newline at end of file diff --git a/third_party/.gitkeep b/third_party/.gitkeep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/third_party/Libxc b/third_party/Libxc new file mode 160000 index 0000000000000000000000000000000000000000..5d63dde34f79a8f0b3ccbb5327f9191c821aa82d --- /dev/null +++ b/third_party/Libxc @@ -0,0 +1 @@ +Subproject commit 5d63dde34f79a8f0b3ccbb5327f9191c821aa82d diff --git a/third_party/Spglib b/third_party/Spglib new file mode 160000 index 0000000000000000000000000000000000000000..02159eef6e7349535049a43fe2272bb634c77945 --- /dev/null +++ b/third_party/Spglib @@ -0,0 +1 @@ +Subproject commit 02159eef6e7349535049a43fe2272bb634c77945