Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read parameters from TOML file #69

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -31,7 +31,7 @@ repos:
language_version: python3

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.5.0
rev: v2.7.0
hooks:
- id: setup-cfg-fmt
args:
Expand All @@ -44,7 +44,7 @@ repos:
]

- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.19.0
hooks:
- id: pyupgrade
args: [--py37-plus, --keep-runtime-typing]
Expand All @@ -57,15 +57,15 @@ repos:
args: ["--profile", "black", "--filter-files"]

- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
stages: [commit]
stages: [pre-commit]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies: [types-all]
# additional_dependencies: [types-all]
args: [--config-file=pyproject.toml, --ignore-missing-imports]
exclude: "test|examples/|test/conftest.py"
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ param = {
"a2": positions.new_tensor(4.60230534),
}

# parameters can also be obtained using the functional name:
# param = d4.get_params("tpssh")

energy = d4.dftd4(numbers, positions, charge, param)
torch.set_printoptions(precision=10)
print(energy)
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ The following example shows how to calculate the DFT-D4 dispersion energy for a
"a2": positions.new_tensor(4.60230534),
}

# parameters can also be obtained using the functional name:
# param = d4.get_params("tpssh")

energy = d4.dftd4(numbers, positions, charge, param)
torch.set_printoptions(precision=10)
print(energy)
Expand Down
1 change: 1 addition & 0 deletions environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ dependencies:
- pytorch>=1.11.0,<2.5
- tad-mctc
- tad-multicharge
- tomli
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ plugins = ["covdefaults"]
source = ["./src"]

[tool.coverage.report]
fail_under = 90
fail_under = 95
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ install_requires =
numpy<2
tad-mctc
tad-multicharge
tomli
torch>=1.11,<2.5
typing-extensions
python_requires = >=3.8, <3.13
Expand Down Expand Up @@ -64,5 +65,6 @@ tox =
[options.package_data]
tad_dftd4 =
py.typed
parameters.toml
**/*.npy
**/*.npz
2 changes: 2 additions & 0 deletions src/tad_dftd4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@

from . import cutoff, damping, data, disp, model, ncoord, typing
from .__version__ import __version__
from .damping import get_params
from .disp import dftd4

__all__ = [
Expand All @@ -99,6 +100,7 @@
"data",
"dftd4",
"disp",
"get_params",
"model",
"ncoord",
"typing",
Expand Down
1 change: 1 addition & 0 deletions src/tad_dftd4/damping/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
Available damping schemes for two- and three-body dispersion terms.
"""
from .atm import *
from .parameters import *
Dismissed Show dismissed Hide dismissed
from .rational import *
23 changes: 23 additions & 0 deletions src/tad_dftd4/damping/parameters/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file is part of tad-dftd4.
#
# SPDX-Identifier: Apache-2.0
# Copyright (C) 2024 Grimme Group
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Damping Parameters
==================

Access damping parameters for all supported DFAs.
"""
from .read import *
Loading
Loading