Skip to content

Commit

Permalink
Merge branch 'release-0.3' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
aradi committed Jun 27, 2024
2 parents 054c961 + a248bf2 commit b13a0b8
Show file tree
Hide file tree
Showing 57 changed files with 2,333 additions and 1,227 deletions.
96 changes: 33 additions & 63 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@ on: [push, pull_request]

env:
CI: "ON"
HOMEBREW_NO_ANALYTICS: "ON"
HOMEBREW_NO_AUTO_UPDATE: "ON"
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_GITHUB_API: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
BUILD_DIR: _build
INSTALL_DIR: _install

jobs:

gcc-build:

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
config: [Debug]
version: [11]
version: [13]

steps:
- name: Checkout code
Expand All @@ -30,20 +28,7 @@ jobs:
with:
python-version: '3.x'

# Note: xcode version 14.0 (default on macos-latest @ 2022-11-23) fails to link gfortran compiled
# code. Therefore, 14.1 is selected below (which seems to be installed.)
- name: Install GCC (OSX)
if: ${{ contains(matrix.os, 'macos') }}
run: |
brew install gcc@${{ matrix.version }} openblas
ln -s /usr/local/bin/gfortran-${{ matrix.version }} /usr/local/bin/gfortran
ln -s /usr/local/bin/gcc-${{ matrix.version }} /usr/local/bin/gcc
ln -s /usr/local/bin/g++-${{ matrix.version }} /usr/local/bin/g++
echo "PKG_CONFIG_PATH=/usr/local/opt/openblas/lib/pkgconfig" >> $GITHUB_ENV
xcversion select 14.1
- name: Install GCC (Linux)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
Expand All @@ -53,31 +38,23 @@ jobs:
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.version }} \
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.version }}
- name: Set Compiler (Linux)
if: contains(matrix.os, 'ubuntu')
- name: Set Compiler
run: |
echo "FC=gfortran" >> $GITHUB_ENV
echo "CC=gcc" >> $GITHUB_ENV
- name: Set Compiler (OSX)
if: contains(matrix.os, 'macos')
run: |
echo "FC=gfortran-${{ matrix.version }}" >> $GITHUB_ENV
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
- name: Compile and Install libXC
run: |
git clone https://gitlab.com/libxc/libxc.git
cd libxc/
git checkout 6.1.0
FC=gfortran CC=gcc cmake -H. -B ${BUILD_DIR} -DENABLE_FORTRAN=True -DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR}
git checkout 6.2.2
cmake -DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR} -DENABLE_FORTRAN=True -B ${BUILD_DIR} .
cd ${BUILD_DIR}
make -j
make -j 2
make install
cd ../../
- name: Set libXC search path
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: |
echo "CMAKE_PREFIX_PATH=./libxc/${BUILD_DIR}/${INSTALL_DIR}/" >> $GITHUB_ENV
Expand Down Expand Up @@ -105,23 +82,20 @@ jobs:
cmake --install ${BUILD_DIR}
intel-build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
fc: [ifort]
cc: [icc]
config: [RelWithDebInfo]

runs-on: ${{ matrix.os }}

env:
FC: ${{ matrix.fc }}
CC: ${{ matrix.cc }}
APT_PACKAGES: >-
intel-oneapi-compiler-fortran
intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
intel-oneapi-mkl
intel-oneapi-mkl-devel
FC: ifx
CC: icx
CMAKE_OPTIONS: >-
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DCMAKE_BUILD_TYPE=${{ matrix.config }}
-DFYPP_FLAGS='-DTRAVIS'
steps:
- name: Checkout code
Expand All @@ -132,37 +106,33 @@ jobs:
with:
python-version: 3.x

- name: Add Intel repository
if: contains(matrix.os, 'ubuntu')
run: |
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
- name: Setup Intel compiler
uses: rscohn2/setup-oneapi@v0
with:
components: |
[email protected]
[email protected]
[email protected]
- name: Install Intel oneAPI compiler
if: contains(matrix.os, 'ubuntu')
- name: Setup Intel environment
run: |
sudo apt-get update
sudo apt-get install ${APT_PACKAGES}
source /opt/intel/oneapi/setvars.sh
printenv >> $GITHUB_ENV
printenv >> ${GITHUB_ENV}
echo "FC=ifx" >> ${GITHUB_ENV}
echo "CC=icx" >> ${GITHUB_ENV}
- name: Compile and install libXC
if: contains(matrix.os, 'ubuntu')
run: |
git clone https://gitlab.com/libxc/libxc.git
cd libxc/
git checkout 6.1.0
cmake -H. -B ${BUILD_DIR} -DENABLE_FORTRAN=True -DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR}
git checkout 6.2.2
cmake -DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR} -DENABLE_FORTRAN=True -B ${BUILD_DIR} .
cd ${BUILD_DIR}
make -j
make -j 2
make install
cd ../../
- name: Set libXC search path
if: contains(matrix.os, 'ubuntu')
run: |
echo "CMAKE_PREFIX_PATH=./libxc/${BUILD_DIR}/${INSTALL_DIR}/" >> $GITHUB_ENV
Expand All @@ -178,7 +148,7 @@ jobs:
- name: Configure build
run: |
cmake -B ${BUILD_DIR} -DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR} .
cmake -DCMAKE_INSTALL_PREFIX=${PWD}/${BUILD_DIR}/${INSTALL_DIR} -B ${BUILD_DIR} .
- name: Build project
run: cmake --build ${BUILD_DIR}
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)

project(SkProgs VERSION 0.2 LANGUAGES Fortran)
project(SkProgs VERSION 0.3 LANGUAGES Fortran)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
include(SkProgsUtils)
Expand Down Expand Up @@ -61,11 +61,13 @@ set(PYTHON_VERSION_MAJOR_MINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR

set(FYPP "${PROJECT_SOURCE_DIR}/external/fypp/bin/fypp" CACHE FILEPATH "Fypp preprocessor")
skprogs_add_fypp_defines(FYPP_FLAGS)
set(FYPP_FLAGS "${FYPP_FLAGS}")

set(FYPP_CONFIG_FLAGS "${FYPP_FLAGS}")
# Make sure, the line-marker option is not set
list(REMOVE_ITEM FYPP_CONFIG_FLAGS "-n")
set(FYPP_BUILD_FLAGS "${FYPP_FLAGS}" "$<IF:$<CONFIG:Debug>,-DDEBUG=1,-DDEBUG=0>")
set(FYPP_BUILD_FLAGS "${FYPP_FLAGS}" "--file-var-root=${CMAKE_SOURCE_DIR}"
"$<IF:$<CONFIG:Debug>,-DDEBUG=1,-DDEBUG=0>")

set(PYTHON_INTERPRETER "python3" CACHE STRING
"Python interpreter to use for installing and test python components")
Expand Down
18 changes: 9 additions & 9 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,36 @@ When you contribute to the project, your contribution must align with the

Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
Expand Down
82 changes: 71 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ robust. Make sure, you check results as careful as possible. Use at your own
risk!


Installing
==========
Installation
============

|build status|

Expand All @@ -30,16 +30,42 @@ Prerequisites
* libXC library with f03 interface (version >=6.0.0)


Building the code
-----------------
Obtaining via Conda
-------------------

The preferred way of obtaining SkProgs is to install it via the conda package
management framework using `Miniconda
<https://docs.conda.io/en/latest/miniconda.html>`_ or `Anaconda
<https://www.anaconda.com/products/individual>`_. Make sure to add/enable the
``conda-forge`` channel in order to be able to access SkProgs::

conda config --add channels conda-forge
conda config --set channel_priority strict

We recommend to set up a dedicated conda environment and to use the
`mamba solver <https://mamba.readthedocs.io/>`_ ::

conda create --name skprogs
conda activate skprogs
conda install conda-libmamba-solver
conda config --set solver libmamba

to install the latest stable release of SkProgs (Fortran and Python
components)::

mamba install skprogs skprogs-python


Building from source
--------------------

Follow the usual CMake build workflow:

* Configure the project, specify your compilers (e.g. ``gfortran``),
the install location (e.g. ``$HOME/opt/skprogs``) and the build directory
(e.g. ``_build``)::
the install location (i.e. path stored in ``YOUR_SKPROGS_INSTALL_FOLDER``,
e.g. ``$HOME/opt/skprogs``) and the build directory (e.g. ``_build``)::

FC=gfortran cmake -DCMAKE_INSTALL_PREFIX=$HOME/opt/skprogs -B _build .
FC=gfortran cmake -DCMAKE_INSTALL_PREFIX=YOUR_SKPROGS_INSTALL_FOLDER -B _build .

If libXC is installed in a non-standard location, you may need to specify
either the ``CMAKE_PREFIX_PATH`` environment variable (if libXC was built with
Expand All @@ -65,6 +91,39 @@ Follow the usual CMake build workflow:
cmake --install _build


Building libXC from source
--------------------------

Follow the usual CMake build workflow:

* Clone the official libXC repository and checkout the latest release tag, e.g.
``6.2.2``::

git clone https://gitlab.com/libxc/libxc.git libxc
cd libxc/
git checkout 6.2.2

* Configure the project, specify your compilers (e.g. ``gfortran`` and ``gcc``),
the install location (i.e. path stored in ``YOUR_LIBXC_INSTALL_FOLDER``, e.g.
``$HOME/opt/libxc``) and the build directory (e.g. ``_build``)::

FC=gfortran CC=gcc cmake -DENABLE_FORTRAN=True -DCMAKE_INSTALL_PREFIX=YOUR_LIBXC_INSTALL_FOLDER -B _build .

* If the configuration was successful, build the code ::

cmake --build _build -- -j

* After successful build, you should test the code by running ::

pushd _build
ctest -j
popd

* If the tests were successful, install the package via ::

cmake --install _build


Advanced build configuration
============================

Expand All @@ -85,7 +144,7 @@ variable. If you want to load an external toolchain file instead of one from the
source tree, you can specify the file path with the ``-DTOOLCHAIN_FILE`` option
::

-DTOOLCHAIN_FILE=/some/path/myintel.cmake
-DTOOLCHAIN_FILE=/path/to/myintel.cmake

or with the ``SKPROGS_TOOLCHAIN_FILE`` environment variable.

Expand All @@ -101,9 +160,10 @@ Generating SK-files
The basic steps of generating the electronic part of the SK-tables are as
follows:

* Initialize the necessary environment variables by sourceing the
``skprogs-activate.sh`` script (provided you have BASH or compatible shell,
otherwise inspect the script and set up the environment variables manually)::
* If you have build SkProgs from source, initialize the necessary environment
variables by sourceing the ``skprogs-activate.sh`` script (provided you have
BASH or a compatible shell, otherwise inspect the script and set up the
environment variables manually)::

source <SKPROGS_INSTALL_FOLDER>/bin/skprogs-activate.sh

Expand Down
2 changes: 1 addition & 1 deletion cmake/SkProgsUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function(skprogs_guess_toolchain toolchain)

if("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU")
set(_toolchain "gnu")
elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Intel")
elseif("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel|IntelLLVM")
set(_toolchain "intel")
elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "NAG")
set(_toolchain "nag")
Expand Down
2 changes: 1 addition & 1 deletion common/include/LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DFTB+: general package for performing fast atomistic simulations
Copyright (C) 2006 - 2021 DFTB+ developers group
Copyright (C) 2006 - 2024 DFTB+ developers group

This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Expand Down
Loading

0 comments on commit b13a0b8

Please sign in to comment.