Simple DFT-D3

Simple DFT-D3: Library first implementation of the D3 dispersion correction - Published in JOSS (2024)

https://github.com/dftd3/simple-dftd3

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 10 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    2 of 18 committers (11.1%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

ase computational-chemistry dispersion-correction pyscf qcschema quantum-chemistry

Scientific Fields

Engineering Computer Science - 40% confidence
Last synced: 6 months ago · JSON representation

Repository

Library first implementation of the D3 dispersion correction

Basic Info
Statistics
  • Stars: 70
  • Watchers: 2
  • Forks: 32
  • Open Issues: 16
  • Releases: 14
Topics
ase computational-chemistry dispersion-correction pyscf qcschema quantum-chemistry
Created over 6 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License

README.md

The D3 dispersion model

Latest Version LGPL-3.0-or-later JOSS CI Documentation docs codecov

This package provides a library first implementation of the DFT-D3 dispersion correction (see JCP 132, 154104 (2010) and JCC 32, 1456 (2011) for details). Usable via the command line interface of the s-dftd3 executable, in Fortran via the dftd3 module, with the C interface by including the dftd3.h header, or in Python by using the dftd3 module. Additionally, the geometric counter-poise correction (see JCP 136, 154101 (2012)) is available to correct for basis set superposition errors and construct composite electronic structure methods of the 3c family.

Installation

A full guide for installing this package or building from source can be found in the installation guide.

Conda package

Conda Version Conda Version

The preferred way of installing this package is from the conda-forge distribution via the mamba package manager. To install the mamba package manager the miniforge installer can be used. If you already have the mamba package manager installed add the conda-forge channel if it is not yet enabled:

mamba config --add channels conda-forge

Once the conda-forge channel has been enabled, this project can be installed with:

mamba install simple-dftd3

If you want to enable the Python API as well install

mamba install dftd3-python

Now you are ready to use s-dftd3.

Building from Source

To build this project from the source code in this repository you need a Fortran compiler supporting at least the Fortran 2008 standard. If a C compiler is available the C interface tests will be build with this compiler. For building the Python bindings a C compiler is required to build the Python extension module.

For building from source the

  • meson version 0.58 or newer, with a build-system backend, i.e. ninja version 1.7 or newer
  • asciidoctor to build the manual page (optional)
  • FORD to build the developer documentation (optional)
  • Python 3.7 or newer with the CFFI, NumPy and setuptools package installed to build the Python API

This project builds on many existing Fortran packages, the following ones are used as dependencies

  • mctc-lib: For reading geometry files in a wide range of formats (like xyz, PBD, mol, SDF, Turbomole, DFTB+, Vasp, FHI-aims, Gaussian, QChem, QCSchema JSON, Chemical JSON)
  • toml-f For reading the parameter file with all damping parameters (see assets/)
  • mstore For molecule fixtures to use when defining unit tests (testing only)
  • test-drive Unit testing framework (testing only)

If these Fortran packages are not available, the build system will automatically fetch them and build them as part of this project.

To setup a build use

meson setup _build --prefix=/path/to/install

You can select the Fortran compiler by the FC environment variable, similarly the C compiler is selected from the CC environment variable. To compile and run the projects testsuite use

meson test -C _build --print-errorlogs

If the testsuite passes you can install with

meson install -C _build

This might require administrator access depending on the chosen install prefix.

Meson is the primary build system and provides feature-complete functionality of this project. If you for any reason cannot use meson, this project also supports CMake and fpm as build systems. For more details checkout the installation guide.

Generating docs

The documentation is generated using sphinx for the general documentation and the Python API, FORD for the Fortran API documentation, and asciidoctor for the command line interface manpage.

Documentation pages (Sphinx)

Documentation

For generating the main documentation pages, install the documentation dependencies with

pip install -r doc/requirements.txt

The pages can be built with

sphinx-build doc _docs -b html

To view the final pages you can start a HTTP server via

python -m http.server -d _docs

And open the shown URL in a browser (usually this is https://localhost:8000). The documentation is automatically deployed from the main branch and can be viewed on readthedocs.

API documentation (Ford)

docs

To generate the API documentation of the Fortran library install ford via

mamba install ford

The API documentation can be generated with

ford docs.md -o _api

To view the final pages you can start a HTTP server via

python -m http.server -d _docs

And open the shown URL in a browser. The API documentation is automatically deployed from the main branch and can be viewed on GitHub pages.

Usage

DFT-D3 calculations can be performed with the s-dftd3 executable. To calculate the dispersion correction for PBE0-D3(BJ)-ATM run:

s-dftd3 --bj pbe0 --atm coord

In case you want to access the DFT-D3 results from other programs, dump the results to JSON with (the --noedisp flag prevents the .EDISP file generation):

s-dftd3 --bj pbe0 --atm --json --grad --noedisp struct.xyz

Dispersion related properties can be calculated as well:

s-dftd3 --property geo.gen

For an overview over all command line arguments use the --help argument or checkout the s-dftd3(1) manpage.

API access

This DFT-D3 implementation provides first class API support Fortran, C and Python. Other programming languages should try to interface via one of those three APIs. To provide first class API support for a new language the interface specification should be available as meson build files.

Fortran API

The recommended way to access the Fortran module API is by using dftd3 as a meson subproject. Alternatively, the project is accessible by the Fortran package manager (fpm) or as CMake subproject as explained above.

The complete API is available from dftd3 module, the individual modules are available to the user as well but are not part of the public API and therefore not guaranteed to remain stable. API compatibility is only guaranteed for the same minor version, while ABI compatibility cannot be guaranteed in a pre 1.0 stage.

The communication with the Fortran API uses the error_type and structure_type of the modular computation tool chain library (mctc-lib) to handle errors and represent geometries, respectively.

C API

The C API provides access to the basic Fortran objects and their most important methods to interact with them. All Fortran objects are available as opaque void* in C and can only be manipulated with the correct API calls. To evaluate a dispersion correction in C four objects are available:

  1. the error handler:

Simple error handler to carry runtime exceptions created by the library. Exceptions can be handled and/or transfered to the downstream error handling system by this means.

  1. the molecular structure data:

Provides a representation of the molecular structure with immutable number of atoms, atomic species, total charge and boundary conditions. The object provides a way to update coordinates and lattice parameters, to update immutable quantities the object has to be recreated.

  1. the dispersion model:

Instantiated for a given molecular structure type, it carries no information on the geometry but relies on the atomic species of the structure object. Recreating a structure object requires to recreate the dispersion model as well.

  1. the damping parameters:

Damping parameter object determining the short-range behaviour of the dispersion correction. Standard damping parameters like the rational damping are independent of the molecular structure and can easily be reused for several structures or easily exchanged.

  1. the counter-poise parameters:

Counter-poise parameter object determining the basis set specific correction for basis set superposition error. Recreating a structure object requires to recreate the counter-poise parameters as well as they are dependent on the basis definition for each element type.

The user is responsible for creating and deleting the objects to avoid memory leaks.

Python API

The Python API is disabled by default and can be built in-tree or out-of-tree. The in-tree build is mainly meant for end users and packages. To build the Python API with the normal project set the python option in the configuration step with

sh meson setup _build -Dpython=true -Dpython_version=$(which python3)

The Python version can be used to select a different Python version, it defaults to 'python3'. Python 2 is not supported with this project, the Python version key is meant to select between several local Python 3 versions.

Proceed with the build as described before and install the projects to make the Python API available in the selected prefix.

For the out-of-tree build see the instructions in the python directory.

Contributing

This is a volunteer open source projects and contributions are always welcome. Please, take a moment to read the contributing guidelines.

License

This project 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 Software Foundation, either version 3 of the License, or (at your option) any later version.

This project is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU Lesser General Public License for more details.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the GNU Lesser General Public license, shall be licensed as above, without any additional terms or conditions.

Owner

  • Name: DFT-D3
  • Login: dftd3
  • Kind: organization

Consistent and accurate ab initio parametrization of density functional dispersion correction (DFT-D)

JOSS Publication

Simple DFT-D3: Library first implementation of the D3 dispersion correction
Published
November 29, 2024
Volume 9, Issue 103, Page 7169
Authors
Sebastian Ehlert ORCID
Microsoft Research, AI for Science, The Netherlands
Editor
Bonan Zhu ORCID
Tags
computational chemistry density functional theory dispersion correction

GitHub Events

Total
  • Create event: 6
  • Release event: 2
  • Issues event: 28
  • Watch event: 17
  • Delete event: 4
  • Issue comment event: 42
  • Push event: 57
  • Pull request review comment event: 6
  • Pull request review event: 18
  • Pull request event: 58
  • Fork event: 6
Last Year
  • Create event: 6
  • Release event: 2
  • Issues event: 28
  • Watch event: 17
  • Delete event: 4
  • Issue comment event: 42
  • Push event: 57
  • Pull request review comment event: 6
  • Pull request review event: 18
  • Pull request event: 58
  • Fork event: 6

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 136
  • Total Committers: 18
  • Avg Commits per committer: 7.556
  • Development Distribution Score (DDS): 0.199
Past Year
  • Commits: 36
  • Committers: 9
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.444
Top Committers
Name Email Commits
Sebastian Ehlert 2****k 109
foxtran 3****n 6
Marvin Friede 5****e 4
James A. Green 5****n 2
Thomas Froitzheim 9****m 2
Alex Izvorski a****i@g****m 1
Eisuke Kawashima e****m 1
Federico N. Pedron f****e@g****m 1
Jonathon Vandezande j****e@g****m 1
Kjell Jorner 3****r 1
LGTM Migrator l****r 1
Lori A. Burns l****s@g****m 1
Lukas Wittmann w****n@t****e 1
Qiming Sun o****n@g****m 1
Robert Cohn r****2@g****m 1
Shirong_Wang s****0@f****n 1
Thijs Vogels t****s@m****m 1
Wanja Schulze w****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 72
  • Total pull requests: 75
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 29 days
  • Total issue authors: 23
  • Total pull request authors: 19
  • Average comments per issue: 1.58
  • Average comments per pull request: 1.08
  • Merged pull requests: 69
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 34
  • Pull requests: 41
  • Average time to close issues: 13 days
  • Average time to close pull requests: 9 days
  • Issue authors: 10
  • Pull request authors: 10
  • Average comments per issue: 1.21
  • Average comments per pull request: 1.07
  • Merged pull requests: 37
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • awvwgk (33)
  • foxtran (9)
  • AlexBuccheri (5)
  • Andrew-S-Rosen (3)
  • hebrewsnabla (2)
  • tgmaxson (2)
  • loriab (2)
  • shahmoradi (2)
  • JiashuLiang (1)
  • bhourahine (1)
  • jme52 (1)
  • wangenau (1)
  • miroi (1)
  • wxj6000 (1)
  • pfebrer (1)
Pull Request Authors
  • awvwgk (72)
  • foxtran (15)
  • marvinfriede (7)
  • thfroitzheim (4)
  • jamesagreen (4)
  • fedepedron (2)
  • tvogels (2)
  • wangenau (2)
  • dmejiar (2)
  • aizvorski (2)
  • jevandezande (2)
  • loriab (2)
  • sunqm (2)
  • lukaswittmann (1)
  • hebrewsnabla (1)
Top Labels
Issue Labels
parameters (16) bug (11) enhancement (10) documentation (9) python (5) question (1) help wanted (1)
Pull Request Labels
documentation (18) bug (6) python (6) parameters (5) enhancement (2)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 1,553 last-month
  • Total dependent packages: 6
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 14
  • Total maintainers: 2
pypi.org: dftd3

Python API of the DFT-D3 project

  • Versions: 7
  • Dependent Packages: 3
  • Dependent Repositories: 1
  • Downloads: 1,553 Last month
Rankings
Dependent packages count: 2.4%
Forks count: 9.3%
Downloads: 9.4%
Stargazers count: 10.7%
Average: 10.7%
Dependent repos count: 21.6%
Maintainers (2)
Last synced: 6 months ago
conda-forge.org: simple-dftd3
  • Versions: 7
  • Dependent Packages: 3
  • Dependent Repositories: 0
Rankings
Dependent packages count: 15.6%
Dependent repos count: 34.0%
Average: 42.7%
Stargazers count: 60.1%
Forks count: 61.1%
Last synced: 6 months ago

Dependencies

doc/requirements.txt pypi
  • ase *
  • cffi *
  • numpy *
  • qcelemental *
  • sphinx-book-theme *
  • sphinx-copybutton *
  • sphinx-design *
  • sphinxcontrib-bibtex *
.github/workflows/build.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/download-artifact v2 composite
  • actions/upload-artifact v2 composite
  • codecov/codecov-action v1 composite
  • mamba-org/provision-with-micromamba main composite
  • msys2/setup-msys2 v2 composite
.github/workflows/codeql.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/docs.yml actions
  • JamesIves/github-pages-deploy-action 4.1.6 composite
  • actions/checkout v2 composite
  • actions/setup-python v1 composite
.github/workflows/wheel.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v2 composite
  • actions/upload-artifact v3 composite
  • mamba-org/provision-with-micromamba main composite
  • pypa/gh-action-pypi-publish release/v1 composite
  • svenstaro/upload-release-action v2 composite
python/setup.py pypi