bfflearn 0.1.0.dev3__tar.gz → 0.2.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 (164) hide show
  1. bfflearn-0.2.0/CHANGELOG.md +76 -0
  2. bfflearn-0.2.0/CITATION.cff +31 -0
  3. bfflearn-0.2.0/CODE_OF_CONDUCT.md +8 -0
  4. bfflearn-0.2.0/CONTRIBUTING.md +32 -0
  5. bfflearn-0.2.0/MANIFEST.in +9 -0
  6. bfflearn-0.2.0/PKG-INFO +184 -0
  7. bfflearn-0.2.0/README.md +134 -0
  8. bfflearn-0.2.0/SECURITY.md +14 -0
  9. bfflearn-0.2.0/SUPPORT.md +11 -0
  10. bfflearn-0.2.0/bff/__init__.py +121 -0
  11. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/bayes/gaussian_process.py +27 -7
  12. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/bayes/kernels.py +4 -4
  13. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/bayes/learning.py +76 -51
  14. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/bayes/likelihoods.py +15 -5
  15. bfflearn-0.2.0/bff/bayes/means.py +21 -0
  16. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/bayes/results.py +79 -128
  17. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/bayes/utils.py +30 -10
  18. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/cli.py +72 -72
  19. bfflearn-0.2.0/bff/data.py +19 -0
  20. bfflearn-0.2.0/bff/domain/__init__.py +12 -0
  21. bfflearn-0.1.0.dev3/bff/domain/trainset.py → bfflearn-0.2.0/bff/domain/sample.py +31 -34
  22. bfflearn-0.2.0/bff/domain/specs.py +480 -0
  23. bfflearn-0.2.0/bff/io/__init__.py +21 -0
  24. bfflearn-0.2.0/bff/io/colvars.py +32 -0
  25. bfflearn-0.2.0/bff/io/cp2k.py +650 -0
  26. bfflearn-0.2.0/bff/io/extxyz.py +233 -0
  27. bfflearn-0.2.0/bff/io/logs.py +346 -0
  28. bfflearn-0.2.0/bff/io/plumed.py +50 -0
  29. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/io/progress.py +12 -32
  30. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/io/utils.py +3 -8
  31. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/plotting.py +31 -11
  32. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/qoi/analysis.py +6 -21
  33. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/qoi/routines.py +1 -1
  34. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/tools.py +0 -16
  35. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/topology.py +120 -212
  36. bfflearn-0.2.0/bff/workflows/_shared/__init__.py +0 -0
  37. bfflearn-0.2.0/bff/workflows/_shared/campaign.py +651 -0
  38. bfflearn-0.2.0/bff/workflows/_shared/config.py +370 -0
  39. bfflearn-0.2.0/bff/workflows/_shared/preparation.py +370 -0
  40. bfflearn-0.2.0/bff/workflows/_shared/scheduler.py +148 -0
  41. bfflearn-0.2.0/bff/workflows/analyze/__init__.py +6 -0
  42. bfflearn-0.2.0/bff/workflows/analyze/__main__.py +8 -0
  43. bfflearn-0.2.0/bff/workflows/analyze/config.py +159 -0
  44. bfflearn-0.1.0.dev3/bff/workflows/qoi.py → bfflearn-0.2.0/bff/workflows/analyze/main.py +137 -132
  45. bfflearn-0.2.0/bff/workflows/build/__init__.py +6 -0
  46. bfflearn-0.2.0/bff/workflows/build/__main__.py +10 -0
  47. bfflearn-0.2.0/bff/workflows/build/config.py +206 -0
  48. bfflearn-0.2.0/bff/workflows/build/main.py +294 -0
  49. bfflearn-0.2.0/bff/workflows/evaluate_snapshots/__init__.py +11 -0
  50. bfflearn-0.2.0/bff/workflows/evaluate_snapshots/__main__.py +10 -0
  51. bfflearn-0.2.0/bff/workflows/evaluate_snapshots/config.py +218 -0
  52. bfflearn-0.2.0/bff/workflows/evaluate_snapshots/main.py +736 -0
  53. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/workflows/examples.py +41 -1
  54. bfflearn-0.2.0/bff/workflows/fit/__init__.py +6 -0
  55. bfflearn-0.2.0/bff/workflows/fit/__main__.py +8 -0
  56. bfflearn-0.2.0/bff/workflows/fit/config.py +150 -0
  57. bfflearn-0.2.0/bff/workflows/fit/main.py +75 -0
  58. bfflearn-0.2.0/bff/workflows/learn/__init__.py +6 -0
  59. bfflearn-0.2.0/bff/workflows/learn/__main__.py +8 -0
  60. bfflearn-0.2.0/bff/workflows/learn/config.py +114 -0
  61. bfflearn-0.2.0/bff/workflows/learn/main.py +101 -0
  62. bfflearn-0.2.0/bff/workflows/md/__init__.py +6 -0
  63. bfflearn-0.2.0/bff/workflows/md/__main__.py +13 -0
  64. bfflearn-0.2.0/bff/workflows/md/config.py +76 -0
  65. bfflearn-0.1.0.dev3/bff/workflows/md.py → bfflearn-0.2.0/bff/workflows/md/main.py +100 -82
  66. bfflearn-0.2.0/bff/workflows/prepare_assets/__init__.py +6 -0
  67. bfflearn-0.2.0/bff/workflows/prepare_assets/__main__.py +10 -0
  68. bfflearn-0.2.0/bff/workflows/prepare_assets/config.py +62 -0
  69. bfflearn-0.2.0/bff/workflows/prepare_assets/main.py +199 -0
  70. bfflearn-0.2.0/bff/workflows/sample/__init__.py +6 -0
  71. bfflearn-0.2.0/bff/workflows/sample/__main__.py +8 -0
  72. bfflearn-0.2.0/bff/workflows/sample/config.py +102 -0
  73. bfflearn-0.1.0.dev3/bff/workflows/simulate.py → bfflearn-0.2.0/bff/workflows/sample/main.py +9 -9
  74. bfflearn-0.2.0/bff/workflows/validate/__init__.py +6 -0
  75. bfflearn-0.2.0/bff/workflows/validate/__main__.py +8 -0
  76. bfflearn-0.2.0/bff/workflows/validate/config.py +36 -0
  77. bfflearn-0.1.0.dev3/bff/workflows/validate.py → bfflearn-0.2.0/bff/workflows/validate/main.py +5 -5
  78. bfflearn-0.2.0/bfflearn.egg-info/PKG-INFO +184 -0
  79. bfflearn-0.2.0/bfflearn.egg-info/SOURCES.txt +144 -0
  80. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bfflearn.egg-info/requires.txt +7 -7
  81. bfflearn-0.2.0/docs/architecture.md +114 -0
  82. bfflearn-0.2.0/docs/assets/bff-logo.pdf +0 -0
  83. bfflearn-0.2.0/docs/assets/bff-logo.svg +763 -0
  84. bfflearn-0.2.0/docs/changelog.md +55 -0
  85. bfflearn-0.2.0/docs/cli.md +72 -0
  86. bfflearn-0.2.0/docs/configuration/analyze.md +121 -0
  87. bfflearn-0.2.0/docs/configuration/build.md +98 -0
  88. bfflearn-0.2.0/docs/configuration/evaluate-snapshots.md +88 -0
  89. bfflearn-0.2.0/docs/configuration/fit.md +74 -0
  90. bfflearn-0.2.0/docs/configuration/learn.md +78 -0
  91. bfflearn-0.2.0/docs/configuration/prepare-assets.md +65 -0
  92. bfflearn-0.2.0/docs/configuration/sample.md +156 -0
  93. bfflearn-0.2.0/docs/configuration/validate.md +73 -0
  94. bfflearn-0.2.0/docs/development.md +121 -0
  95. bfflearn-0.2.0/docs/examples/acetate.md +152 -0
  96. bfflearn-0.2.0/docs/examples/arbitrary-data.md +50 -0
  97. bfflearn-0.2.0/docs/examples/index.md +14 -0
  98. bfflearn-0.2.0/docs/examples/neon-mie-lgpmd.md +50 -0
  99. bfflearn-0.2.0/docs/index.md +92 -0
  100. bfflearn-0.2.0/docs/installation.md +85 -0
  101. bfflearn-0.2.0/mkdocs.yml +76 -0
  102. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/pyproject.toml +11 -11
  103. bfflearn-0.2.0/tests/bayes/test_gaussian_process.py +103 -0
  104. bfflearn-0.2.0/tests/bayes/test_learning_problem.py +135 -0
  105. bfflearn-0.2.0/tests/bayes/test_likelihoods.py +79 -0
  106. bfflearn-0.2.0/tests/bayes/test_priors_posterior.py +85 -0
  107. bfflearn-0.2.0/tests/bayes/test_results.py +100 -0
  108. bfflearn-0.2.0/tests/bayes/test_utils.py +19 -0
  109. bfflearn-0.2.0/tests/domain/test_specs.py +182 -0
  110. bfflearn-0.2.0/tests/io/_fake_mdanalysis.py +49 -0
  111. bfflearn-0.2.0/tests/io/test_cp2k.py +144 -0
  112. bfflearn-0.2.0/tests/io/test_cp2k_collect.py +45 -0
  113. bfflearn-0.2.0/tests/io/test_logs.py +48 -0
  114. bfflearn-0.2.0/tests/io/test_mdp.py +38 -0
  115. bfflearn-0.2.0/tests/mcmc/test_convergence.py +61 -0
  116. bfflearn-0.2.0/tests/mcmc/test_proposal.py +77 -0
  117. bfflearn-0.2.0/tests/mcmc/test_sampler.py +119 -0
  118. bfflearn-0.2.0/tests/qoi/test_data.py +71 -0
  119. bfflearn-0.2.0/tests/test_examples.py +85 -0
  120. bfflearn-0.2.0/tests/test_plotting.py +53 -0
  121. bfflearn-0.2.0/tests/test_topology.py +74 -0
  122. bfflearn-0.2.0/tests/workflows/test_charge_constraints.py +168 -0
  123. bfflearn-0.2.0/tests/workflows/test_configs.py +340 -0
  124. bfflearn-0.2.0/tests/workflows/test_regressions.py +196 -0
  125. bfflearn-0.2.0/tests/workflows/test_scheduler.py +120 -0
  126. bfflearn-0.1.0.dev3/PKG-INFO +0 -940
  127. bfflearn-0.1.0.dev3/README.md +0 -215
  128. bfflearn-0.1.0.dev3/bff/__init__.py +0 -30
  129. bfflearn-0.1.0.dev3/bff/data.py +0 -93
  130. bfflearn-0.1.0.dev3/bff/domain/__init__.py +0 -12
  131. bfflearn-0.1.0.dev3/bff/domain/specs.py +0 -347
  132. bfflearn-0.1.0.dev3/bff/io/__init__.py +0 -12
  133. bfflearn-0.1.0.dev3/bff/io/colvars.py +0 -186
  134. bfflearn-0.1.0.dev3/bff/io/cp2k.py +0 -330
  135. bfflearn-0.1.0.dev3/bff/io/logs.py +0 -213
  136. bfflearn-0.1.0.dev3/bff/io/plumed.py +0 -184
  137. bfflearn-0.1.0.dev3/bff/workflows/configs.py +0 -1147
  138. bfflearn-0.1.0.dev3/bff/workflows/learn.py +0 -77
  139. bfflearn-0.1.0.dev3/bff/workflows/prepare.py +0 -788
  140. bfflearn-0.1.0.dev3/bff/workflows/runsims.py +0 -620
  141. bfflearn-0.1.0.dev3/bff/workflows/train.py +0 -69
  142. bfflearn-0.1.0.dev3/bfflearn.egg-info/PKG-INFO +0 -940
  143. bfflearn-0.1.0.dev3/bfflearn.egg-info/SOURCES.txt +0 -59
  144. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/LICENSE +0 -0
  145. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/bayes/__init__.py +0 -0
  146. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/bayes/posterior.py +0 -0
  147. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/bayes/priors.py +0 -0
  148. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/domain/bias.py +0 -0
  149. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/io/commands.py +0 -0
  150. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/io/mdp.py +0 -0
  151. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/io/schedulers.py +0 -0
  152. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/mcmc/__init__.py +0 -0
  153. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/mcmc/convergence.py +0 -0
  154. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/mcmc/proposal.py +0 -0
  155. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/mcmc/sampler.py +0 -0
  156. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/qoi/__init__.py +0 -0
  157. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/qoi/data.py +0 -0
  158. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/qoi/hbonds.py +0 -0
  159. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/qoi/rdf.py +0 -0
  160. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bff/workflows/__init__.py +0 -0
  161. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bfflearn.egg-info/dependency_links.txt +0 -0
  162. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bfflearn.egg-info/entry_points.txt +0 -0
  163. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/bfflearn.egg-info/top_level.txt +0 -0
  164. {bfflearn-0.1.0.dev3 → bfflearn-0.2.0}/setup.cfg +0 -0
@@ -0,0 +1,76 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## `0.2.0` - 2026-06-01
6
+
7
+ The public reproduction snapshot for the published study is archived as
8
+ [`v0.0.1`](https://github.com/vojtechkostal/BayesicForceFields/tree/v0.0.1).
9
+ Use that tag for exact reproduction of the paper results. The current
10
+ `0.2.0` release is a substantial workflow refactor.
11
+
12
+ ### Reference Points
13
+
14
+ The code history contains two useful paper-era reference points:
15
+
16
+ - Earlier paper-era branches parsed and modified GROMACS topologies through
17
+ ParmEd.
18
+ - The later public `v0.0.1` reproduction snapshot had already removed ParmEd
19
+ and used an intermediate `gmxtop` parser together with MDAnalysis.
20
+ - The current development line uses `gmxtopology` for GROMACS topology
21
+ handling and MDAnalysis selections for flexible atom grouping.
22
+
23
+ ### Publication Snippet
24
+
25
+ Relative to the paper-era implementation, Bayesic Force Fields has been
26
+ refactored into a staged, configuration-driven workflow for system preparation,
27
+ reference-data generation, force-field sampling, surrogate fitting, posterior
28
+ learning, and validation. The refactor replaces the external `emcee` sampling
29
+ backend with an in-package Torch MCMC implementation, moves topology handling
30
+ away from the earlier ParmEd-based path, and adds reusable quantity-of-interest
31
+ datasets, local and Slurm execution, hierarchical charge constraints, broader
32
+ GROMACS topology updates, and notebook-first examples for externally generated
33
+ data.
34
+
35
+ ### Architecture Changes
36
+
37
+ | Area | Paper-Era Implementation | `0.2.0` |
38
+ | --- | --- | --- |
39
+ | Posterior sampling | `emcee.EnsembleSampler` with an `emcee` HDF backend | In-package Torch parallel Metropolis-Hastings sampler with an adaptive Gaussian proposal |
40
+ | MCMC diagnostics | Autocorrelation handling through `emcee` results | Checkpoint and restart support, rank-normalized split R-hat, integrated autocorrelation time, and effective sample size diagnostics |
41
+ | Topology handling | Earlier branches used ParmEd; `v0.0.1` used the intermediate `gmxtop` parser | `gmxtopology` topology model with MDAnalysis selections and complete-topology updates |
42
+ | Charge constraints | One molecule of interest, one total molecular charge, and one implicit charge parameter | Reconstructable residue- or system-level hierarchical constraints with separate implicit parameters and compatibility checks |
43
+ | Training data | Monolithic `TrainData` arrays and YAML sidecar files | Serialized `QoIDataset` objects that can also be assembled from external data |
44
+ | Learning results | `MCMCResults` and `InferenceResults` inside a broad `structures.py` module | Focused `LearningProblem`, `PosteriorResults`, priors, proposal, sampler, and convergence modules |
45
+ | Workflow API | Broad `initialize`, `runsims`, `analyze`, and `learn` commands | Focused `build`, `prepare-assets`, `evaluate-snapshots`, `sample`, `analyze`, `fit`, `learn`, and `validate` stages |
46
+
47
+ ### Highlights
48
+
49
+ - Removed the runtime `emcee` dependency and added a Torch-native MCMC stack
50
+ with adaptive proposals, checkpoints, restart support, and convergence
51
+ diagnostics.
52
+ - Replaced the earlier ParmEd topology path with a GROMACS-native topology
53
+ model and MDAnalysis selections.
54
+ - Split the former monolithic structures and inference code into focused
55
+ domain, MCMC, learning, and results modules.
56
+ - Added reconstructable `specs.yaml` files and hierarchical residue- or
57
+ system-level charge constraints with explicit compatibility checks.
58
+ - Added CP2K snapshot staging and collection, EXTXYZ output, PLUMED and Colvars
59
+ bias inputs, and local or Slurm execution.
60
+ - Unified analyzed observables as reusable quantity-of-interest datasets and
61
+ added notebook workflows for arbitrary tabular data and Neon RDF inference.
62
+ - Added callable Gaussian-process means, numerical-stability improvements, and
63
+ more reliable posterior plotting and MAP selection.
64
+ - Added GROMACS function-9 dihedral force-constant sampling through labels such
65
+ as `dihedraltype9_3_180`, updating every matching topology term.
66
+ - Expanded documentation, packaged examples, regression coverage, and release
67
+ automation.
68
+
69
+ ## `v0.0.1`: Publication Snapshot
70
+
71
+ Archived public snapshot for reproducing the results reported in:
72
+
73
+ Kostal, V.; Shanks, B. L.; Jungwirth, P.; Martinez-Seara, H.
74
+ *Bayesian Learning for Accurate and Robust Biomolecular Force Fields.*
75
+ J. Chem. Theory Comput. **2026**, 22 (5), 2652-2663.
76
+ [https://doi.org/10.1021/acs.jctc.5c02051](https://doi.org/10.1021/acs.jctc.5c02051)
@@ -0,0 +1,31 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use BFF, please cite the repository and the associated paper."
3
+ title: "Bayesic Force Fields"
4
+ version: "0.2.0"
5
+ date-released: "2026-06-01"
6
+ authors:
7
+ - family-names: Kostal
8
+ given-names: Vojtech
9
+ url: "https://github.com/vojtechkostal/BayesicForceFields"
10
+ repository-code: "https://github.com/vojtechkostal/BayesicForceFields"
11
+ license: "GPL-3.0-only"
12
+ preferred-citation:
13
+ type: article
14
+ title: "Bayesian Learning for Accurate and Robust Biomolecular Force Fields"
15
+ authors:
16
+ - family-names: Kostal
17
+ given-names: Vojtech
18
+ - family-names: Shanks
19
+ given-names: Brennon L.
20
+ - family-names: Jungwirth
21
+ given-names: Pavel
22
+ - family-names: Martinez-Seara
23
+ given-names: Hector
24
+ journal: "Journal of Chemical Theory and Computation"
25
+ year: 2026
26
+ volume: 22
27
+ issue: 5
28
+ start: 2652
29
+ end: 2663
30
+ doi: "10.1021/acs.jctc.5c02051"
31
+ url: "https://pubs.acs.org/doi/10.1021/acs.jctc.5c02051"
@@ -0,0 +1,8 @@
1
+ # Code Of Conduct
2
+
3
+ Bayesic Force Fields welcomes constructive participation. Be respectful,
4
+ assume good faith, discuss technical disagreements directly, and avoid
5
+ harassment or discriminatory language.
6
+
7
+ Report unacceptable behavior privately to the repository maintainer at
8
+ vojtakostal8@gmail.com. Reports will be reviewed in confidence.
@@ -0,0 +1,32 @@
1
+ # Contributing
2
+
3
+ Thank you for improving Bayesic Force Fields.
4
+
5
+ ## Development Setup
6
+
7
+ Create the repository environment and install the PyTorch build appropriate
8
+ for your machine:
9
+
10
+ ```bash
11
+ mamba env create -f environment.yaml
12
+ mamba activate bfflearn
13
+ ```
14
+
15
+ See the [development guide](https://vojtechkostal.github.io/BayesicForceFields/development/)
16
+ for the branch workflow and repository layout.
17
+
18
+ ## Before Opening A Pull Request
19
+
20
+ Run the release-facing checks:
21
+
22
+ ```bash
23
+ python -m compileall -q bff
24
+ ruff check .
25
+ python -m pytest -q
26
+ mkdocs build --strict
27
+ python -m build
28
+ python -m twine check dist/*
29
+ ```
30
+
31
+ Keep pull requests focused, describe observable behavior changes, and add
32
+ regression tests when fixing a bug.
@@ -0,0 +1,9 @@
1
+ include CHANGELOG.md
2
+ include CITATION.cff
3
+ include CODE_OF_CONDUCT.md
4
+ include CONTRIBUTING.md
5
+ include SECURITY.md
6
+ include SUPPORT.md
7
+ include mkdocs.yml
8
+ recursive-include docs *.md *.pdf *.svg
9
+ recursive-include tests *.py
@@ -0,0 +1,184 @@
1
+ Metadata-Version: 2.4
2
+ Name: bfflearn
3
+ Version: 0.2.0
4
+ Summary: Bayesian workflows for fixed-charge molecular force fields
5
+ Author-email: Vojtech Kostal <vojtakostal8@gmail.com>
6
+ License-Expression: GPL-3.0-only
7
+ Project-URL: Documentation, https://vojtechkostal.github.io/BayesicForceFields/
8
+ Project-URL: Homepage, https://github.com/vojtechkostal/BayesicForceFields
9
+ Project-URL: Issues, https://github.com/vojtechkostal/BayesicForceFields/issues
10
+ Project-URL: Publication, https://pubs.acs.org/doi/10.1021/acs.jctc.5c02051
11
+ Project-URL: Preprint, https://arxiv.org/abs/2511.05398
12
+ Project-URL: Releases, https://github.com/vojtechkostal/BayesicForceFields/releases
13
+ Project-URL: Repository, https://github.com/vojtechkostal/BayesicForceFields
14
+ Keywords: bayesian-inference,force-fields,gromacs,molecular-dynamics,physical-chemistry
15
+ Classifier: Development Status :: 3 - Alpha
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
23
+ Classifier: Topic :: Scientific/Engineering :: Physics
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: gmxtopology>=0.1.1
28
+ Requires-Dist: matplotlib>=3.8
29
+ Requires-Dist: MDAnalysis>=2.7
30
+ Requires-Dist: numpy>=1.26
31
+ Requires-Dist: PyYAML>=6.0
32
+ Requires-Dist: scipy>=1.11
33
+ Requires-Dist: typer>=0.12
34
+ Provides-Extra: notebook
35
+ Requires-Dist: ipykernel; extra == "notebook"
36
+ Requires-Dist: ipython; extra == "notebook"
37
+ Requires-Dist: ipywidgets; extra == "notebook"
38
+ Requires-Dist: jupyterlab; extra == "notebook"
39
+ Requires-Dist: notebook; extra == "notebook"
40
+ Provides-Extra: dev
41
+ Requires-Dist: build; extra == "dev"
42
+ Requires-Dist: pytest; extra == "dev"
43
+ Requires-Dist: ruff; extra == "dev"
44
+ Requires-Dist: twine; extra == "dev"
45
+ Provides-Extra: docs
46
+ Requires-Dist: mkdocs>=1.6; extra == "docs"
47
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
48
+ Requires-Dist: pymdown-extensions; extra == "docs"
49
+ Dynamic: license-file
50
+
51
+ # Bayesic Force Fields
52
+
53
+ <p align="center">
54
+ <img src="https://raw.githubusercontent.com/vojtechkostal/BayesicForceFields/main/docs/assets/bff-logo.svg" alt="BFF logo" width="300">
55
+ </p>
56
+
57
+ [![Docs](https://img.shields.io/badge/docs-latest-brightgreen)](https://vojtechkostal.github.io/BayesicForceFields/)
58
+ [![Paper](https://img.shields.io/badge/paper-JCTC%202026-blue)](https://pubs.acs.org/doi/10.1021/acs.jctc.5c02051)
59
+ [![Release](https://img.shields.io/github/v/tag/vojtechkostal/BayesicForceFields?label=release)](https://github.com/vojtechkostal/BayesicForceFields/releases)
60
+ [![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://github.com/vojtechkostal/BayesicForceFields/blob/main/LICENSE)
61
+
62
+ Bayesic Force Fields (BFF) is a Python toolkit for learning fixed-charge
63
+ molecular force-field parameters from molecular-dynamics observables. It
64
+ coordinates simulation campaigns, trajectory analysis, surrogate fitting, and
65
+ Bayesian posterior learning.
66
+
67
+ Full documentation:
68
+ [vojtechkostal.github.io/BayesicForceFields](https://vojtechkostal.github.io/BayesicForceFields/)
69
+
70
+ ## Workflow
71
+
72
+ ```text
73
+ build -> prepare-assets -> evaluate-snapshots
74
+ -> sample -> analyze -> fit -> learn -> validate
75
+ ```
76
+
77
+ The command-line interface guides a force-field model from prepared molecular
78
+ systems to sampled trajectories, quantities of interest, surrogate models, and
79
+ validated posterior samples. See the [CLI reference](https://vojtechkostal.github.io/BayesicForceFields/cli/)
80
+ for the
81
+ individual commands.
82
+
83
+ ## Installation
84
+
85
+ Create an environment, install the [PyTorch build appropriate for your
86
+ machine](https://pytorch.org/get-started/locally/), and then install BFF:
87
+
88
+ ```bash
89
+ mamba create -n bfflearn python=3.10 pip
90
+ mamba activate bfflearn
91
+ pip install bfflearn
92
+ ```
93
+
94
+ > **WARNING:** GPU-enabled PyTorch must be installed separately. Use the
95
+ > [official PyTorch installation selector](https://pytorch.org/get-started/locally/)
96
+ > to choose the command matching your CUDA version before running fitting,
97
+ > learning, or the posterior notebooks.
98
+
99
+ Full MD workflows also require GROMACS. CP2K and PLUMED are needed only for the
100
+ stages that use them. See the [installation guide](https://vojtechkostal.github.io/BayesicForceFields/installation/)
101
+ for
102
+ details, CUDA guidance, and the repository-development setup.
103
+
104
+ ## Quick Start
105
+
106
+ Install the example tree and choose a walkthrough:
107
+
108
+ ```bash
109
+ bff examples
110
+ cd examples/acetate
111
+ ```
112
+
113
+ - [Acetate](https://github.com/vojtechkostal/BayesicForceFields/tree/main/examples/acetate):
114
+ complete staged MD workflow.
115
+ - [Arbitrary data](https://github.com/vojtechkostal/BayesicForceFields/tree/main/examples/arbitrary-data):
116
+ notebook using existing tabular
117
+ simulation results and targets.
118
+ - [Neon Mie](https://github.com/vojtechkostal/BayesicForceFields/tree/main/examples/neon-mie-lgpmd):
119
+ notebook using published RDF data.
120
+
121
+ The [examples guide](https://vojtechkostal.github.io/BayesicForceFields/examples/)
122
+ explains which starting point fits your data. The
123
+ [acetate walkthrough](https://vojtechkostal.github.io/BayesicForceFields/examples/acetate/)
124
+ shows the full command sequence.
125
+
126
+ ## Supported Parameters
127
+
128
+ BFF currently updates and learns four GROMACS force-field parameter families:
129
+
130
+ | Parameter | Bound label example |
131
+ | --- | --- |
132
+ | Partial charge | `charge O1 O2` |
133
+ | Lennard-Jones sigma | `sigma OW` |
134
+ | Lennard-Jones epsilon | `epsilon OW` |
135
+ | Function-9 dihedral force constant | `dihedraltype9_3_180` |
136
+
137
+ Multiple names in one label share one learned value. Charges can additionally
138
+ participate in hierarchical residue- or system-level constraints. The [sample
139
+ configuration reference](https://vojtechkostal.github.io/BayesicForceFields/configuration/sample/#parameter-labels)
140
+ documents the complete syntax and matching rules.
141
+
142
+ ## Architecture
143
+
144
+ ```mermaid
145
+ flowchart LR
146
+ A["YAML configs or Python API"] --> B["Simulation workflows"]
147
+ B --> C["Trajectories and reference data"]
148
+ C --> D["QoIDataset"]
149
+ D --> E["Gaussian-process surrogates"]
150
+ E --> F["Posterior learning and validation"]
151
+ ```
152
+
153
+ The [architecture guide](https://vojtechkostal.github.io/BayesicForceFields/architecture/)
154
+ describes the package modules, workflow stages, persisted artifacts, and
155
+ repository layout.
156
+
157
+ ## Documentation
158
+
159
+ - [Installation](https://vojtechkostal.github.io/BayesicForceFields/installation/)
160
+ - [Examples](https://vojtechkostal.github.io/BayesicForceFields/examples/)
161
+ - [Configuration reference](https://vojtechkostal.github.io/BayesicForceFields/configuration/build/)
162
+ - [Architecture](https://vojtechkostal.github.io/BayesicForceFields/architecture/)
163
+ - [Changelog](https://github.com/vojtechkostal/BayesicForceFields/blob/main/CHANGELOG.md)
164
+ - [Development](https://vojtechkostal.github.io/BayesicForceFields/development/)
165
+ - [Contributing](https://github.com/vojtechkostal/BayesicForceFields/blob/main/CONTRIBUTING.md)
166
+ - [Support](https://github.com/vojtechkostal/BayesicForceFields/blob/main/SUPPORT.md)
167
+ - [Security](https://github.com/vojtechkostal/BayesicForceFields/blob/main/SECURITY.md)
168
+
169
+ ## Citation
170
+
171
+ If you use BFF, please cite:
172
+
173
+ > Kostal, V.; Shanks, B. L.; Jungwirth, P.; Martinez-Seara, H.
174
+ > Bayesian Learning for Accurate and Robust Biomolecular Force Fields.
175
+ > *J. Chem. Theory Comput.* **2026**, *22* (5), 2652-2663.
176
+ > [https://doi.org/10.1021/acs.jctc.5c02051](https://doi.org/10.1021/acs.jctc.5c02051)
177
+
178
+ The exact publication snapshot is archived as
179
+ [`v0.0.1`](https://github.com/vojtechkostal/BayesicForceFields/tree/v0.0.1).
180
+
181
+ ## License
182
+
183
+ BFF is distributed under the
184
+ [GNU GPL v3](https://github.com/vojtechkostal/BayesicForceFields/blob/main/LICENSE).
@@ -0,0 +1,134 @@
1
+ # Bayesic Force Fields
2
+
3
+ <p align="center">
4
+ <img src="https://raw.githubusercontent.com/vojtechkostal/BayesicForceFields/main/docs/assets/bff-logo.svg" alt="BFF logo" width="300">
5
+ </p>
6
+
7
+ [![Docs](https://img.shields.io/badge/docs-latest-brightgreen)](https://vojtechkostal.github.io/BayesicForceFields/)
8
+ [![Paper](https://img.shields.io/badge/paper-JCTC%202026-blue)](https://pubs.acs.org/doi/10.1021/acs.jctc.5c02051)
9
+ [![Release](https://img.shields.io/github/v/tag/vojtechkostal/BayesicForceFields?label=release)](https://github.com/vojtechkostal/BayesicForceFields/releases)
10
+ [![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://github.com/vojtechkostal/BayesicForceFields/blob/main/LICENSE)
11
+
12
+ Bayesic Force Fields (BFF) is a Python toolkit for learning fixed-charge
13
+ molecular force-field parameters from molecular-dynamics observables. It
14
+ coordinates simulation campaigns, trajectory analysis, surrogate fitting, and
15
+ Bayesian posterior learning.
16
+
17
+ Full documentation:
18
+ [vojtechkostal.github.io/BayesicForceFields](https://vojtechkostal.github.io/BayesicForceFields/)
19
+
20
+ ## Workflow
21
+
22
+ ```text
23
+ build -> prepare-assets -> evaluate-snapshots
24
+ -> sample -> analyze -> fit -> learn -> validate
25
+ ```
26
+
27
+ The command-line interface guides a force-field model from prepared molecular
28
+ systems to sampled trajectories, quantities of interest, surrogate models, and
29
+ validated posterior samples. See the [CLI reference](https://vojtechkostal.github.io/BayesicForceFields/cli/)
30
+ for the
31
+ individual commands.
32
+
33
+ ## Installation
34
+
35
+ Create an environment, install the [PyTorch build appropriate for your
36
+ machine](https://pytorch.org/get-started/locally/), and then install BFF:
37
+
38
+ ```bash
39
+ mamba create -n bfflearn python=3.10 pip
40
+ mamba activate bfflearn
41
+ pip install bfflearn
42
+ ```
43
+
44
+ > **WARNING:** GPU-enabled PyTorch must be installed separately. Use the
45
+ > [official PyTorch installation selector](https://pytorch.org/get-started/locally/)
46
+ > to choose the command matching your CUDA version before running fitting,
47
+ > learning, or the posterior notebooks.
48
+
49
+ Full MD workflows also require GROMACS. CP2K and PLUMED are needed only for the
50
+ stages that use them. See the [installation guide](https://vojtechkostal.github.io/BayesicForceFields/installation/)
51
+ for
52
+ details, CUDA guidance, and the repository-development setup.
53
+
54
+ ## Quick Start
55
+
56
+ Install the example tree and choose a walkthrough:
57
+
58
+ ```bash
59
+ bff examples
60
+ cd examples/acetate
61
+ ```
62
+
63
+ - [Acetate](https://github.com/vojtechkostal/BayesicForceFields/tree/main/examples/acetate):
64
+ complete staged MD workflow.
65
+ - [Arbitrary data](https://github.com/vojtechkostal/BayesicForceFields/tree/main/examples/arbitrary-data):
66
+ notebook using existing tabular
67
+ simulation results and targets.
68
+ - [Neon Mie](https://github.com/vojtechkostal/BayesicForceFields/tree/main/examples/neon-mie-lgpmd):
69
+ notebook using published RDF data.
70
+
71
+ The [examples guide](https://vojtechkostal.github.io/BayesicForceFields/examples/)
72
+ explains which starting point fits your data. The
73
+ [acetate walkthrough](https://vojtechkostal.github.io/BayesicForceFields/examples/acetate/)
74
+ shows the full command sequence.
75
+
76
+ ## Supported Parameters
77
+
78
+ BFF currently updates and learns four GROMACS force-field parameter families:
79
+
80
+ | Parameter | Bound label example |
81
+ | --- | --- |
82
+ | Partial charge | `charge O1 O2` |
83
+ | Lennard-Jones sigma | `sigma OW` |
84
+ | Lennard-Jones epsilon | `epsilon OW` |
85
+ | Function-9 dihedral force constant | `dihedraltype9_3_180` |
86
+
87
+ Multiple names in one label share one learned value. Charges can additionally
88
+ participate in hierarchical residue- or system-level constraints. The [sample
89
+ configuration reference](https://vojtechkostal.github.io/BayesicForceFields/configuration/sample/#parameter-labels)
90
+ documents the complete syntax and matching rules.
91
+
92
+ ## Architecture
93
+
94
+ ```mermaid
95
+ flowchart LR
96
+ A["YAML configs or Python API"] --> B["Simulation workflows"]
97
+ B --> C["Trajectories and reference data"]
98
+ C --> D["QoIDataset"]
99
+ D --> E["Gaussian-process surrogates"]
100
+ E --> F["Posterior learning and validation"]
101
+ ```
102
+
103
+ The [architecture guide](https://vojtechkostal.github.io/BayesicForceFields/architecture/)
104
+ describes the package modules, workflow stages, persisted artifacts, and
105
+ repository layout.
106
+
107
+ ## Documentation
108
+
109
+ - [Installation](https://vojtechkostal.github.io/BayesicForceFields/installation/)
110
+ - [Examples](https://vojtechkostal.github.io/BayesicForceFields/examples/)
111
+ - [Configuration reference](https://vojtechkostal.github.io/BayesicForceFields/configuration/build/)
112
+ - [Architecture](https://vojtechkostal.github.io/BayesicForceFields/architecture/)
113
+ - [Changelog](https://github.com/vojtechkostal/BayesicForceFields/blob/main/CHANGELOG.md)
114
+ - [Development](https://vojtechkostal.github.io/BayesicForceFields/development/)
115
+ - [Contributing](https://github.com/vojtechkostal/BayesicForceFields/blob/main/CONTRIBUTING.md)
116
+ - [Support](https://github.com/vojtechkostal/BayesicForceFields/blob/main/SUPPORT.md)
117
+ - [Security](https://github.com/vojtechkostal/BayesicForceFields/blob/main/SECURITY.md)
118
+
119
+ ## Citation
120
+
121
+ If you use BFF, please cite:
122
+
123
+ > Kostal, V.; Shanks, B. L.; Jungwirth, P.; Martinez-Seara, H.
124
+ > Bayesian Learning for Accurate and Robust Biomolecular Force Fields.
125
+ > *J. Chem. Theory Comput.* **2026**, *22* (5), 2652-2663.
126
+ > [https://doi.org/10.1021/acs.jctc.5c02051](https://doi.org/10.1021/acs.jctc.5c02051)
127
+
128
+ The exact publication snapshot is archived as
129
+ [`v0.0.1`](https://github.com/vojtechkostal/BayesicForceFields/tree/v0.0.1).
130
+
131
+ ## License
132
+
133
+ BFF is distributed under the
134
+ [GNU GPL v3](https://github.com/vojtechkostal/BayesicForceFields/blob/main/LICENSE).
@@ -0,0 +1,14 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Security fixes are applied to the latest tagged BFF release.
6
+
7
+ ## Reporting A Vulnerability
8
+
9
+ Please do not open a public issue for a suspected vulnerability. Report it
10
+ privately through
11
+ [GitHub private vulnerability reporting](https://github.com/vojtechkostal/BayesicForceFields/security/advisories/new).
12
+ If private vulnerability reporting is not enabled, email
13
+ vojtakostal8@gmail.com. Include the affected version, reproduction steps, and
14
+ expected impact.
@@ -0,0 +1,11 @@
1
+ # Support
2
+
3
+ For installation questions, unexpected behavior, and feature requests, open a
4
+ [GitHub issue](https://github.com/vojtechkostal/BayesicForceFields/issues).
5
+
6
+ Include the BFF version, Python version, operating system, relevant
7
+ configuration fragment, and the complete error message. For GROMACS, CP2K, or
8
+ PLUMED issues, also include the external tool version and invocation.
9
+
10
+ Report security-sensitive issues privately as described in
11
+ [SECURITY.md](SECURITY.md).
@@ -0,0 +1,121 @@
1
+ """Bayesic Force Fields public package namespace."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib import import_module
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ __version__ = "0.2.0"
10
+
11
+ _INTERNAL_MODULES = {
12
+ "bayes",
13
+ "data",
14
+ "domain",
15
+ "io",
16
+ "plotting",
17
+ "qoi",
18
+ "tools",
19
+ }
20
+
21
+ __all__ = [
22
+ "Project",
23
+ "build",
24
+ "prepare_assets",
25
+ "evaluate_snapshots",
26
+ "sample",
27
+ "analyze",
28
+ "fit",
29
+ "learn",
30
+ "validate",
31
+ "QoI",
32
+ "QoIDataset",
33
+ "PosteriorResults",
34
+ ]
35
+
36
+
37
+ def _run_workflow(module_name: str, fn_config: str | Path):
38
+ workflow = import_module(module_name)
39
+ return workflow.main(Path(fn_config))
40
+
41
+
42
+ def build(fn_config: str | Path):
43
+ return _run_workflow("bff.workflows.build", fn_config)
44
+
45
+
46
+ def prepare_assets(fn_config: str | Path):
47
+ return _run_workflow("bff.workflows.prepare_assets", fn_config)
48
+
49
+
50
+ def evaluate_snapshots(fn_config: str | Path):
51
+ return _run_workflow("bff.workflows.evaluate_snapshots", fn_config)
52
+
53
+
54
+ def sample(fn_config: str | Path):
55
+ return _run_workflow("bff.workflows.sample", fn_config)
56
+
57
+
58
+ def analyze(fn_config: str | Path):
59
+ return _run_workflow("bff.workflows.analyze", fn_config)
60
+
61
+
62
+ def fit(fn_config: str | Path):
63
+ return _run_workflow("bff.workflows.fit", fn_config)
64
+
65
+
66
+ def learn(fn_config: str | Path):
67
+ return _run_workflow("bff.workflows.learn", fn_config)
68
+
69
+
70
+ def validate(fn_config: str | Path):
71
+ return _run_workflow("bff.workflows.validate", fn_config)
72
+
73
+
74
+ class Project:
75
+ def __init__(self, root: str | Path):
76
+ self.root = Path(root).expanduser().resolve()
77
+
78
+ def _resolve(self, fn_config: str | Path) -> Path:
79
+ fn_config = Path(fn_config)
80
+ if fn_config.is_absolute():
81
+ return fn_config
82
+ return (self.root / fn_config).resolve()
83
+
84
+ def build(self, fn_config: str | Path):
85
+ return build(self._resolve(fn_config))
86
+
87
+ def prepare_assets(self, fn_config: str | Path):
88
+ return prepare_assets(self._resolve(fn_config))
89
+
90
+ def evaluate_snapshots(self, fn_config: str | Path):
91
+ return evaluate_snapshots(self._resolve(fn_config))
92
+
93
+ def sample(self, fn_config: str | Path):
94
+ return sample(self._resolve(fn_config))
95
+
96
+ def analyze(self, fn_config: str | Path):
97
+ return analyze(self._resolve(fn_config))
98
+
99
+ def fit(self, fn_config: str | Path):
100
+ return fit(self._resolve(fn_config))
101
+
102
+ def learn(self, fn_config: str | Path):
103
+ return learn(self._resolve(fn_config))
104
+
105
+ def validate(self, fn_config: str | Path):
106
+ return validate(self._resolve(fn_config))
107
+
108
+
109
+ def __getattr__(name: str) -> Any:
110
+ if name in _INTERNAL_MODULES:
111
+ return import_module(f".{name}", __name__)
112
+ if name == "QoI":
113
+ from .qoi.data import QoI
114
+ return QoI
115
+ if name == "QoIDataset":
116
+ from .qoi.data import QoIDataset
117
+ return QoIDataset
118
+ if name == "PosteriorResults":
119
+ from .bayes.results import PosteriorResults
120
+ return PosteriorResults
121
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")