├── .codecov.yml
├── .github
├── dco.yml
└── workflows
│ ├── build.yml
│ ├── codeql.yml
│ ├── docs.yml
│ └── wheel.yml
├── .gitignore
├── .readthedocs.yaml
├── CMakeLists.txt
├── CONTRIBUTING.md
├── COPYING
├── COPYING.LESSER
├── README.md
├── app
├── CMakeLists.txt
├── argument.f90
├── cli.f90
├── driver.f90
├── example.xyz
├── help.f90
├── main.f90
├── meson.build
└── toml.f90
├── assets
├── ci
│ ├── build-env.yaml
│ ├── python-env.yaml
│ ├── setup-intel.sh
│ └── wheel-req.txt
└── parameters.toml
├── config
├── CMakeLists.txt
├── cmake
│ ├── Findmctc-lib.cmake
│ ├── Findmstore.cmake
│ ├── Findtoml-f.cmake
│ └── s-dftd3-utils.cmake
├── install-mod.py
├── meson.build
├── template.cmake
└── template.pc
├── doc
├── _static
│ └── references.bib
├── api
│ ├── ase.rst
│ ├── c.rst
│ ├── fortran.rst
│ ├── index.rst
│ ├── pyscf.rst
│ ├── python.rst
│ └── qcschema.rst
├── comparison.rst
├── conf.py
├── guide
│ ├── citing.rst
│ ├── index.rst
│ ├── minimal-example.rst
│ └── minimal-example
│ │ ├── energy.c
│ │ ├── energy.f90
│ │ └── energy.py
├── index.rst
├── installation.rst
├── requirements.txt
└── tutorial
│ ├── first-steps-cli.rst
│ ├── first-steps-fortran.rst
│ ├── first-steps-fortran
│ ├── app
│ │ └── main.f90
│ ├── fpm.toml
│ └── src
│ │ └── scan.f90
│ └── index.rst
├── docs.md
├── fpm.toml
├── include
├── dftd3.h
└── s-dftd3.h
├── man
└── s-dftd3.1.adoc
├── meson.build
├── meson_options.txt
├── python
├── .gitignore
├── COPYING
├── COPYING.LESSER
├── README.rst
├── dftd3
│ ├── __init__.py
│ ├── ase.py
│ ├── interface.py
│ ├── library.py
│ ├── meson.build
│ ├── parameters.py
│ ├── py.typed
│ ├── pyscf.py
│ ├── qcschema.py
│ ├── test_ase.py
│ ├── test_interface.py
│ ├── test_library.py
│ ├── test_parameters.py
│ ├── test_pyscf.py
│ └── test_qcschema.py
├── ffibuilder.py
├── include
│ └── _dftd3.h
├── meson.build
├── meson_options.txt
├── mesonpep517.toml
├── setup.cfg
└── setup.py
├── src
├── CMakeLists.txt
├── dftd3.f90
├── dftd3
│ ├── CMakeLists.txt
│ ├── api.f90
│ ├── citation.f90
│ ├── cutoff.f90
│ ├── damping.f90
│ ├── damping
│ │ ├── CMakeLists.txt
│ │ ├── atm.f90
│ │ ├── meson.build
│ │ ├── mzero.f90
│ │ ├── optimizedpower.f90
│ │ ├── rational.f90
│ │ └── zero.f90
│ ├── data.f90
│ ├── data
│ │ ├── CMakeLists.txt
│ │ ├── meson.build
│ │ ├── r4r2.f90
│ │ └── vdwrad.f90
│ ├── disp.f90
│ ├── gcp.f90
│ ├── gcp
│ │ ├── CMakeLists.txt
│ │ ├── meson.build
│ │ └── param.f90
│ ├── meson.build
│ ├── model.f90
│ ├── ncoord.f90
│ ├── output.f90
│ ├── param.f90
│ ├── reference.f90
│ ├── utils.f90
│ └── version.f90
└── meson.build
├── subprojects
├── .gitignore
├── mctc-lib.wrap
├── mstore.wrap
└── toml-f.wrap
└── test
├── CMakeLists.txt
├── api
├── api-test.c
└── meson.build
├── meson.build
├── unit
├── CMakeLists.txt
├── main.f90
├── meson.build
├── test_dftd3.f90
├── test_gcp.f90
├── test_model.f90
├── test_pairwise.f90
├── test_param.f90
├── test_periodic.f90
└── test_regression.f90
└── validation
├── 01-energy-d3-bj.json
├── 01-energy-d3-bj.resp
├── 01-tyr-xab.xyz
├── 02-energy-d3-zero.json
├── 02-energy-d3-zero.resp
├── 02-ser-xad.gen
├── 03-energy-d3-bjm.json
├── 03-energy-d3-bjm.resp
├── 03-met-xag.coord
├── 04-energy-d3-zerom.json
├── 04-energy-d3-zerom.resp
├── 04-val-xad.mol
├── 05-cys-xag.sdf
├── 05-energy-d3-op.json
├── 05-energy-d3-op.resp
├── 06-229.xyz
├── 06-gradient-d3-bj.json
├── 06-gradient-d3-bj.resp
├── 07-bih3-nh3.tmol
├── 07-gradient-d3-zero.json
├── 07-gradient-d3-zero.resp
├── 08-gradient-d3-bjm.json
├── 08-gradient-d3-bjm.resp
├── 08-teh2-hbr.mol
├── 09-0a.pdb
├── 09-gradient-d3-zerom.json
├── 09-gradient-d3-zerom.resp
├── 10-but14diol.log
├── 10-gradient-d3-op.json
├── 10-gradient-d3-op.resp
├── 11-cf3br-benzene.xyz
├── 11-pairwise-d3-bj.json
├── 11-pairwise-d3-bj.resp
├── 12-butane.gen
├── 12-pairwise-d3-zero.json
├── 12-pairwise-d3-zero.resp
├── 13-c60.coord
├── 13-pairwise-d3-bjm.json
├── 13-pairwise-d3-bjm.resp
├── 14-anthracene2.xyz
├── 14-pairwise-d3-zerom.json
├── 14-pairwise-d3-zerom.resp
├── 15-pairwise-d3-op.json
├── 15-pairwise-d3-op.resp
├── 15-pxylene.mol
├── 16-db-d3-bj.json
├── 16-db-d3-bj.resp
├── 16-i10e.gen
├── 17-db-d3-zero.json
├── 17-db-d3-zero.resp
├── 17-li2-ch4.sdf
├── 18-c1.pdb
├── 18-db-d3-bjm.json
├── 18-db-d3-bjm.resp
├── 19-db-d3-zerom.json
├── 19-db-d3-zerom.resp
├── 19-g1.mol
├── 20-db-d3-op.json
├── 20-db-d3-op.resp
├── 20-i21p.tmol
├── 21-ad3.coord
├── 21-gcp-pbeh3c.json
├── 21-gcp-pbeh3c.resp
├── 22-benI-acetone.xyz
├── 22-gcp-b973c.json
├── 22-gcp-b973c.resp
├── 23-444.sdf
├── 23-gcp-hf3c.json
├── 23-gcp-hf3c.resp
├── 24-gcp-hf-deftzvp.json
├── 24-gcp-hf-deftzvp.resp
├── 24-h2o_6.qchem
├── 25-g3.gen
├── 25-gcp-b3lyp-631gd.json
├── 25-gcp-b3lyp-631gd.resp
├── meson.build
└── tester.py
/.codecov.yml:
--------------------------------------------------------------------------------
1 | fixes:
2 | - "/home/runner/work/simple-dftd3/simple-dftd3::"
3 |
4 | ignore:
5 | - "python/**/test_*.py"
6 | - "test/**"
7 |
--------------------------------------------------------------------------------
/.github/dco.yml:
--------------------------------------------------------------------------------
1 | require:
2 | members: false
3 |
--------------------------------------------------------------------------------
/.github/workflows/codeql.yml:
--------------------------------------------------------------------------------
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@v4
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 }}"
42 |
--------------------------------------------------------------------------------
/.github/workflows/docs.yml:
--------------------------------------------------------------------------------
1 | name: docs
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | build-and-deploy:
7 | runs-on: ubuntu-latest
8 | permissions:
9 | contents: write
10 |
11 | steps:
12 | - id: deploy-on-push
13 | run:
14 | echo "::set-output name=result::${{ env.DEPLOY_BRANCH }}"
15 | env:
16 | DEPLOY_BRANCH: ${{ secrets.DEPLOY_BRANCH && contains(github.ref, secrets.DEPLOY_BRANCH) && 1 || 0 }}
17 |
18 | - name: Checkout code
19 | uses: actions/checkout@v4
20 |
21 | - name: Set up Python
22 | uses: actions/setup-python@v5
23 | with:
24 | python-version: '3.x'
25 |
26 | - name: Install dependencies
27 | run: pip install ford
28 |
29 | - name: Build Documentation
30 | run: ford docs.md
31 |
32 | - uses: JamesIves/github-pages-deploy-action@4.1.6
33 | if: ${{ github.event_name == 'push' && steps.deploy-on-push.outputs.result != 0 }}
34 | with:
35 | branch: gh-pages
36 | folder: _docs
37 | single-commit: true
38 | git-config-email: 104521936+dftd3@users.noreply.github.com
39 | git-config-name: DFT-D3
40 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 |
34 | # Directories
35 | /build*/
36 | **/_build
37 | /_*/
38 |
39 | # Outputs
40 | .EDISP
41 | .CPC
42 |
--------------------------------------------------------------------------------
/.readthedocs.yaml:
--------------------------------------------------------------------------------
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
23 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | cmake_minimum_required(VERSION 3.14)
18 |
19 | project(
20 | "s-dftd3"
21 | LANGUAGES "Fortran"
22 | VERSION "1.2.1"
23 | DESCRIPTION "Simple reimplementation of the DFT-D3 dispersion model"
24 | )
25 |
26 | # Follow GNU conventions for installing directories
27 | include(GNUInstallDirs)
28 |
29 | # General configuration information
30 | add_subdirectory("config")
31 |
32 | if(NOT TARGET "OpenMP::OpenMP_Fortran" AND WITH_OpenMP)
33 | find_package("OpenMP" REQUIRED)
34 | endif()
35 |
36 | # Collect subprojects
37 | if(NOT TARGET "mctc-lib::mctc-lib")
38 | find_package("mctc-lib" REQUIRED)
39 | endif()
40 | if(NOT TARGET "mstore::mstore" AND WITH_TESTS)
41 | find_package("mstore" REQUIRED)
42 | endif()
43 | if(NOT TARGET "toml-f::toml-f")
44 | find_package("toml-f" REQUIRED)
45 | endif()
46 | set(
47 | lib-deps
48 | "mctc-lib::mctc-lib"
49 | )
50 | set(
51 | exe-deps
52 | "toml-f::toml-f"
53 | )
54 |
55 | # Collect source of the project
56 | set(srcs)
57 | add_subdirectory("src")
58 |
59 | # multicharge library target
60 | add_library(
61 | "${PROJECT_NAME}-lib"
62 | "${srcs}"
63 | )
64 | set_target_properties(
65 | "${PROJECT_NAME}-lib"
66 | PROPERTIES
67 | POSITION_INDEPENDENT_CODE TRUE
68 | OUTPUT_NAME "${PROJECT_NAME}"
69 | VERSION "${PROJECT_VERSION}"
70 | SOVERSION "${PROJECT_VERSION_MAJOR}"
71 | Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include"
72 | )
73 | target_link_libraries(
74 | "${PROJECT_NAME}-lib"
75 | PUBLIC
76 | "${lib-deps}"
77 | )
78 | if(WITH_OpenMP)
79 | target_link_libraries(
80 | "${PROJECT_NAME}-lib"
81 | PUBLIC
82 | "OpenMP::OpenMP_Fortran"
83 | )
84 | endif()
85 | target_include_directories(
86 | "${PROJECT_NAME}-lib"
87 | PUBLIC
88 | $
89 | $
90 | $
91 | $
92 | )
93 |
94 | # Add example application
95 | add_subdirectory("app")
96 |
97 | # Export targets for other projects
98 | add_library("${PROJECT_NAME}" INTERFACE)
99 | target_link_libraries("${PROJECT_NAME}" INTERFACE "${PROJECT_NAME}-lib")
100 | install(
101 | TARGETS
102 | "${PROJECT_NAME}"
103 | "${PROJECT_NAME}-lib"
104 | EXPORT
105 | "${PROJECT_NAME}-targets"
106 | LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
107 | ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
108 | )
109 | install(
110 | EXPORT
111 | "${PROJECT_NAME}-targets"
112 | NAMESPACE
113 | "${PROJECT_NAME}::"
114 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
115 | )
116 | install(
117 | DIRECTORY
118 | "${CMAKE_CURRENT_SOURCE_DIR}/include/"
119 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
120 | )
121 | install(
122 | DIRECTORY
123 | "${CMAKE_CURRENT_BINARY_DIR}/include/"
124 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${module-dir}"
125 | )
126 | if(WITH_API)
127 | install(
128 | DIRECTORY
129 | "${CMAKE_CURRENT_SOURCE_DIR}/include/"
130 | DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
131 | )
132 | endif()
133 | # Package license files
134 | install(
135 | FILES
136 | "COPYING"
137 | "COPYING.LESSER"
138 | DESTINATION "${CMAKE_INSTALL_DATADIR}/licenses/${PROJECT_NAME}"
139 | )
140 |
141 | # add the testsuite
142 | if(WITH_TESTS)
143 | enable_testing()
144 | add_subdirectory("test")
145 | endif()
146 |
--------------------------------------------------------------------------------
/app/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | add_executable(
18 | "${PROJECT_NAME}-exe"
19 | "argument.f90"
20 | "cli.f90"
21 | "driver.f90"
22 | "help.f90"
23 | "main.f90"
24 | "toml.f90"
25 | )
26 | set_target_properties(
27 | "${PROJECT_NAME}-exe"
28 | PROPERTIES
29 | OUTPUT_NAME "${PROJECT_NAME}"
30 | )
31 | target_link_libraries(
32 | "${PROJECT_NAME}-exe"
33 | PRIVATE
34 | "${PROJECT_NAME}-lib"
35 | "${exe-deps}"
36 | )
37 |
38 | install(
39 | TARGETS
40 | "${PROJECT_NAME}-exe"
41 | DESTINATION
42 | "${CMAKE_INSTALL_BINDIR}"
43 | )
44 |
--------------------------------------------------------------------------------
/app/example.xyz:
--------------------------------------------------------------------------------
1 | 24
2 | -42.15450736
3 | C -3.2624567556 -1.0740397867 -0.0000043734
4 | N -2.2754344008 -0.0292896574 0.0000359020
5 | C -0.9120851382 -0.2075386125 -0.0004880509
6 | C -0.3749333299 1.0720554184 -0.0001564184
7 | N -1.3570794708 1.9998111614 0.0003858762
8 | C -2.4726070186 1.3013159995 0.0005402177
9 | H -3.4474896946 1.7467507266 0.0010080843
10 | N 0.9669701935 1.2880523079 -0.0003374012
11 | C 1.8275740716 0.2107859932 -0.0000027214
12 | O 3.0306801280 0.3524772071 0.0002192165
13 | N 1.2570001166 -1.0570195560 -0.0000714961
14 | C -0.0994181855 -1.3854842224 -0.0003307823
15 | O -0.4879332634 -2.5400052828 -0.0002686844
16 | C 2.2118766147 -2.1535108670 0.0005997875
17 | H 1.6458936552 -3.0819689593 0.0002644601
18 | H 2.8452151680 -2.0921377814 -0.8838098923
19 | H 2.8439724684 -2.0920881626 0.8858951171
20 | C 1.4878336345 2.6373781425 -0.0003075130
21 | H 1.1373305002 3.1659703185 -0.8863920642
22 | H 1.1383298601 3.1656042978 0.8863960393
23 | H 2.5739975007 2.5744621695 -0.0008973695
24 | H -3.8918239831 -1.0020514766 -0.8884978421
25 | H -3.8928014413 -1.0010907638 0.8876971655
26 | H -2.7437217829 -2.0316581902 0.0007283419
27 |
--------------------------------------------------------------------------------
/app/main.f90:
--------------------------------------------------------------------------------
1 | ! This file is part of s-dftd3.
2 | ! SPDX-Identifier: LGPL-3.0-or-later
3 | !
4 | ! s-dftd3 is free software: you can redistribute it and/or modify it under
5 | ! the terms of the GNU Lesser General Public License as published by
6 | ! the Free Software Foundation, either version 3 of the License, or
7 | ! (at your option) any later version.
8 | !
9 | ! s-dftd3 is distributed in the hope that it will be useful,
10 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ! GNU Lesser General Public License for more details.
13 | !
14 | ! You should have received a copy of the GNU Lesser General Public License
15 | ! along with s-dftd3. If not, see .
16 |
17 | program dftd3_main
18 | use, intrinsic :: iso_fortran_env, only : output_unit, error_unit
19 | use mctc_env, only : error_type
20 | use dftd3_app_cli, only : app_config, get_arguments
21 | use dftd3_app_driver, only : app_driver
22 | implicit none
23 | class(app_config), allocatable :: config
24 | type(error_type), allocatable :: error
25 |
26 | call get_arguments(config, error)
27 | call handle_error(error)
28 |
29 | call app_driver(config, error)
30 | call handle_error(error)
31 |
32 | contains
33 |
34 | subroutine handle_error(error)
35 | type(error_type), allocatable, intent(inout) :: error
36 |
37 | interface
38 | subroutine sys_exit(stat) bind(c, name="exit")
39 | use, intrinsic :: iso_c_binding, only : c_int
40 | integer(c_int), value :: stat
41 | end subroutine sys_exit
42 | end interface
43 |
44 | if (allocated(error)) then
45 | if (error%stat == 0) then
46 | write(output_unit, '(a)') error%message
47 | call sys_exit(0)
48 | else
49 | write(error_unit, '("[Error]", 1x, a)') error%message
50 | call sys_exit(1)
51 | end if
52 | end if
53 | end subroutine handle_error
54 |
55 | end program dftd3_main
56 |
--------------------------------------------------------------------------------
/app/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | sdftd3_exe = executable(
18 | meson.project_name(),
19 | sources: files(
20 | 'argument.f90',
21 | 'cli.f90',
22 | 'driver.f90',
23 | 'help.f90',
24 | 'main.f90',
25 | 'toml.f90',
26 | ),
27 | dependencies: [sdftd3_dep, exe_deps],
28 | install: install,
29 | )
30 |
31 | if os != 'windows'
32 | test('version', sdftd3_exe, args: '--version', suite: 'app')
33 | test('help', sdftd3_exe, args: '--help', suite: 'app')
34 | test('noargs', sdftd3_exe, should_fail: true, suite: 'app')
35 | test('example', sdftd3_exe, args: files('example.xyz'), suite: 'app')
36 | test('run-example', sdftd3_exe, args: ['run', '--', files('example.xyz')], suite: 'app')
37 | test('param-all', sdftd3_exe, args: ['param', sdftd3_parameters], suite: 'app')
38 | test('param-select', sdftd3_exe, args: ['param', sdftd3_parameters, 'b2plyp'], suite: 'app')
39 | endif
40 |
--------------------------------------------------------------------------------
/assets/ci/build-env.yaml:
--------------------------------------------------------------------------------
1 | name: devel
2 | channels:
3 | - conda-forge
4 | dependencies:
5 | - meson 0.58.0
6 | - fpm
7 | - cmake
8 | - ninja
9 | - gcovr
10 |
--------------------------------------------------------------------------------
/assets/ci/python-env.yaml:
--------------------------------------------------------------------------------
1 | name: python
2 | channels:
3 | - conda-forge
4 | dependencies:
5 | - python
6 | - pip
7 | - python-build
8 | - pkgconfig
9 | - pyscf
10 | - pytest
11 | - pytest-cov
12 | - coverage
13 | - cffi
14 | - numpy
15 | - ase
16 | - qcelemental
17 | - matplotlib-base
18 | - meson !=1.8.0
19 |
--------------------------------------------------------------------------------
/assets/ci/setup-intel.sh:
--------------------------------------------------------------------------------
1 | set -ex
2 | if [ $(uname) = Darwin ]; then
3 | OUT=webimage-base.dmg
4 | URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17969/m_BaseKit_p_2021.3.0.3043.dmg
5 | COMPONENTS=intel.oneapi.mac.mkl.devel
6 | curl --output $OUT --url "$URL" --retry 5 --retry-delay 5
7 | hdiutil attach $OUT
8 | if [ -z "$COMPONENTS" ]; then
9 | sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --eula=accept --continue-with-optional-error=yes --log-dir=.
10 | installer_exit_code=$?
11 | else
12 | sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --continue-with-optional-error=yes --log-dir=.
13 | installer_exit_code=$?
14 | fi
15 | hdiutil detach /Volumes/"$(basename "$URL" .dmg)" -quiet
16 |
17 | URL=https://registrationcenter-download.intel.com/akdlm/irc_nas/17890/m_HPCKit_p_2021.3.0.3226_offline.dmg
18 | COMPONENTS=all
19 | curl --output $OUT --url "$URL" --retry 5 --retry-delay 5
20 | hdiutil attach $OUT
21 | if [ -z "$COMPONENTS" ]; then
22 | sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --eula=accept --continue-with-optional-error=yes --log-dir=.
23 | installer_exit_code=$?
24 | else
25 | sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --continue-with-optional-error=yes --log-dir=.
26 | installer_exit_code=$?
27 | fi
28 | hdiutil detach /Volumes/"$(basename "$URL" .dmg)" -quiet
29 | exit $installer_exit_code
30 | else
31 | KEY=GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
32 | wget https://apt.repos.intel.com/intel-gpg-keys/$KEY
33 | sudo apt-key add $KEY
34 | rm $KEY
35 | echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
36 | sudo apt-get update
37 | sudo apt-get install \
38 | intel-oneapi-compiler-fortran-2021.2.0 \
39 | intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2021.2.0
40 | fi
41 |
--------------------------------------------------------------------------------
/assets/ci/wheel-req.txt:
--------------------------------------------------------------------------------
1 | git
2 | python
3 | pip
4 | python-build
5 | pkgconfig
6 | patchelf
7 | cffi
8 | numpy
9 | ase
10 | qcelemental
11 | matplotlib-base
12 | meson !=1.8.0
13 | setuptools
14 | unzip
15 | wheel
16 |
--------------------------------------------------------------------------------
/config/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | option(BUILD_SHARED_LIBS "Whether the libraries built should be shared" FALSE)
18 |
19 | option(WITH_API "Enable support for C API via iso_c_binding module" TRUE)
20 | option(WITH_OpenMP "Enable support for shared memory parallelisation with OpenMP" TRUE)
21 | option(WITH_BLAS "Use external BLAS library" TRUE)
22 | option(WITH_TESTS "Enable compilation of unit tests" TRUE)
23 | if(NOT DEFINED "${PROJECT_NAME}-dependeny-method")
24 | set(
25 | "${PROJECT_NAME}-dependency-method"
26 | "subproject" "cmake" "pkgconf" "fetch"
27 | )
28 | endif()
29 |
30 | set(
31 | module-dir
32 | "${PROJECT_NAME}/${CMAKE_Fortran_COMPILER_ID}-${CMAKE_Fortran_COMPILER_VERSION}"
33 | )
34 | set(module-dir "${module-dir}" PARENT_SCOPE)
35 |
36 | # Set build type as CMake does not provide defaults
37 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
38 | set(
39 | CMAKE_BUILD_TYPE "RelWithDebInfo"
40 | CACHE STRING "Build type to be used."
41 | FORCE
42 | )
43 | message(
44 | STATUS
45 | "Setting build type to '${CMAKE_BUILD_TYPE}' as none was specified."
46 | )
47 | endif()
48 |
49 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
50 | set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
51 | install(
52 | DIRECTORY
53 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/"
54 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
55 | )
56 |
57 | include(CMakePackageConfigHelpers)
58 | configure_package_config_file(
59 | "${CMAKE_CURRENT_SOURCE_DIR}/template.cmake"
60 | "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
61 | INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
62 | )
63 | write_basic_package_version_file(
64 | "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
65 | VERSION "${PROJECT_VERSION}"
66 | COMPATIBILITY SameMinorVersion
67 | )
68 | install(
69 | FILES
70 | "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
71 | "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
72 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
73 | )
74 |
75 | configure_file(
76 | "${CMAKE_CURRENT_SOURCE_DIR}/template.pc"
77 | "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
78 | @ONLY
79 | )
80 | install(
81 | FILES
82 | "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc"
83 | DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
84 | )
85 |
--------------------------------------------------------------------------------
/config/cmake/Findmctc-lib.cmake:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | set(_lib "mctc-lib")
18 | set(_pkg "MCTCLIB")
19 | set(_url "https://github.com/grimme-lab/mctc-lib")
20 | set(_rev "v0.4.1")
21 |
22 | if(NOT DEFINED "${_pkg}_FIND_METHOD")
23 | if(DEFINED "${PROJECT_NAME}-dependency-method")
24 | set("${_pkg}_FIND_METHOD" "${${PROJECT_NAME}-dependency-method}")
25 | else()
26 | set("${_pkg}_FIND_METHOD" "cmake" "pkgconf" "subproject" "fetch")
27 | endif()
28 | set("_${_pkg}_FIND_METHOD")
29 | endif()
30 |
31 | include("${CMAKE_CURRENT_LIST_DIR}/s-dftd3-utils.cmake")
32 |
33 | sdftd3_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}" "${_rev}")
34 |
35 | if(DEFINED "_${_pkg}_FIND_METHOD")
36 | unset("${_pkg}_FIND_METHOD")
37 | unset("_${_pkg}_FIND_METHOD")
38 | endif()
39 | unset(_lib)
40 | unset(_pkg)
41 | unset(_url)
42 | unset(_rev)
43 |
--------------------------------------------------------------------------------
/config/cmake/Findmstore.cmake:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | set(_lib "mstore")
18 | set(_pkg "MSTORE")
19 | set(_url "https://github.com/grimme-lab/mstore")
20 | set(_rev "v0.3.0")
21 |
22 | if(NOT DEFINED "${_pkg}_FIND_METHOD")
23 | if(DEFINED "${PROJECT_NAME}-dependency-method")
24 | set("${_pkg}_FIND_METHOD" "${${PROJECT_NAME}-dependency-method}")
25 | else()
26 | set("${_pkg}_FIND_METHOD" "cmake" "pkgconf" "subproject" "fetch")
27 | endif()
28 | set("_${_pkg}_FIND_METHOD")
29 | endif()
30 |
31 | include("${CMAKE_CURRENT_LIST_DIR}/s-dftd3-utils.cmake")
32 |
33 | sdftd3_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}" "${_rev}")
34 |
35 | if(DEFINED "_${_pkg}_FIND_METHOD")
36 | unset("${_pkg}_FIND_METHOD")
37 | unset("_${_pkg}_FIND_METHOD")
38 | endif()
39 | unset(_lib)
40 | unset(_pkg)
41 | unset(_url)
42 | unset(_rev)
43 |
--------------------------------------------------------------------------------
/config/cmake/Findtoml-f.cmake:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | set(_lib "toml-f")
18 | set(_pkg "TOMLF")
19 | set(_url "https://github.com/toml-f/toml-f")
20 | set(_rev "v0.4.2")
21 |
22 | if(NOT DEFINED "${_pkg}_FIND_METHOD")
23 | if(DEFINED "${PROJECT_NAME}-dependency-method")
24 | set("${_pkg}_FIND_METHOD" "${${PROJECT_NAME}-dependency-method}")
25 | else()
26 | set("${_pkg}_FIND_METHOD" "cmake" "pkgconf" "subproject" "fetch")
27 | endif()
28 | set("_${_pkg}_FIND_METHOD")
29 | endif()
30 |
31 | include("${CMAKE_CURRENT_LIST_DIR}/s-dftd3-utils.cmake")
32 |
33 | sdftd3_find_package("${_lib}" "${${_pkg}_FIND_METHOD}" "${_url}" "${_rev}")
34 |
35 | if(DEFINED "_${_pkg}_FIND_METHOD")
36 | unset("${_pkg}_FIND_METHOD")
37 | unset("_${_pkg}_FIND_METHOD")
38 | endif()
39 | unset(_lib)
40 | unset(_pkg)
41 | unset(_url)
42 | unset(_rev)
43 |
--------------------------------------------------------------------------------
/config/cmake/s-dftd3-utils.cmake:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | # Handling of subproject dependencies
18 | macro(
19 | "sdftd3_find_package"
20 | package
21 | methods
22 | url
23 | revision
24 | )
25 | if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20")
26 | list(APPEND CMAKE_MESSAGE_CONTEXT "${package}")
27 | endif()
28 |
29 | string(TOLOWER "${package}" _pkg_lc)
30 | string(TOUPPER "${package}" _pkg_uc)
31 |
32 | foreach(method in ITEMS ${methods})
33 |
34 | if(TARGET "${package}::${package}")
35 | break()
36 | endif()
37 |
38 | if("${method}" STREQUAL "cmake")
39 | message(STATUS "${package}: Find installed package")
40 | find_package("${package}" CONFIG)
41 | if("${package}_FOUND")
42 | message(STATUS "${package}: Found installed package")
43 | break()
44 | endif()
45 | endif()
46 |
47 | if("${method}" STREQUAL "pkgconf")
48 | find_package(PkgConfig QUIET)
49 | pkg_check_modules("${_pkg_uc}" QUIET "${package}")
50 | if("${_pkg_uc}_FOUND")
51 | message(STATUS "Found ${package} via pkg-config")
52 |
53 | add_library("${package}::${package}" INTERFACE IMPORTED)
54 | target_link_libraries(
55 | "${package}::${package}"
56 | INTERFACE
57 | "${${_pkg_uc}_LINK_LIBRARIES}"
58 | )
59 | target_include_directories(
60 | "${package}::${package}"
61 | INTERFACE
62 | "${${_pkg_uc}_INCLUDE_DIRS}"
63 | )
64 | break()
65 | endif()
66 | endif()
67 |
68 | if("${method}" STREQUAL "subproject")
69 | set("${_pkg_uc}_SOURCE_DIR" "${PROJECT_SOURCE_DIR}/subprojects/${package}")
70 | set("${_pkg_uc}_BINARY_DIR" "${PROJECT_BINARY_DIR}/subprojects/${package}")
71 | if(EXISTS "${${_pkg_uc}_SOURCE_DIR}/CMakeLists.txt")
72 | message(STATUS "Include ${package} from subprojects")
73 | add_subdirectory(
74 | "${${_pkg_uc}_SOURCE_DIR}"
75 | "${${_pkg_uc}_BINARY_DIR}"
76 | )
77 |
78 | add_library("${package}::${package}" INTERFACE IMPORTED)
79 | target_link_libraries("${package}::${package}" INTERFACE "${package}")
80 |
81 | # We need the module directory in the subproject before we finish the configure stage
82 | if(NOT EXISTS "${${_pkg_uc}_BINARY_DIR}/include")
83 | file(MAKE_DIRECTORY "${${_pkg_uc}_BINARY_DIR}/include")
84 | endif()
85 |
86 | break()
87 | endif()
88 | endif()
89 |
90 | if("${method}" STREQUAL "fetch")
91 | message(STATUS "Retrieving ${package} from ${url}")
92 | include(FetchContent)
93 | FetchContent_Declare(
94 | "${_pkg_lc}"
95 | GIT_REPOSITORY "${url}"
96 | GIT_TAG "${revision}"
97 | )
98 | FetchContent_MakeAvailable("${_pkg_lc}")
99 |
100 | add_library("${package}::${package}" INTERFACE IMPORTED)
101 | target_link_libraries("${package}::${package}" INTERFACE "${package}")
102 |
103 | # We need the module directory in the subproject before we finish the configure stage
104 | FetchContent_GetProperties("${_pkg_lc}" BINARY_DIR "${_pkg_uc}_BINARY_DIR")
105 | if(NOT EXISTS "${${_pkg_uc}_BINARY_DIR}/include")
106 | file(MAKE_DIRECTORY "${${_pkg_uc}_BINARY_DIR}/include")
107 | endif()
108 |
109 | break()
110 | endif()
111 |
112 | endforeach()
113 |
114 | unset(_pkg_lc)
115 | unset(_pkg_uc)
116 | if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20")
117 | list(POP_BACK CMAKE_MESSAGE_CONTEXT)
118 | endif()
119 |
120 | if(NOT TARGET "${package}::${package}")
121 | message(FATAL_ERROR "Could not find dependency ${package}")
122 | endif()
123 |
124 | endmacro()
125 |
--------------------------------------------------------------------------------
/config/install-mod.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # This file is part of s-dftd3.
3 | # SPDX-Identifier: LGPL-3.0-or-later
4 | #
5 | # s-dftd3 is free software: you can redistribute it and/or modify it under
6 | # the terms of the Lesser GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # s-dftd3 is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # Lesser GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the Lesser GNU General Public License
16 | # along with s-dftd3. If not, see .
17 |
18 | from os import environ, listdir, makedirs
19 | from os.path import join, isdir, exists
20 | from sys import argv
21 | from shutil import copy
22 |
23 | build_dir = environ["MESON_BUILD_ROOT"]
24 | if "MESON_INSTALL_DESTDIR_PREFIX" in environ:
25 | install_dir = environ["MESON_INSTALL_DESTDIR_PREFIX"]
26 | else:
27 | install_dir = environ["MESON_INSTALL_PREFIX"]
28 |
29 | include_dir = argv[1] if len(argv) > 1 else "include"
30 | module_dir = join(install_dir, include_dir)
31 |
32 | modules = []
33 | for d in listdir(build_dir):
34 | bd = join(build_dir, d)
35 | if isdir(bd):
36 | for f in listdir(bd):
37 | if f.endswith(".mod"):
38 | modules.append(join(bd, f))
39 |
40 | if not exists(module_dir):
41 | makedirs(module_dir)
42 |
43 | for mod in modules:
44 | print("Installing", mod, "to", module_dir)
45 | copy(mod, module_dir)
46 |
--------------------------------------------------------------------------------
/config/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | os = host_machine.system()
18 | fc = meson.get_compiler('fortran')
19 | fc_id = fc.get_id()
20 |
21 | if fc_id == 'gcc'
22 | add_project_arguments(
23 | '-ffree-line-length-none',
24 | '-fbacktrace',
25 | language: 'fortran',
26 | )
27 | elif fc_id == 'intel'
28 | add_project_arguments(
29 | '-traceback',
30 | language: 'fortran',
31 | )
32 | elif fc_id == 'pgi'
33 | add_project_arguments(
34 | '-Mbackslash',
35 | '-Mallocatable=03',
36 | '-traceback',
37 | language: 'fortran',
38 | )
39 | endif
40 |
41 | if get_option('openmp')
42 | omp_dep = dependency('OpenMP')
43 | lib_deps += omp_dep
44 | endif
45 |
46 | # Create the tool chain library as subproject
47 | mctc_dep = dependency(
48 | 'mctc-lib',
49 | version: '>=0.4.1',
50 | fallback: ['mctc-lib', 'mctc_dep'],
51 | default_options: ['default_library=static'],
52 | )
53 | lib_deps += mctc_dep
54 |
55 | # Create the TOML Fortran library as subproject
56 | tomlf_dep = dependency(
57 | 'toml-f',
58 | fallback: ['toml-f', 'tomlf_dep'],
59 | default_options: ['default_library=static'],
60 | )
61 | exe_deps += tomlf_dep
62 |
--------------------------------------------------------------------------------
/config/template.cmake:
--------------------------------------------------------------------------------
1 | @PACKAGE_INIT@
2 |
3 | set("@PROJECT_NAME@_WITH_API" @WITH_API@)
4 | set("@PROJECT_NAME@_WITH_OpenMP" @WITH_OpenMP@)
5 | set("@PROJECT_NAME@_WITH_BLAS" @WITH_BLAS@)
6 | set(
7 | "@PROJECT_NAME@_INCLUDE_DIRS"
8 | "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@"
9 | "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@/@module-dir@"
10 | )
11 |
12 | if(NOT TARGET "@PROJECT_NAME@::@PROJECT_NAME@")
13 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake")
14 |
15 | include(CMakeFindDependencyMacro)
16 |
17 | if(NOT TARGET "OpenMP::OpenMP_Fortran" AND "@PROJECT_NAME@_WITH_OpenMP")
18 | find_dependency("OpenMP")
19 | endif()
20 |
21 | if(NOT TARGET "BLAS::BLAS" AND "@PROJECT_NAME@_WITH_BLAS")
22 | find_dependency("BLAS")
23 | endif()
24 |
25 | if(NOT TARGET "mctc-lib::mctc-lib")
26 | find_dependency("mctc-lib")
27 | endif()
28 | endif()
29 |
--------------------------------------------------------------------------------
/config/template.pc:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
4 |
5 | Name: @PROJECT_NAME@
6 | Description: @PROJECT_DESCRIPTION@
7 | Version: @PROJECT_VERSION@
8 | Libs: -L${libdir} -l@PROJECT_NAME@
9 | Cflags: -I${includedir} -I${includedir}/@module-dir@
10 |
--------------------------------------------------------------------------------
/doc/api/ase.rst:
--------------------------------------------------------------------------------
1 | .. automodule:: dftd3.ase
2 |
--------------------------------------------------------------------------------
/doc/api/index.rst:
--------------------------------------------------------------------------------
1 | .. _api:
2 |
3 | Public API documentation
4 | ========================
5 |
6 | This DFT-D3 implementation provides first class API support Fortran, C and Python.
7 | Other programming languages should try to interface via one of those three APIs.
8 | To provide first class API support for a new language the interface specification should be available as meson build files.
9 |
10 | .. toctree::
11 |
12 | fortran
13 | c
14 | python
15 |
--------------------------------------------------------------------------------
/doc/api/pyscf.rst:
--------------------------------------------------------------------------------
1 | .. automodule:: dftd3.pyscf
2 | :members:
3 |
--------------------------------------------------------------------------------
/doc/api/python.rst:
--------------------------------------------------------------------------------
1 | .. _python:
2 |
3 | Python API
4 | ==========
5 |
6 | .. automodule:: dftd3
7 |
8 |
9 | .. toctree::
10 |
11 | ase
12 | qcschema
13 | pyscf
14 |
15 |
16 | Library interface
17 | -----------------
18 |
19 | .. automodule:: dftd3.interface
20 |
21 |
22 | Structure
23 | ~~~~~~~~~
24 |
25 | .. autoclass:: Structure
26 | :members:
27 |
28 |
29 | DispersionModel
30 | ~~~~~~~~~~~~~~~
31 |
32 | .. autoclass:: DispersionModel
33 | :members:
34 |
35 |
36 | DampingParam
37 | ~~~~~~~~~~~~
38 |
39 | .. autoclass:: DampingParam
40 | :members:
41 |
42 |
43 | RationalDampingParam
44 | ~~~~~~~~~~~~~~~~~~~~
45 |
46 | .. autoclass:: RationalDampingParam
47 | :members:
48 |
49 |
50 | ZeroDampingParam
51 | ~~~~~~~~~~~~~~~~
52 |
53 | .. autoclass:: ZeroDampingParam
54 | :members:
55 |
56 |
57 | ModifiedRationalDampingParam
58 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59 |
60 | .. autoclass:: ModifiedRationalDampingParam
61 | :members:
62 |
63 |
64 | ModifiedZeroDampingParam
65 | ~~~~~~~~~~~~~~~~~~~~~~~~
66 |
67 | .. autoclass:: ModifiedZeroDampingParam
68 | :members:
69 |
70 |
71 | OptimizedPowerDampingParam
72 | ~~~~~~~~~~~~~~~~~~~~~~~~~~
73 |
74 | .. autoclass:: OptimizedPowerDampingParam
75 | :members:
76 |
77 |
78 | QCSchema support
79 | ----------------
80 |
81 | .. note::
82 |
83 | For more information on using the DFT-D3 with QCSchema input see :mod:`dftd3.qcschema`.
84 |
85 |
86 | ASE support
87 | -----------
88 |
89 | .. note::
90 |
91 | For more information on using the DFT-D3 as ASE calculator see :mod:`dftd3.ase`.
92 |
93 |
94 |
95 | PySCF support
96 | -------------
97 |
98 | .. note::
99 |
100 | For more information on integrating DFT-D3 with PySCF see :mod:`dftd3.pyscf`.
101 |
102 |
103 | Literature
104 | ----------
105 |
106 | .. footbibliography::
107 |
--------------------------------------------------------------------------------
/doc/api/qcschema.rst:
--------------------------------------------------------------------------------
1 | .. automodule:: dftd3.qcschema
2 |
--------------------------------------------------------------------------------
/doc/comparison.rst:
--------------------------------------------------------------------------------
1 | Comparison with other DFT-D3 implementations
2 | ============================================
3 |
4 | This DFT-D3 reimplementation was created as a spin-off from the `dftd4`_ and `xtb`_ project, to provide an easier to use API, improve the parallel performance and get a fast build of the DFT-D3 project.
5 | It is however not the only project providing an implementation of DFT-D3, many forks of the original reference implementation and some reimplementations are currently available.
6 |
7 | .. _dftd4: https://github.com/dftd4/dftd4
8 | .. _xtb: https://github.com/grimme-lab/xtb
9 |
10 | A non-comprehensive list of DFT-D3 implementations is provided here:
11 |
12 | ============================== =========== ==================== ==========================
13 | repository license APIs notes
14 | ============================== =========== ==================== ==========================
15 | `dftd3`_ GPL-1.0 Fortran reference implementation
16 | `dftd3/simple-dftd3`_ LGPL-3.0 Fortran, C, Python
17 | `dftd3/tad-dftd3`_ Apache-2.0 Python torch
18 | `dftbplus/dftd3-lib`_ GPL-1.0 Fortran patched fork (archived)
19 | `ehermes/ased3`_ LGPL-3.0 Python f2py, ASE
20 | `pfnet-research/torch-dftd`_ MIT Python torch
21 | `cuanto/libdftd3`_ GPL-3.0 Fortran, Python ctypes, pyscf
22 | `cresset-group/dftd3`_ GPL-1.0 Fortran patched fork
23 | `loriab/dftd3`_ GPL-1.0 Fortran patched fork, Windows
24 | `f3rmion/dftd3`_ GPL-1.0 Fortran patched fork
25 | `bobbypaton/pydftd3`_ MIT Python Gaussian
26 | ============================== =========== ==================== ==========================
27 |
28 | .. _dftd3: http://mctc.uni-bonn.de/software/dft-d3
29 | .. _dftd3/simple-dftd3: https://github.com/dftd3/simple-dftd3
30 | .. _dftd3/tad-dftd3: https://github.com/dftd3/tad-dftd3
31 | .. _dftbplus/dftd3-lib: https://github.com/dftbplus/dftd3-lib
32 | .. _ehermes/ased3: https://github.com/ehermes/ased3
33 | .. _pfnet-research/torch-dftd: https://github.com/pfnet-research/torch-dftd
34 | .. _cuanto/libdftd3: https://github.com/cuanto/libdftd3
35 | .. _cresset-group/dftd3: https://github.com/cresset-group/dftd3
36 | .. _loriab/dftd3: https://github.com/loriab/dftd3
37 | .. _f3rmion/dftd3: https://github.com/f3rmion/dftd3
38 | .. _bobbypaton/pydftd3: https://github.com/bobbypaton/pyDFTD3
39 |
40 | Many more versions are probably around or redistributed in various quantum chemistry programs.
41 |
42 | .. _users:
43 |
44 | Users of this library
45 | ---------------------
46 |
47 | A list of projects currently using this DFT-D3 implementation is given here.
48 |
49 | `tblite `_: (since 0.1.0)
50 | Light-weight tight-binding framework
51 | `DFTB+ `_: (since 21.2)
52 | General package for performing fast atomistic calculations.\ :footcite:`hourahine2020`
53 | `DFT-FE `_:
54 | Real-space DFT calculations using Finite Elements.\ :footcite:`motamarri2020`
55 | `QCEngine `_: (since 0.24.0)
56 | Quantum chemistry program executor and IO standardizer.\ :footcite:`smith2021`
57 | `Siesta `_: (since 5.0.0)
58 | A first-principles materials simulation code using DFT.\ :footcite:`garcia2020`
59 | `Psi4 `_: (since 1.9.0)
60 | Open-Source Quantum Chemistry - an electronic structure package in C++ driven by Python.\ :footcite:`smith2020`
61 | `PySCF `_:
62 | Python-based Simulations of Chemistry Framework.\ :footcite:`sun2020`
63 | `Caracal `_:
64 | Ring polymer molecular dynamics and rate constant calculations on black-box potential energy surfaces.\ :footcite:`steffen2023`
65 | `Curcuma `_:
66 | Simple small molecular docking and conformation filtering tool.
67 | `MLAtom `_: (since 3.11.0)
68 | Platform for Machine Learning-Enhanced Computational Chemistry Simulations and Workflows.\ :footcite:`dral2024`
69 | `FHI-aims `_: (since 240920)
70 | All-electron electronic structure theory with numeric atom-centered orbitals.\ :footcite:`blum2009`
71 |
72 | If your project is using *s-dftd3* feel free to add your project to this list.
73 |
74 |
75 | Literature
76 | ----------
77 |
78 | .. footbibliography::
79 |
--------------------------------------------------------------------------------
/doc/conf.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 |
4 | sys.path.insert(0, os.path.join(os.path.abspath(".."), "python"))
5 | import dftd3
6 |
7 |
8 | project = "s-dftd3"
9 | author = "Sebastian Ehlert"
10 | copyright = f"2019-2024, {author}"
11 |
12 | version = dftd3.__version__
13 | release = version
14 |
15 | extensions = [
16 | "sphinx_design",
17 | "sphinx_copybutton",
18 | "sphinx.ext.autosummary",
19 | "sphinx.ext.autodoc",
20 | "sphinx.ext.mathjax",
21 | "sphinx.ext.viewcode",
22 | "sphinx.ext.napoleon",
23 | "sphinx.ext.intersphinx",
24 | "sphinx.ext.extlinks",
25 | "sphinxcontrib.bibtex",
26 | ]
27 |
28 | html_theme = "sphinx_book_theme"
29 | html_title = "Simple DFT-D3"
30 |
31 | html_theme_options = {
32 | "repository_url": "https://github.com/dftd3/simple-dftd3",
33 | "repository_branch": "main",
34 | "use_repository_button": True,
35 | "use_edit_page_button": True,
36 | "use_download_button": False,
37 | "path_to_docs": "doc",
38 | }
39 |
40 | html_css_files = []
41 | html_static_path = ["_static"]
42 | templates_path = ["_templates"]
43 | locale_dirs = ["locales"]
44 | autodoc_mock_imports = ["dftd3.library", "numpy", "ase", "qcelemental", "pyscf"]
45 | bibtex_bibfiles = ["_static/references.bib"]
46 |
47 | master_doc = "index"
48 |
--------------------------------------------------------------------------------
/doc/guide/citing.rst:
--------------------------------------------------------------------------------
1 | Suggesting references for D3 dispersion corrections
2 | ---------------------------------------------------
3 |
4 | The D3 dispersion correction was originally introduced as D3(0)\ :footcite:`grimme2010` and later extended to D3(BJ).\ :footcite:`grimme2011`
5 | Additional damping functions and parametrizations for new functionals have been introduced in the literature over time.
6 | Providing proper attribution to the method, parameters and software can be challenging to keep up with.
7 | The *s-dftd3* library keeps track of the references for each method and parameter set, and provides an option to suggest the used references.
8 |
9 | For example when running a computation with SCAN-D3(BJ), we can use the following command to get the suggested references:
10 |
11 | .. code-block:: text
12 |
13 | s-dftd3 structure.xyz --bj scan --citation
14 |
15 | In the output we will see
16 |
17 | .. code-block:: text
18 |
19 | -----------------------------------
20 | s i m p l e D F T - D 3 v1.2.1
21 | -----------------------------------
22 |
23 | Rational (Becke-Johnson) damping: scan-D3(BJ)
24 | ---------------------
25 | s6 1.0000
26 | s8 0.0000
27 | s9 0.0000
28 | a1 0.5380
29 | a2 5.4200
30 | alp 14.0000
31 | --------------------
32 |
33 | Dispersion energy: -1.0554287327920E-02 Eh
34 |
35 | [Info] Writing Dispersion energy to '.EDISP'
36 | [Info] Citation information written to 'dftd3.bib'
37 |
38 | Inspecting this file shows three suggested references, here first the citation for the library itself used to perform the calculation, second the original publication of the D3(BJ) method and finally the publication introducing parameters for the SCAN functional.
39 |
40 | .. code-block:: bib
41 | :caption: dftd3.bib
42 |
43 | @article{10.21105/joss.07169,
44 | title = {{Simple DFT-D3: Library first implementation of the D3 dispersion correction}},
45 | author = {Sebastian Ehlert},
46 | issue = {103},
47 | volume = {9},
48 | pages = {7169},
49 | doi = {10.21105/joss.07169},
50 | url = {https://doi.org/10.21105/joss.07169}
51 | }
52 | @article{10.1002/jcc.21759,
53 | title = {{Effect of the damping function in dispersion corrected density functional theory}},
54 | author = {Stefan Grimme
55 | and Stephan Ehrlich
56 | and Lars Goerigk},
57 | issue = {7},
58 | volume = {32},
59 | pages = {1456-1465},
60 | doi = {10.1002/jcc.21759},
61 | url = {https://doi.org/10.1002/jcc.21759}
62 | }
63 | @article{10.1103/physrevb.94.115144,
64 | title = {{Benchmark tests of a strongly constrained semilocal functional with a long-range dispersion correction}},
65 | author = {J. G. Brandenburg
66 | and J. E. Bates
67 | and J. Sun
68 | and J. P. Perdew},
69 | volume = {94},
70 | pages = {115144},
71 | doi = {10.1103/physrevb.94.115144},
72 | url = {https://doi.org/10.1103/physrevb.94.115144}
73 | }
74 |
75 | In the computational details section in a publication using SCAN-D3(BJ) we can now refer to these publications for example as
76 |
77 | .. code-block:: tex
78 |
79 | The D3(BJ) dispersion correction\cite{10.1002/jcc.21759} for
80 | SCAN-D3(BJ)\cite{10.1002/jcc.21759} was calculated
81 | using the s-dftd3 library (version 1.2.1).\cite{10.21105/joss.07169}
82 |
83 | .. important::
84 |
85 | The suggested references are based on the information available in the library.
86 | Always check the original publications for the most recent references and the correct citation.
87 |
--------------------------------------------------------------------------------
/doc/guide/index.rst:
--------------------------------------------------------------------------------
1 | How-to guides
2 | =============
3 |
4 | This section contains guides on how to use D3 for your applications.
5 |
6 | .. toctree::
7 |
8 | minimal-example
9 | citing
10 |
--------------------------------------------------------------------------------
/doc/guide/minimal-example.rst:
--------------------------------------------------------------------------------
1 | How to use this library?
2 | ========================
3 |
4 | This section contains a few self-contained examples on how to use D3.
5 |
6 |
7 | Compute energy with rational damping
8 | ------------------------------------
9 |
10 | This example shows how to compute the dispersion energy with the rational damping function.
11 |
12 | .. tab-set::
13 | :sync-group: code
14 |
15 | .. tab-item:: Fortran
16 | :sync: fortran
17 |
18 | .. literalinclude:: minimal-example/energy.f90
19 | :language: fortran
20 | :caption: energy.f90
21 |
22 | .. tab-item:: C
23 | :sync: c
24 |
25 | .. literalinclude:: minimal-example/energy.c
26 | :language: c
27 | :caption: energy.c
28 |
29 | .. tab-item:: Python
30 | :sync: python
31 |
32 | .. literalinclude:: minimal-example/energy.py
33 | :language: python
34 | :caption: energy.py
35 |
36 | To test this example you can install the dependencies with
37 |
38 | .. tab-set::
39 | :sync-group: code
40 |
41 | .. tab-item:: Fortran
42 | :sync: fortran
43 |
44 | .. code-block:: text
45 |
46 | mamba create d3 simple-dftd3 fortran-compiler pkg-config
47 | mamba activate d3
48 |
49 | .. tab-item:: C
50 | :sync: c
51 |
52 | .. code-block:: text
53 |
54 | mamba create d3 simple-dftd3 c-compiler pkg-config
55 | mamba activate d3
56 |
57 | .. tab-item:: Python
58 | :sync: python
59 |
60 | .. code-block:: text
61 |
62 | mamba create d3 dftd3-python
63 | mamba activate d3
64 |
65 | You can run the example code with
66 |
67 | .. tab-set::
68 | :sync-group: code
69 |
70 | .. tab-item:: Fortran
71 | :sync: fortran
72 |
73 | .. code-block:: shell
74 |
75 | ❯ $FC energy.f90 $(pkg-config s-dftd3 mctc-lib --cflags --libs) && ./a.out
76 | Dispersion energy for PBE0-D3(BJ) is -0.0009218696 Hartree
77 |
78 | .. tab-item:: C
79 | :sync: c
80 |
81 | .. code-block:: shell
82 |
83 | ❯ $CC energy.c $(pkg-config s-dftd3 mctc-lib --cflags --libs) && ./a.out
84 | Dispersion energy for PBE0-D3(BJ) is -0.0009218696 Hartree
85 |
86 | .. tab-item:: Python
87 | :sync: python
88 |
89 | .. code-block:: shell
90 |
91 | ❯ python energy.py
92 | Dispersion energy for PBE0-D3(BJ) is -0.0009218696 Hartree
93 |
94 |
--------------------------------------------------------------------------------
/doc/guide/minimal-example/energy.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "dftd3.h"
5 |
6 | int main(void)
7 | {
8 | dftd3_error error = dftd3_new_error();
9 | dftd3_structure mol = NULL;
10 | dftd3_model d3 = NULL;
11 | dftd3_param param = NULL;
12 |
13 | int nat = 5;
14 | int num[5] = {6, 1, 1, 1, 1};
15 | double xyz[15] = { // coordinates in Bohr
16 | 0.0000000, -0.0000000, 0.0000000,
17 | -1.1922080, 1.1922080, 1.1922080,
18 | 1.1922080, -1.1922080, 1.1922080,
19 | -1.1922080, -1.1922080, -1.1922080,
20 | 1.1922080, 1.1922080, -1.1922080};
21 | mol = dftd3_new_structure(error, nat, num, xyz, NULL, NULL);
22 | if (dftd3_check_error(error)) goto handle_error;
23 |
24 | char method[5] = "PBE0";
25 | param = dftd3_load_rational_damping(error, method, false);
26 | if (dftd3_check_error(error)) goto handle_error;
27 |
28 | d3 = dftd3_new_d3_model(error, mol);
29 | if (dftd3_check_error(error)) goto handle_error;
30 |
31 | double energy;
32 | dftd3_get_dispersion(error, mol, d3, param, &energy, NULL, NULL);
33 | if (dftd3_check_error(error)) goto handle_error;
34 |
35 | printf("Dispersion energy for %s-D3(BJ) is %13.10lf Hartree\n", method, energy);
36 |
37 | dftd3_delete(error);
38 | dftd3_delete(mol);
39 | dftd3_delete(d3);
40 | dftd3_delete(param);
41 | return 0;
42 |
43 | handle_error:
44 | char msg[512];
45 | dftd3_get_error(error, msg, NULL);
46 | printf("Error: %s\n", msg);
47 |
48 | dftd3_delete(error);
49 | dftd3_delete(mol);
50 | dftd3_delete(d3);
51 | dftd3_delete(param);
52 | return 1;
53 | }
54 |
--------------------------------------------------------------------------------
/doc/guide/minimal-example/energy.f90:
--------------------------------------------------------------------------------
1 | program test_simple_d3
2 | use, intrinsic :: iso_fortran_env, only : r8 => real64
3 | use mctc_env, only: error_type
4 | use mctc_io, only: structure_type, new
5 | use dftd3, only: d3_model, d3_param, rational_damping_param, get_rational_damping, &
6 | & new_rational_damping, new_d3_model, get_dispersion, realspace_cutoff
7 | implicit none
8 |
9 | character(len=:), allocatable :: method
10 | type(structure_type) :: mol
11 | type(error_type), allocatable :: error
12 | integer, allocatable :: num(:)
13 | real(r8), allocatable :: xyz(:, :)
14 | real(r8) :: energy
15 |
16 | type(d3_model) :: disp
17 | type(d3_param) :: inp
18 | type(rational_damping_param) :: param
19 |
20 | method = 'PBE0'
21 | num = [6, 1, 1, 1, 1]
22 | xyz = reshape([ & ! coordinates in Bohr
23 | & 0.0000000_r8, -0.0000000_r8, 0.0000000_r8, &
24 | & -1.1922080_r8, 1.1922080_r8, 1.1922080_r8, &
25 | & 1.1922080_r8, -1.1922080_r8, 1.1922080_r8, &
26 | & -1.1922080_r8, -1.1922080_r8, -1.1922080_r8, &
27 | & 1.1922080_r8, 1.1922080_r8, -1.1922080_r8],&
28 | & [3, size(num)])
29 | call new(mol, num, xyz, charge=0.0_r8, uhf=0)
30 |
31 | call get_rational_damping(inp, method, error, s9=1.0_r8)
32 | if (allocated(error)) then
33 | print '(2a)', "Error: ", error%message
34 | return
35 | end if
36 | call new_rational_damping(param, inp)
37 | call new_d3_model(disp, mol)
38 |
39 | call get_dispersion(mol, disp, param, realspace_cutoff(), energy)
40 | print '(3a, f13.10, a)', 'Dispersion energy for ', method, '-D3(BJ) is ', energy, ' Hartree'
41 |
42 | end program test_simple_d3
43 |
--------------------------------------------------------------------------------
/doc/guide/minimal-example/energy.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | from dftd3.interface import RationalDampingParam, DispersionModel
3 |
4 | num = np.array([6, 1, 1, 1, 1])
5 | xyz = np.array( # coordinates in Bohr
6 | [
7 | [ 0.0000000, -0.0000000, 0.0000000],
8 | [-1.1922080, 1.1922080, 1.1922080],
9 | [ 1.1922080, -1.1922080, 1.1922080],
10 | [-1.1922080, -1.1922080, -1.1922080],
11 | [ 1.1922080, 1.1922080, -1.1922080],
12 | ]
13 | )
14 | method = "PBE0"
15 |
16 | model = DispersionModel(num, xyz)
17 | res = model.get_dispersion(RationalDampingParam(method=method), grad=False)
18 | print(f"Dispersion energy for {method}-D3(BJ) is {res['energy']:13.10f} Hartree")
19 |
--------------------------------------------------------------------------------
/doc/index.rst:
--------------------------------------------------------------------------------
1 | Reimplementation of D3 dispersion correction
2 | ============================================
3 |
4 | This pages describe the library first implementation of the DFT-D3 dispersion correction, in the `s-dftd3`_ software package.\ :footcite:`ehlert2024`.
5 | This project aims to provide a user-friendly and uniform interface to the D3 dispersion model and for the calculation of DFT-D3 dispersion corrections.
6 | Additionally, it provides the geometric counter-poise correction to create composite electronic structure methods of the 3c family.
7 |
8 | Supported features include:
9 |
10 | - Rational damping function, D3(BJ).\ :footcite:`grimme2011`
11 | - Zero damping function D3(0).\ :footcite:`grimme2010`
12 | - Modified rational and zero damping functions, D3M(BJ) and D3M(0).\ :footcite:`smith2016`
13 | - Optimized power damping function, D3(op).\ :footcite:`witte2017`
14 | - Axilrod-Teller-Muto three-center contribution.
15 | - Pairwise analysis of dispersion contributions.
16 | - Extensive parameter support for (almost) all published D3 parameters.
17 | - Geometric counter-poise correction and short-range bond correction.\ :footcite:`kruse2012`
18 | - Readily available in Fortran (:ref:`dftd3 module `),
19 | C (:ref:`dftd3.h header `),
20 | Python (:ref:`dftd3 package `),
21 | and via command line (`s-dftd3 executable `__)
22 |
23 |
24 | .. footbibliography::
25 |
26 |
27 | .. _s-dftd3: https://github.com/dftd3/simple-dftd3
28 |
29 | .. toctree::
30 | :maxdepth: 2
31 |
32 | Installation
33 | Tutorial
34 | How-to
35 | Comparison
36 | API
37 |
--------------------------------------------------------------------------------
/doc/requirements.txt:
--------------------------------------------------------------------------------
1 | sphinx-book-theme
2 | sphinx-copybutton
3 | sphinx-design
4 | sphinxcontrib-bibtex
5 | numpy
6 | ase
7 | cffi
8 | qcelemental
9 |
--------------------------------------------------------------------------------
/doc/tutorial/first-steps-fortran/app/main.f90:
--------------------------------------------------------------------------------
1 | program param_scanner
2 | use mctc_env, only : wp, error_type, get_argument, fatal_error
3 | use mctc_io, only : structure_type, read_structure
4 | use d3_param_scan, only : reaction_type, scan_param_for_reaction
5 | implicit none
6 |
7 | type(reaction_type) :: reaction
8 | type(error_type), allocatable :: error
9 | character(:), allocatable :: method
10 | real(wp), allocatable :: dft_energy
11 | integer :: n_args, n_mol, iarg, imol
12 |
13 | n_args = command_argument_count()
14 |
15 | if (n_args < 3) then
16 | print '(a)', "Usage: param-scanner ... [dft energy]"
17 | stop 1
18 | end if
19 |
20 | n_mol = (n_args - 1) / 2
21 |
22 | call get_argument(1, method)
23 |
24 | allocate(reaction%mol(n_mol))
25 | allocate(reaction%stochiometry(n_mol))
26 | imol = 0
27 | do iarg = 1, 2 * n_mol, 2
28 | imol = imol + 1
29 | call read_real(iarg + 1, reaction%stochiometry(imol), error)
30 | if (allocated(error)) exit
31 | call read_mol(iarg + 2, reaction%mol(imol), error)
32 | if (allocated(error)) exit
33 | end do
34 | if (.not.allocated(error) .and. 2 * n_mol < n_args - 1) then
35 | allocate(dft_energy)
36 | call read_real(n_args, dft_energy, error)
37 | end if
38 | if (allocated(error)) then
39 | print '(a)', error%message
40 | stop 1
41 | end if
42 |
43 | call scan_param_for_reaction(error, reaction, method, dft_energy)
44 | if (allocated(error)) then
45 | print '(a)', error%message
46 | stop 1
47 | end if
48 |
49 | contains
50 |
51 | subroutine read_mol(idx, mol, error)
52 | integer, intent(in) :: idx
53 | type(structure_type), intent(out) :: mol
54 | type(error_type), allocatable, intent(out) :: error
55 |
56 | character(len=:), allocatable :: tmp
57 |
58 | call get_argument(idx, tmp)
59 | call read_structure(mol, tmp, error=error)
60 | end subroutine read_mol
61 |
62 | subroutine read_real(idx, val, error)
63 | integer, intent(in) :: idx
64 | real(wp), intent(out) :: val
65 | type(error_type), allocatable, intent(out) :: error
66 |
67 | character(len=:), allocatable :: tmp
68 | integer :: stat
69 |
70 | call get_argument(idx, tmp)
71 | read(tmp, *, iostat=stat) val
72 | if (stat /= 0) then
73 | call fatal_error(error, "Could not read floating point value from '"//tmp//"'")
74 | end if
75 | end subroutine read_real
76 |
77 | end program param_scanner
--------------------------------------------------------------------------------
/doc/tutorial/first-steps-fortran/fpm.toml:
--------------------------------------------------------------------------------
1 | name = "d3-example"
2 | version = "1.0.0"
3 |
4 | [dependencies]
5 | # s-dftd3.git = "https://github.com/dftd3/simple-dftd3"
6 | s-dftd3.path = "../../../"
--------------------------------------------------------------------------------
/doc/tutorial/index.rst:
--------------------------------------------------------------------------------
1 | Tutorials
2 | =========
3 |
4 | This section contains tutorials on using D3.
5 |
6 | .. toctree::
7 |
8 | first-steps-cli
9 | first-steps-fortran
10 |
--------------------------------------------------------------------------------
/fpm.toml:
--------------------------------------------------------------------------------
1 | name = "s-dftd3"
2 | version = "1.2.1"
3 | license = "LGPL-3.0-or-later"
4 | maintainer = ["@awvwgk"]
5 | author = ["Sebastian Ehlert"]
6 | copyright = "2019-2022 Sebastian Ehlert"
7 | description = "Simple reimplementation of the DFT-D3 method"
8 | keywords = ["dispersion-correction", "quantum-chemistry"]
9 |
10 | [dependencies]
11 | mctc-lib.git = "https://github.com/grimme-lab/mctc-lib"
12 | mctc-lib.tag = "v0.4.1"
13 |
14 | [dev-dependencies]
15 | mstore.git = "https://github.com/grimme-lab/mstore"
16 | mstore.tag = "v0.3.0"
17 |
18 | [build]
19 | auto-tests = false
20 |
21 | [[executable]]
22 | name = "s-dftd3"
23 | dependencies.toml-f.git = "https://github.com/toml-f/toml-f"
24 |
25 | [[test]]
26 | name = "tester"
27 | source-dir = "test/unit"
28 |
29 | [[test]]
30 | name = "api-tester"
31 | source-dir = "test/api"
32 | main = "api-test.c"
33 |
--------------------------------------------------------------------------------
/include/dftd3.h:
--------------------------------------------------------------------------------
1 | /* This file is part of s-dftd3.
2 | * SPDX-Identifier: LGPL-3.0-or-later
3 | *
4 | * s-dftd3 is free software: you can redistribute it and/or modify it under
5 | * the terms of the GNU Lesser General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * s-dftd3 is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU Lesser General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU Lesser General Public License
15 | * along with s-dftd3. If not, see .
16 | **/
17 | #pragma once
18 |
19 | #include "s-dftd3.h"
20 |
--------------------------------------------------------------------------------
/man/s-dftd3.1.adoc:
--------------------------------------------------------------------------------
1 | = s-dftd3(1)
2 | :doctype: manpage
3 |
4 | == Name
5 | s-dftd3 - Simple reimplementation of the DFT-D3 dispersion model
6 |
7 | == Synopsis
8 | *s-dftd3* [_options_] _input_
9 |
10 | == Description
11 |
12 | Takes an geometry input to calculate the D3 dispersion correction.
13 | Periodic calculations are performed automatically for periodic input formats
14 | Specify the functional to select the correct parameters.
15 |
16 | == Options
17 |
18 | *-i, --input* _format_::
19 | Hint for the format of the input file
20 |
21 | *--bj* _method_::
22 | Use rational (Becke-Johnson) damping function
23 |
24 | *--bj-param* _list_::
25 | Specify parameters for rational damping,
26 | expected order is s6, s8, a1, a2 (requires four arguments)
27 |
28 | *--zero* _method_::
29 | Use zero (Chai-Head-Gordon) damping function
30 |
31 | *--zero-param* _list_::
32 | Specify parameters for zero damping,
33 | expected order is s6, s8, rs6 (requires three arguments)
34 |
35 | *--bjm* _method_::
36 | Use modified rational damping function
37 |
38 | *--bjm-param* _list_::
39 | Specify parameters for rational damping,
40 | expected order is s6, s8, a1, a2 (requires four arguments)
41 |
42 | *--zerom* _method_::
43 | Use modified zero damping function
44 |
45 | *--zerom-param* _list_::
46 | Specify parameters for modified zero damping,
47 | expected order is s6, s8, rs6, beta (requires four arguments)
48 |
49 | *--op* _method_::
50 | Use modified zero damping function
51 |
52 | *--op-param* _list_::
53 | Specify parameters for optimized power damping,
54 | expected order is s6, s8, a1, a2, beta (requires five arguments)
55 |
56 | *--atm*::
57 | Use ATM three-body dispersion
58 |
59 | *--atm-scale* _s9_::
60 | Use scaled ATM three-body dispersion
61 |
62 | *--db* _file_::
63 | Load parameters from external data file
64 |
65 | *--noedisp*::
66 | Disable writing of dispersion energy to `.EDISP` file
67 |
68 | *--json* [_file_]::
69 | Dump results to JSON output (default: `dftd3.json`)
70 |
71 | *--grad* [_file_]::
72 | Request gradient evaluation,
73 | write results to _file_ (default: dftd3.txt),
74 | attempts to add to Turbomole gradient and gradlatt files
75 |
76 | *--property*::
77 | Evaluate dispersion related properties
78 |
79 | *--pair-resolved*::
80 | Calculate pairwise representation of dispersion energy
81 |
82 | *--citation* [_file_]::
83 | Write citations as bibtex (default: `dftd3.bib`)
84 |
85 | *-v, --verbose*::
86 | Show more, can be used multiple times
87 |
88 | *-s, --silent*::
89 | Show less, use twice to supress all output
90 |
91 | *--version*::
92 | Print program version and exit
93 |
94 | *--help*::
95 | Show this help message
96 |
--------------------------------------------------------------------------------
/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | project(
18 | 's-dftd3',
19 | 'fortran',
20 | version: '1.2.1',
21 | license: 'LGPL-3.0-or-later',
22 | meson_version: '>=0.55,!=1.8.0',
23 | default_options: [
24 | 'buildtype=debugoptimized',
25 | 'default_library=both',
26 | 'c_std=c11',
27 | ],
28 | )
29 | install = not (meson.is_subproject() and get_option('default_library') == 'static')
30 | has_cc = add_languages('c', required: get_option('api') or get_option('python'))
31 |
32 | # General configuration information
33 | inc_dirs = []
34 | lib_deps = []
35 | exe_deps = []
36 | subdir('config')
37 |
38 | # Collect source of the project
39 | srcs = []
40 | subdir('src')
41 |
42 | # Library target
43 | sdftd3_lib = library(
44 | meson.project_name(),
45 | sources: srcs,
46 | version: meson.project_version(),
47 | dependencies: lib_deps,
48 | include_directories: inc_dirs,
49 | install: install,
50 | )
51 |
52 | # Export dependency for other projects and test suite
53 | sdftd3_inc = [sdftd3_lib.private_dir_include(), include_directories('include')]
54 | sdftd3_dep = declare_dependency(
55 | link_with: sdftd3_lib,
56 | include_directories: sdftd3_inc,
57 | dependencies: lib_deps,
58 | variables: {'includedir': meson.current_source_dir() / 'include'},
59 | )
60 |
61 | sdftd3_parameters = files(
62 | 'assets/parameters.toml',
63 | )
64 |
65 | # Add applications
66 | subdir('app')
67 |
68 | # Package the license files
69 | sdftd3_lic = files(
70 | 'COPYING',
71 | 'COPYING.LESSER',
72 | )
73 |
74 | sdftd3_header = files(
75 | 'include/dftd3.h',
76 | 'include/s-dftd3.h',
77 | )
78 |
79 | if install
80 | # Distribute the license files in share/licenses/
81 | install_data(
82 | sdftd3_lic,
83 | install_dir: get_option('datadir')/'licenses'/meson.project_name(),
84 | )
85 |
86 | if get_option('api')
87 | install_headers(
88 | sdftd3_header,
89 | )
90 | endif
91 |
92 | module_id = meson.project_name() / fc_id + '-' + fc.version()
93 | meson.add_install_script(
94 | find_program(files('config'/'install-mod.py')),
95 | get_option('includedir') / module_id,
96 | )
97 |
98 | pkg = import('pkgconfig')
99 | pkg.generate(
100 | sdftd3_lib,
101 | description: 'Simple reimplementation of the DFT-D3 dispersion model',
102 | subdirs: ['', module_id],
103 | )
104 |
105 | asciidoc = find_program('asciidoctor', required: false)
106 | if asciidoc.found()
107 | install_man(
108 | configure_file(
109 | command: [asciidoc, '-b', 'manpage', '@INPUT@', '-o', '@OUTPUT@'],
110 | input: files('man/s-dftd3.1.adoc'),
111 | output: '@BASENAME@',
112 | )
113 | )
114 | endif
115 |
116 | install_data(
117 | sdftd3_parameters,
118 | install_dir: get_option('datadir')/meson.project_name(),
119 | )
120 | endif
121 |
122 | # Add the testsuite
123 | subdir('test')
124 |
125 | # Build Python extension module
126 | if get_option('python')
127 | subdir('python'/'dftd3')
128 | endif
129 |
--------------------------------------------------------------------------------
/meson_options.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | option(
18 | 'blas',
19 | type: 'combo',
20 | value: 'none',
21 | choices: ['none', 'netlib', 'custom'],
22 | description: 'Use basic linear algebra subprograms',
23 | )
24 | option(
25 | 'blas_libs',
26 | type: 'array',
27 | value: [],
28 | description: 'Libraries to link against as custom BLAS backend',
29 | )
30 | option(
31 | 'openmp',
32 | type: 'boolean',
33 | value: true,
34 | yield: true,
35 | description: 'Use OpenMP parallelisation',
36 | )
37 | option(
38 | 'api',
39 | type: 'boolean',
40 | value: true,
41 | description: 'Build C API using iso_c_binding module',
42 | )
43 | option(
44 | 'python',
45 | type: 'boolean',
46 | value: false,
47 | description: 'Build Python extension module',
48 | )
49 | option(
50 | 'python_version',
51 | type: 'string',
52 | value: 'python3',
53 | description: 'Python version to link against.',
54 | )
55 |
--------------------------------------------------------------------------------
/python/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 |
34 | # Byte-compiled / optimized / DLL files
35 | __pycache__/
36 | *.py[cod]
37 | *$py.class
38 |
39 | # Distribution / packaging
40 | .Python
41 | build/
42 | develop-eggs/
43 | dist/
44 | downloads/
45 | eggs/
46 | .eggs/
47 | lib/
48 | lib64/
49 | parts/
50 | sdist/
51 | var/
52 | wheels/
53 | share/python-wheels/
54 | *.egg-info/
55 | .installed.cfg
56 | *.egg
57 | MANIFEST
58 |
59 | # PyInstaller
60 | # Usually these files are written by a python script from a template
61 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
62 | *.manifest
63 | *.spec
64 |
65 | # Installer logs
66 | pip-log.txt
67 | pip-delete-this-directory.txt
68 |
69 | # Unit test / coverage reports
70 | htmlcov/
71 | .tox/
72 | .nox/
73 | .coverage
74 | .coverage.*
75 | .cache
76 | nosetests.xml
77 | coverage.xml
78 | *.cover
79 | *.py,cover
80 | .hypothesis/
81 | .pytest_cache/
82 | cover/
83 |
84 | # Translations
85 | *.mo
86 | *.pot
87 |
88 | # Django stuff:
89 | *.log
90 | local_settings.py
91 | db.sqlite3
92 | db.sqlite3-journal
93 |
94 | # Flask stuff:
95 | instance/
96 | .webassets-cache
97 |
98 | # Scrapy stuff:
99 | .scrapy
100 |
101 | # Sphinx documentation
102 | docs/_build/
103 |
104 | # PyBuilder
105 | .pybuilder/
106 | target/
107 |
108 | # Jupyter Notebook
109 | .ipynb_checkpoints
110 |
111 | # IPython
112 | profile_default/
113 | ipython_config.py
114 |
115 | # pyenv
116 | # For a library or package, you might want to ignore these files since the code is
117 | # intended to run in multiple environments; otherwise, check them in:
118 | # .python-version
119 |
120 | # pipenv
121 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
122 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
123 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
124 | # install all needed dependencies.
125 | #Pipfile.lock
126 |
127 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
128 | __pypackages__/
129 |
130 | # Celery stuff
131 | celerybeat-schedule
132 | celerybeat.pid
133 |
134 | # SageMath parsed files
135 | *.sage.py
136 |
137 | # Environments
138 | .env
139 | .venv
140 | env/
141 | venv/
142 | ENV/
143 | env.bak/
144 | venv.bak/
145 |
146 | # Spyder project settings
147 | .spyderproject
148 | .spyproject
149 |
150 | # Rope project settings
151 | .ropeproject
152 |
153 | # mkdocs documentation
154 | /site
155 |
156 | # mypy
157 | .mypy_cache/
158 | .dmypy.json
159 | dmypy.json
160 |
161 | # Pyre type checker
162 | .pyre/
163 |
164 | # pytype static type analyzer
165 | .pytype/
166 |
167 | # Cython debug symbols
168 | cython_debug/
169 |
170 | # Directories
171 | /build*/
172 | /_*/
173 |
--------------------------------------------------------------------------------
/python/dftd3/__init__.py:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 | """Python API for the DFT-D3 dispersion model"""
17 |
18 | # make sure we have a CFFI available
19 | import cffi
20 |
21 | __version__ = "1.2.1"
22 |
--------------------------------------------------------------------------------
/python/dftd3/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | cc = meson.get_compiler('c')
18 |
19 | pymod = import('python')
20 | python = pymod.find_installation(
21 | get_option('python_version'),
22 | modules: [
23 | 'cffi', # Needed for generating the FFI interface
24 | 'setuptools', # Needed for running ffi-builder.py
25 | ],
26 | )
27 | python_dep = python.dependency(required: true)
28 |
29 | # Python's CFFI is horrible in working with preprocessor statements,
30 | # therefore, we have to preprocess the header before passing it to the ffibuilder
31 | sdftd3_pp = configure_file(
32 | command: [
33 | cc,
34 | '-I@0@'.format(
35 | sdftd3_dep.get_variable(
36 | pkgconfig: 'includedir',
37 | cmake: 's-dftd3_INCLUDE_DIRS',
38 | internal: 'includedir',
39 | ).split().get(0)
40 | ),
41 | '-DSDFTD3_CFFI',
42 | '-E',
43 | '@INPUT@',
44 | ],
45 | input: sdftd3_header[0],
46 | output: '_libdftd3.h',
47 | capture: true,
48 | )
49 |
50 | # This is the actual out-of-line API processing of the ffibuilder
51 | sdftd3_cffi_srcs = configure_file(
52 | command: [python, files('..'/'ffibuilder.py'), '@INPUT@', '@BASENAME@'],
53 | input: sdftd3_pp,
54 | output: '@BASENAME@.c',
55 | )
56 |
57 | # Actual generation of the Python extension, since the shared_module does not work
58 | # well with dependency objects, we will trick it by linking a whole static lib
59 | sdftd3_pyext = python.extension_module(
60 | '_libdftd3',
61 | link_whole: static_library(
62 | '_libdftd3',
63 | sdftd3_cffi_srcs,
64 | dependencies: [sdftd3_dep, python_dep],
65 | ),
66 | dependencies: [sdftd3_dep, python_dep],
67 | install: install,
68 | subdir: 'dftd3',
69 | )
70 |
71 | pysrcs = files(
72 | '__init__.py',
73 | 'ase.py',
74 | 'library.py',
75 | 'interface.py',
76 | 'parameters.py',
77 | 'pyscf.py',
78 | 'qcschema.py',
79 | 'test_ase.py',
80 | 'test_library.py',
81 | 'test_interface.py',
82 | 'test_parameters.py',
83 | 'test_pyscf.py',
84 | 'test_qcschema.py',
85 | 'py.typed',
86 | )
87 | fs = import('fs')
88 | if fs.exists('parameters.toml')
89 | pysrcs += files('parameters.toml')
90 | endif
91 |
92 | if install
93 | python.install_sources(
94 | pysrcs,
95 | subdir: 'dftd3',
96 | pure: false,
97 | )
98 | endif
99 |
--------------------------------------------------------------------------------
/python/dftd3/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dftd3/simple-dftd3/442fbec1b0cf249359358ed247d90731d4da4b37/python/dftd3/py.typed
--------------------------------------------------------------------------------
/python/dftd3/test_ase.py:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the Lesser GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # Lesser GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the Lesser GNU General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | from typing import Iterator
18 |
19 | import numpy as np
20 | import pytest
21 | from pytest import approx
22 |
23 | try:
24 | import ase
25 | from dftd3.ase import DFTD3
26 | from ase.build import molecule
27 | from ase.calculators.emt import EMT
28 | except ModuleNotFoundError:
29 | ase = None
30 |
31 |
32 | def get_calcs(calc) -> Iterator[ase.calculators.calculator.Calculator]:
33 | if hasattr(calc, "mixer"):
34 | calc = calc.mixer
35 | yield from calc.calcs
36 |
37 |
38 | @pytest.mark.skipif(ase is None, reason="requires ase")
39 | def test_ase_scand4():
40 | thr = 1.0e-6
41 |
42 | forces = np.array(
43 | [
44 | [-0.00000000e-00, -0.00000000e-00, -6.83426991e-05],
45 | [-0.00000000e-00, +3.44839555e-04, +7.21176947e-04],
46 | [+6.80565391e-22, -3.44839555e-04, +7.21176947e-04],
47 | [+2.12676685e-23, +3.26671388e-20, -1.60555514e-03],
48 | [+3.21599856e-04, +5.54947267e-04, +6.86106874e-04],
49 | [-3.21599856e-04, +5.54947267e-04, +6.86106874e-04],
50 | [-3.21599856e-04, -5.54947267e-04, +6.86106874e-04],
51 | [+3.21599856e-04, -5.54947267e-04, +6.86106874e-04],
52 | [+1.87155483e-21, +2.87678390e-04, -1.25644177e-03],
53 | [-3.40282696e-22, -2.87678390e-04, -1.25644177e-03],
54 | ]
55 | )
56 |
57 | atoms = molecule("methylenecyclopropane")
58 | atoms.calc = DFTD3(method="SCAN", damping="d3bj")
59 |
60 | assert atoms.get_potential_energy() == approx(-0.03880921894019244, abs=thr)
61 | assert atoms.get_forces() == approx(forces, abs=thr)
62 |
63 | atoms.calc = DFTD3(method="SCAN", damping="d3bj").add_calculator(EMT())
64 | assert atoms.get_potential_energy() == approx(3.6452960962398406, abs=thr)
65 | energies = [calc.get_potential_energy() for calc in get_calcs(atoms.calc)]
66 | assert energies == approx([-0.03880921894019244, 3.684105315180033], abs=thr)
67 |
68 |
69 | @pytest.mark.skipif(ase is None, reason="requires ase")
70 | def test_ase_tpssd4():
71 | thr = 1.0e-6
72 |
73 | forces = np.array(
74 | [
75 | [+1.21727790e-03, +1.98579200e-03, -1.16371697e-02],
76 | [-5.82484114e-04, +9.01770290e-03, +7.78537640e-03],
77 | [-4.30031958e-03, +4.63213536e-03, -4.56657109e-03],
78 | [-1.16941383e-03, -8.39071556e-03, +1.60593512e-02],
79 | [-6.90354443e-03, -5.07801933e-03, -1.75396161e-03],
80 | [+1.03561818e-02, -1.68908740e-02, -2.74225314e-03],
81 | [+5.59001294e-03, +3.35129491e-03, -9.24429928e-04],
82 | [-5.13316989e-03, +6.07626858e-03, +3.89454026e-05],
83 | [+3.35952011e-03, +3.95424504e-03, -5.65438002e-04],
84 | [-2.13140242e-03, +2.77295425e-03, -4.76829804e-04],
85 | [+4.33961724e-03, -1.51731003e-03, -7.01598391e-04],
86 | [-4.64227572e-03, +8.65258554e-05, -5.15421318e-04],
87 | ]
88 | )
89 |
90 | atoms = molecule("C2H6CHOH")
91 | atoms.calc = DFTD3(method="TPSS", damping="d3zero")
92 |
93 | assert atoms.get_potential_energy() == approx(-0.14230914516094673, abs=thr)
94 | assert atoms.get_forces() == approx(forces, abs=thr)
95 |
96 | atoms.calc = DFTD3(method="TPSS", damping="d3zero").add_calculator(EMT())
97 | assert atoms.get_potential_energy() == approx(4.963774668847532, abs=thr)
98 | energies = [calc.get_potential_energy() for calc in get_calcs(atoms.calc)]
99 | assert energies == approx([-0.14230914516094673, 5.106083814008478], abs=thr)
100 |
--------------------------------------------------------------------------------
/python/dftd3/test_library.py:
--------------------------------------------------------------------------------
1 | # This file is part of dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the Lesser GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # Lesser GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the Lesser GNU General Public License
15 | # along with dftd3. If not, see .
16 |
17 |
18 | from pkg_resources import parse_version
19 | from dftd3 import __version__
20 | from dftd3.library import get_api_version
21 |
22 |
23 | def test_api_version():
24 | """Ensure that the API version is compatible."""
25 | assert parse_version(get_api_version()) == parse_version(__version__)
26 |
--------------------------------------------------------------------------------
/python/dftd3/test_parameters.py:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the Lesser GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # Lesser GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the Lesser GNU General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 |
18 | from pytest import approx
19 | from dftd3.parameters import get_damping_param, get_all_damping_params
20 |
21 |
22 | def get_data_file_name() -> str:
23 | """Make sure we can still test without installing"""
24 | from os.path import join, dirname, exists
25 | from dftd3.parameters import get_data_file_name as _get_data_file_name
26 |
27 | data_file = join(dirname(__file__), "..", "..", "assets", "parameters.toml")
28 | return data_file if exists(data_file) else _get_data_file_name()
29 |
30 |
31 | def test_get_b3lyp():
32 |
33 | expected = {
34 | "s6": 1.0,
35 | "s9": 1.0,
36 | "alp": 14.0,
37 | "a1": 0.3981,
38 | "s8": 1.9889,
39 | "a2": 4.4211,
40 | }
41 | actual = get_damping_param("b3lyp", data_file=get_data_file_name())
42 |
43 | for key in expected.keys():
44 | assert approx(actual[key]) == expected[key]
45 |
46 |
47 | def test_get_m11l():
48 |
49 | expected = {
50 | "s6": 1.0,
51 | "s9": 1.0,
52 | "alp": 14.0,
53 | "rs8": 1.0,
54 | "s8": 1.1129,
55 | "rs6": 2.3933,
56 | }
57 | actual = get_damping_param("m11l", data_file=get_data_file_name())
58 |
59 | for key in expected.keys():
60 | assert approx(actual[key]) == expected[key]
61 |
62 |
63 | def test_get_pw6b95():
64 |
65 | expected = {
66 | "s6": 1.0,
67 | "s9": 1.0,
68 | "alp": 14.0,
69 | "a1": 0.2076,
70 | "s8": 0.7257,
71 | "a2": 6.3750,
72 | }
73 | actual = get_damping_param(
74 | "pw6b95", data_file=get_data_file_name(), defaults=["bj"]
75 | )
76 |
77 | for key in expected.keys():
78 | assert approx(actual[key]) == expected[key]
79 |
80 |
81 | def test_all_parameters():
82 |
83 | params = get_all_damping_params()
84 |
85 | assert "b3lyp" in params
86 | assert "b2plyp" in params
87 | assert "pw6b95" in params
88 |
--------------------------------------------------------------------------------
/python/ffibuilder.py:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the Lesser GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # Lesser GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the Lesser GNU General Public License
15 | # along with s-dftd3. If not, see .
16 | """
17 | FFI builder module for s-dftd3 for usage from meson and from setup.py.
18 |
19 | Since meson has the full knowledge about the build, it will handle
20 | the generation of the C definitions in the meson.build file rather
21 | than in the FFI builder. This allows to correctly keep track of
22 | dependencies and updates in the build process.
23 |
24 | For setup.py we have to do the preprocessing ourselves here, this
25 | requires us to use the C compiler to preprocess the header file
26 | of s-dftd3 because the CFFI C parser cannot handle certain C
27 | preprocessor constructs. Also, we cannot rely on an external build
28 | system fixing dependencies for us and therefore have to find those
29 | ourselves using pkg-config.
30 | """
31 |
32 | import os
33 | import cffi
34 |
35 | library = "s-dftd3"
36 | include_header = '#include "dftd3.h"'
37 | prefix_var = "SDFTD3_PREFIX"
38 | if prefix_var not in os.environ:
39 | prefix_var = "CONDA_PREFIX"
40 |
41 | if __name__ == "__main__":
42 | import sys
43 |
44 | kwargs = dict(libraries=[library])
45 |
46 | header_file = sys.argv[1]
47 | module_name = sys.argv[2]
48 |
49 | with open(header_file) as f:
50 | cdefs = f.read()
51 | else:
52 | import subprocess
53 |
54 | try:
55 | import pkgconfig
56 |
57 | if not pkgconfig.exists(library):
58 | raise ModuleNotFoundError("Unable to find pkg-config package 's-dftd3'")
59 | if pkgconfig.installed(library, "< 0.4"):
60 | raise Exception(
61 | "Installed 's-dftd3' version is too old, 0.4 or newer is required"
62 | )
63 |
64 | kwargs = pkgconfig.parse(library)
65 | cflags = pkgconfig.cflags(library).split()
66 |
67 | except ModuleNotFoundError:
68 | kwargs = dict(libraries=[library])
69 | cflags = []
70 | if prefix_var in os.environ:
71 | prefix = os.environ[prefix_var]
72 | kwargs.update(
73 | include_dirs=[os.path.join(prefix, "include")],
74 | library_dirs=[os.path.join(prefix, "lib")],
75 | runtime_library_dirs=[os.path.join(prefix, "lib")],
76 | )
77 | cflags.append("-I" + os.path.join(prefix, "include"))
78 |
79 | cc = os.environ["CC"] if "CC" in os.environ else "cc"
80 |
81 | module_name = "dftd3._libdftd3"
82 |
83 | p = subprocess.Popen(
84 | [cc, *cflags, "-E", "-"],
85 | stdin=subprocess.PIPE,
86 | stdout=subprocess.PIPE,
87 | stderr=subprocess.PIPE,
88 | )
89 | out, err = p.communicate(include_header.encode())
90 |
91 | cdefs = out.decode()
92 |
93 | ffibuilder = cffi.FFI()
94 | ffibuilder.set_source(module_name, include_header, **kwargs)
95 | ffibuilder.cdef(cdefs)
96 |
97 | if __name__ == "__main__":
98 | ffibuilder.distutils_extension(".")
99 |
--------------------------------------------------------------------------------
/python/include/_dftd3.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "dftd3.h"
4 |
--------------------------------------------------------------------------------
/python/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | # Standalone build for Python-API of DFT-D4, requires a dftd4 library
18 | # in the PKG_CONFIG_PATH environment variable to work.
19 | project(
20 | 'dftd3',
21 | 'c',
22 | version: '1.2.1',
23 | license: 'LGPL-3.0-or-later',
24 | meson_version: '>=0.55,!=1.8.0',
25 | default_options: [
26 | 'buildtype=debugoptimized',
27 | ],
28 | )
29 | install = true
30 |
31 | sdftd3_dep = dependency(
32 | 's-dftd3',
33 | version: '>=@0@'.format(meson.project_version()),
34 | fallback: ['s-dftd3', 'sdftd3_dep'],
35 | default_options: [
36 | 'default_library=static',
37 | 'api=true',
38 | 'python=false',
39 | ],
40 | )
41 | sdftd3_header = files('include'/'_dftd3.h')
42 |
43 | subdir('dftd3')
44 |
--------------------------------------------------------------------------------
/python/meson_options.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the Lesser GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # Lesser GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the Lesser GNU General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | option(
18 | 'python_version',
19 | type: 'string',
20 | value: 'python3',
21 | description: 'Python version to link against.',
22 | )
23 |
--------------------------------------------------------------------------------
/python/mesonpep517.toml:
--------------------------------------------------------------------------------
1 | [build-system]
2 | requires = [
3 | "meson-python",
4 | "cffi",
5 | "setuptools",
6 | "meson!=1.8.0",
7 | ]
8 | build-backend = "mesonpy"
9 |
10 | [project]
11 | name = "dftd3"
12 | version = "1.2.1"
13 | description = "Python API of the DFT-D3 project"
14 | readme = "README.rst"
15 | license.text = "LGPL-3.0-or-later"
16 | urls.repository = "https://github.com/dftd3/simple-dftd3"
17 | urls.documentation = "https://dftd3.readthedocs.io"
18 | classifiers = [
19 | "Intended Audience :: Science/Research",
20 | "Programming Language :: Fortran",
21 | "Programming Language :: Python :: 3",
22 | "Programming Language :: Python :: 3.7",
23 | "Programming Language :: Python :: 3.8",
24 | "Programming Language :: Python :: 3.9",
25 | "Programming Language :: Python :: 3.10",
26 | "Programming Language :: Python :: 3.11",
27 | "Programming Language :: Python :: 3.12",
28 | "Programming Language :: Python :: 3.13",
29 | "Topic :: Scientific/Engineering :: Chemistry",
30 | "Topic :: Scientific/Engineering :: Physics",
31 | ]
32 | requires-python = ">=3.7"
33 | dependencies = [
34 | "cffi",
35 | "numpy",
36 | ]
37 | optional-dependencies.ase = ["ase"]
38 | optional-dependencies.qcschema = ["qcelemental"]
39 | optional-dependencies.pyscf = ["pyscf"]
40 | optional-dependencies.test = [
41 | "pytest",
42 | "pytest-cov",
43 | ]
44 |
--------------------------------------------------------------------------------
/python/setup.cfg:
--------------------------------------------------------------------------------
1 | [metadata]
2 | name = dftd3
3 | version = 1.2.1
4 | desciption = Python API of the DFT-D3 project
5 | long_desciption = file: README.rst
6 | long_description_content_type = text/x-rst
7 | author = Sebastian Ehlert
8 | author_email = awvwgk@gmail.com
9 | url = https://github.com/dftd3/simple-dftd3
10 | license = LGPL-3.0-or-later
11 | license_files =
12 | COPYING
13 | COPYING.LESSER
14 | classifiers =
15 | Development Status :: 5 - Production
16 | Intended Audience :: Science/Research
17 | Operating System :: POSIX :: Linux
18 | Programming Language :: Fortran
19 | Programming Language :: Python :: 3 :: Only
20 | Programming Language :: Python :: 3
21 | Programming Language :: Python :: 3.8
22 | Programming Language :: Python :: 3.9
23 | Programming Language :: Python :: 3.10
24 | Programming Language :: Python :: 3.11
25 | Programming Language :: Python :: 3.12
26 | Topic :: Scientific/Engineering :: Chemistry
27 |
28 | [options]
29 | packages = find:
30 | install_requires =
31 | cffi
32 | numpy
33 | tests_require =
34 | pytest
35 | pytest-cov
36 | ase
37 | pyscf
38 | qcelemental
39 | python_requires = >=3.8
40 |
41 | [options.extras_require]
42 | ase = ase
43 | pyscf = pyscf
44 | parameters = tomli
45 | qcschema = qcelemental
46 |
47 | [coverage:run]
48 | omit =
49 | */test_*.py
50 |
51 | [aliases]
52 | test=pytest
53 |
--------------------------------------------------------------------------------
/python/setup.py:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the Lesser GNU General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # Lesser GNU General Public License for more details.
13 | #
14 | # You should have received a copy of the Lesser GNU General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | from setuptools import setup
18 |
19 | setup(
20 | cffi_modules=["ffibuilder.py:ffibuilder"],
21 | package_data={"dftd3": ["_libdftd3*.so", "parameters.toml"]},
22 | )
23 |
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | add_subdirectory("dftd3")
18 |
19 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}")
20 |
21 | list(
22 | APPEND srcs
23 | "${dir}/dftd3.f90"
24 | )
25 |
26 | set(srcs "${srcs}" PARENT_SCOPE)
27 |
--------------------------------------------------------------------------------
/src/dftd3.f90:
--------------------------------------------------------------------------------
1 | ! This file is part of s-dftd3.
2 | ! SPDX-Identifier: LGPL-3.0-or-later
3 | !
4 | ! s-dftd3 is free software: you can redistribute it and/or modify it under
5 | ! the terms of the GNU Lesser General Public License as published by
6 | ! the Free Software Foundation, either version 3 of the License, or
7 | ! (at your option) any later version.
8 | !
9 | ! s-dftd3 is distributed in the hope that it will be useful,
10 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ! GNU Lesser General Public License for more details.
13 | !
14 | ! You should have received a copy of the GNU Lesser General Public License
15 | ! along with s-dftd3. If not, see .
16 |
17 | module dftd3
18 | use dftd3_cutoff, only : realspace_cutoff, get_lattice_points
19 | use dftd3_disp, only : get_dispersion, get_pairwise_dispersion
20 | use dftd3_ncoord, only : get_coordination_number
21 | use dftd3_damping, only : damping_param
22 | use dftd3_damping_mzero, only : mzero_damping_param, new_mzero_damping
23 | use dftd3_damping_optimizedpower, only : optimizedpower_damping_param, &
24 | & new_optimizedpower_damping
25 | use dftd3_damping_rational, only : rational_damping_param, new_rational_damping
26 | use dftd3_damping_zero, only : zero_damping_param, new_zero_damping
27 | use dftd3_model, only : d3_model, new_d3_model
28 | use dftd3_param, only : d3_param, get_rational_damping, get_zero_damping, &
29 | & get_mrational_damping, get_mzero_damping, get_optimizedpower_damping
30 | use dftd3_version, only : get_dftd3_version
31 | implicit none
32 | private
33 |
34 | public :: get_dispersion, get_pairwise_dispersion
35 | public :: get_coordination_number
36 | public :: realspace_cutoff, get_lattice_points
37 | public :: damping_param, d3_param
38 | public :: get_rational_damping, get_zero_damping
39 | public :: get_mrational_damping, get_mzero_damping
40 | public :: get_optimizedpower_damping
41 | public :: mzero_damping_param, new_mzero_damping
42 | public :: optimizedpower_damping_param, new_optimizedpower_damping
43 | public :: rational_damping_param, new_rational_damping
44 | public :: zero_damping_param, new_zero_damping
45 | public :: d3_model, new_d3_model
46 | public :: get_dftd3_version
47 |
48 |
49 | end module dftd3
50 |
--------------------------------------------------------------------------------
/src/dftd3/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | add_subdirectory("damping")
18 | add_subdirectory("data")
19 | add_subdirectory("gcp")
20 |
21 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}")
22 |
23 | list(
24 | APPEND srcs
25 | "${dir}/citation.f90"
26 | "${dir}/cutoff.f90"
27 | "${dir}/damping.f90"
28 | "${dir}/data.f90"
29 | "${dir}/disp.f90"
30 | "${dir}/gcp.f90"
31 | "${dir}/model.f90"
32 | "${dir}/ncoord.f90"
33 | "${dir}/output.f90"
34 | "${dir}/param.f90"
35 | "${dir}/reference.f90"
36 | "${dir}/utils.f90"
37 | "${dir}/version.f90"
38 | )
39 | if(WITH_API)
40 | list(APPEND srcs "${dir}/api.f90")
41 | endif()
42 |
43 | set(srcs "${srcs}" PARENT_SCOPE)
44 |
--------------------------------------------------------------------------------
/src/dftd3/damping.f90:
--------------------------------------------------------------------------------
1 | ! This file is part of s-dftd3.
2 | ! SPDX-Identifier: LGPL-3.0-or-later
3 | !
4 | ! s-dftd3 is free software: you can redistribute it and/or modify it under
5 | ! the terms of the GNU Lesser General Public License as published by
6 | ! the Free Software Foundation, either version 3 of the License, or
7 | ! (at your option) any later version.
8 | !
9 | ! s-dftd3 is distributed in the hope that it will be useful,
10 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ! GNU Lesser General Public License for more details.
13 | !
14 | ! You should have received a copy of the GNU Lesser General Public License
15 | ! along with s-dftd3. If not, see .
16 |
17 | module dftd3_damping
18 | use mctc_env, only : wp
19 | use mctc_io, only : structure_type
20 | implicit none
21 |
22 | public :: damping_param, dispersion_interface
23 |
24 |
25 | type, abstract :: damping_param
26 | contains
27 | procedure(dispersion_interface), deferred :: get_dispersion2
28 | procedure(dispersion_interface), deferred :: get_dispersion3
29 | procedure(pairwise_dispersion_interface), deferred :: get_pairwise_dispersion2
30 | procedure(pairwise_dispersion_interface), deferred :: get_pairwise_dispersion3
31 | end type damping_param
32 |
33 |
34 | abstract interface
35 | !> Evaluation of the dispersion energy expression
36 | subroutine dispersion_interface(self, mol, trans, cutoff, rvdw, r4r2, c6, dc6dcn, &
37 | & energy, dEdcn, gradient, sigma)
38 | import :: structure_type, damping_param, wp
39 |
40 | !> Damping parameters
41 | class(damping_param), intent(in) :: self
42 |
43 | !> Molecular structure data
44 | class(structure_type), intent(in) :: mol
45 |
46 | !> Lattice points
47 | real(wp), intent(in) :: trans(:, :)
48 |
49 | !> Real space cutoff
50 | real(wp), intent(in) :: cutoff
51 |
52 | !> Van-der-Waals radii for damping function
53 | real(wp), intent(in) :: rvdw(:, :)
54 |
55 | !> Expectation values for C8 extrapolation
56 | real(wp), intent(in) :: r4r2(:)
57 |
58 | !> C6 coefficients for all atom pairs.
59 | real(wp), intent(in) :: c6(:, :)
60 |
61 | !> Derivative of the C6 w.r.t. the coordination number
62 | real(wp), intent(in), optional :: dc6dcn(:, :)
63 |
64 | !> Dispersion energy
65 | real(wp), intent(inout) :: energy(:)
66 |
67 | !> Derivative of the energy w.r.t. the coordination number
68 | real(wp), intent(inout), optional :: dEdcn(:)
69 |
70 | !> Dispersion gradient
71 | real(wp), intent(inout), optional :: gradient(:, :)
72 |
73 | !> Dispersion virial
74 | real(wp), intent(inout), optional :: sigma(:, :)
75 | end subroutine dispersion_interface
76 |
77 |
78 | !> Evaluation of the pairwise representation of the dispersion energy
79 | subroutine pairwise_dispersion_interface(self, mol, trans, cutoff, rvdw, r4r2, c6, &
80 | & energy)
81 | import :: structure_type, damping_param, wp
82 |
83 | !> Damping parameters
84 | class(damping_param), intent(in) :: self
85 |
86 | !> Molecular structure data
87 | class(structure_type), intent(in) :: mol
88 |
89 | !> Lattice points
90 | real(wp), intent(in) :: trans(:, :)
91 |
92 | !> Real space cutoff
93 | real(wp), intent(in) :: cutoff
94 |
95 | !> Van-der-Waals radii for damping function
96 | real(wp), intent(in) :: rvdw(:, :)
97 |
98 | !> Expectation values for r4 over r2 operator
99 | real(wp), intent(in) :: r4r2(:)
100 |
101 | !> C6 coefficients for all atom pairs.
102 | real(wp), intent(in) :: c6(:, :)
103 |
104 | !> Pairwise representation of the dispersion energy
105 | real(wp), intent(inout) :: energy(:, :)
106 | end subroutine pairwise_dispersion_interface
107 | end interface
108 |
109 |
110 | end module dftd3_damping
111 |
--------------------------------------------------------------------------------
/src/dftd3/damping/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}")
18 |
19 | list(
20 | APPEND srcs
21 | "${dir}/atm.f90"
22 | "${dir}/mzero.f90"
23 | "${dir}/optimizedpower.f90"
24 | "${dir}/rational.f90"
25 | "${dir}/zero.f90"
26 | )
27 |
28 | set(srcs "${srcs}" PARENT_SCOPE)
29 |
--------------------------------------------------------------------------------
/src/dftd3/damping/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | srcs += files(
18 | 'atm.f90',
19 | 'mzero.f90',
20 | 'optimizedpower.f90',
21 | 'rational.f90',
22 | 'zero.f90',
23 | )
24 |
--------------------------------------------------------------------------------
/src/dftd3/data.f90:
--------------------------------------------------------------------------------
1 | ! This file is part of s-dftd3.
2 | ! SPDX-Identifier: LGPL-3.0-or-later
3 | !
4 | ! s-dftd3 is free software: you can redistribute it and/or modify it under
5 | ! the terms of the GNU Lesser General Public License as published by
6 | ! the Free Software Foundation, either version 3 of the License, or
7 | ! (at your option) any later version.
8 | !
9 | ! s-dftd3 is distributed in the hope that it will be useful,
10 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ! GNU Lesser General Public License for more details.
13 | !
14 | ! You should have received a copy of the GNU Lesser General Public License
15 | ! along with s-dftd3. If not, see .
16 |
17 | module dftd3_data
18 | use dftd3_data_r4r2, only : get_r4r2_val
19 | use dftd3_data_vdwrad, only : get_vdw_rad
20 | implicit none
21 | private
22 |
23 | public :: get_r4r2_val, get_vdw_rad
24 |
25 |
26 | end module dftd3_data
27 |
--------------------------------------------------------------------------------
/src/dftd3/data/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}")
18 |
19 | list(
20 | APPEND srcs
21 | "${dir}/r4r2.f90"
22 | "${dir}/vdwrad.f90"
23 | )
24 |
25 | set(srcs "${srcs}" PARENT_SCOPE)
26 |
--------------------------------------------------------------------------------
/src/dftd3/data/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | srcs += files(
18 | 'r4r2.f90',
19 | 'vdwrad.f90',
20 | )
21 |
22 |
--------------------------------------------------------------------------------
/src/dftd3/data/r4r2.f90:
--------------------------------------------------------------------------------
1 | ! This file is part of s-dftd3.
2 | ! SPDX-Identifier: LGPL-3.0-or-later
3 | !
4 | ! s-dftd3 is free software: you can redistribute it and/or modify it under
5 | ! the terms of the GNU Lesser General Public License as published by
6 | ! the Free Software Foundation, either version 3 of the License, or
7 | ! (at your option) any later version.
8 | !
9 | ! s-dftd3 is distributed in the hope that it will be useful,
10 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ! GNU Lesser General Public License for more details.
13 | !
14 | ! You should have received a copy of the GNU Lesser General Public License
15 | ! along with s-dftd3. If not, see .
16 |
17 | module dftd3_data_r4r2
18 | use mctc_env, only : wp
19 | use mctc_io_convert, only : aatoau
20 | use mctc_io_symbols, only : to_number
21 | implicit none
22 | private
23 |
24 | public :: get_r4r2_val
25 |
26 |
27 | !> Get r4/r2 expectation value
28 | interface get_r4r2_val
29 | module procedure :: get_r4r2_val_num
30 | module procedure :: get_r4r2_val_sym
31 | end interface get_r4r2_val
32 |
33 |
34 | integer, parameter :: max_elem = 118
35 |
36 | ! PBE0/def2-QZVP atomic values calculated by S. Grimme in Gaussian (2010)
37 | ! rare gases recalculated by J. Mewes with PBE0/aug-cc-pVQZ in Dirac (2018)
38 | ! He: 3.4698 -> 3.5544, Ne: 3.1036 -> 3.7943, Ar: 5.6004 -> 5.6638,
39 | ! Kr: 6.1971 -> 6.2312, Xe: 7.5152 -> 8.8367
40 | ! not replaced but recalculated (PBE0/cc-pVQZ) were
41 | ! H: 8.0589 ->10.9359, Li:29.0974 ->39.7226, Be:14.8517 ->17.7460
42 | ! also new super heavies Cn,Nh,Fl,Lv,Og
43 | ! Am-Rg calculated at 4c-PBE/Dyall-AE4Z (Dirac 2022)
44 | real(wp), parameter :: r4_over_r2(max_elem) = [ &
45 | & 8.0589_wp, 3.4698_wp, & ! H,He
46 | & 29.0974_wp,14.8517_wp,11.8799_wp, 7.8715_wp, 5.5588_wp, 4.7566_wp, 3.8025_wp, 3.1036_wp, & ! Li-Ne
47 | & 26.1552_wp,17.2304_wp,17.7210_wp,12.7442_wp, 9.5361_wp, 8.1652_wp, 6.7463_wp, 5.6004_wp, & ! Na-Ar
48 | & 29.2012_wp,22.3934_wp, & ! K,Ca
49 | & 19.0598_wp,16.8590_wp,15.4023_wp,12.5589_wp,13.4788_wp, & ! Sc-
50 | & 12.2309_wp,11.2809_wp,10.5569_wp,10.1428_wp, 9.4907_wp, & ! -Zn
51 | & 13.4606_wp,10.8544_wp, 8.9386_wp, 8.1350_wp, 7.1251_wp, 6.1971_wp, & ! Ga-Kr
52 | & 30.0162_wp,24.4103_wp, & ! Rb,Sr
53 | & 20.3537_wp,17.4780_wp,13.5528_wp,11.8451_wp,11.0355_wp, & ! Y-
54 | & 10.1997_wp, 9.5414_wp, 9.0061_wp, 8.6417_wp, 8.9975_wp, & ! -Cd
55 | & 14.0834_wp,11.8333_wp,10.0179_wp, 9.3844_wp, 8.4110_wp, 7.5152_wp, & ! In-Xe
56 | & 32.7622_wp,27.5708_wp, & ! Cs,Ba
57 | & 23.1671_wp,21.6003_wp,20.9615_wp,20.4562_wp,20.1010_wp,19.7475_wp,19.4828_wp, & ! La-Eu
58 | & 15.6013_wp,19.2362_wp,17.4717_wp,17.8321_wp,17.4237_wp,17.1954_wp,17.1631_wp, & ! Gd-Yb
59 | & 14.5716_wp,15.8758_wp,13.8989_wp,12.4834_wp,11.4421_wp, & ! Lu-
60 | & 10.2671_wp, 8.3549_wp, 7.8496_wp, 7.3278_wp, 7.4820_wp, & ! -Hg
61 | & 13.5124_wp,11.6554_wp,10.0959_wp, 9.7340_wp, 8.8584_wp, 8.0125_wp, & ! Tl-Rn
62 | & 29.8135_wp,26.3157_wp, & ! Fr,Ra
63 | & 19.1885_wp,15.8542_wp,16.1305_wp,15.6161_wp,15.1226_wp,16.1576_wp,14.6510_wp, & ! Ac-Am
64 | & 14.7178_wp,13.9108_wp,13.5623_wp,13.2326_wp,12.9189_wp,12.6133_wp,12.3142_wp, & ! Cm-No
65 | & 14.8326_wp,12.3771_wp,10.6378_wp, 9.3638_wp, 8.2297_wp, & ! Lr-
66 | & 7.5667_wp, 6.9456_wp, 6.3946_wp, 5.9159_wp, 5.4929_wp, & ! -Cn
67 | & 6.7286_wp, 6.5144_wp,10.9169_wp,10.3600_wp, 9.4723_wp, 8.6641_wp ] ! Nh-Og
68 | integer :: idum
69 | real(wp), parameter :: sqrt_z_r4_over_r2(max_elem) = &
70 | & sqrt(0.5_wp*(r4_over_r2*[(sqrt(real(idum,wp)),idum=1,max_elem)]))
71 |
72 |
73 | contains
74 |
75 |
76 | !> Get r4/r2 expectation value for a given element symbol
77 | elemental function get_r4r2_val_sym(sym) result(rad)
78 |
79 | !> Element symbol
80 | character(len=*), intent(in) :: sym
81 |
82 | !> r4/r2 expectation value
83 | real(wp) :: rad
84 |
85 | rad = get_r4r2_val(to_number(sym))
86 |
87 | end function get_r4r2_val_sym
88 |
89 |
90 | !> Get r4/r2 expectation value for a given atomic number
91 | elemental function get_r4r2_val_num(num) result(rad)
92 |
93 | !> Atomic number
94 | integer, intent(in) :: num
95 |
96 | !> r4/r2 expectation value
97 | real(wp) :: rad
98 |
99 | if (num > 0 .and. num <= size(sqrt_z_r4_over_r2)) then
100 | rad = sqrt_z_r4_over_r2(num)
101 | else
102 | rad = 0.0_wp
103 | end if
104 |
105 | end function get_r4r2_val_num
106 |
107 |
108 | end module dftd3_data_r4r2
109 |
--------------------------------------------------------------------------------
/src/dftd3/gcp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | set(dir "${CMAKE_CURRENT_SOURCE_DIR}")
18 |
19 | list(
20 | APPEND srcs
21 | "${dir}/param.f90"
22 | )
23 |
24 | set(srcs "${srcs}" PARENT_SCOPE)
25 |
--------------------------------------------------------------------------------
/src/dftd3/gcp/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | srcs += files(
18 | 'param.f90',
19 | )
20 |
--------------------------------------------------------------------------------
/src/dftd3/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | subdir('damping')
18 | subdir('data')
19 | subdir('gcp')
20 |
21 | srcs += files(
22 | 'citation.f90',
23 | 'cutoff.f90',
24 | 'damping.f90',
25 | 'data.f90',
26 | 'disp.f90',
27 | 'gcp.f90',
28 | 'model.f90',
29 | 'ncoord.f90',
30 | 'output.f90',
31 | 'param.f90',
32 | 'reference.f90',
33 | 'utils.f90',
34 | 'version.f90',
35 | )
36 | if get_option('api') or get_option('python')
37 | srcs += files('api.f90')
38 | endif
39 |
--------------------------------------------------------------------------------
/src/dftd3/ncoord.f90:
--------------------------------------------------------------------------------
1 | ! This file is part of s-dftd3.
2 | ! SPDX-Identifier: LGPL-3.0-or-later
3 | !
4 | ! s-dftd3 is free software: you can redistribute it and/or modify it under
5 | ! the terms of the GNU Lesser General Public License as published by
6 | ! the Free Software Foundation, either version 3 of the License, or
7 | ! (at your option) any later version.
8 | !
9 | ! s-dftd3 is distributed in the hope that it will be useful,
10 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ! GNU Lesser General Public License for more details.
13 | !
14 | ! You should have received a copy of the GNU Lesser General Public License
15 | ! along with s-dftd3. If not, see .
16 |
17 | module dftd3_ncoord
18 | use, intrinsic :: iso_fortran_env, only : error_unit
19 | use mctc_env, only : error_type, wp
20 | use mctc_io, only : structure_type
21 | use mctc_ncoord, only : ncoord_type, new_ncoord, cn_count
22 | implicit none
23 | private
24 |
25 | public :: get_coordination_number, add_coordination_number_derivs
26 |
27 | !> Steepness of counting function
28 | real(wp), parameter :: default_kcn = 16.0_wp
29 |
30 | contains
31 |
32 |
33 | !> Wrapper for geometric fractional coordination number
34 | !> with standard exponential counting function.
35 | subroutine get_coordination_number(mol, trans, cutoff, rcov, cn, dcndr, dcndL)
36 |
37 | !> Molecular structure data
38 | type(structure_type), intent(in) :: mol
39 |
40 | !> Lattice points
41 | real(wp), intent(in) :: trans(:, :)
42 |
43 | !> Real space cutoff
44 | real(wp), intent(in) :: cutoff
45 |
46 | !> Covalent radius
47 | real(wp), intent(in) :: rcov(:)
48 |
49 | !> Error function coordination number.
50 | real(wp), intent(out) :: cn(:)
51 |
52 | !> Derivative of the CN with respect to the Cartesian coordinates.
53 | real(wp), intent(out), optional :: dcndr(:, :, :)
54 |
55 | !> Derivative of the CN with respect to strain deformations.
56 | real(wp), intent(out), optional :: dcndL(:, :, :)
57 |
58 | class(ncoord_type), allocatable :: ncoord
59 | type(error_type), allocatable :: error
60 |
61 | call new_ncoord(ncoord, mol, cn_count%exp, error, &
62 | & kcn=default_kcn, cutoff=cutoff, rcov=rcov)
63 | if(allocated(error)) then
64 | write(error_unit, '("[Error]:", 1x, a)') error%message
65 | error stop
66 | end if
67 |
68 | call ncoord%get_coordination_number(mol, trans, cn, dcndr, dcndL)
69 |
70 | end subroutine get_coordination_number
71 |
72 |
73 | subroutine add_coordination_number_derivs(mol, trans, cutoff, rcov, dEdcn, gradient, sigma)
74 |
75 | !> Molecular structure data
76 | type(structure_type), intent(in) :: mol
77 |
78 | !> Lattice points
79 | real(wp), intent(in) :: trans(:, :)
80 |
81 | !> Real space cutoff
82 | real(wp), intent(in) :: cutoff
83 |
84 | !> Covalent radius
85 | real(wp), intent(in) :: rcov(:)
86 |
87 | !> Derivative of expression with respect to the coordination number
88 | real(wp), intent(in) :: dEdcn(:)
89 |
90 | !> Derivative of the CN with respect to the Cartesian coordinates
91 | real(wp), intent(inout) :: gradient(:, :)
92 |
93 | !> Derivative of the CN with respect to strain deformations
94 | real(wp), intent(inout) :: sigma(:, :)
95 |
96 | class(ncoord_type), allocatable :: ncoord
97 | type(error_type), allocatable :: error
98 |
99 | call new_ncoord(ncoord, mol, cn_count%exp, error, &
100 | & kcn=default_kcn, cutoff=cutoff, rcov=rcov)
101 | if(allocated(error)) then
102 | write(error_unit, '("[Error]:", 1x, a)') error%message
103 | error stop
104 | end if
105 |
106 | call ncoord%add_coordination_number_derivs(mol, trans, dEdcn, gradient, sigma)
107 |
108 | end subroutine add_coordination_number_derivs
109 |
110 |
111 | end module dftd3_ncoord
--------------------------------------------------------------------------------
/src/dftd3/utils.f90:
--------------------------------------------------------------------------------
1 | ! This file is part of s-dftd3.
2 | ! SPDX-Identifier: LGPL-3.0-or-later
3 | !
4 | ! s-dftd3 is free software: you can redistribute it and/or modify it under
5 | ! the terms of the GNU Lesser General Public License as published by
6 | ! the Free Software Foundation, either version 3 of the License, or
7 | ! (at your option) any later version.
8 | !
9 | ! s-dftd3 is distributed in the hope that it will be useful,
10 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ! GNU Lesser General Public License for more details.
13 | !
14 | ! You should have received a copy of the GNU Lesser General Public License
15 | ! along with s-dftd3. If not, see .
16 |
17 | module dftd3_utils
18 | use mctc_env, only : wp
19 | use mctc_io_math, only : matinv_3x3
20 | implicit none
21 |
22 | public :: wrap_to_central_cell
23 |
24 |
25 | contains
26 |
27 |
28 | subroutine wrap_to_central_cell(xyz, lattice, periodic)
29 | real(wp), intent(inout) :: xyz(:, :)
30 | real(wp), intent(in) :: lattice(:, :)
31 | logical, intent(in) :: periodic(:)
32 | real(wp) :: invlat(3, 3), vec(3)
33 | integer :: iat, idir
34 |
35 | if (.not.any(periodic)) return
36 |
37 | invlat = matinv_3x3(lattice)
38 | do iat = 1, size(xyz, 2)
39 | vec(:) = matmul(invlat, xyz(:, iat))
40 | vec(:) = shift_back_abc(vec)
41 | xyz(:, iat) = matmul(lattice, vec)
42 | end do
43 |
44 | end subroutine wrap_to_central_cell
45 |
46 |
47 | elemental function shift_back_abc(in) result(out)
48 | !> fractional coordinate in (-∞,+∞)
49 | real(wp),intent(in) :: in
50 | !> fractional coordinate in [0,1)
51 | real(wp) :: out
52 | real(wp),parameter :: p_pbc_eps = 1.0e-14_wp
53 | out = in
54 | if(in < (0.0_wp - p_pbc_eps)) &
55 | out = in + real(ceiling(-in),wp)
56 | if(in > (1.0_wp + p_pbc_eps)) &
57 | out = in - real(floor ( in),wp)
58 | if (abs(in - 1.0_wp) < p_pbc_eps) &
59 | out = in - 1.0_wp
60 | end function shift_back_abc
61 |
62 |
63 | end module dftd3_utils
64 |
--------------------------------------------------------------------------------
/src/dftd3/version.f90:
--------------------------------------------------------------------------------
1 | ! This file is part of s-dftd3.
2 | ! SPDX-Identifier: LGPL-3.0-or-later
3 | !
4 | ! s-dftd3 is free software: you can redistribute it and/or modify it under
5 | ! the terms of the GNU Lesser General Public License as published by
6 | ! the Free Software Foundation, either version 3 of the License, or
7 | ! (at your option) any later version.
8 | !
9 | ! s-dftd3 is distributed in the hope that it will be useful,
10 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ! GNU Lesser General Public License for more details.
13 | !
14 | ! You should have received a copy of the GNU Lesser General Public License
15 | ! along with s-dftd3. If not, see .
16 |
17 | !> Versioning information on this library.
18 | module dftd3_version
19 | implicit none
20 | private
21 |
22 | public :: dftd3_version_string, dftd3_version_compact
23 | public :: get_dftd3_version
24 |
25 |
26 | !> String representation of the s-dftd3 version
27 | character(len=*), parameter :: dftd3_version_string = "1.2.1"
28 |
29 | !> Numeric representation of the s-dftd3 version
30 | integer, parameter :: dftd3_version_compact(3) = [1, 2, 1]
31 |
32 |
33 | contains
34 |
35 |
36 | !> Getter function to retrieve s-dftd3 version
37 | subroutine get_dftd3_version(major, minor, patch, string)
38 |
39 | !> Major version number of the s-dftd3 version
40 | integer, intent(out), optional :: major
41 |
42 | !> Minor version number of the s-dftd3 version
43 | integer, intent(out), optional :: minor
44 |
45 | !> Patch version number of the s-dftd3 version
46 | integer, intent(out), optional :: patch
47 |
48 | !> String representation of the s-dftd3 version
49 | character(len=:), allocatable, intent(out), optional :: string
50 |
51 | if (present(major)) then
52 | major = dftd3_version_compact(1)
53 | end if
54 | if (present(minor)) then
55 | minor = dftd3_version_compact(2)
56 | end if
57 | if (present(patch)) then
58 | patch = dftd3_version_compact(3)
59 | end if
60 | if (present(string)) then
61 | string = dftd3_version_string
62 | end if
63 |
64 | end subroutine get_dftd3_version
65 |
66 |
67 | end module dftd3_version
68 |
--------------------------------------------------------------------------------
/src/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | subdir('dftd3')
18 |
19 | srcs += files(
20 | 'dftd3.f90',
21 | )
22 |
--------------------------------------------------------------------------------
/subprojects/.gitignore:
--------------------------------------------------------------------------------
1 | /*/
2 | json-fortran*.wrap
3 | test-drive*.wrap
4 |
--------------------------------------------------------------------------------
/subprojects/mctc-lib.wrap:
--------------------------------------------------------------------------------
1 | [wrap-git]
2 | directory = mctc-lib
3 | url = https://github.com/grimme-lab/mctc-lib
4 | revision = v0.4.1
5 |
--------------------------------------------------------------------------------
/subprojects/mstore.wrap:
--------------------------------------------------------------------------------
1 | [wrap-git]
2 | directory = mstore
3 | url = https://github.com/grimme-lab/mstore
4 | revision = v0.3.0
5 |
--------------------------------------------------------------------------------
/subprojects/toml-f.wrap:
--------------------------------------------------------------------------------
1 | [wrap-git]
2 | directory = toml-f
3 | url = https://github.com/toml-f/toml-f
4 | revision = v0.4.2
5 |
--------------------------------------------------------------------------------
/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | add_subdirectory("unit")
18 |
--------------------------------------------------------------------------------
/test/api/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | api_tester = executable(
18 | 'api-tester',
19 | sources: files('api-test.c'),
20 | dependencies: sdftd3_dep,
21 | )
22 |
23 | test('api-test', api_tester, suite: 'api')
24 |
--------------------------------------------------------------------------------
/test/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | if get_option('api')
18 | subdir('api')
19 | endif
20 |
21 | subdir('unit')
22 | subdir('validation')
23 |
--------------------------------------------------------------------------------
/test/unit/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | # Unit testing
18 | set(
19 | tests
20 | "model"
21 | "dftd3"
22 | "param"
23 | "pairwise"
24 | "periodic"
25 | "gcp"
26 | "regression"
27 | )
28 | set(
29 | test-srcs
30 | "main.f90"
31 | )
32 | foreach(t IN LISTS tests)
33 | string(MAKE_C_IDENTIFIER ${t} t)
34 | list(APPEND test-srcs "test_${t}.f90")
35 | endforeach()
36 |
37 | add_executable(
38 | "${PROJECT_NAME}-tester"
39 | "${test-srcs}"
40 | )
41 | target_link_libraries(
42 | "${PROJECT_NAME}-tester"
43 | PRIVATE
44 | "${PROJECT_NAME}-lib"
45 | "mstore::mstore"
46 | )
47 |
48 | foreach(t IN LISTS tests)
49 | add_test("${PROJECT_NAME}/${t}" "${PROJECT_NAME}-tester" "${t}")
50 | endforeach()
51 |
--------------------------------------------------------------------------------
/test/unit/main.f90:
--------------------------------------------------------------------------------
1 | ! This file is part of s-dftd3.
2 | ! SPDX-Identifier: LGPL-3.0-or-later
3 | !
4 | ! s-dftd3 is free software: you can redistribute it and/or modify it under
5 | ! the terms of the GNU Lesser General Public License as published by
6 | ! the Free Software Foundation, either version 3 of the License, or
7 | ! (at your option) any later version.
8 | !
9 | ! s-dftd3 is distributed in the hope that it will be useful,
10 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ! GNU Lesser General Public License for more details.
13 | !
14 | ! You should have received a copy of the GNU Lesser General Public License
15 | ! along with s-dftd3. If not, see .
16 |
17 | !> Driver for unit testing
18 | program tester
19 | use, intrinsic :: iso_fortran_env, only : error_unit
20 | use mctc_env_testing, only : run_testsuite, new_testsuite, testsuite_type, &
21 | & select_suite, run_selected
22 | use test_dftd3, only : collect_dftd3
23 | use test_gcp, only : collect_gcp
24 | use test_model, only : collect_model
25 | use test_param, only : collect_param
26 | use test_pairwise, only : collect_pairwise
27 | use test_periodic, only : collect_periodic
28 | use test_regression, only : collect_regression
29 | implicit none
30 | integer :: stat, is
31 | character(len=:), allocatable :: suite_name, test_name
32 | type(testsuite_type), allocatable :: testsuites(:)
33 | character(len=*), parameter :: fmt = '("#", *(1x, a))'
34 |
35 | stat = 0
36 |
37 | testsuites = [ &
38 | & new_testsuite("model", collect_model), &
39 | & new_testsuite("dftd3", collect_dftd3), &
40 | & new_testsuite("param", collect_param), &
41 | & new_testsuite("pairwise", collect_pairwise), &
42 | & new_testsuite("periodic", collect_periodic), &
43 | & new_testsuite("gcp", collect_gcp), &
44 | & new_testsuite("regression", collect_regression) &
45 | & ]
46 |
47 | call get_argument(1, suite_name)
48 | call get_argument(2, test_name)
49 |
50 | if (allocated(suite_name)) then
51 | is = select_suite(testsuites, suite_name)
52 | if (is > 0 .and. is <= size(testsuites)) then
53 | if (allocated(test_name)) then
54 | write(error_unit, fmt) "Suite:", testsuites(is)%name
55 | call run_selected(testsuites(is)%collect, test_name, error_unit, stat)
56 | if (stat < 0) then
57 | error stop 1
58 | end if
59 | else
60 | write(error_unit, fmt) "Testing:", testsuites(is)%name
61 | call run_testsuite(testsuites(is)%collect, error_unit, stat)
62 | end if
63 | else
64 | write(error_unit, fmt) "Available testsuites"
65 | do is = 1, size(testsuites)
66 | write(error_unit, fmt) "-", testsuites(is)%name
67 | end do
68 | error stop 1
69 | end if
70 | else
71 | do is = 1, size(testsuites)
72 | write(error_unit, fmt) "Testing:", testsuites(is)%name
73 | call run_testsuite(testsuites(is)%collect, error_unit, stat)
74 | end do
75 | end if
76 |
77 | if (stat > 0) then
78 | write(error_unit, '(i0, 1x, a)') stat, "test(s) failed!"
79 | error stop 1
80 | end if
81 |
82 |
83 | contains
84 |
85 |
86 | !> Obtain the command line argument at a given index
87 | subroutine get_argument(idx, arg)
88 |
89 | !> Index of command line argument, range [0:command_argument_count()]
90 | integer, intent(in) :: idx
91 |
92 | !> Command line argument
93 | character(len=:), allocatable, intent(out) :: arg
94 |
95 | integer :: length, stat
96 |
97 | call get_command_argument(idx, length=length, status=stat)
98 | if (stat /= 0) then
99 | return
100 | endif
101 |
102 | allocate(character(len=length) :: arg, stat=stat)
103 | if (stat /= 0) then
104 | return
105 | endif
106 |
107 | if (length > 0) then
108 | call get_command_argument(idx, arg, status=stat)
109 | if (stat /= 0) then
110 | deallocate(arg)
111 | return
112 | end if
113 | end if
114 |
115 | end subroutine get_argument
116 |
117 |
118 | end program tester
119 |
--------------------------------------------------------------------------------
/test/unit/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | # Create mstore as subproject for testing
18 | mstore_dep = dependency(
19 | 'mstore',
20 | fallback: ['mstore', 'mstore_dep'],
21 | default_options: ['default_library=static'],
22 | required: not meson.is_subproject(),
23 | )
24 | # If we do not find mstore and are a subproject, we just skip testing
25 | if not mstore_dep.found()
26 | subdir_done()
27 | endif
28 |
29 | tests = [
30 | 'model',
31 | 'dftd3',
32 | 'param',
33 | 'pairwise',
34 | 'periodic',
35 | 'gcp',
36 | 'regression',
37 | ]
38 |
39 | test_srcs = files(
40 | 'main.f90',
41 | )
42 | foreach t : tests
43 | test_srcs += files('test_@0@.f90'.format(t.underscorify()))
44 | endforeach
45 |
46 | tester = executable(
47 | 'tester',
48 | sources: test_srcs,
49 | dependencies: [sdftd3_dep, mstore_dep],
50 | )
51 |
52 | foreach t : tests
53 | test(t, tester, args: t, suite: 'unit')
54 | endforeach
55 |
--------------------------------------------------------------------------------
/test/validation/01-energy-d3-bj.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.4.2",
3 | "energy": -3.8087650433476242E-02
4 | }
5 |
--------------------------------------------------------------------------------
/test/validation/01-energy-d3-bj.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/01-tyr-xab.xyz
2 | --bj
3 | pbe
4 | --atm
5 | -v
6 | --noedisp
7 |
--------------------------------------------------------------------------------
/test/validation/01-tyr-xab.xyz:
--------------------------------------------------------------------------------
1 | 33
2 |
3 | N 0.87996427473680 0.70373153069661 -0.51130615332982
4 | C 1.10704529919061 -0.55461352577400 0.18358227689533
5 | C 2.53243169485739 -1.06013286624365 -0.07940659552962
6 | O 2.76690368640623 -2.01908445460069 -0.80809113637910
7 | C 0.07718334321989 -1.58491859500309 -0.26644429020475
8 | C -1.32238150345124 -1.05727589758464 -0.13752801567630
9 | C -2.07592829696871 -0.72619745351818 -1.26740100887309
10 | C -1.89158956777023 -0.82886461798850 1.11809805382464
11 | C -3.35242751809691 -0.18162067229317 -1.15826278419073
12 | C -3.16675459785480 -0.28680819327576 1.24281820945032
13 | C -3.90005534699349 0.04280724519891 0.10221594989071
14 | O -5.15467279694705 0.58022165995762 0.15896198901934
15 | H 0.26422704793176 0.69669246972162 -1.30798635271141
16 | H 1.00110241543816 -0.34780861173736 1.25099363808786
17 | H 0.29514290098764 -1.86478996170181 -1.29734137668874
18 | H 0.21986340134956 -2.48487623925482 0.33175686852106
19 | H -1.66547932441700 -0.91529296640891 -2.25261171204151
20 | H -1.33556194169588 -1.08011103320885 2.01327871528387
21 | H -3.93449981177153 0.06698801820358 -2.03455405478385
22 | H -3.59269036992699 -0.12109211141602 2.22540908459364
23 | H -5.40384402252618 0.66587460634466 1.08499587727572
24 | N 3.48006557218715 -0.34829092097608 0.56680864659140
25 | H 3.17894010445215 0.51000909482083 1.01448898844450
26 | C 4.88363355171323 -0.61129562294630 0.33472413924353
27 | H 5.22197937554705 -0.20587250330695 -0.61938990381363
28 | H 5.46574996772595 -0.16715246627480 1.13668278894436
29 | H 5.04710485821156 -1.68503783362043 0.32074562610932
30 | C 1.21384729479401 1.89626412369496 0.03660111841995
31 | O 1.87545560949581 1.98194376318615 1.07275071654650
32 | C 0.72162515389210 3.11678606143173 -0.69686604438548
33 | H 0.01691199788496 3.64009963838439 -0.05402370678109
34 | H 0.23599873722674 2.88135503158529 -1.64048183520313
35 | H 1.56330998445914 3.78057684719786 -0.87605389811523
36 |
--------------------------------------------------------------------------------
/test/validation/02-energy-d3-zero.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.4.2",
3 | "energy": -2.0978912279090350E-02
4 | }
5 |
--------------------------------------------------------------------------------
/test/validation/02-energy-d3-zero.resp:
--------------------------------------------------------------------------------
1 | run
2 | $ORIGIN/02-ser-xad.gen
3 | --zero
4 | b3lyp
5 | --citation
6 | --noedisp
7 | -s
8 |
--------------------------------------------------------------------------------
/test/validation/02-ser-xad.gen:
--------------------------------------------------------------------------------
1 | 23 C
2 | N C O H
3 | 1 1 1.06312787373003E+00 5.77590120515497E-01 -8.02571649314514E-02
4 | 2 2 -1.47046053023568E-01 6.77716091801599E-01 7.14681901124652E-01
5 | 3 2 -1.26507858637002E+00 -1.67878157630723E-01 9.40513680911926E-02
6 | 4 3 -2.21782887396919E+00 3.49269354463233E-01 -4.96652690012851E-01
7 | 5 2 -5.62421424720114E-01 2.13843618149974E+00 7.65758538617561E-01
8 | 6 3 -7.00304433908859E-01 2.66128328203886E+00 -5.44041748928084E-01
9 | 7 4 1.18338691049087E+00 1.27888410956740E+00 -7.94477273621817E-01
10 | 8 4 7.71530797679159E-02 3.00493657425821E-01 1.71348113537225E+00
11 | 9 4 -1.48860820001221E+00 2.23000539787805E+00 1.33572285019554E+00
12 | 10 4 2.13450193261303E-01 2.71925336804804E+00 1.26114676270286E+00
13 | 11 4 -1.43272796332901E+00 2.14531182049284E+00 -9.16795615144989E-01
14 | 12 1 -1.09283891217850E+00 -1.49250726615548E+00 2.49772480442874E-01
15 | 13 4 -2.05870514220780E-01 -1.78491861335924E+00 6.46888305744733E-01
16 | 14 2 -1.98199850970634E+00 -2.45771079545724E+00 -3.60913732119547E-01
17 | 15 4 -1.55195112646314E+00 -2.87733918500152E+00 -1.26979775160983E+00
18 | 16 4 -2.19066037075745E+00 -3.26424831608051E+00 3.37062556617459E-01
19 | 17 4 -2.90663608567996E+00 -1.94899745191628E+00 -6.13813259335138E-01
20 | 18 2 1.92346531999600E+00 -4.58699319024711E-01 3.46053353709904E-02
21 | 19 3 1.72394343255157E+00 -1.39667562642952E+00 8.10209877527121E-01
22 | 20 2 3.15648350796564E+00 -3.87943206952889E-01 -8.27779987160275E-01
23 | 21 4 4.02581102712857E+00 -3.10330391497139E-01 -1.78499513850043E-01
24 | 22 4 3.14817148491170E+00 4.53717141847420E-01 -1.51522229275048E+00
25 | 23 4 3.24389167461231E+00 -1.31581971677912E+00 -1.38691431058146E+00
26 |
--------------------------------------------------------------------------------
/test/validation/03-energy-d3-bjm.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.4.2",
3 | "energy": -1.4015259773094069E-01
4 | }
5 |
--------------------------------------------------------------------------------
/test/validation/03-energy-d3-bjm.resp:
--------------------------------------------------------------------------------
1 | --bjm
2 | b97d
3 | --noedisp
4 | $ORIGIN/03-met-xag.coord
5 |
--------------------------------------------------------------------------------
/test/validation/03-met-xag.coord:
--------------------------------------------------------------------------------
1 | $coord
2 | -4.55788385290990E-01 1.58926865881272E+00 2.27393989642140E-01 N
3 | -2.02302594601558E+00 6.97201441723190E-01 -4.15030744547260E-01 H
4 | 1.08436044925995E+00 2.74892355987020E-01 2.08986318360246E+00 C
5 | 1.72564220039796E+00 1.70239362419894E+00 3.43755322778506E+00 H
6 | -4.51717407873560E-01 -1.72254673462198E+00 3.48029714351319E+00 C
7 | -1.86770849922830E+00 -7.89992675527580E-01 4.65598338389725E+00 H
8 | 8.44771583554930E-01 -2.70785189083993E+00 4.73784022443857E+00 H
9 | -1.71760880480359E+00 -3.69533486170741E+00 1.78826910650659E+00 C
10 | -5.01621622244800E-01 -4.15401915304158E+00 1.94855573945840E-01 H
11 | -2.05239143214679E+00 -5.42384211421478E+00 2.85521464257023E+00 H
12 | -4.75902854723851E+00 -2.57890784597224E+00 6.22062510383820E-01 S
13 | -5.36427456778641E+00 -5.06763085187603E+00 -1.63248281064648E+00 C
14 | -7.17689275160376E+00 -4.67780012531301E+00 -2.51622478336922E+00 H
15 | -5.46111526549819E+00 -6.88453772473109E+00 -6.75933166173060E-01 H
16 | -3.89951899886126E+00 -5.11519807809382E+00 -3.07312554783166E+00 H
17 | 3.46773224701937E+00 -8.84293744634850E-01 8.87794504983050E-01 C
18 | 3.87789547906652E+00 -3.17085436129397E+00 8.98497931861620E-01 O
19 | 5.02603374343230E+00 8.63365190468150E-01 -1.18361491826040E-01 N
20 | 4.46187018445129E+00 2.69415174264866E+00 -1.08492202513900E-02 H
21 | -9.38366297150000E-04 3.99839432962530E+00 -4.82910442591650E-01 C
22 | 1.86898187625819E+00 5.19310576290576E+00 2.36199556429710E-01 O
23 | -1.92905998793513E+00 5.14718330017453E+00 -2.23626923874210E+00 C
24 | -2.60959358692860E+00 6.89393358006298E+00 -1.39494828104343E+00 H
25 | -3.51842388387039E+00 3.90055720268680E+00 -2.60969702843445E+00 H
26 | -1.00411790198553E+00 5.62961738898537E+00 -4.00748134553430E+00 H
27 | 7.33604963602204E+00 1.78183204111750E-01 -1.40605028871652E+00 C
28 | 8.94166221056998E+00 1.17095655808730E+00 -5.90752170768810E-01 H
29 | 7.60396611286902E+00 -1.84282227982917E+00 -1.17839100297275E+00 H
30 | 7.23121618353314E+00 6.21016517550090E-01 -3.41354044727008E+00 H
31 | $periodic 0
32 | $end
33 |
--------------------------------------------------------------------------------
/test/validation/04-energy-d3-zerom.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.4.2",
3 | "energy": -3.0961041197330064E-02
4 | }
5 |
--------------------------------------------------------------------------------
/test/validation/04-energy-d3-zerom.resp:
--------------------------------------------------------------------------------
1 | --zerom
2 | bp
3 | $ORIGIN/04-val-xad.mol
4 | --noedisp
5 |
--------------------------------------------------------------------------------
/test/validation/04-val-xad.mol:
--------------------------------------------------------------------------------
1 |
2 | 12282121023D
3 |
4 | 28 0 0 0 0 999 V2000
5 | 0.7046 -0.9025 0.4305 N 0 0 0 0 0 0 0 0 0 0 0 0
6 | -0.4828 -0.3101 -0.1701 C 0 0 0 0 0 0 0 0 0 0 0 0
7 | -0.5493 1.1568 0.2692 C 0 0 0 0 0 0 0 0 0 0 0 0
8 | -1.2152 1.5291 1.2304 O 0 0 0 0 0 0 0 0 0 0 0 0
9 | -1.7403 -1.0818 0.2049 C 0 0 0 0 0 0 0 0 0 0 0 0
10 | -2.9449 -0.4695 -0.5017 C 0 0 0 0 0 0 0 0 0 0 0 0
11 | -1.6065 -2.5558 -0.1610 C 0 0 0 0 0 0 0 0 0 0 0 0
12 | 0.6336 -1.2696 1.3649 H 0 0 0 0 0 0 0 0 0 0 0 0
13 | -0.3310 -0.3579 -1.2503 H 0 0 0 0 0 0 0 0 0 0 0 0
14 | -1.8830 -0.9748 1.2833 H 0 0 0 0 0 0 0 0 0 0 0 0
15 | -3.0849 0.5705 -0.2176 H 0 0 0 0 0 0 0 0 0 0 0 0
16 | -3.8517 -1.0166 -0.2471 H 0 0 0 0 0 0 0 0 0 0 0 0
17 | -2.8156 -0.5260 -1.5842 H 0 0 0 0 0 0 0 0 0 0 0 0
18 | -0.7757 -3.0384 0.3502 H 0 0 0 0 0 0 0 0 0 0 0 0
19 | -2.5186 -3.0928 0.0962 H 0 0 0 0 0 0 0 0 0 0 0 0
20 | -1.4455 -2.6654 -1.2350 H 0 0 0 0 0 0 0 0 0 0 0 0
21 | 0.2243 1.9748 -0.4818 N 0 0 0 0 0 0 0 0 0 0 0 0
22 | 0.8925 1.5208 -1.0917 H 0 0 0 0 0 0 0 0 0 0 0 0
23 | 0.4236 3.3559 -0.0959 C 0 0 0 0 0 0 0 0 0 0 0 0
24 | 1.1692 3.4568 0.6937 H 0 0 0 0 0 0 0 0 0 0 0 0
25 | 0.7418 3.9282 -0.9623 H 0 0 0 0 0 0 0 0 0 0 0 0
26 | -0.5171 3.7512 0.2747 H 0 0 0 0 0 0 0 0 0 0 0 0
27 | 1.9317 -0.7665 -0.1327 C 0 0 0 0 0 0 0 0 0 0 0 0
28 | 2.1059 -0.1725 -1.1965 O 0 0 0 0 0 0 0 0 0 0 0 0
29 | 3.0716 -1.4107 0.6144 C 0 0 0 0 0 0 0 0 0 0 0 0
30 | 3.5326 -2.1510 -0.0351 H 0 0 0 0 0 0 0 0 0 0 0 0
31 | 2.7626 -1.8893 1.5403 H 0 0 0 0 0 0 0 0 0 0 0 0
32 | 3.8182 -0.6506 0.8310 H 0 0 0 0 0 0 0 0 0 0 0 0
33 | M END
34 |
--------------------------------------------------------------------------------
/test/validation/05-cys-xag.sdf:
--------------------------------------------------------------------------------
1 |
2 | 12282121023D
3 |
4 | 23 0 0 0 0 999 V2000
5 | 0.9953 -0.2409 -0.2616 N 0 0 0 0 0 0 0 0 0 0 0 0
6 | -0.0107 0.1811 0.6866 C 0 0 0 0 0 0 0 0 0 0 0 0
7 | -1.3853 -0.4296 0.4088 C 0 0 0 0 0 0 0 0 0 0 0 0
8 | -2.4066 0.1061 0.8285 O 0 0 0 0 0 0 0 0 0 0 0 0
9 | -0.1237 1.6985 0.7568 C 0 0 0 0 0 0 0 0 0 0 0 0
10 | -0.5487 2.4394 -0.8517 S 0 0 0 0 0 0 0 0 0 0 0 0
11 | 0.9496 0.2011 -1.1687 H 0 0 0 0 0 0 0 0 0 0 0 0
12 | 0.3174 -0.1955 1.6584 H 0 0 0 0 0 0 0 0 0 0 0 0
13 | -0.8703 1.9848 1.4908 H 0 0 0 0 0 0 0 0 0 0 0 0
14 | 0.8384 2.1231 1.0382 H 0 0 0 0 0 0 0 0 0 0 0 0
15 | 2.2137 -0.7159 0.1647 C 0 0 0 0 0 0 0 0 0 0 0 0
16 | 2.4288 -1.0326 1.3240 O 0 0 0 0 0 0 0 0 0 0 0 0
17 | -1.3628 -1.5839 -0.2902 N 0 0 0 0 0 0 0 0 0 0 0 0
18 | -2.5623 -2.3411 -0.5698 C 0 0 0 0 0 0 0 0 0 0 0 0
19 | -2.6732 -2.5104 -1.6388 H 0 0 0 0 0 0 0 0 0 0 0 0
20 | -2.5496 -3.3011 -0.0566 H 0 0 0 0 0 0 0 0 0 0 0 0
21 | -3.4040 -1.7580 -0.2094 H 0 0 0 0 0 0 0 0 0 0 0 0
22 | -0.4613 -1.9185 -0.5848 H 0 0 0 0 0 0 0 0 0 0 0 0
23 | 3.2588 -0.8339 -0.9175 C 0 0 0 0 0 0 0 0 0 0 0 0
24 | 3.9994 -0.0502 -0.7685 H 0 0 0 0 0 0 0 0 0 0 0 0
25 | 2.8453 -0.7440 -1.9190 H 0 0 0 0 0 0 0 0 0 0 0 0
26 | 3.7633 -1.7899 -0.8125 H 0 0 0 0 0 0 0 0 0 0 0 0
27 | -1.8126 1.9993 -0.8493 H 0 0 0 0 0 0 0 0 0 0 0 0
28 | M END
29 | $$$$
30 |
--------------------------------------------------------------------------------
/test/validation/05-energy-d3-op.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.4.2",
3 | "energy": -1.5164778334471978E-02
4 | }
5 |
--------------------------------------------------------------------------------
/test/validation/05-energy-d3-op.resp:
--------------------------------------------------------------------------------
1 | --op
2 | tpss
3 | $ORIGIN/05-cys-xag.sdf
4 | --noedisp
5 |
--------------------------------------------------------------------------------
/test/validation/06-229.xyz:
--------------------------------------------------------------------------------
1 | 16
2 |
3 | C 1.07776015926015 1.08690016084956 1.96349029060070
4 | C 0.13839002057770 -0.02710000383022 1.50913022336688
5 | N 0.05607000814774 -0.03575000520705 -0.00617000072208
6 | H 1.01448015025232 -0.03619000557073 -0.38615005703752
7 | H -0.42692006326689 -0.87277012933582 -0.36520005420149
8 | H -0.42357006280708 0.79410011751742 -0.38662005699303
9 | H -0.87527012971845 0.09069001338292 1.91101028282250
10 | H 0.52929007807763 -1.01124014988343 1.78217026354770
11 | H 1.13486016821113 1.08204016029622 3.05884045290231
12 | H 2.08532030841101 0.93493013823573 1.55682023016854
13 | H 0.71662010591290 2.07853030765754 1.65256024469480
14 | O 3.97298058824183 -2.02259029932861 0.29357004343941
15 | Cl 2.85192042224866 -1.84894027375644 -0.60735008972859
16 | O 3.11691046135615 -2.40491035608686 -1.93070028586786
17 | O 1.60869023830847 -2.45077036291535 -0.04085000619929
18 | O 2.57594038132153 -0.33642004994480 -0.77092011432950
19 |
--------------------------------------------------------------------------------
/test/validation/06-gradient-d3-bj.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.4.2",
3 | "energy": -7.3515758133287826E-02,
4 | "virial": [
5 | 4.4026855865588896E-02,
6 | -1.0455782798689578E-02,
7 | -5.8691458547748673E-03,
8 | -1.0455782798689577E-02,
9 | 3.8805304990794182E-02,
10 | 1.4965908931787624E-02,
11 | -5.8691458547748673E-03,
12 | 1.4965908931787623E-02,
13 | 4.1129818147568137E-02
14 | ],
15 | "gradient": [
16 | 6.2113001180635766E-04,
17 | 1.5153659716303529E-03,
18 | 1.8741160970768328E-03,
19 | -1.3554649802790645E-03,
20 | 2.4870592563885341E-05,
21 | 1.3076326139947814E-03,
22 | -2.5058087533708050E-03,
23 | 5.2843572433059307E-04,
24 | -1.2943467646864227E-03,
25 | -5.2269120849198175E-04,
26 | 7.6870792730359923E-04,
27 | -1.3494039580462182E-03,
28 | -1.3512994422147627E-03,
29 | -1.3247281838410860E-04,
30 | -9.1881375935716860E-04,
31 | -8.6372117722440835E-04,
32 | 4.3074026311425417E-04,
33 | -1.2326375214950977E-03,
34 | -1.2626976783675053E-03,
35 | -3.2876172473804486E-04,
36 | 9.0268237401773185E-04,
37 | -6.6805783928961947E-04,
38 | -9.3626403960285021E-04,
39 | 1.4905816849330438E-03,
40 | 4.2611706098229961E-04,
41 | 5.4184563532737903E-04,
42 | 9.1517925803877461E-04,
43 | 1.0800157316426891E-03,
44 | 1.1452612762240092E-03,
45 | 1.0349394236689618E-03,
46 | 3.0314221988344831E-04,
47 | 1.3961888375287092E-03,
48 | 5.3304657686789126E-04,
49 | 1.5501489920990953E-03,
50 | -4.6122899772461310E-04,
51 | 8.9396709877176861E-04,
52 | 2.5291585392740886E-03,
53 | -1.9528016707951589E-03,
54 | -1.1440660803823314E-03,
55 | 4.9081117405343970E-04,
56 | -7.9555541409968313E-04,
57 | -1.5298127044654837E-03,
58 | 1.1146188969145853E-06,
59 | -2.8178690042370241E-03,
60 | 5.9412165158665837E-05,
61 | 1.5281027305998130E-03,
62 | 1.0735374415587011E-03,
63 | -1.5424765040957284E-03
64 | ]
65 | }
66 |
--------------------------------------------------------------------------------
/test/validation/06-gradient-d3-bj.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/06-229.xyz
2 | --bj
3 | olyp
4 | --grad
5 | --noedisp
6 |
--------------------------------------------------------------------------------
/test/validation/07-bih3-nh3.tmol:
--------------------------------------------------------------------------------
1 | $coord
2 | 0.00000000000000E+00 0.00000000000000E+00 3.37965918862498E+00 Bi
3 | -2.70602581502430E+00 0.00000000000000E+00 5.33757376878306E+00 H
4 | 1.35301290751215E+00 -2.34348709910754E+00 5.33757376878306E+00 H
5 | 1.35301290751215E+00 2.34348709910754E+00 5.33757376878306E+00 H
6 | 0.00000000000000E+00 0.00000000000000E+00 -4.30897068337498E+00 N
7 | -8.84090853044590E-01 -1.53129027598015E+00 -5.02780367370401E+00 H
8 | -8.84090853044590E-01 1.53129027598015E+00 -5.02780367370401E+00 H
9 | 1.76818170608919E+00 0.00000000000000E+00 -5.02780367370401E+00 H
10 | $periodic 0
11 | $end
12 |
--------------------------------------------------------------------------------
/test/validation/07-gradient-d3-zero.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.4.2",
3 | "energy": -5.1821816925295637E-05,
4 | "virial": [
5 | -2.7545139487123090E-07,
6 | 5.7902642878711937E-22,
7 | 1.1603689632893872E-20,
8 | 4.9961708998202872E-22,
9 | -2.7545139487127982E-07,
10 | 3.8050308177439273E-22,
11 | 1.1808830424807023E-20,
12 | 3.8050308177439273E-22,
13 | 6.6952638494552022E-05
14 | ],
15 | "gradient": [
16 | 4.0368481844119133E-21,
17 | 1.3234889800848443E-23,
18 | -1.1658743436649658E-05,
19 | -1.4168004457027399E-07,
20 | -5.2939565514281013E-23,
21 | 5.5403189236693714E-06,
22 | 7.0840022285135819E-08,
23 | -1.2269851780715832E-07,
24 | 5.5403189236693689E-06,
25 | 7.0840022285135925E-08,
26 | 1.2269851780715826E-07,
27 | 5.5403189236693698E-06,
28 | -2.0878038660838419E-21,
29 | -3.3087224502121107E-24,
30 | -1.0168425107768889E-05,
31 | 1.6034102133727205E-07,
32 | 2.7771879549364048E-07,
33 | 1.7354039244701460E-06,
34 | 1.6034102133727205E-07,
35 | -2.7771879549364053E-07,
36 | 1.7354039244701458E-06,
37 | -3.2068204267454361E-07,
38 | -1.9128551665288765E-23,
39 | 1.7354039244701446E-06
40 | ]
41 | }
42 |
--------------------------------------------------------------------------------
/test/validation/07-gradient-d3-zero.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/07-bih3-nh3.tmol
2 | -i
3 | coord
4 | --zero
5 | m06l
6 | --grad
7 | 07-gradient-d3-zero.txt
8 | --noedisp
9 | --atm
10 | --property
11 |
--------------------------------------------------------------------------------
/test/validation/08-gradient-d3-bjm.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.4.2",
3 | "energy": -5.1194250741768621E-03,
4 | "virial": [
5 | 2.6237160771705632E-04,
6 | 8.4666226810823777E-05,
7 | 0.0000000000000000E+00,
8 | 8.4666226810823722E-05,
9 | 1.3766950133419834E-02,
10 | 0.0000000000000000E+00,
11 | 0.0000000000000000E+00,
12 | 0.0000000000000000E+00,
13 | 0.0000000000000000E+00
14 | ],
15 | "gradient": [
16 | 4.0863495652256887E-05,
17 | -1.7454500280934795E-03,
18 | 0.0000000000000000E+00,
19 | -6.1368795661468514E-05,
20 | -1.0204348374404155E-04,
21 | 0.0000000000000000E+00,
22 | -8.8642873359802203E-07,
23 | -3.2491449086100248E-05,
24 | 0.0000000000000000E+00,
25 | -3.0991017649668099E-05,
26 | 9.3770124435977735E-05,
27 | 0.0000000000000000E+00,
28 | 5.2382746392477759E-05,
29 | 1.7862148364876432E-03,
30 | 0.0000000000000000E+00
31 | ]
32 | }
33 |
--------------------------------------------------------------------------------
/test/validation/08-gradient-d3-bjm.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/08-teh2-hbr.mol
2 | --grad
3 | --noedisp
4 | --bjm
5 | pbe0
6 |
--------------------------------------------------------------------------------
/test/validation/08-teh2-hbr.mol:
--------------------------------------------------------------------------------
1 |
2 | 12282121313D
3 |
4 | 5 0 0 0 0 999 V2000
5 | 0.6870 -1.3881 0.0000 Te 0 0 0 0 0 0 0 0 0 0 0 0
6 | -0.8684 -0.8923 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
7 | 0.1933 -2.9475 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
8 | -0.6989 2.7551 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
9 | 0.6870 2.4729 0.0000 Br 0 0 0 0 0 0 0 0 0 0 0 0
10 | M END
11 |
--------------------------------------------------------------------------------
/test/validation/09-0a.pdb:
--------------------------------------------------------------------------------
1 | HETATM 1 H UNK A 1 3.029 -1.810 -4.528 1.00 0.00 H
2 | HETATM 2 O UNK A 1 2.626 -1.778 -3.646 1.00 0.00 O
3 | HETATM 3 C UNK A 1 1.986 -0.498 -3.493 1.00 0.00 C
4 | HETATM 4 H UNK A 1 1.300 -0.306 -4.327 1.00 0.00 H
5 | HETATM 5 H UNK A 1 2.734 0.306 -3.454 1.00 0.00 H
6 | HETATM 6 C UNK A 1 1.204 -0.497 -2.194 1.00 0.00 C
7 | HETATM 7 H UNK A 1 0.824 0.514 -2.016 1.00 0.00 H
8 | HETATM 8 O UNK A 1 0.046 -1.389 -2.290 1.00 0.00 O
9 | HETATM 9 C UNK A 1 0.166 -2.448 -1.339 1.00 0.00 C
10 | HETATM 10 H UNK A 1 -0.518 -2.290 -0.502 1.00 0.00 H
11 | HETATM 11 N UNK A 1 -0.265 -3.698 -1.967 1.00 0.00 N
12 | HETATM 12 C UNK A 1 0.462 -4.224 -3.012 1.00 0.00 C
13 | HETATM 13 H UNK A 1 1.328 -3.636 -3.300 1.00 0.00 H
14 | HETATM 14 C UNK A 1 0.110 -5.365 -3.650 1.00 0.00 C
15 | HETATM 15 H UNK A 1 0.706 -5.756 -4.464 1.00 0.00 H
16 | HETATM 16 C UNK A 1 -1.090 -6.062 -3.262 1.00 0.00 C
17 | HETATM 17 O UNK A 1 -1.531 -7.106 -3.756 1.00 0.00 O
18 | HETATM 18 N UNK A 1 -1.811 -5.416 -2.246 1.00 0.00 N
19 | HETATM 19 H UNK A 1 -2.687 -5.847 -1.962 1.00 0.00 H
20 | HETATM 20 C UNK A 1 -1.482 -4.257 -1.573 1.00 0.00 C
21 | HETATM 21 O UNK A 1 -2.210 -3.762 -0.715 1.00 0.00 O
22 | HETATM 22 C UNK A 1 1.996 -0.974 -0.976 1.00 0.00 C
23 | HETATM 23 H UNK A 1 3.070 -0.802 -1.068 1.00 0.00 H
24 | HETATM 24 C UNK A 1 1.628 -2.457 -0.853 1.00 0.00 C
25 | HETATM 25 H UNK A 1 2.250 -3.049 -1.528 1.00 0.00 H
26 | HETATM 26 O UNK A 1 1.787 -2.987 0.452 1.00 0.00 O
27 | HETATM 27 H UNK A 1 1.634 -2.253 1.088 1.00 0.00 H
28 | HETATM 28 O UNK A 1 1.496 -0.318 0.198 1.00 0.00 O
29 | HETATM 29 P UNK A 1 2.498 0.246 1.378 1.00 0.00 P
30 | HETATM 30 O UNK A 1 3.861 0.492 0.800 1.00 0.00 O
31 | HETATM 31 O UNK A 1 2.291 -0.633 2.577 1.00 0.00 O
32 | HETATM 32 O UNK A 1 1.734 1.647 1.703 1.00 0.00 O
33 | HETATM 33 C UNK A 1 1.874 2.737 0.766 1.00 0.00 C
34 | HETATM 34 H UNK A 1 1.900 2.355 -0.260 1.00 0.00 H
35 | HETATM 35 H UNK A 1 2.806 3.274 0.968 1.00 0.00 H
36 | HETATM 36 C UNK A 1 0.708 3.685 0.929 1.00 0.00 C
37 | HETATM 37 H UNK A 1 0.917 4.585 0.336 1.00 0.00 H
38 | HETATM 38 O UNK A 1 -0.510 3.073 0.419 1.00 0.00 O
39 | HETATM 39 C UNK A 1 -1.623 3.456 1.201 1.00 0.00 C
40 | HETATM 40 H UNK A 1 -2.407 3.881 0.571 1.00 0.00 H
41 | HETATM 41 N UNK A 1 -2.202 2.235 1.846 1.00 0.00 N
42 | HETATM 42 C UNK A 1 -1.545 1.032 1.859 1.00 0.00 C
43 | HETATM 43 H UNK A 1 -0.578 1.038 1.372 1.00 0.00 H
44 | HETATM 44 C UNK A 1 -2.069 -0.077 2.440 1.00 0.00 C
45 | HETATM 45 H UNK A 1 -1.527 -1.013 2.436 1.00 0.00 H
46 | HETATM 46 C UNK A 1 -3.360 -0.019 3.075 1.00 0.00 C
47 | HETATM 47 O UNK A 1 -3.952 -0.947 3.641 1.00 0.00 O
48 | HETATM 48 N UNK A 1 -3.960 1.249 3.010 1.00 0.00 N
49 | HETATM 49 H UNK A 1 -4.875 1.348 3.444 1.00 0.00 H
50 | HETATM 50 C UNK A 1 -3.456 2.391 2.427 1.00 0.00 C
51 | HETATM 51 O UNK A 1 -4.058 3.465 2.415 1.00 0.00 O
52 | HETATM 52 C UNK A 1 0.366 4.095 2.361 1.00 0.00 C
53 | HETATM 53 H UNK A 1 0.500 3.251 3.044 1.00 0.00 H
54 | HETATM 54 C UNK A 1 -1.124 4.464 2.245 1.00 0.00 C
55 | HETATM 55 H UNK A 1 -1.666 4.380 3.192 1.00 0.00 H
56 | HETATM 56 O UNK A 1 -1.254 5.775 1.695 1.00 0.00 O
57 | HETATM 57 H UNK A 1 -0.479 6.272 2.028 1.00 0.00 H
58 | HETATM 58 O UNK A 1 1.184 5.200 2.747 1.00 0.00 O
59 | HETATM 59 H UNK A 1 1.217 5.229 3.718 1.00 0.00 H
60 | END
61 |
--------------------------------------------------------------------------------
/test/validation/09-gradient-d3-zerom.resp:
--------------------------------------------------------------------------------
1 | --grad
2 | --zerom
3 | lcwpbe
4 | --noedisp
5 | $ORIGIN/09-0a.pdb
6 |
--------------------------------------------------------------------------------
/test/validation/10-but14diol.log:
--------------------------------------------------------------------------------
1 | 16
2 |
3 | C 1.57838535256826 0.14769003298993 0.34380907679758
4 | H 1.39475031154920 0.01296800289670 1.41354531574749
5 | O 1.35992930377113 -1.08620324262819 -0.35978208036551
6 | C 0.65384514605118 1.21509927142005 -0.22132204943731
7 | H 1.05782723628977 2.18028348701590 0.09392402098007
8 | H 0.72969316299356 1.18486426466637 -1.31143829293956
9 | C -0.81733418257017 1.15212725735382 0.20815604649638
10 | H -1.30352529117202 2.06573846142966 -0.14582803257401
11 | H -0.88376519740905 1.15976225905927 1.29926029021933
12 | H 1.98412044319842 -1.73444638742804 -0.02138500477683
13 | H 2.61628658440710 0.45894810251649 0.20654404613631
14 | C -1.62772536358947 -0.03405200760629 -0.31130106953617
15 | H -2.68422959958372 0.15101503373264 -0.11856602648442
16 | H -1.50186833547645 -0.11814602639060 -1.39750631216481
17 | O -1.32426229580410 -1.26015428148411 0.33337707446735
18 | H -0.41765109329187 -1.47531432954500 0.07663701711862
19 |
--------------------------------------------------------------------------------
/test/validation/10-gradient-d3-op.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.4.2",
3 | "energy": -3.2983249134201482E-02,
4 | "virial": [
5 | 2.5035005460326588E-02,
6 | 1.2225114345056740E-04,
7 | 1.5178673394213936E-03,
8 | 1.2225114345056735E-04,
9 | 1.8821123253468526E-02,
10 | 2.9332081077463186E-04,
11 | 1.5178673394213938E-03,
12 | 2.9332081077463175E-04,
13 | 7.4600943408629035E-03
14 | ],
15 | "gradient": [
16 | 9.7744278039912013E-04,
17 | -2.9673373955269967E-05,
18 | 1.6819815836083930E-04,
19 | 5.7919154325742912E-04,
20 | -9.3494543727091573E-05,
21 | 7.0335037450553037E-04,
22 | 7.8459902771178531E-04,
23 | -7.7212285413402954E-04,
24 | -1.6750860731383629E-04,
25 | 4.5938368627132536E-04,
26 | 7.7421799923310392E-04,
27 | -1.5739109840434576E-04,
28 | 3.1958034528880859E-04,
29 | 6.7843388435763724E-04,
30 | -8.5239131829020155E-05,
31 | 3.5360023058058791E-04,
32 | 4.8696608541225623E-04,
33 | -6.8820392421219373E-04,
34 | -5.4589094175245927E-04,
35 | 6.8100089966668964E-04,
36 | 1.3296472955027166E-04,
37 | -3.8235192507077309E-04,
38 | 6.5181830552226458E-04,
39 | 6.1385886970043862E-05,
40 | -4.0259809127954132E-04,
41 | 4.8985566043090287E-04,
42 | 6.7946489957478224E-04,
43 | 3.9915720927268200E-04,
44 | -5.6578016678295983E-04,
45 | -1.1531328071715678E-04,
46 | 6.3835553359891035E-04,
47 | 4.5061797122802926E-05,
48 | 1.2171183274245401E-04,
49 | -9.0995546590162213E-04,
50 | -2.3347444526543388E-04,
51 | -1.4351087847486478E-04,
52 | -6.4982704305320820E-04,
53 | -1.2246938448998499E-04,
54 | -8.2938726114956815E-05,
55 | -5.8783398056615047E-04,
56 | -2.3281988265250745E-04,
57 | -6.2284267282932163E-04,
58 | -6.9683561159152735E-04,
59 | -8.4285836633574097E-04,
60 | 1.4394611663427436E-04,
61 | -3.3601729716536673E-04,
62 | -9.1466161440263976E-04,
63 | 5.1926321557500229E-05
64 | ]
65 | }
66 |
--------------------------------------------------------------------------------
/test/validation/10-gradient-d3-op.resp:
--------------------------------------------------------------------------------
1 | --input
2 | xyz
3 | $ORIGIN/10-but14diol.log
4 | --op
5 | revpbe0
6 | --noedisp
7 | --grad
8 |
--------------------------------------------------------------------------------
/test/validation/11-cf3br-benzene.xyz:
--------------------------------------------------------------------------------
1 | 17
2 |
3 | H 0.00214419447896 0.36104355564729 0.02979971565645
4 | C 0.01502059535519 0.27478979938055 1.10764826341843
5 | C 1.22763293221973 0.29665510626467 1.79462982787138
6 | C 1.24395910386655 0.18370283203421 3.18370464515283
7 | C 0.04795822371256 0.04891501292628 3.88648545113490
8 | C -1.16513591425960 0.02695435402087 3.20021399584057
9 | C -1.18183234698913 0.13982867423392 1.81037699138887
10 | H 2.15580838854882 0.39917712616529 1.24944186409125
11 | H 2.18497983206493 0.19859859736151 3.71617159109143
12 | H 0.06093467561114 -0.04067276508519 4.96401536082571
13 | H -2.09322106956852 -0.07862897656357 3.74512589255903
14 | H -2.12284591118590 0.12325714653229 1.27764608239131
15 | Br -0.26832596693670 -3.19420973749938 1.99445939550786
16 | C 0.04999994416862 -5.08919861078823 1.92939160197349
17 | F 0.07894961863519 -5.51244256632939 0.67185171307336
18 | F 1.21198420772423 -5.38399750263827 2.49866503913365
19 | F -0.90998760826642 -5.74374861099686 2.57072231222928
20 |
--------------------------------------------------------------------------------
/test/validation/11-pairwise-d3-bj.resp:
--------------------------------------------------------------------------------
1 | --pair-resolved
2 | --bj-param
3 | 1.0
4 | 2.9491
5 | 0.4466
6 | 6.1742
7 | $ORIGIN/11-cf3br-benzene.xyz
8 | --noedisp
9 |
--------------------------------------------------------------------------------
/test/validation/12-butane.gen:
--------------------------------------------------------------------------------
1 | 14 C
2 | C H
3 | 1 1 5.90548087290348E-01 1.43771521259008E+00 -5.12024504205641E-01
4 | 2 2 -3.44397051005888E-01 1.99735829569539E+00 -5.55829510682569E-01
5 | 3 2 7.03646103992809E-01 9.05509134074616E-01 -1.45472364400404E+00
6 | 4 2 1.40578620794351E+00 2.15594231891721E+00 -4.40925493786247E-01
7 | 5 1 5.90548087290348E-01 4.83546071681767E-01 6.76488671646776E-01
8 | 6 2 1.52076822504862E+00 -8.97620130969553E-02 6.86161672810807E-01
9 | 7 2 5.75510085299898E-01 1.06333915739483E+00 1.60085280822090E+00
10 | 8 1 -5.90548087290348E-01 -4.83546071681767E-01 6.76488671646776E-01
11 | 9 2 -1.52076822504862E+00 8.97620130969553E-02 6.86161672810807E-01
12 | 10 2 -5.75510085299898E-01 -1.06333915739483E+00 1.60085280822090E+00
13 | 11 1 -5.90548087290348E-01 -1.43771521259008E+00 -5.12024504205641E-01
14 | 12 2 3.44397051005888E-01 -1.99735829569539E+00 -5.55829510682569E-01
15 | 13 2 -1.40578620794351E+00 -2.15594231891721E+00 -4.40925493786247E-01
16 | 14 2 -7.03646103992809E-01 -9.05509134074616E-01 -1.45472364400404E+00
17 |
--------------------------------------------------------------------------------
/test/validation/12-pairwise-d3-zero.resp:
--------------------------------------------------------------------------------
1 | --pair-resolved
2 | $ORIGIN/12-butane.gen
3 | --zero-param
4 | 1.0
5 | 1.764
6 | 0.806
7 | --atm
8 | --noedisp
9 |
--------------------------------------------------------------------------------
/test/validation/13-c60.coord:
--------------------------------------------------------------------------------
1 | $coord
2 | -2.33619927251900E+00 0.00000000000000E+00 6.29274336133455E+00 C
3 | -7.21925277454760E-01 -2.22185754149319E+00 6.29274336133455E+00 C
4 | 1.89002491371426E+00 -1.37318347880308E+00 6.29274336133455E+00 C
5 | 1.89002491371426E+00 1.37318347880308E+00 6.29274336133455E+00 C
6 | -7.21925277454760E-01 2.22185754149319E+00 6.29274336133455E+00 C
7 | 4.43015231296584E+00 -4.91604218629124E+00 1.12371070968761E+00 C
8 | 6.04442630803008E+00 -2.69418464479805E+00 1.12371070968761E+00 C
9 | 5.59825194922534E+00 -1.32100116599497E+00 3.45990998220660E+00 C
10 | 3.70822703551107E+00 -2.69418464479805E+00 4.90376053711613E+00 C
11 | 2.98630175805632E+00 -4.91604218629124E+00 3.45990998220660E+00 C
12 | 6.04442630803008E+00 2.69418464479805E+00 1.12371070968761E+00 C
13 | 4.43015231296584E+00 4.91604218629124E+00 1.12371070968761E+00 C
14 | 2.98630175805632E+00 4.91604218629124E+00 3.45990998220660E+00 C
15 | 3.70822703551107E+00 2.69418464479805E+00 4.90376053711613E+00 C
16 | 5.59825194922534E+00 1.32100116599497E+00 3.45990998220660E+00 C
17 | -6.94491412109200E-01 6.58113986874450E+00 1.12371070968761E+00 C
18 | -3.30644160327823E+00 5.73246580605438E+00 1.12371070968761E+00 C
19 | -3.75261596208297E+00 4.35928232725129E+00 3.45990998220660E+00 C
20 | -1.41641668956397E+00 4.35928232725129E+00 4.90376053711613E+00 C
21 | 4.73608224150290E-01 5.73246580605438E+00 3.45990998220660E+00 C
22 | -6.47364560560848E+00 1.37318347880308E+00 1.12371070968761E+00 C
23 | -6.47364560560848E+00 -1.37318347880308E+00 1.12371070968761E+00 C
24 | -5.30554596934898E+00 -2.22185754149319E+00 3.45990998220660E+00 C
25 | -4.58362069189423E+00 0.00000000000000E+00 4.90376053711613E+00 C
26 | -5.30554596934898E+00 2.22185754149319E+00 3.45990998220660E+00 C
27 | -3.30644160327823E+00 -5.73246580605438E+00 1.12371070968761E+00 C
28 | -6.94491412109200E-01 -6.58113986874450E+00 1.12371070968761E+00 C
29 | 4.73608224150290E-01 -5.73246580605438E+00 3.45990998220660E+00 C
30 | -1.41641668956397E+00 -4.35928232725129E+00 4.90376053711613E+00 C
31 | -3.75261596208297E+00 -4.35928232725129E+00 3.45990998220660E+00 C
32 | -4.73608224150290E-01 -5.73246580605438E+00 -3.45990998220660E+00 C
33 | 1.41641668956397E+00 -4.35928232725129E+00 -4.90376053711613E+00 C
34 | 3.75261596208297E+00 -4.35928232725129E+00 -3.45990998220660E+00 C
35 | 3.30644160327823E+00 -5.73246580605438E+00 -1.12371070968761E+00 C
36 | 6.94491412109200E-01 -6.58113986874450E+00 -1.12371070968761E+00 C
37 | 5.30554596934897E+00 -2.22185754149319E+00 -3.45990998220660E+00 C
38 | 4.58362069189423E+00 0.00000000000000E+00 -4.90376053711613E+00 C
39 | 5.30554596934897E+00 2.22185754149319E+00 -3.45990998220660E+00 C
40 | 6.47364560560848E+00 1.37318347880308E+00 -1.12371070968761E+00 C
41 | 6.47364560560848E+00 -1.37318347880308E+00 -1.12371070968761E+00 C
42 | 3.75261596208297E+00 4.35928232725129E+00 -3.45990998220660E+00 C
43 | 1.41641668956397E+00 4.35928232725129E+00 -4.90376053711613E+00 C
44 | -4.73608224150290E-01 5.73246580605438E+00 -3.45990998220660E+00 C
45 | 6.94491412109200E-01 6.58113986874450E+00 -1.12371070968761E+00 C
46 | 3.30644160327823E+00 5.73246580605438E+00 -1.12371070968761E+00 C
47 | -2.98630175805631E+00 4.91604218629124E+00 -3.45990998220660E+00 C
48 | -3.70822703551107E+00 2.69418464479805E+00 -4.90376053711613E+00 C
49 | -5.59825194922534E+00 1.32100116599497E+00 -3.45990998220660E+00 C
50 | -6.04442630803008E+00 2.69418464479805E+00 -1.12371070968761E+00 C
51 | -4.43015231296584E+00 4.91604218629124E+00 -1.12371070968761E+00 C
52 | -5.59825194922534E+00 -1.32100116599497E+00 -3.45990998220660E+00 C
53 | -3.70822703551107E+00 -2.69418464479805E+00 -4.90376053711613E+00 C
54 | -2.98630175805631E+00 -4.91604218629124E+00 -3.45990998220660E+00 C
55 | -4.43015231296584E+00 -4.91604218629124E+00 -1.12371070968761E+00 C
56 | -6.04442630803008E+00 -2.69418464479805E+00 -1.12371070968761E+00 C
57 | -1.89002491371426E+00 -1.37318347880308E+00 -6.29274336133455E+00 C
58 | -1.89002491371426E+00 1.37318347880308E+00 -6.29274336133455E+00 C
59 | 7.21925277454750E-01 2.22185754149319E+00 -6.29274336133455E+00 C
60 | 2.33619927251900E+00 0.00000000000000E+00 -6.29274336133455E+00 C
61 | 7.21925277454750E-01 -2.22185754149319E+00 -6.29274336133455E+00 C
62 | $periodic 0
63 | $end
64 |
--------------------------------------------------------------------------------
/test/validation/13-pairwise-d3-bjm.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/13-c60.coord
2 | --pair-resolved
3 | --atm-scale
4 | 2.0
5 | --noedisp
6 | --bjm-param
7 | 1.0
8 | 1.206988
9 | 0.240184
10 | 3.864426
11 |
--------------------------------------------------------------------------------
/test/validation/14-anthracene2.xyz:
--------------------------------------------------------------------------------
1 | 48
2 |
3 | C -1.39370912681838 -2.33772886011298 1.81573292454493
4 | C -0.69752106544700 -3.45600969709632 2.27580522165332
5 | C 0.69752106544700 -3.45600969709632 2.27580522165332
6 | C 1.39370912681838 -2.33772886011298 1.81573292454493
7 | C 0.70122881940877 -1.22202532492336 1.34910933817675
8 | C -0.70122881940877 -1.22202532492336 1.34910933817675
9 | C 1.38857656747876 0.00000000000000 0.80473286324757
10 | C -1.38857656747876 0.00000000000000 0.80473286324757
11 | C -0.70122881940877 1.22202532492336 1.34910933817675
12 | C 0.70122881940877 1.22202532492336 1.34910933817675
13 | C -1.39370912681838 2.33772886011298 1.81573292454493
14 | C 1.39370912681838 2.33772886011298 1.81573292454493
15 | C -0.69752106544700 3.45600969709632 2.27580522165332
16 | C 0.69752106544700 3.45600969709632 2.27580522165332
17 | C -1.39370912681838 2.33772886011298 -1.81573292454493
18 | C -0.69752106544700 3.45600969709632 -2.27580522165332
19 | C 0.69752106544700 3.45600969709632 -2.27580522165332
20 | C 1.39370912681838 2.33772886011298 -1.81573292454493
21 | C 0.70122881940877 1.22202532492336 -1.34910933817675
22 | C -0.70122881940877 1.22202532492336 -1.34910933817675
23 | C 1.38857656747876 0.00000000000000 -0.80473286324757
24 | C -1.38857656747876 0.00000000000000 -0.80473286324757
25 | C -0.70122881940877 -1.22202532492336 -1.34910933817675
26 | C 0.70122881940877 -1.22202532492336 -1.34910933817675
27 | C -1.39370912681838 -2.33772886011298 -1.81573292454493
28 | C 1.39370912681838 -2.33772886011298 -1.81573292454493
29 | C -0.69752106544700 -3.45600969709632 -2.27580522165332
30 | C 0.69752106544700 -3.45600969709632 -2.27580522165332
31 | H -2.47672320084633 -2.33198425611387 1.81707515304807
32 | H -1.23953134231498 -4.31875373833059 2.63685703865411
33 | H 1.23953134231498 -4.31875373833059 2.63685703865411
34 | H 2.47672320084633 -2.33198425611387 1.81707515304807
35 | H 2.43320867626217 0.00000000000000 1.11849829030884
36 | H -2.43320867626217 0.00000000000000 1.11849829030884
37 | H -2.47672320084633 2.33198425611387 1.81707515304807
38 | H 2.47672320084633 2.33198425611387 1.81707515304807
39 | H -1.23953134231498 4.31875373833059 2.63685703865411
40 | H 1.23953134231498 4.31875373833059 2.63685703865411
41 | H -2.47672320084633 2.33198425611387 -1.81707515304807
42 | H -1.23953134231498 4.31875373833059 -2.63685703865411
43 | H 1.23953134231498 4.31875373833059 -2.63685703865411
44 | H 2.47672320084633 2.33198425611387 -1.81707515304807
45 | H 2.43320867626217 0.00000000000000 -1.11849829030884
46 | H -2.43320867626217 0.00000000000000 -1.11849829030884
47 | H -2.47672320084633 -2.33198425611387 -1.81707515304807
48 | H 2.47672320084633 -2.33198425611387 -1.81707515304807
49 | H -1.23953134231498 -4.31875373833059 -2.63685703865411
50 | H 1.23953134231498 -4.31875373833059 -2.63685703865411
51 |
--------------------------------------------------------------------------------
/test/validation/14-pairwise-d3-zerom.resp:
--------------------------------------------------------------------------------
1 | --zerom-param
2 | 1.0
3 | 1.841686
4 | 1.279637
5 | 0.014370
6 | --pair-resolved
7 | --noedisp
8 | $ORIGIN/14-anthracene2.xyz
9 | --atm-scale
10 | 0.5
11 |
--------------------------------------------------------------------------------
/test/validation/15-pairwise-d3-op.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/15-pxylene.mol
2 | --noedisp
3 | --op-param
4 | 1.0
5 | 0.27632
6 | 0.700
7 | 2.500
8 | 8.0
9 | --pair-resolved
10 | --verbose
11 |
--------------------------------------------------------------------------------
/test/validation/15-pxylene.mol:
--------------------------------------------------------------------------------
1 |
2 | 12292117023D
3 |
4 | 18 0 0 0 0 999 V2000
5 | 0.0000 1.4218 0.0069 C 0 0 0 0 0 0 0 0 0 0 0 0
6 | 0.0000 0.6966 -1.1955 C 0 0 0 0 0 0 0 0 0 0 0 0
7 | 0.0000 -0.6966 -1.1955 C 0 0 0 0 0 0 0 0 0 0 0 0
8 | 0.0000 -1.4218 0.0069 C 0 0 0 0 0 0 0 0 0 0 0 0
9 | 0.0000 -0.6992 1.2046 C 0 0 0 0 0 0 0 0 0 0 0 0
10 | 0.0000 0.6992 1.2046 C 0 0 0 0 0 0 0 0 0 0 0 0
11 | 0.0000 2.9284 -0.0009 C 0 0 0 0 0 0 0 0 0 0 0 0
12 | 0.0000 -2.9284 -0.0009 C 0 0 0 0 0 0 0 0 0 0 0 0
13 | 0.0000 1.2362 -2.1454 H 0 0 0 0 0 0 0 0 0 0 0 0
14 | 0.0000 -1.2362 -2.1454 H 0 0 0 0 0 0 0 0 0 0 0 0
15 | 0.0000 -1.2402 2.1533 H 0 0 0 0 0 0 0 0 0 0 0 0
16 | 0.0000 1.2402 2.1533 H 0 0 0 0 0 0 0 0 0 0 0 0
17 | 0.0000 3.3297 1.0217 H 0 0 0 0 0 0 0 0 0 0 0 0
18 | -0.8856 3.3232 -0.5224 H 0 0 0 0 0 0 0 0 0 0 0 0
19 | 0.8856 3.3232 -0.5224 H 0 0 0 0 0 0 0 0 0 0 0 0
20 | 0.0000 -3.3297 1.0217 H 0 0 0 0 0 0 0 0 0 0 0 0
21 | -0.8856 -3.3232 -0.5224 H 0 0 0 0 0 0 0 0 0 0 0 0
22 | 0.8856 -3.3232 -0.5224 H 0 0 0 0 0 0 0 0 0 0 0 0
23 | M END
24 |
--------------------------------------------------------------------------------
/test/validation/16-db-d3-bj.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.1",
3 | "energy": -7.5474602132487828E-02,
4 | "damping parameters": {
5 | "damping": "rational",
6 | "s6": 1.0000000000000000E+00,
7 | "s8": 2.1166999999999998E+00,
8 | "s9": 1.0000000000000000E+00,
9 | "a1": 1.9860000000000000E-01,
10 | "a2": 5.3875000000000002E+00,
11 | "alp": 1.4000000000000000E+01
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/test/validation/16-db-d3-bj.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/16-i10e.gen
2 | --db
3 | $ORIGIN/../../assets/parameters.toml
4 | --bj
5 | b1lyp
6 | --noedisp
7 |
--------------------------------------------------------------------------------
/test/validation/16-i10e.gen:
--------------------------------------------------------------------------------
1 | 35 C
2 | C O H
3 | 1 1 -1.67936522430125E+00 1.08308283826864E+00 4.84431093716762E-01
4 | 2 1 -2.98062597153404E+00 1.59983562844350E+00 4.35878244911889E-01
5 | 3 1 -4.03589260336344E+00 8.12719147757933E-01 -2.39166264555231E-02
6 | 4 1 -3.79243172939078E+00 -4.96379097784745E-01 -4.47218935814005E-01
7 | 5 1 -2.49170790672094E+00 -1.00649405749627E+00 -3.91369922738649E-01
8 | 6 1 -1.41112046751654E+00 -2.48337261985126E-01 8.00232375785927E-02
9 | 7 2 -7.08410725399516E-01 1.93974681597795E+00 9.47658400709087E-01
10 | 8 1 1.00175446557284E-02 -8.37288094112689E-01 2.37610224362558E-01
11 | 9 1 1.01290445771239E+00 1.01257322918909E-01 -4.88334073518622E-01
12 | 10 1 2.24811850488681E+00 4.64851779469988E-01 -6.52417238581525E-02
13 | 11 1 4.98682344804346E-01 5.72617347049681E-01 -1.84644280452077E+00
14 | 12 1 3.09508172644334E+00 1.45847088423451E+00 -8.40808850769755E-01
15 | 13 1 2.96973215859345E+00 -7.32795335138893E-02 1.16148539782041E+00
16 | 14 1 1.53351952363722E-01 -2.23213086842874E+00 -4.14158237678017E-01
17 | 15 3 1.71199513559968E-01 1.57437151233529E+00 7.28573240802039E-01
18 | 16 1 1.97030943164675E-01 -1.02271438354840E+00 1.76971851315035E+00
19 | 17 3 -3.13996657251056E+00 2.62658608169951E+00 7.57446923057343E-01
20 | 18 3 -5.04218980479219E+00 1.22597044785055E+00 -5.70321400764462E-02
21 | 19 3 -4.60394001082101E+00 -1.11863049690268E+00 -8.18213523828763E-01
22 | 20 3 -2.31885367174931E+00 -2.02687757076236E+00 -7.21874642708823E-01
23 | 21 3 1.30592481541993E+00 6.50891618151859E-01 -2.58170195553037E+00
24 | 22 3 -2.47083324734581E-01 -1.28272602483595E-01 -2.23543246542392E+00
25 | 23 3 7.28034163046715E-04 1.55036230911348E+00 -1.77915092694647E+00
26 | 24 3 2.52524923611538E+00 2.06411791339638E+00 -1.55038225899906E+00
27 | 25 3 3.89518581475161E+00 9.39128936725803E-01 -1.39327388302125E+00
28 | 26 3 3.59412710537457E+00 2.14001304861454E+00 -1.37102600524808E-01
29 | 27 3 2.92766126354986E+00 -1.16604844631395E+00 1.21442522632092E+00
30 | 28 3 4.02762176256008E+00 2.14022115960063E-01 1.12263150530791E+00
31 | 29 3 2.55918115234079E+00 3.18842993219727E-01 2.10053375790487E+00
32 | 30 3 1.18423495064797E+00 -2.58010672752542E+00 -2.78475129977319E-01
33 | 31 3 -5.19791318195689E-01 -2.95756617706091E+00 6.05040795721514E-02
34 | 32 3 -6.67495789203908E-02 -2.20393653944657E+00 -1.48757386127731E+00
35 | 33 3 1.07951247290137E+00 -1.62071554866583E+00 2.00980367323215E+00
36 | 34 3 2.63704477643954E-01 -6.32534533725885E-02 2.29251347659595E+00
37 | 35 3 -6.81121321702816E-01 -1.55485788178446E+00 2.15446756862500E+00
38 |
--------------------------------------------------------------------------------
/test/validation/17-db-d3-zero.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.4.2",
3 | "energy": -2.0129634599802857E-02
4 | }
5 |
--------------------------------------------------------------------------------
/test/validation/17-db-d3-zero.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/17-li2-ch4.sdf
2 | --db
3 | $ORIGIN/../../assets/parameters.toml
4 | --zero
5 | pkzb
6 | --noedisp
7 |
--------------------------------------------------------------------------------
/test/validation/17-li2-ch4.sdf:
--------------------------------------------------------------------------------
1 |
2 | 12292117033D
3 |
4 | 7 0 0 0 0 999 V2000
5 | 0.1423 -0.1047 0.7355 C 0 0 0 0 0 0 0 0 0 0 0 0
6 | -0.4296 -0.9472 -1.0953 Li 0 0 0 0 0 0 0 0 0 0 0 0
7 | 0.0418 1.2151 -0.9034 Li 0 0 0 0 0 0 0 0 0 0 0 0
8 | -0.4512 0.3072 -2.3128 H 0 0 0 0 0 0 0 0 0 0 0 0
9 | 0.4429 0.8013 1.2863 H 0 0 0 0 0 0 0 0 0 0 0 0
10 | 0.9620 -0.8011 0.9616 H 0 0 0 0 0 0 0 0 0 0 0 0
11 | -0.7082 -0.4705 1.3281 H 0 0 0 0 0 0 0 0 0 0 0 0
12 | M END
13 | $$$$
14 |
--------------------------------------------------------------------------------
/test/validation/18-c1.pdb:
--------------------------------------------------------------------------------
1 | HETATM 1 C UNK A 1 -2.849 -0.995 -0.111 1.00 0.00 C
2 | HETATM 2 C UNK A 1 -1.492 -0.804 0.589 1.00 0.00 C
3 | HETATM 3 C UNK A 1 -0.357 -0.523 -0.404 1.00 0.00 C
4 | HETATM 4 C UNK A 1 1.013 -0.217 0.240 1.00 0.00 C
5 | HETATM 5 C UNK A 1 1.164 1.314 0.056 1.00 0.00 C
6 | HETATM 6 O UNK A 1 0.621 2.032 1.150 1.00 0.00 O
7 | HETATM 7 C UNK A 1 0.406 1.539 -1.253 1.00 0.00 C
8 | HETATM 8 O UNK A 1 -3.398 0.261 -0.501 1.00 0.00 O
9 | HETATM 9 O UNK A 1 1.996 -0.958 -0.475 1.00 0.00 O
10 | HETATM 10 O UNK A 1 -1.611 0.253 1.551 1.00 0.00 O
11 | HETATM 11 O UNK A 1 -0.711 0.631 -1.198 1.00 0.00 O
12 | HETATM 12 C UNK A 1 3.249 -1.056 0.190 1.00 0.00 C
13 | HETATM 13 H UNK A 1 -2.742 -1.675 -0.967 1.00 0.00 H
14 | HETATM 14 H UNK A 1 -3.568 -1.432 0.588 1.00 0.00 H
15 | HETATM 15 H UNK A 1 -1.239 -1.722 1.136 1.00 0.00 H
16 | HETATM 16 H UNK A 1 -0.236 -1.393 -1.064 1.00 0.00 H
17 | HETATM 17 H UNK A 1 1.043 -0.480 1.306 1.00 0.00 H
18 | HETATM 18 H UNK A 1 2.213 1.611 -0.030 1.00 0.00 H
19 | HETATM 19 H UNK A 1 -0.187 1.571 1.447 1.00 0.00 H
20 | HETATM 20 H UNK A 1 0.015 2.554 -1.343 1.00 0.00 H
21 | HETATM 21 H UNK A 1 1.036 1.299 -2.120 1.00 0.00 H
22 | HETATM 22 H UNK A 1 -2.754 0.679 -1.100 1.00 0.00 H
23 | HETATM 23 H UNK A 1 -2.363 0.796 1.253 1.00 0.00 H
24 | HETATM 24 H UNK A 1 3.724 -0.076 0.329 1.00 0.00 H
25 | HETATM 25 H UNK A 1 3.137 -1.537 1.172 1.00 0.00 H
26 | HETATM 26 H UNK A 1 3.890 -1.674 -0.442 1.00 0.00 H
27 | END
28 |
--------------------------------------------------------------------------------
/test/validation/18-db-d3-bjm.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.1",
3 | "energy": -7.0407406164846739E-02,
4 | "damping parameters": {
5 | "damping": "rational",
6 | "s6": 1.0000000000000000E+00,
7 | "s8": 1.8750070000000001E+00,
8 | "s9": 1.0000000000000000E+00,
9 | "a1": 4.4848600000000000E-01,
10 | "a2": 3.6106790000000002E+00,
11 | "alp": 1.4000000000000000E+01
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/test/validation/18-db-d3-bjm.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/18-c1.pdb
2 | --db
3 | $ORIGIN/../../assets/parameters.toml
4 | --bjm
5 | blyp
6 | --noedisp
7 |
--------------------------------------------------------------------------------
/test/validation/19-db-d3-zerom.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.1",
3 | "energy": -1.8667013017417262E-02,
4 | "damping parameters": {
5 | "damping": "mzero",
6 | "s6": 6.4000000000000001E-01,
7 | "s8": 7.1754300000000004E-01,
8 | "s9": 1.0000000000000000E+00,
9 | "rs6": 1.3131340000000000E+00,
10 | "rs8": 1.0000000000000000E+00,
11 | "alp": 1.4000000000000000E+01,
12 | "bet": 1.6035000000000001E-02
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/test/validation/19-db-d3-zerom.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/19-g1.mol
2 | --db
3 | $ORIGIN/../../assets/parameters.toml
4 | --zerom
5 | b2plyp
6 | --noedisp
7 | --silent
8 |
--------------------------------------------------------------------------------
/test/validation/19-g1.mol:
--------------------------------------------------------------------------------
1 |
2 | 12292117043D
3 |
4 | 24 0 0 0 0 999 V2000
5 | -0.6161 -1.4619 -0.2608 C 0 0 0 0 0 0 0 0 0 0 0 0
6 | 0.6836 -1.1582 0.2331 O 0 0 0 0 0 0 0 0 0 0 0 0
7 | 1.1957 0.1013 -0.2401 C 0 0 0 0 0 0 0 0 0 0 0 0
8 | 0.2819 1.2348 0.2464 C 0 0 0 0 0 0 0 0 0 0 0 0
9 | -1.6181 -0.4151 0.2311 C 0 0 0 0 0 0 0 0 0 0 0 0
10 | -1.1564 0.9720 -0.2016 C 0 0 0 0 0 0 0 0 0 0 0 0
11 | -1.9650 2.0056 0.3552 O 0 0 0 0 0 0 0 0 0 0 0 0
12 | 0.7704 2.4575 -0.2897 O 0 0 0 0 0 0 0 0 0 0 0 0
13 | 2.6233 0.2071 0.2840 C 0 0 0 0 0 0 0 0 0 0 0 0
14 | 3.4370 -0.8581 -0.1888 O 0 0 0 0 0 0 0 0 0 0 0 0
15 | -2.8848 1.8437 0.0882 H 0 0 0 0 0 0 0 0 0 0 0 0
16 | 0.1142 3.1456 -0.0881 H 0 0 0 0 0 0 0 0 0 0 0 0
17 | 3.0083 -1.6870 0.0796 H 0 0 0 0 0 0 0 0 0 0 0 0
18 | -1.0201 -2.6988 0.2495 O 0 0 0 0 0 0 0 0 0 0 0 0
19 | -2.9147 -0.6133 -0.3250 O 0 0 0 0 0 0 0 0 0 0 0 0
20 | -1.1949 1.0271 -1.3014 H 0 0 0 0 0 0 0 0 0 0 0 0
21 | 0.3048 1.2659 1.3472 H 0 0 0 0 0 0 0 0 0 0 0 0
22 | 1.2182 0.0950 -1.3413 H 0 0 0 0 0 0 0 0 0 0 0 0
23 | 3.0736 1.1340 -0.0765 H 0 0 0 0 0 0 0 0 0 0 0 0
24 | -0.4583 -3.3987 -0.1199 H 0 0 0 0 0 0 0 0 0 0 0 0
25 | -3.2449 -1.4775 -0.0302 H 0 0 0 0 0 0 0 0 0 0 0 0
26 | -0.5898 -1.4791 -1.3641 H 0 0 0 0 0 0 0 0 0 0 0 0
27 | -1.6537 -0.4710 1.3285 H 0 0 0 0 0 0 0 0 0 0 0 0
28 | 2.6059 0.2291 1.3848 H 0 0 0 0 0 0 0 0 0 0 0 0
29 | M END
30 |
--------------------------------------------------------------------------------
/test/validation/20-db-d3-op.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.1",
3 | "energy": -1.5521531426306081E-02,
4 | "damping parameters": {
5 | "damping": "optimizedpower",
6 | "s6": 1.0000000000000000E+00,
7 | "s8": 9.0742999999999996E-01,
8 | "s9": 1.0000000000000000E+00,
9 | "a1": 6.9999999999999996E-01,
10 | "a2": 4.0000000000000000E+00,
11 | "alp": 1.4000000000000000E+01,
12 | "bet": 2.0000000000000000E+00
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/test/validation/20-db-d3-op.resp:
--------------------------------------------------------------------------------
1 | $ORIGIN/20-i21p.tmol
2 | --db
3 | $ORIGIN/../../assets/parameters.toml
4 | --op
5 | ms2
6 | --noedisp
7 |
--------------------------------------------------------------------------------
/test/validation/20-i21p.tmol:
--------------------------------------------------------------------------------
1 | $coord
2 | 1.18217363750496E+00 -4.23605921475857E+00 -1.62744549958430E-01 C
3 | -3.31612599015600E-01 -6.09709239402187E+00 6.38506538049940E-01 C
4 | -1.81360402882818E+00 -5.74109226084406E+00 2.02295698607452E+00 H
5 | -1.14480038564870E-01 -8.02504590952073E+00 -4.94244935082500E-02 H
6 | 3.23449602631604E+00 -4.62624593837025E+00 -2.09364462051153E+00 C
7 | 5.09825087059155E+00 -4.22580157407601E+00 -1.27194052533186E+00 H
8 | 3.21807493042316E+00 -6.56432913161505E+00 -2.82359885341861E+00 H
9 | 2.99727065205589E+00 -3.30698204399135E+00 -3.68035931677542E+00 H
10 | 8.92895838530720E-01 -1.58611734807097E+00 8.95289371200640E-01 C
11 | 4.95493484152230E-01 3.26375054775580E-01 -1.09243461844882E+00 N
12 | -1.95580767797953E+00 1.06911591158710E-01 -2.41193082618930E+00 C
13 | -4.18237930064933E+00 7.21106940695950E-01 -7.16898369850520E-01 C
14 | -5.86237233817309E+00 -1.18130260528022E+00 3.49169165285500E-02 C
15 | -7.89621636720549E+00 -6.28237498915610E-01 1.63332814822680E+00 C
16 | -8.25623206421458E+00 1.84132632670170E+00 2.49974816777531E+00 C
17 | -6.57965608097678E+00 3.75172074765815E+00 1.75877604696212E+00 C
18 | -4.55323578440726E+00 3.19796568242815E+00 1.59910502449800E-01 C
19 | -5.56629416778528E+00 -3.10420895975522E+00 -6.37199908361940E-01 H
20 | -9.19104797878862E+00 -2.12204274019853E+00 2.20259806102756E+00 H
21 | -9.83460213762020E+00 2.27861838701514E+00 3.74411851688031E+00 H
22 | -6.86069635724350E+00 5.67860184232938E+00 2.42248766889617E+00 H
23 | -3.24409994787005E+00 4.66785276213836E+00 -4.32497045914540E-01 H
24 | 1.86282614450866E+00 2.51626261463455E+00 -1.40125762031410E+00 C
25 | 4.46534911188674E+00 2.71132793753365E+00 -3.71493323424800E-01 C
26 | 1.04298607161189E+00 4.37058073176216E+00 -2.56303694130439E+00 O
27 | 5.84381784318815E+00 4.85525109581606E+00 9.41238574846600E-02 C
28 | 8.30156966991591E+00 4.08415843845119E+00 8.88012733404340E-01 C
29 | 8.25926096542766E+00 1.50094416206587E+00 8.24755872282320E-01 C
30 | 5.14149010828354E+00 6.76081518939670E+00 -1.40080188859270E-01 H
31 | 9.88844743840402E+00 5.25587842224348E+00 1.42191290158233E+00 H
32 | 5.97691650475889E+00 6.02606870961650E-01 7.05875292048900E-02 O
33 | 1.05425747461535E+01 -7.18018827183520E-01 1.49525978781636E+00 Cl
34 | -7.46798552110270E-01 -1.52434219143957E+00 2.16859762819458E+00 H
35 | 2.56093399679301E+00 -1.07631555113965E+00 1.99589250942031E+00 H
36 | -1.90409004062026E+00 1.38213526713743E+00 -4.03702731608649E+00 H
37 | -2.11160257845375E+00 -1.84720587572252E+00 -3.08621122520313E+00 H
38 | $periodic 0
39 | $end
40 |
--------------------------------------------------------------------------------
/test/validation/21-ad3.coord:
--------------------------------------------------------------------------------
1 | $coord
2 | 0.79457714965951 3.55602905386715 0.00000000000000 c
3 | -0.79457714965951 3.77432460885587 2.39660993619036 c
4 | -0.79457714965951 3.77432460885587 -2.39660993619036 c
5 | 2.25063800006750 5.02905587026014 0.00000000000000 h
6 | 1.79951300232100 1.74494525518548 0.00000000000000 h
7 | 0.37035808014807 3.61430066526315 4.09670630847074 h
8 | -2.22853764673775 2.28531070488959 2.46581361633477 h
9 | -1.77392043411708 5.59484192304179 2.46581361633477 h
10 | 0.37035808014807 3.61430066526315 -4.09670630847074 h
11 | -2.22853764673775 2.28531070488959 -2.46581361633477 h
12 | -1.77392043411708 5.59484192304179 -2.46581361633477 h
13 | -0.79457714965951 -3.55602905386715 0.00000000000000 c
14 | 0.79457714965951 -3.77432460885587 -2.39660993619036 c
15 | 0.79457714965951 -3.77432460885587 2.39660993619036 c
16 | -1.79951300232100 -1.74494525518548 0.00000000000000 h
17 | -2.25063800006750 -5.02905587026014 0.00000000000000 h
18 | -0.37035808014807 -3.61430066526315 -4.09670630847074 h
19 | 1.77392043411708 -5.59484192304179 -2.46581361633477 h
20 | 2.22853764673775 -2.28531070488959 -2.46581361633477 h
21 | -0.37035808014807 -3.61430066526315 4.09670630847074 h
22 | 1.77392043411708 -5.59484192304179 2.46581361633477 h
23 | 2.22853764673775 -2.28531070488959 2.46581361633477 h
24 | $end
--------------------------------------------------------------------------------
/test/validation/21-gcp-pbeh3c.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.1",
3 | "energy": 2.4408581444610614E-02,
4 | "virial": [
5 | -1.6574359800216241E-02,
6 | 2.0119627561238601E-03,
7 | 1.6534083130403943E-18,
8 | 2.0119627561238618E-03,
9 | -2.2463098851840998E-03,
10 | -1.6940658945086007E-19,
11 | 1.1113072267976420E-18,
12 | -4.4045713257223618E-19,
13 | -3.7753665063192894E-02
14 | ],
15 | "gradient": [
16 | -2.8026033066000148E-03,
17 | 2.4390779524848948E-04,
18 | -1.0842021724855044E-19,
19 | 1.1950451267053234E-03,
20 | -2.3762562720102155E-04,
21 | -2.0663035801345331E-03,
22 | 1.1950451267053234E-03,
23 | -2.3762562720102155E-04,
24 | 2.0663035801345335E-03,
25 | -6.8360546166405974E-04,
26 | 1.0124060154628643E-06,
27 | 0.0000000000000000E+00,
28 | -7.2054440646042786E-04,
29 | -1.4820156713158696E-05,
30 | 0.0000000000000000E+00,
31 | 4.5251185867576900E-04,
32 | -6.3822465818580702E-05,
33 | -2.4669490466976086E-04,
34 | 1.9648267644481823E-04,
35 | -1.9837755776525693E-04,
36 | -7.0986894457992632E-04,
37 | 2.2138861006725468E-04,
38 | 1.0653376468129232E-04,
39 | -6.9966824801623285E-04,
40 | 4.5251185867576895E-04,
41 | -6.3822465818580702E-05,
42 | 2.4669490466976092E-04,
43 | 1.9648267644481828E-04,
44 | -1.9837755776525693E-04,
45 | 7.0986894457992643E-04,
46 | 2.2138861006725473E-04,
47 | 1.0653376468129233E-04,
48 | 6.9966824801623285E-04,
49 | 2.8026033066000143E-03,
50 | -2.4390779524848953E-04,
51 | 1.0842021724855044E-19,
52 | -1.1950451267053236E-03,
53 | 2.3762562720102152E-04,
54 | 2.0663035801345331E-03,
55 | -1.1950451267053236E-03,
56 | 2.3762562720102163E-04,
57 | -2.0663035801345331E-03,
58 | 7.2054440646042786E-04,
59 | 1.4820156713158750E-05,
60 | 0.0000000000000000E+00,
61 | 6.8360546166405984E-04,
62 | -1.0124060154628376E-06,
63 | 0.0000000000000000E+00,
64 | -4.5251185867576900E-04,
65 | 6.3822465818580702E-05,
66 | 2.4669490466976081E-04,
67 | -2.2138861006725468E-04,
68 | -1.0653376468129230E-04,
69 | 6.9966824801623274E-04,
70 | -1.9648267644481828E-04,
71 | 1.9837755776525696E-04,
72 | 7.0986894457992643E-04,
73 | -4.5251185867576900E-04,
74 | 6.3822465818580702E-05,
75 | -2.4669490466976086E-04,
76 | -2.2138861006725468E-04,
77 | -1.0653376468129232E-04,
78 | -6.9966824801623263E-04,
79 | -1.9648267644481834E-04,
80 | 1.9837755776525696E-04,
81 | -7.0986894457992632E-04
82 | ]
83 | }
84 |
--------------------------------------------------------------------------------
/test/validation/21-gcp-pbeh3c.resp:
--------------------------------------------------------------------------------
1 | gcp
2 | $ORIGIN/21-ad3.coord
3 | --level
4 | pbeh3c
5 | --grad
6 | --nocpc
--------------------------------------------------------------------------------
/test/validation/22-benI-acetone.xyz:
--------------------------------------------------------------------------------
1 | 22
2 |
3 | C -0.43601987190704 -0.00000150300001 1.03540729252862
4 | C 0.58976220857948 -0.00001321400006 1.97850007065348
5 | C 1.92224732040744 -0.00000620100003 1.57169559487422
6 | C 2.22826604374589 -0.00002197200010 0.21256912192973
7 | C 1.21108714329700 -0.00000640500003 -0.74015358323725
8 | H -1.46924203642611 -0.00000195000001 1.35222461891430
9 | H 0.34310109250064 -0.00000842500004 3.03162969825961
10 | H 2.71469423987341 0.00001150200005 2.30703292809040
11 | H 3.26026141025959 -0.00002655400011 -0.11155152048790
12 | H 1.45070781434504 -0.00001010800004 -1.79398552984646
13 | C -0.12040282452661 0.00002212200010 -0.32357594141524
14 | I -1.65822411125267 0.00022120300097 -1.73801997760168
15 | O -3.94993994027608 -0.00014345000063 -3.81589692468980
16 | C -3.80061832262298 0.00377150001650 -5.02581161398168
17 | C -2.41374687855714 0.01392866206092 -5.62884087361918
18 | C -5.00409199488668 -0.00151565300663 -5.94221514498980
19 | H -1.88103810222720 0.89133045189846 -5.26547224702990
20 | H -1.87007825717927 -0.85848332775480 -5.26971232504844
21 | H -2.42067773158745 0.01652053407226 -6.71412316936594
22 | H -5.61626987956420 0.87012827680573 -5.71741149300657
23 | H -5.60537142251653 -0.88176795885664 -5.72158319002481
24 | H -4.74004724773182 0.00263918901154 -6.99488255559392
25 |
--------------------------------------------------------------------------------
/test/validation/22-gcp-b973c.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.1",
3 | "energy": -1.1487620744730206E-01,
4 | "damping parameters": {
5 | "damping": "rational",
6 | "s6": 1.0000000000000000E+00,
7 | "s8": 1.5000000000000000E+00,
8 | "s9": 0.0000000000000000E+00,
9 | "a1": 3.7000000000000000E-01,
10 | "a2": 4.0999999999999996E+00,
11 | "alp": 1.4000000000000000E+01
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/test/validation/22-gcp-b973c.resp:
--------------------------------------------------------------------------------
1 | run
2 | --bj
3 | b973c
4 | --gcp
5 | --noedisp
6 | $ORIGIN/22-benI-acetone.xyz
--------------------------------------------------------------------------------
/test/validation/23-444.sdf:
--------------------------------------------------------------------------------
1 |
2 | 11302419103D
3 |
4 | 37 0 0 0 0 999 V2000
5 | 2.5903 -2.7264 1.1396 O 0 0 0 0 0 0 0 0 0 0 0 0
6 | 2.9003 -1.7974 0.4296 C 0 0 0 0 0 0 0 0 0 0 0 0
7 | 2.8263 -1.8644 -0.9034 O 0 0 0 0 0 0 0 0 0 0 0 0
8 | 3.1053 -0.9954 -1.2824 H 0 0 0 0 0 0 0 0 0 0 0 0
9 | 3.4013 -0.4684 0.9836 C 0 0 0 0 0 0 0 0 0 0 0 0
10 | 4.4123 -0.2904 0.6116 H 0 0 0 0 0 0 0 0 0 0 0 0
11 | 3.4233 -0.5444 2.0656 H 0 0 0 0 0 0 0 0 0 0 0 0
12 | 2.5623 0.6566 0.6136 N 0 0 0 0 0 0 0 0 0 0 0 0
13 | 1.8913 1.0566 1.2686 H 0 0 0 0 0 0 0 0 0 0 0 0
14 | 2.5763 1.1686 -0.6264 C 0 0 0 0 0 0 0 0 0 0 0 0
15 | 3.2463 0.6926 -1.5524 O 0 0 0 0 0 0 0 0 0 0 0 0
16 | 1.7003 2.3976 -0.8174 C 0 0 0 0 0 0 0 0 0 0 0 0
17 | 1.9023 2.7876 -1.8094 H 0 0 0 0 0 0 0 0 0 0 0 0
18 | 1.9593 3.1466 -0.0674 H 0 0 0 0 0 0 0 0 0 0 0 0
19 | 0.2873 2.0946 -0.7124 N 0 0 0 0 0 0 0 0 0 0 0 0
20 | -0.3337 2.1456 -1.5084 H 0 0 0 0 0 0 0 0 0 0 0 0
21 | -0.3257 1.9366 0.4716 C 0 0 0 0 0 0 0 0 0 0 0 0
22 | 0.2703 1.9106 1.5546 O 0 0 0 0 0 0 0 0 0 0 0 0
23 | -1.8457 1.8206 0.3966 C 0 0 0 0 0 0 0 0 0 0 0 0
24 | -2.2987 1.8046 -0.9934 N 0 0 0 0 0 0 0 0 0 0 0 0
25 | -3.2037 2.2476 -1.0744 H 0 0 0 0 0 0 0 0 0 0 0 0
26 | -2.4147 0.8416 -1.2984 H 0 0 0 0 0 0 0 0 0 0 0 0
27 | -2.2107 2.7366 0.8656 H 0 0 0 0 0 0 0 0 0 0 0 0
28 | -2.3197 0.6246 1.2456 C 0 0 0 0 0 0 0 0 0 0 0 0
29 | -1.8237 0.6816 2.2136 H 0 0 0 0 0 0 0 0 0 0 0 0
30 | -3.3947 0.7276 1.4056 H 0 0 0 0 0 0 0 0 0 0 0 0
31 | -2.0327 -0.6824 0.5636 C 0 0 0 0 0 0 0 0 0 0 0 0
32 | -3.0087 -1.2834 -0.2404 C 0 0 0 0 0 0 0 0 0 0 0 0
33 | -3.9927 -0.8344 -0.3024 H 0 0 0 0 0 0 0 0 0 0 0 0
34 | -2.7397 -2.4624 -0.9334 C 0 0 0 0 0 0 0 0 0 0 0 0
35 | -3.5087 -2.9154 -1.5444 H 0 0 0 0 0 0 0 0 0 0 0 0
36 | -1.4857 -3.0574 -0.8284 C 0 0 0 0 0 0 0 0 0 0 0 0
37 | -1.2737 -3.9754 -1.3594 H 0 0 0 0 0 0 0 0 0 0 0 0
38 | -0.5057 -2.4784 -0.0224 C 0 0 0 0 0 0 0 0 0 0 0 0
39 | 0.4623 -2.9484 0.0826 H 0 0 0 0 0 0 0 0 0 0 0 0
40 | -0.7787 -1.2964 0.6626 C 0 0 0 0 0 0 0 0 0 0 0 0
41 | -0.0207 -0.8594 1.3016 H 0 0 0 0 0 0 0 0 0 0 0 0
42 | M END
43 | $$$$
44 |
--------------------------------------------------------------------------------
/test/validation/23-gcp-hf3c.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.1",
3 | "energy": -2.0199949882394205E-01
4 | }
5 |
--------------------------------------------------------------------------------
/test/validation/23-gcp-hf3c.resp:
--------------------------------------------------------------------------------
1 | gcp
2 | --level
3 | hf3c
4 | $ORIGIN/23-444.sdf
--------------------------------------------------------------------------------
/test/validation/24-gcp-hf-deftzvp.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.1",
3 | "energy": 7.1769896849684205E-03,
4 | "damping parameters": {
5 | "damping": "zero",
6 | "s6": 1.0000000000000000E+00,
7 | "s8": 1.7460000000000000E+00,
8 | "s9": 1.0000000000000000E+00,
9 | "rs6": 1.1579999999999999E+00,
10 | "rs8": 1.0000000000000000E+00,
11 | "alp": 1.4000000000000000E+01
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/test/validation/24-gcp-hf-deftzvp.resp:
--------------------------------------------------------------------------------
1 | run
2 | --zero
3 | hf
4 | --gcp
5 | deftzvp
6 | --atm
7 | $ORIGIN/24-h2o_6.qchem
--------------------------------------------------------------------------------
/test/validation/24-h2o_6.qchem:
--------------------------------------------------------------------------------
1 | $molecule
2 | 0 1
3 | o 0.11448392281773 1.51123327008092 0.84351297623233
4 | h 0.95880573623723 1.47155799179987 0.32950022850208
5 | h 0.26129103645727 2.12410912352789 1.56850115482200
6 | o -0.02817040100173 -1.43708228218242 0.98511825009724
7 | h -0.03831273056231 -0.48623197337830 1.17189380200513
8 | h -0.86424990477834 -1.59839377519356 0.50558843087301
9 | o -2.35379807024322 1.32801810801878 -0.46182075721370
10 | h -1.48714230779134 1.50194038048355 -0.04531091525911
11 | h -2.34725343052677 1.79416500782283 -1.30125669084489
12 | o -2.46767106530964 -1.45760274129337 -0.41854609908859
13 | h -2.53975419218662 -0.48503716343007 -0.49641687571481
14 | h -3.26029002096919 -1.74564200881398 0.04080615100984
15 | o 2.42644955265113 1.14816004581118 -0.49586368573878
16 | h 2.48383495016489 0.16184556854355 -0.50914940516318
17 | h 2.52619219832975 1.43384884343363 -1.40718630625545
18 | o 2.27629136915678 -1.54900494733334 -0.42626722875407
19 | h 1.42256374614478 -1.63495392360958 0.06497690996263
20 | h 2.91672961140960 -2.08092952428755 0.05192006052832
21 | $end
22 |
--------------------------------------------------------------------------------
/test/validation/25-g3.gen:
--------------------------------------------------------------------------------
1 | 24 C
2 | C O H
3 | 1 1 -1.12885064915344E-01 -1.41863844617349E+00 -7.80362498298278E-01
4 | 2 2 4.09592407421189E-01 -2.36548698407175E-01 -1.36364838541136E+00
5 | 3 1 6.19799977621229E-01 8.89905751402348E-01 -5.02538213519736E-01
6 | 4 1 -6.10116041805569E-01 1.20757778290933E+00 3.67780827198579E-01
7 | 5 1 -1.43900587170863E+00 -1.16243455996366E+00 -4.62672873964163E-02
8 | 6 1 -1.24760318997206E+00 -5.08890838053665E-02 1.00951572052529E+00
9 | 7 2 -4.86797482060935E-01 -4.99194756761102E-01 2.12454981438015E+00
10 | 8 2 -1.66043778109922E+00 1.79383387185583E+00 -4.22680367436187E-01
11 | 9 1 1.93115068908887E+00 7.74794098890431E-01 3.28828322366809E-01
12 | 10 2 2.88225415460348E+00 -1.16345429245288E-01 -2.56160344296218E-01
13 | 11 3 1.29113665504839E-01 -1.18582686926397E+00 1.80296413321587E+00
14 | 12 3 -1.33590286621933E+00 2.59430229650854E+00 -8.64241078868696E-01
15 | 13 3 2.97633759330056E+00 8.92087438907900E-02 -1.20071451738229E+00
16 | 14 2 7.93330183785820E-01 -1.98847595858884E+00 1.60863527434552E-01
17 | 15 2 -2.47074754876863E+00 -8.63512585694265E-01 -9.70219081919390E-01
18 | 16 3 -2.23180271908296E+00 2.45770664766718E-01 1.38586283862572E+00
19 | 17 3 -3.18410548179756E-01 1.89503777569582E+00 1.17421385796704E+00
20 | 18 3 7.51511780065613E-01 1.71194211464097E+00 -1.21902350171035E+00
21 | 19 3 2.36346506806486E+00 1.78005871805928E+00 4.37353614115734E-01
22 | 20 3 1.70348772650670E+00 -1.75009521752220E+00 -1.11972385813754E-01
23 | 21 3 -2.39388948446623E+00 7.67028777273814E-02 -1.21635880287680E+00
24 | 22 3 -2.65720769643726E-01 -2.08828234086970E+00 -1.63230513539516E+00
25 | 23 3 -1.73289577975631E+00 -2.08526093479100E+00 4.64247803351864E-01
26 | 24 3 1.74617190171553E+00 3.86370184738622E-01 1.33031114114306E+00
27 |
--------------------------------------------------------------------------------
/test/validation/25-gcp-b3lyp-631gd.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.2.1",
3 | "energy": 9.3584755369634995E-02,
4 | "virial": [
5 | -8.1810660539116148E-02,
6 | -9.6093525430042008E-05,
7 | -1.3672586053845414E-04,
8 | -9.6093525430033822E-05,
9 | -8.1086316048136181E-02,
10 | 2.6884889728128747E-03,
11 | -1.3672586053845327E-04,
12 | 2.6884889728128769E-03,
13 | -6.9896275544401601E-02
14 | ],
15 | "gradient": [
16 | 7.2728850731336030E-05,
17 | 1.4180915671166015E-04,
18 | 1.6261536689883918E-04,
19 | -3.2812414702953552E-04,
20 | -9.6291499805133672E-05,
21 | 2.8585524050143050E-03,
22 | 1.1530950793400656E-06,
23 | 4.4394105707793303E-05,
24 | 2.2859757014506683E-05,
25 | 1.5704086214981611E-04,
26 | -6.9760254879827824E-05,
27 | 4.8776502098259354E-05,
28 | 2.7803749513078053E-04,
29 | 8.0445644544793331E-05,
30 | 2.1536273375148256E-04,
31 | -9.1001875781775095E-06,
32 | -3.1382705708857148E-05,
33 | -2.8908539135137200E-04,
34 | 9.0521100022711862E-04,
35 | -7.1275780796299670E-04,
36 | -3.7621158749063439E-03,
37 | 2.4600714427851058E-03,
38 | -6.7297758581742154E-04,
39 | 3.3247966137161005E-06,
40 | -2.9861834386274064E-04,
41 | -1.5141183384514436E-04,
42 | 1.7158713453133080E-04,
43 | -2.8018803569370364E-03,
44 | 1.0769449589210006E-03,
45 | -1.1034076359568937E-03,
46 | -1.4942950694016729E-03,
47 | 1.8988535063400643E-03,
48 | -1.1230645409583207E-03,
49 | -2.0482168026468152E-04,
50 | -2.7953944201808637E-03,
51 | 1.4740456014026243E-03,
52 | -1.3710125284322350E-03,
53 | -3.7898366040712731E-04,
54 | 2.8764723118768682E-03,
55 | 1.8885118020500004E-04,
56 | 2.9908946774985300E-03,
57 | -1.0400408033423422E-03,
58 | 2.6727382615169670E-03,
59 | 2.1580838440340890E-03,
60 | 1.2568082812288058E-03,
61 | 2.5547141679660656E-03,
62 | -6.4673074021500733E-04,
63 | -1.4790393947981288E-03,
64 | -5.8467010454819131E-04,
65 | -2.0336642369187391E-03,
66 | -2.0365272866933945E-03,
67 | -6.5013599295336030E-04,
68 | -2.2455940125889404E-03,
69 | 1.8185293287786258E-03,
70 | -1.1638022762662889E-03,
71 | -2.5594896062603911E-03,
72 | -5.6359284689985419E-04,
73 | -2.6910174215525641E-03,
74 | 1.1131745039147612E-03,
75 | 2.9384988490817972E-04,
76 | 1.1343537456426651E-03,
77 | -1.8440875951904231E-03,
78 | 1.6511634393546679E-03,
79 | 3.7969649933155322E-04,
80 | 2.0849072919157260E-03,
81 | 2.3577195538768436E-03,
82 | 1.2255060371075487E-03,
83 | 2.5563382240707719E-03,
84 | -1.1503593321425839E-03,
85 | -4.3262452904681314E-04,
86 | 9.2680046121683160E-05,
87 | -2.6644339902998199E-03
88 | ]
89 | }
90 |
--------------------------------------------------------------------------------
/test/validation/25-gcp-b3lyp-631gd.resp:
--------------------------------------------------------------------------------
1 | gcp
2 | $ORIGIN/25-g3.gen
3 | -i
4 | gen
5 | --nocpc
6 | --level
7 | b3lyp/631gd
8 | --grad
--------------------------------------------------------------------------------
/test/validation/meson.build:
--------------------------------------------------------------------------------
1 | # This file is part of s-dftd3.
2 | # SPDX-Identifier: LGPL-3.0-or-later
3 | #
4 | # s-dftd3 is free software: you can redistribute it and/or modify it under
5 | # the terms of the GNU Lesser General Public License as published by
6 | # the Free Software Foundation, either version 3 of the License, or
7 | # (at your option) any later version.
8 | #
9 | # s-dftd3 is distributed in the hope that it will be useful,
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | # GNU Lesser General Public License for more details.
13 | #
14 | # You should have received a copy of the GNU Lesser General Public License
15 | # along with s-dftd3. If not, see .
16 |
17 | app_tester = find_program(meson.current_source_dir() / 'tester.py')
18 | tests = [
19 | '01-energy-d3-bj',
20 | '02-energy-d3-zero',
21 | '03-energy-d3-bjm',
22 | '04-energy-d3-zerom',
23 | '05-energy-d3-op',
24 | '06-gradient-d3-bj',
25 | '07-gradient-d3-zero',
26 | '08-gradient-d3-bjm',
27 | '09-gradient-d3-zerom',
28 | '10-gradient-d3-op',
29 | '11-pairwise-d3-bj',
30 | '12-pairwise-d3-zero',
31 | '13-pairwise-d3-bjm',
32 | '14-pairwise-d3-zerom',
33 | '15-pairwise-d3-op',
34 | '16-db-d3-bj',
35 | '17-db-d3-zero',
36 | '18-db-d3-bjm',
37 | '19-db-d3-zerom',
38 | '20-db-d3-op',
39 | '21-gcp-pbeh3c',
40 | '22-gcp-b973c',
41 | '23-gcp-hf3c',
42 | '24-gcp-hf-deftzvp',
43 | '25-gcp-b3lyp-631gd',
44 | ]
45 |
46 | foreach t : tests
47 | benchmark(
48 | t,
49 | app_tester,
50 | args: [
51 | sdftd3_exe,
52 | files('@0@.json'.format(t)),
53 | files('@0@.resp'.format(t)),
54 | ],
55 | suite: 'app',
56 | )
57 | endforeach
58 |
--------------------------------------------------------------------------------
/test/validation/tester.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | """
3 | Minimal Python wrapper for testing the s-dftd3 command line interface.
4 |
5 | The wrapper will assume a specific order in the arguments rather than
6 | providing a generic command line interface by itself since it is
7 | supposed to be used by meson for testing purposes only.
8 | """
9 |
10 | try:
11 | import subprocess, sys, json, os
12 | except ImportError:
13 | exit(77)
14 |
15 | if len(sys.argv) < 4:
16 | raise RuntimeError("Requires at least four arguments")
17 |
18 |
19 | class approx:
20 | def __init__(self, value, abs):
21 | self.value = value
22 | self.abs = abs
23 | self.log = []
24 |
25 | def __eq__(self, other):
26 | def compare(a, b, ctx):
27 | if isinstance(a, list) and isinstance(b, list):
28 | return all(compare(x, y, f"{ctx}[{idx}]") for idx, (x, y) in enumerate(zip(a, b)))
29 |
30 | if isinstance(a, dict) and isinstance(b, dict):
31 | try:
32 | return all(compare(a[k], b[k], f"{ctx}[{k}]") for k in a.keys())
33 | except KeyError as e:
34 | self.log.append(f"{ctx}: Missing key {e} in dictionary")
35 | return False
36 |
37 | if isinstance(a, (int, float)) and isinstance(b, (int, float)):
38 | stat = abs(a - b) < self.abs
39 | if not stat:
40 | self.log.append(f"{ctx}: {a} != {b} (diff: {abs(a - b)})")
41 | return stat
42 |
43 | stat = a == b
44 | if not stat:
45 | self.log.append(f"{ctx}: {a} != {b}")
46 | return stat
47 |
48 | stat = compare(self.value, other, "")
49 | if not stat:
50 | print("\n".join(self.log))
51 |
52 | return stat
53 |
54 |
55 | thr = 1.0e-6
56 | prog = sys.argv[1]
57 | outp = sys.argv[2]
58 | with open(sys.argv[3]) as fd:
59 | wdir = os.path.dirname(fd.name)
60 | args = [arg.replace('$ORIGIN', wdir) for arg in fd.read().strip().split("\n")]
61 |
62 | stat = subprocess.call(
63 | [prog, *args, "--json", os.path.basename(outp)],
64 | shell=False,
65 | stdin=None,
66 | stderr=subprocess.STDOUT,
67 | )
68 | if stat != 0:
69 | raise RuntimeError("Calculation failed")
70 |
71 | with open(outp) as f:
72 | ref = json.load(f)
73 | del ref["version"]
74 |
75 | with open(os.path.basename(outp)) as f:
76 | res = json.load(f)
77 |
78 | assert approx(ref, abs=thr) == res
79 |
--------------------------------------------------------------------------------