Skip to content

Commit

Permalink
Read parameters from TOML file (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinfriede authored Dec 4, 2024
1 parent 33c7d4e commit ed652e4
Show file tree
Hide file tree
Showing 15 changed files with 779 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ repos:
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 *
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

0 comments on commit ed652e4

Please sign in to comment.