kbkit 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. kbkit-1.0.0/.coveragerc +23 -0
  2. kbkit-1.0.0/.editorconfig +16 -0
  3. kbkit-1.0.0/.gitattributes +2 -0
  4. kbkit-1.0.0/.github/workflows/build-and-test.yml +54 -0
  5. kbkit-1.0.0/.github/workflows/publish.yml +30 -0
  6. kbkit-1.0.0/.gitignore +182 -0
  7. kbkit-1.0.0/.pre-commit-config.yaml +45 -0
  8. kbkit-1.0.0/.readthedocs.yaml +24 -0
  9. kbkit-1.0.0/LICENSE +21 -0
  10. kbkit-1.0.0/PKG-INFO +217 -0
  11. kbkit-1.0.0/README.md +157 -0
  12. kbkit-1.0.0/docs/conf.py +78 -0
  13. kbkit-1.0.0/docs/index.rst +79 -0
  14. kbkit-1.0.0/docs/kbkit.analysis.kb_integrator.rst +14 -0
  15. kbkit-1.0.0/docs/kbkit.analysis.kb_thermo.rst +16 -0
  16. kbkit-1.0.0/docs/kbkit.analysis.rst +12 -0
  17. kbkit-1.0.0/docs/kbkit.analysis.system_state.rst +7 -0
  18. kbkit-1.0.0/docs/kbkit.calculators.kbi_calculator.rst +12 -0
  19. kbkit-1.0.0/docs/kbkit.calculators.rst +11 -0
  20. kbkit-1.0.0/docs/kbkit.calculators.static_structure_calculator.rst +14 -0
  21. kbkit-1.0.0/docs/kbkit.core.kb_pipeline.rst +7 -0
  22. kbkit-1.0.0/docs/kbkit.core.rst +13 -0
  23. kbkit-1.0.0/docs/kbkit.core.system_loader.rst +7 -0
  24. kbkit-1.0.0/docs/kbkit.core.system_properties.rst +7 -0
  25. kbkit-1.0.0/docs/kbkit.core.system_registry.rst +7 -0
  26. kbkit-1.0.0/docs/kbkit.parsers.edr_file.rst +7 -0
  27. kbkit-1.0.0/docs/kbkit.parsers.gro_file.rst +7 -0
  28. kbkit-1.0.0/docs/kbkit.parsers.rdf_file.rst +7 -0
  29. kbkit-1.0.0/docs/kbkit.parsers.rst +12 -0
  30. kbkit-1.0.0/docs/kbkit.parsers.top_file.rst +7 -0
  31. kbkit-1.0.0/docs/kbkit.viz.plotter.rst +7 -0
  32. kbkit-1.0.0/pixi.lock +3792 -0
  33. kbkit-1.0.0/pyproject.toml +99 -0
  34. kbkit-1.0.0/requirements.txt +31 -0
  35. kbkit-1.0.0/src/kbkit/__init__.py +5 -0
  36. kbkit-1.0.0/src/kbkit/_version.py +1 -0
  37. kbkit-1.0.0/src/kbkit/analysis/__init__.py +7 -0
  38. kbkit-1.0.0/src/kbkit/analysis/kb_integrator.py +283 -0
  39. kbkit-1.0.0/src/kbkit/analysis/kb_thermo.py +876 -0
  40. kbkit-1.0.0/src/kbkit/analysis/system_state.py +381 -0
  41. kbkit-1.0.0/src/kbkit/calculators/__init__.py +6 -0
  42. kbkit-1.0.0/src/kbkit/calculators/kbi_calculator.py +268 -0
  43. kbkit-1.0.0/src/kbkit/calculators/static_structure_calculator.py +415 -0
  44. kbkit-1.0.0/src/kbkit/config/__init__.py +6 -0
  45. kbkit-1.0.0/src/kbkit/config/mplstyle.py +18 -0
  46. kbkit-1.0.0/src/kbkit/config/presentation.mplstyle +48 -0
  47. kbkit-1.0.0/src/kbkit/config/unit_registry.py +82 -0
  48. kbkit-1.0.0/src/kbkit/core/__init__.py +7 -0
  49. kbkit-1.0.0/src/kbkit/core/kb_pipeline.py +196 -0
  50. kbkit-1.0.0/src/kbkit/core/system_loader.py +352 -0
  51. kbkit-1.0.0/src/kbkit/core/system_properties.py +222 -0
  52. kbkit-1.0.0/src/kbkit/core/system_registry.py +136 -0
  53. kbkit-1.0.0/src/kbkit/data/__init__.py +5 -0
  54. kbkit-1.0.0/src/kbkit/data/gmx_units.json +12 -0
  55. kbkit-1.0.0/src/kbkit/data/property_resolver.py +101 -0
  56. kbkit-1.0.0/src/kbkit/parsers/__init__.py +8 -0
  57. kbkit-1.0.0/src/kbkit/parsers/edr_file.py +265 -0
  58. kbkit-1.0.0/src/kbkit/parsers/gro_file.py +88 -0
  59. kbkit-1.0.0/src/kbkit/parsers/rdf_file.py +259 -0
  60. kbkit-1.0.0/src/kbkit/parsers/top_file.py +126 -0
  61. kbkit-1.0.0/src/kbkit/schema/kbi_metadata.py +49 -0
  62. kbkit-1.0.0/src/kbkit/schema/plot_spec.py +39 -0
  63. kbkit-1.0.0/src/kbkit/schema/system_config.py +51 -0
  64. kbkit-1.0.0/src/kbkit/schema/system_metadata.py +49 -0
  65. kbkit-1.0.0/src/kbkit/schema/thermo_property.py +77 -0
  66. kbkit-1.0.0/src/kbkit/schema/thermo_state.py +121 -0
  67. kbkit-1.0.0/src/kbkit/utils/__init__.py +5 -0
  68. kbkit-1.0.0/src/kbkit/utils/chem.py +53 -0
  69. kbkit-1.0.0/src/kbkit/utils/file_resolver.py +123 -0
  70. kbkit-1.0.0/src/kbkit/utils/format.py +82 -0
  71. kbkit-1.0.0/src/kbkit/utils/io.py +54 -0
  72. kbkit-1.0.0/src/kbkit/utils/logging.py +35 -0
  73. kbkit-1.0.0/src/kbkit/utils/validation.py +61 -0
  74. kbkit-1.0.0/src/kbkit/viz/__init__.py +5 -0
  75. kbkit-1.0.0/src/kbkit/viz/plotter.py +653 -0
  76. kbkit-1.0.0/tests/__init__.py +1 -0
  77. kbkit-1.0.0/tests/core/test_system_loader.py +197 -0
  78. kbkit-1.0.0/tests/core/test_system_properties.py +205 -0
  79. kbkit-1.0.0/tests/core/test_system_registry.py +136 -0
  80. kbkit-1.0.0/tests/parsers/test_edrfile_parser.py +125 -0
  81. kbkit-1.0.0/tests/parsers/test_grofile_parser.py +121 -0
  82. kbkit-1.0.0/tests/parsers/test_rdf_parser.py +119 -0
  83. kbkit-1.0.0/tests/parsers/test_topfile_parser.py +83 -0
  84. kbkit-1.0.0/tests/test_smoke.py +21 -0
  85. kbkit-1.0.0/tests/utils/test_formatting_resolution.py +90 -0
  86. kbkit-1.0.0/tools/bump_version.py +30 -0
  87. kbkit-1.0.0/tools/tree_gen.py +49 -0
@@ -0,0 +1,23 @@
1
+ [run]
2
+ source = kbkit
3
+ omit = kbkit/__main__.py
4
+
5
+ [report]
6
+ exclude_lines =
7
+ # Have to re-enable the standard pragma
8
+ pragma: no cover
9
+
10
+ # Don't complain about missing debug-only code:
11
+ def __repr__
12
+ if self\.debug
13
+
14
+ # Don't complain if tests don't hit defensive assertion code:
15
+ raise AssertionError
16
+ raise NotImplementedError
17
+
18
+ # Don't complain if non-runnable code isn't run:
19
+ if 0:
20
+ if __name__ == .__main__.:
21
+
22
+ # Don't complain if an ellipsis isn't run (typically in an abstractmethod):
23
+ ^\s*\.\.\.
@@ -0,0 +1,16 @@
1
+ # http://editorconfig.org/#file-format-details
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ end_of_line = lf
7
+ indent_size = 4
8
+ indent_style = space
9
+ insert_final_newline = true
10
+ trim_trailing_whitespace = true
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
14
+
15
+ [Makefile]
16
+ indent_style = tab
@@ -0,0 +1,2 @@
1
+ # SCM syntax highlighting & preventing 3-way merges
2
+ pixi.lock merge=binary linguist-language=YAML linguist-generated=true
@@ -0,0 +1,54 @@
1
+ name: Build and Test
2
+
3
+ on:
4
+ pull_request: {}
5
+ push:
6
+ branches: main
7
+
8
+ jobs:
9
+ build-and-test:
10
+ strategy:
11
+ matrix:
12
+ python-version: ["3.12"]
13
+ os: [ubuntu-latest]
14
+
15
+ name: Python ${{ matrix.os }} ${{ matrix.python-version }}
16
+ runs-on: ${{ matrix.os }}
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip setuptools wheel
28
+ pip install -r requirements.txt
29
+ pip install pytest pytest-cov ruff mypy coveralls
30
+ pip install -e .
31
+
32
+ - name: Format check
33
+ run: ruff check src/kbkit
34
+
35
+ - name: Type check
36
+ run: mypy src/kbkit
37
+
38
+ - name: Run tests with coverage
39
+ run: pytest tests/ --cov=. --cov-report=xml --junitxml=junit/test-results.xml
40
+
41
+ - name: Upload test results
42
+ uses: actions/upload-artifact@v4
43
+ if: ${{ always() }}
44
+ with:
45
+ name: test-results-${{ matrix.os }}-${{ matrix.python-version }}
46
+ path: |
47
+ junit/test-results.xml
48
+ coverage.xml
49
+
50
+ - name: Upload coverage to Coveralls
51
+ env:
52
+ COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
53
+ run: |
54
+ coveralls
@@ -0,0 +1,30 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+ id-token: write
10
+
11
+ jobs:
12
+ build-and-publish:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.x"
21
+
22
+ - name: Build package
23
+ run: |
24
+ python -m pip install --upgrade pip build
25
+ python -m build
26
+
27
+ - name: Publish to PyPI
28
+ uses: pypa/gh-action-pypi-publish@v1.10.0
29
+ with:
30
+ password: ${{ secrets.PYPI_API_TOKEN }}
kbkit-1.0.0/.gitignore ADDED
@@ -0,0 +1,182 @@
1
+ # Created by https://www.toptal.com/developers/gitignore/api/python
2
+ # Edit at https://www.toptal.com/developers/gitignore?templates=python
3
+
4
+ ### Python ###
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+ junit/
58
+ test-result*
59
+
60
+ # Translations
61
+ *.mo
62
+ *.pot
63
+
64
+ # Django stuff:
65
+ *.log
66
+ local_settings.py
67
+ db.sqlite3
68
+ db.sqlite3-journal
69
+
70
+ # Flask stuff:
71
+ instance/
72
+ .webassets-cache
73
+
74
+ # Scrapy stuff:
75
+ .scrapy
76
+
77
+ # Sphinx documentation
78
+ docs/_build/
79
+
80
+ # PyBuilder
81
+ .pybuilder/
82
+ target/
83
+
84
+ # Jupyter Notebook
85
+ .ipynb_checkpoints
86
+
87
+ # IPython
88
+ profile_default/
89
+ ipython_config.py
90
+
91
+ # pyenv
92
+ # For a library or package, you might want to ignore these files since the code is
93
+ # intended to run in multiple environments; otherwise, check them in:
94
+ # .python-version
95
+
96
+ # pipenv
97
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
98
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
99
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
100
+ # install all needed dependencies.
101
+ #Pipfile.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/#use-with-ide
116
+ .pdm.toml
117
+
118
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
119
+ __pypackages__/
120
+
121
+ # Celery stuff
122
+ celerybeat-schedule
123
+ celerybeat.pid
124
+
125
+ # SageMath parsed files
126
+ *.sage.py
127
+
128
+ # Environments
129
+ .env
130
+ .venv
131
+ env/
132
+ venv/
133
+ ENV/
134
+ env.bak/
135
+ venv.bak/
136
+ .envrc
137
+
138
+ # Spyder project settings
139
+ .spyderproject
140
+ .spyproject
141
+
142
+ # Rope project settings
143
+ .ropeproject
144
+
145
+ # mkdocs documentation
146
+ /site
147
+
148
+ # mypy
149
+ .mypy_cache/
150
+ .dmypy.json
151
+ dmypy.json
152
+
153
+ # Pyre type checker
154
+ .pyre/
155
+
156
+ # pytype static type analyzer
157
+ .pytype/
158
+
159
+ # Cython debug symbols
160
+ cython_debug/
161
+
162
+ # PyCharm
163
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
164
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
165
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
166
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
167
+ #.idea/
168
+
169
+ ### Python Patch ###
170
+ # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
171
+ poetry.toml
172
+
173
+ # ruff
174
+ .ruff_cache/
175
+
176
+ # LSP config files
177
+ pyrightconfig.json
178
+
179
+ # End of https://www.toptal.com/developers/gitignore/api/python
180
+
181
+ # Pixi
182
+ .pixi
@@ -0,0 +1,45 @@
1
+ exclude: '.pixi/'
2
+ repos:
3
+ - repo: https://github.com/pre-commit/pre-commit-hooks
4
+ rev: v5.0.0 # this is optional, use `pre-commit autoupdate` to get the latest rev!
5
+ hooks:
6
+ - id: check-yaml
7
+ - id: check-toml
8
+ - id: end-of-file-fixer
9
+ - id: trailing-whitespace
10
+
11
+ - repo: local
12
+ hooks:
13
+ - id: ruff
14
+ name: ruff-format
15
+ stages: [pre-commit, pre-push]
16
+ language: system
17
+ entry: pixi run fmt
18
+ types: [python]
19
+ pass_filenames: false
20
+
21
+ - id: ruff
22
+ name: ruff-check
23
+ stages: [pre-commit, pre-push]
24
+ language: system
25
+ entry: pixi run lint
26
+ types: [python]
27
+ pass_filenames: false
28
+
29
+ - id: Mypy
30
+ args: [src/kbkit, --ignore-missing-imports, --disable-error-code=assignment]
31
+ name: mypy
32
+ stages: [pre-commit, pre-push]
33
+ language: system
34
+ entry: pixi run types
35
+ types: [python]
36
+ pass_filenames: false
37
+
38
+ - id: pytest
39
+ args: [kbkit]
40
+ name: pytest
41
+ stages: [pre-commit, pre-push]
42
+ language: system
43
+ entry: pixi run test
44
+ types: [python]
45
+ pass_filenames: false
@@ -0,0 +1,24 @@
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ # Required
5
+ version: 2
6
+
7
+ # Set the OS, Python version, and other tools you might need
8
+ build:
9
+ os: ubuntu-24.04
10
+ tools:
11
+ python: "3.12"
12
+
13
+ # Build documentation in the "docs/" directory with Sphinx
14
+ sphinx:
15
+ configuration: docs/conf.py
16
+
17
+ # Optionally, but recommended,
18
+ # declare the Python requirements required to build your documentation
19
+ # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
20
+ python:
21
+ install:
22
+ - requirements: requirements.txt
23
+ - method: pip
24
+ path: .
kbkit-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Allison Peroutka
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
kbkit-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: kbkit
3
+ Version: 1.0.0
4
+ Summary: KBKit: Kirkwood-Buff Analysis Toolkit
5
+ Author: Allison Peroutka
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Allison Peroutka
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ License-File: LICENSE
28
+ Requires-Python: >=3.10
29
+ Requires-Dist: babel<3,>=2.17.0
30
+ Requires-Dist: click<9,>=8.2.1
31
+ Requires-Dist: furo<2026,>=2025.7.19
32
+ Requires-Dist: gromacs<0.0.1,>=0.0.0
33
+ Requires-Dist: ipykernel<7,>=6.30.1
34
+ Requires-Dist: matplotlib<4,>=3.10.5
35
+ Requires-Dist: mdanalysis
36
+ Requires-Dist: mpltern<2,>=1.0.4
37
+ Requires-Dist: mypy
38
+ Requires-Dist: natsort<9,>=8.4.0
39
+ Requires-Dist: nbsphinx<0.10,>=0.9.6
40
+ Requires-Dist: numpy<3,>=2.3.2
41
+ Requires-Dist: pandas<3,>=2.3.1
42
+ Requires-Dist: pandoc<3,>=2.4
43
+ Requires-Dist: pathlib<2,>=1.0.1
44
+ Requires-Dist: pint<0.25
45
+ Requires-Dist: plotly<7,>=6.3.0
46
+ Requires-Dist: pytest-cov>=6.2.1
47
+ Requires-Dist: pytest>=8.4.1
48
+ Requires-Dist: rdkit<2026,>=2025.3.5
49
+ Requires-Dist: scipy<2,>=1.16.1
50
+ Requires-Dist: seaborn<0.14,>=0.13.2
51
+ Requires-Dist: sphinx-copybutton<0.6,>=0.5.2
52
+ Requires-Dist: sphinx-gallery<0.20,>=0.19.0
53
+ Requires-Dist: sphinx-rtd-theme<4,>=3.0.2
54
+ Requires-Dist: sphinx>=7.0
55
+ Requires-Dist: stubs>=1.0.0
56
+ Requires-Dist: sympy<2,>=1.14.0
57
+ Requires-Dist: tree-format<0.2,>=0.1.2
58
+ Requires-Dist: uncertainties<4,>=3.2.3
59
+ Description-Content-Type: text/markdown
60
+
61
+ # KBKit: Kirkwood-Buff Analysis Toolkit
62
+
63
+ [![License](https://img.shields.io/github/license/aperoutka/kbkit)](https://github.com/aperoutka/kbkit/blob/master/LICENSE)
64
+ [![Powered by: Pixi](https://img.shields.io/badge/Powered_by-Pixi-facc15)](https://pixi.sh)
65
+ [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
66
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/aperoutka/kbkit/build-and-test.yml?branch=main&logo=github-actions)](https://github.com/aperoutka/kbkit/actions/workflows/build-and-test.yml)
67
+ [![Coverage Status](https://coveralls.io/repos/github/aperoutka/kbkit/badge.svg?branch=main)](https://coveralls.io/github/aperoutka/kbkit?branch=main)
68
+ [![docs](http://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](https://kbkit.readthedocs.io/)
69
+ ![python 3.12](https://img.shields.io/badge/Python-3.12%2B-blue)
70
+
71
+ **KBKit** is a Python package for automated Kirkwood-Buff (KB) analysis of molecular simulation data. It provides tools to parse simulation outputs, compute Kirkwood-Buff integrals, and extract thermodynamic properties for binary and multicomponent systems. **KBKit** supports flexible workflows, including:
72
+
73
+ * Parsing and processing of simulation data (e.g., RDFs, densities)
74
+ * Calculation of KB integrals and related thermodynamic quantities
75
+ * Integration of activity coefficient derivatives (numerical or polynomial)
76
+ * Automated pipelines for batch analysis
77
+ * Calculation of static structure factor and X-ray intensities in the limit of q &rarr; 0
78
+ * Visualization tools for KB integrals, thermodynamic properties, and static structure factors
79
+
80
+ **KBKit** is designed for researchers in computational chemistry, soft matter, and statistical mechanics who need robust, reproducible KB analysis from simulation data. The package is modular, extensible, and integrates easily with Jupyter notebooks and Python scripts.
81
+
82
+ ## Installation
83
+
84
+ **KBKit** can be installed from cloning its github repository and creating an anaconda environment with dependencies.
85
+
86
+ ```python
87
+ git clone https://github.com/aperoutka/kbkit.git
88
+ cd kbkit
89
+ conda create --name kbkit python=3.12
90
+ conda activate kbkit
91
+ pip install .
92
+ ```
93
+
94
+ ## Examples
95
+
96
+ Below are several examples on various ways to implement **KBKit**.
97
+
98
+ ### Calculating Kirkwood-Buff integrals on a single RDF
99
+
100
+ ```python
101
+ from kbkit.analysis import KBIntegrator
102
+
103
+ # create integrator object from single RDF file
104
+ integrator = KBIntegrator(rdf_file)
105
+
106
+ # calculate running-KBI
107
+ rkbi = integrator.rkbi()
108
+
109
+ # calculate KBI in thermodynamic limit
110
+ kbi = integrator.integrate()
111
+
112
+ # visualize KBI integration and extrapolation
113
+ integrator.plot()
114
+ ```
115
+
116
+ ### Run an automated pipeline for batch analysis
117
+
118
+ ```python
119
+ from kbkit.core import KBPipeline
120
+
121
+ # Set up and run the pipeline
122
+ pipe = KBPipeline(
123
+ base_path="/path/to/systems", # directory with system data
124
+ pure_path="/path/to/pure_components", # directory with pure component data
125
+ pure_systems=["acetone_300", "water_300"], # list of pure systems
126
+ ensemble="npt", # ensemble type: npt or nvt
127
+ gamma_integration_type="numerical", # integration method
128
+ verbose=False # logging verbosity
129
+ )
130
+
131
+ # run kbkit pipeline
132
+ results = pipe.run()
133
+
134
+ # Access the results properties
135
+ # stored in dataclass (ThermoProperty); attributes: name, value, units
136
+ # example for excess energy
137
+ ge_obj = results.ge
138
+ ge_array = ge_obj.value
139
+ ge_units = ge_obj.units
140
+ print("GE summary: ", ge_array.shape, ge_units)
141
+
142
+ # Convert units from kJ/mol -> kcal/mol
143
+ # default units will be those from GROMACS
144
+ pipe.convert_units("ge", "kcal/mol")
145
+ ```
146
+
147
+ ### Create plots for thermodynamic properties from pipeline
148
+
149
+ ```python
150
+ from kbkit.viz import Plotter
151
+
152
+ # Map molecule IDs (as present in .top files) to names for figures
153
+ molecule_map = {
154
+ "ACETO": "Acetone",
155
+ "TIP4P": "Water",
156
+ }
157
+ x_mol = "ACETO" # molecule for x-axis labels
158
+
159
+ plotter = Plotter(pipeline=pipe, x_mol=x_mol, molecule_map=molecule_map)
160
+
161
+ # Plot Kirkwood-Buff integrals
162
+ plotter.plot("kbi")
163
+
164
+ # Plot log of activity coefficients
165
+ plotter.plot("lngammas")
166
+
167
+ # Generate all figures (saved to /path/to/systems/kb_analysis)
168
+ plotter.make_figures()
169
+ ```
170
+
171
+ ### Parse GROMACS files
172
+
173
+ ```python
174
+ from kbkit.parsers import TopFileParser, EdrFileParser, GroFileParser
175
+
176
+ # determines molecules present in simulation and their counts
177
+ top_parser = TopFileParser(top_file.top)
178
+ print("molecule dict: ", top_parser.molecule_counts)
179
+ print("molecule names: ", top_parser.molecules)
180
+ print("total molecule number: ", top_parser.total_molecules)
181
+
182
+ # determines electron count for each molecule type
183
+ gro_parser = GroFileParser(gro_file.gro)
184
+ print("electron dict: ", gro_parser.electron_count)
185
+ print("box volume: ", gro_parser.compute_box_volume())
186
+
187
+ # computes energy properties by calling gmx energy
188
+ edr_parser = EdrFileParser(edr_file.edr)
189
+ print("List of available properties: ", edr_parser.available_properties())
190
+ print("Density array over simulation time: ", edr_parser.extract_timeseries("density"))
191
+ print("Average density with std deviation: ", edr_parser.average_property("density", return_std=True))
192
+ ```
193
+
194
+ ### Calculate static structure factors and x-ray intensities as q &rarr; 0
195
+
196
+ ```python
197
+ from kbkit.calculators import StaticStructureCalculator
198
+
199
+ """
200
+ Requires:
201
+ - mol fraction matrix: shape(num compositions, num components)
202
+ - molar_volume: shape(num components), units cm^3/mol
203
+ - n_electrons: shape(num components)
204
+ """
205
+ calculator = StaticStructureCalculator(mol_fr, molar_volume, n_electrons)
206
+
207
+ # update conditions
208
+ # if conditions are not updated all calculations will use previous values
209
+ calculator.update_conditions(T, Hessian, isothermal_compressibility)
210
+
211
+ # calculate x-ray intensity
212
+ calculator.i0()
213
+ ```
214
+
215
+ ## Credits
216
+
217
+ This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [jevandezande/pixi-cookiecutter](https://github.com/jevandezande/pixi-cookiecutter) project template.