Skip to content

Commit e157c8a

Browse files
committed
Merge branch 'main'
2 parents a9ae77f + aab9ba1 commit e157c8a

38 files changed

+67714
-23386
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ jobs:
1818
version: [10]
1919

2020
include:
21-
- os: ubuntu-latest
21+
- os: ubuntu-20.04
2222
build: cmake
2323
build-type: debug
2424
compiler: gnu
2525
version: 8
2626

27-
- os: macos-latest
27+
- os: macos-12
2828
build: cmake
2929
build-type: debug
3030
compiler: gnu
31-
version: 9
31+
version: 10
3232

3333
- os: ubuntu-latest
3434
build: meson
3535
build-type: coverage
3636
compiler: gnu
3737
version: 9
3838

39-
- os: macos-latest
39+
- os: macos-12
4040
build: meson
4141
build-type: debug
4242
compiler: gnu
@@ -48,7 +48,7 @@ jobs:
4848
compiler: gnu
4949
version: 11
5050

51-
- os: ubuntu-latest
51+
- os: ubuntu-20.04
5252
build: meson
5353
build-type: debug
5454
compiler: intel
@@ -176,7 +176,7 @@ jobs:
176176
--suite s-dftd3
177177
-t 2
178178
env:
179-
OMP_NUM_THREADS: 2,1,1
179+
OMP_NUM_THREADS: 1,2,1
180180

181181
- name: Run benchmarks
182182
if: ${{ matrix.build == 'meson' }}
@@ -196,7 +196,7 @@ jobs:
196196
ctest --output-on-failure --parallel 2
197197
working-directory: ${{ env.BUILD_DIR }}
198198
env:
199-
OMP_NUM_THREADS: 2,1,1
199+
OMP_NUM_THREADS: 1,2,1
200200

201201
- name: Create coverage report
202202
if: ${{ matrix.build == 'meson' && matrix.build-type == 'coverage' }}
@@ -242,7 +242,7 @@ jobs:
242242
matrix:
243243
os: [ubuntu-latest]
244244
gcc_v: [10]
245-
python_v: ['3.7', '3.8', '3.9', '3.10']
245+
python_v: ['3.8', '3.9', '3.10', '3.11', '3.12']
246246

247247
env:
248248
FC: gfortran

.github/workflows/codeql.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: "58 13 * * 2"
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ python ]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v2
31+
with:
32+
languages: ${{ matrix.language }}
33+
queries: +security-and-quality
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@v2
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@v2
40+
with:
41+
category: "/language:${{ matrix.language }}"

.github/workflows/docs.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,30 @@ on: [push, pull_request]
55
jobs:
66
build-and-deploy:
77
runs-on: ubuntu-latest
8+
permissions:
9+
contents: write
10+
811
steps:
912
- id: deploy-on-push
1013
run:
1114
echo "::set-output name=result::${{ env.DEPLOY_BRANCH }}"
1215
env:
1316
DEPLOY_BRANCH: ${{ secrets.DEPLOY_BRANCH && contains(github.ref, secrets.DEPLOY_BRANCH) && 1 || 0 }}
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-python@v1
17+
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
1623
with:
1724
python-version: '3.x'
25+
1826
- name: Install dependencies
1927
run: pip install ford
28+
2029
- name: Build Documentation
2130
run: ford docs.md
31+
2232
- uses: JamesIves/[email protected]
2333
if: ${{ github.event_name == 'push' && steps.deploy-on-push.outputs.result != 0 }}
2434
with:

.github/workflows/wheel.yml

Lines changed: 90 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,47 @@
11
name: wheel
22

3-
on: [push, workflow_dispatch]
3+
on:
4+
push:
5+
workflow_dispatch:
6+
release:
7+
types: [published]
48

59
jobs:
10+
source:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
shell: bash -l {0}
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Setup Python
18+
uses: mamba-org/provision-with-micromamba@main
19+
with:
20+
environment-file: assets/ci/build-env.yaml
21+
- run: |
22+
meson setup _build
23+
meson dist -C _build --no-tests --include-subprojects
24+
mv _build/meson-dist/*.tar.xz .
25+
- uses: actions/upload-artifact@v3
26+
with:
27+
name: dftd3-source
28+
path: ./*.tar.xz
29+
retention-days: 5
30+
631
sdist:
732
runs-on: ubuntu-latest
33+
defaults:
34+
run:
35+
shell: bash -l {0}
836
steps:
9-
- uses: actions/checkout@v2
37+
- uses: actions/checkout@v3
38+
- name: Setup Python
39+
uses: mamba-org/provision-with-micromamba@main
40+
with:
41+
environment-file: assets/ci/python-env.yaml
42+
extra-specs: |
43+
meson-python
44+
python-build
1045
- name: Reorganize repository
1146
run: |
1247
git config user.email ""
@@ -16,7 +51,7 @@ jobs:
1651
git mv python/{mesonpep517,pyproject}.toml
1752
git commit -m "Python dist"
1853
- run: |
19-
pipx run build python/ --sdist --outdir .
54+
python -m build python/ --sdist --outdir . -n
2055
- uses: actions/upload-artifact@v3
2156
with:
2257
name: dftd3-python-sdist
@@ -31,7 +66,7 @@ jobs:
3166
strategy:
3267
fail-fast: false
3368
matrix:
34-
python: ['3.7', '3.8', '3.9', '3.10']
69+
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
3570

3671
defaults:
3772
run:
@@ -76,3 +111,54 @@ jobs:
76111
name: dftd3-python-${{ matrix.python }}
77112
path: ./*.whl
78113
retention-days: 5
114+
115+
release:
116+
needs:
117+
- source
118+
- sdist
119+
- manylinux
120+
runs-on: ubuntu-latest
121+
steps:
122+
- name: Download artifacts
123+
uses: actions/download-artifact@v2
124+
with:
125+
path: ${{ github.workspace }} # This will download all files
126+
127+
- name: Create SHA256 checksums
128+
run: |
129+
set -ex
130+
for output in dftd3*/*dftd3*; do
131+
pushd $(dirname "$output")
132+
sha256sum $(basename "$output") | tee $(basename "$output").sha256
133+
popd
134+
done
135+
136+
- name: Copy release artifacts
137+
run: |
138+
mkdir dist/
139+
cp -v dftd3*/dftd3*.whl dftd3*/dftd3*.tar.gz dist/
140+
141+
- name: Publish to Test PyPI
142+
if: ${{ github.event_name == 'release' }}
143+
uses: pypa/gh-action-pypi-publish@release/v1
144+
with:
145+
user: __token__
146+
password: ${{ secrets.TEST_PYPI_TOKEN }}
147+
repository_url: https://test.pypi.org/legacy/
148+
149+
- name: Upload assets
150+
uses: svenstaro/upload-release-action@v2
151+
if: ${{ github.event_name == 'release' }}
152+
with:
153+
repo_token: ${{ secrets.GITHUB_TOKEN }}
154+
file: dftd3*/*dftd3*
155+
file_glob: true
156+
tag: ${{ github.ref }}
157+
overwrite: true
158+
159+
- name: Publish to PyPI
160+
if: ${{ github.event_name == 'release' }}
161+
uses: pypa/gh-action-pypi-publish@release/v1
162+
with:
163+
user: __token__
164+
password: ${{ secrets.PYPI_TOKEN }}

.readthedocs.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
14+
# Build documentation in the docs/ directory with Sphinx
15+
sphinx:
16+
configuration: doc/conf.py
17+
18+
# We recommend specifying your dependencies to enable reproducible builds:
19+
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
20+
python:
21+
install:
22+
- requirements: doc/requirements.txt

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cmake_minimum_required(VERSION 3.14)
1919
project(
2020
"s-dftd3"
2121
LANGUAGES "Fortran"
22-
VERSION "0.6.0"
22+
VERSION "1.0.0"
2323
DESCRIPTION "Simple reimplementation of the DFT-D3 dispersion model"
2424
)
2525

@@ -38,6 +38,10 @@ if(WITH_ILP64)
3838
endif()
3939

4040
if(NOT TARGET "BLAS::BLAS" AND WITH_BLAS)
41+
if(BLA_VENDOR MATCHES "^Intel")
42+
# For detection of MKL we need a C compiler
43+
enable_language("C")
44+
endif()
4145
find_package("custom-blas" REQUIRED)
4246
endif()
4347

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
[![Latest Version](https://img.shields.io/github/v/release/dftd3/simple-dftd3)](https://github.com/dftd3/simple-dftd3/releases/latest)
44
[![LGPL-3.0-or-later](https://img.shields.io/github/license/dftd3/simple-dftd3)](COPYING)
55
[![CI](https://github.com/dftd3/simple-dftd3/workflows/CI/badge.svg)](https://github.com/dftd3/simple-dftd3/actions)
6-
[![docs](https://github.com/dftd3/simple-dftd3/workflows/docs/badge.svg)](https://dftd3.github.io/simple-dftd3/)
6+
[![Documentation](https://readthedocs.org/projects/dftd3/badge/?version=latest)](https://dftd3.readthedocs.io/en/latest/)
7+
[![docs](https://github.com/dftd3/simple-dftd3/actions/workflows/docs.yml/badge.svg)](https://dftd3.github.io/simple-dftd3/)
78
[![codecov](https://codecov.io/gh/dftd3/simple-dftd3/branch/main/graph/badge.svg)](https://codecov.io/gh/dftd3/simple-dftd3)
89

910
A simple drop-in replacement for ``dftd3``.
@@ -262,8 +263,6 @@ The user is responsible for creating and deleting the objects to avoid memory le
262263

263264
### Python API
264265

265-
[![LGTM](https://img.shields.io/lgtm/grade/python/g/dftd3/simple-dftd3.svg)](https://lgtm.com/projects/g/dftd3/simple-dftd3/context:python)
266-
267266
The Python API is disabled by default and can be built in-tree or out-of-tree.
268267
The in-tree build is mainly meant for end users and packages.
269268
To build the Python API with the normal project set the ``python`` option in the configuration step with

app/driver.f90

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ subroutine run_driver(config, error)
5151
class(damping_param), allocatable :: param
5252
type(d3_param) :: inp
5353
type(d3_model) :: d3
54-
real(wp), allocatable :: energy, gradient(:, :), sigma(:, :)
54+
real(wp), allocatable :: energies(:), gradient(:, :), sigma(:, :)
5555
real(wp), allocatable :: pair_disp2(:, :), pair_disp3(:, :)
5656
real(wp), allocatable :: s9
57+
real(wp) :: energy
5758
integer :: stat, unit
5859
logical :: exist
5960

@@ -163,7 +164,7 @@ subroutine run_driver(config, error)
163164
end if
164165

165166
if (allocated(param)) then
166-
energy = 0.0_wp
167+
allocate(energies(mol%nat))
167168
if (config%grad) then
168169
allocate(gradient(3, mol%nat), sigma(3, 3))
169170
end if
@@ -176,14 +177,19 @@ subroutine run_driver(config, error)
176177
end if
177178

178179
if (allocated(param)) then
179-
call get_dispersion(mol, d3, param, realspace_cutoff(), energy, gradient, &
180-
& sigma)
180+
call get_dispersion(mol, d3, param, realspace_cutoff(), energies, &
181+
& gradient, sigma)
182+
energy = sum(energies)
183+
181184
if (config%pair_resolved) then
182185
allocate(pair_disp2(mol%nat, mol%nat), pair_disp3(mol%nat, mol%nat))
183186
call get_pairwise_dispersion(mol, d3, param, realspace_cutoff(), pair_disp2, &
184187
& pair_disp3)
185188
end if
186189
if (config%verbosity > 0) then
190+
if (config%verbosity > 2) then
191+
call ascii_energy_atom(output_unit, mol, energies)
192+
end if
187193
call ascii_results(output_unit, mol, energy, gradient, sigma)
188194
if (config%pair_resolved) then
189195
call ascii_pairwise(output_unit, mol, pair_disp2, pair_disp3)

assets/parameters.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
d3 = ["bj", "zero"]
33

44
[default.parameter]
5-
d3.bj = {s6=1.0, s9=0.0, alp=14.0, damping="rational"}
6-
d3.zero = {s6=1.0, s9=0.0, rs8=1.0, alp=14.0, damping="zero"}
7-
d3.bjm = {s6=1.0, s9=0.0, alp=14.0, damping="rational"}
8-
d3.zerom = {s6=1.0, s9=0.0, rs8=1.0, alp=14.0, damping="mzero"}
9-
d3.op = {s9=0.0, alp=14.0, damping="optimizedpower"}
5+
d3.bj = {s6=1.0, s9=1.0, alp=14.0, damping="rational"}
6+
d3.zero = {s6=1.0, s9=1.0, rs8=1.0, alp=14.0, damping="zero"}
7+
d3.bjm = {s6=1.0, s9=1.0, alp=14.0, damping="rational"}
8+
d3.zerom = {s6=1.0, s9=1.0, rs8=1.0, alp=14.0, damping="mzero"}
9+
d3.op = {s9=1.0, alp=14.0, damping="optimizedpower"}
1010

1111
[parameter.bp]
1212
d3.bj = {a1=0.3946, s8=3.2822, a2=4.8516}
@@ -37,6 +37,10 @@ d3.bjm = {a1=0.240184, s8=1.206988, a2=3.864426, doi="10.1021/acs.jpclett.6b0078
3737
d3.zerom = {rs6=1.151808, s8=1.020078, bet=0.035964, doi="10.1021/acs.jpclett.6b00780"}
3838
d3.op = {s6=1.0, s8=1.46861, a1=0.600, a2=2.50, bet=0.0, doi="10.1021/acs.jctc.7b00176"}
3939

40+
[parameter.b973c]
41+
d3.bj = {a1=0.37, s8=1.50, a2=4.10, doi="10.1063/1.5012601"}
42+
d3.zero = {rs6=1.06, s8=1.50, doi="10.1063/1.5012601"}
43+
4044
[parameter.pbe]
4145
d3.bj = {a1=0.4289, s8=0.7875, a2=4.4407}
4246
d3.zero = {rs6=1.217, s8=0.722, doi="10.1063/1.3382344"}

0 commit comments

Comments
 (0)