duello 0.2.0__tar.gz → 0.2.1__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 (53) hide show
  1. {duello-0.2.0 → duello-0.2.1}/Cargo.lock +1 -1
  2. {duello-0.2.0 → duello-0.2.1}/Cargo.toml +1 -1
  3. duello-0.2.1/PKG-INFO +227 -0
  4. {duello-0.2.0 → duello-0.2.1}/README.md +4 -1
  5. {duello-0.2.0 → duello-0.2.1}/pyproject.toml +2 -1
  6. duello-0.2.0/CLAUDE.md +0 -9
  7. duello-0.2.0/PKG-INFO +0 -5
  8. {duello-0.2.0 → duello-0.2.1}/.cargo/config.toml +0 -0
  9. {duello-0.2.0 → duello-0.2.1}/.github/dependabot.yml +0 -0
  10. {duello-0.2.0 → duello-0.2.1}/.github/workflows/rust.yml +0 -0
  11. {duello-0.2.0 → duello-0.2.1}/.gitignore +0 -0
  12. {duello-0.2.0 → duello-0.2.1}/.vscode/extensions.json +0 -0
  13. {duello-0.2.0 → duello-0.2.1}/.vscode/launch.json +0 -0
  14. {duello-0.2.0 → duello-0.2.1}/.vscode/settings.json +0 -0
  15. {duello-0.2.0 → duello-0.2.1}/.zed/settings.json +0 -0
  16. {duello-0.2.0 → duello-0.2.1}/.zenodo.json +0 -0
  17. {duello-0.2.0 → duello-0.2.1}/LICENSE +0 -0
  18. {duello-0.2.0 → duello-0.2.1}/assets/atoms.yml +0 -0
  19. {duello-0.2.0 → duello-0.2.1}/assets/convert-calvados3.ipynb +0 -0
  20. {duello-0.2.0 → duello-0.2.1}/assets/duello-logo.png +0 -0
  21. {duello-0.2.0 → duello-0.2.1}/assets/illustration.png +0 -0
  22. {duello-0.2.0 → duello-0.2.1}/examples/calvados3/4lzt.xyz +0 -0
  23. {duello-0.2.0 → duello-0.2.1}/examples/calvados3/topology.yaml +0 -0
  24. {duello-0.2.0 → duello-0.2.1}/examples/cppm/cppm-p00.xyz +0 -0
  25. {duello-0.2.0 → duello-0.2.1}/examples/cppm/cppm-p18.xyz +0 -0
  26. {duello-0.2.0 → duello-0.2.1}/examples/cppm/topology.yaml +0 -0
  27. {duello-0.2.0 → duello-0.2.1}/examples/lazy_static.rs +0 -0
  28. {duello-0.2.0 → duello-0.2.1}/examples/lookup.rs +0 -0
  29. {duello-0.2.0 → duello-0.2.1}/examples/notebook/interpolation-error.ipynb +0 -0
  30. {duello-0.2.0 → duello-0.2.1}/examples/notebook/plot_potential.py +0 -0
  31. {duello-0.2.0 → duello-0.2.1}/scripts/calvados3.sh +0 -0
  32. {duello-0.2.0 → duello-0.2.1}/scripts/colab.ipynb +0 -0
  33. {duello-0.2.0 → duello-0.2.1}/scripts/cppm.sh +0 -0
  34. {duello-0.2.0 → duello-0.2.1}/src/backend/cpu.rs +0 -0
  35. {duello-0.2.0 → duello-0.2.1}/src/backend/gpu.rs +0 -0
  36. {duello-0.2.0 → duello-0.2.1}/src/backend/mod.rs +0 -0
  37. {duello-0.2.0 → duello-0.2.1}/src/backend/simd.rs +0 -0
  38. {duello-0.2.0 → duello-0.2.1}/src/energy.rs +0 -0
  39. {duello-0.2.0 → duello-0.2.1}/src/fibonacci.rs +0 -0
  40. {duello-0.2.0 → duello-0.2.1}/src/icoscan.rs +0 -0
  41. {duello-0.2.0 → duello-0.2.1}/src/icosphere.rs +0 -0
  42. {duello-0.2.0 → duello-0.2.1}/src/icotable.rs +0 -0
  43. {duello-0.2.0 → duello-0.2.1}/src/lib.rs +0 -0
  44. {duello-0.2.0 → duello-0.2.1}/src/main.rs +0 -0
  45. {duello-0.2.0 → duello-0.2.1}/src/report.rs +0 -0
  46. {duello-0.2.0 → duello-0.2.1}/src/sample.rs +0 -0
  47. {duello-0.2.0 → duello-0.2.1}/src/shaders/energy.wgsl +0 -0
  48. {duello-0.2.0 → duello-0.2.1}/src/spherical.rs +0 -0
  49. {duello-0.2.0 → duello-0.2.1}/src/structure.rs +0 -0
  50. {duello-0.2.0 → duello-0.2.1}/src/table.rs +0 -0
  51. {duello-0.2.0 → duello-0.2.1}/src/vertex.rs +0 -0
  52. {duello-0.2.0 → duello-0.2.1}/src/virial.rs +0 -0
  53. {duello-0.2.0 → duello-0.2.1}/topology.yaml +0 -0
@@ -745,7 +745,7 @@ dependencies = [
745
745
 
746
746
  [[package]]
747
747
  name = "duello"
748
- version = "0.2.0"
748
+ version = "0.2.1"
749
749
  dependencies = [
750
750
  "anyhow",
751
751
  "approx",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "duello"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  edition = "2021"
5
5
  description = "Calculates the osmotic second virial coefficient (B2), and dissociation constant (Kd), for two rigid (macro)molecules, e.g. globular proteins. Done by explicit summation of the partition function in six dimensions (angular space and rigid-body separation). Calvados 3 parameters for use with coarsed grained amino acids are provided, but any pair-wise additivie potential can be used."
6
6
  authors = ["Mikael Lund <lyssky@icloud.com>"]
duello-0.2.1/PKG-INFO ADDED
@@ -0,0 +1,227 @@
1
+ Metadata-Version: 2.4
2
+ Name: duello
3
+ Version: 0.2.1
4
+ Requires-Dist: pdb2xyz>=0.1.2
5
+ License-File: LICENSE
6
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
7
+
8
+ <p align="center">
9
+ <img src="assets/duello-logo.png" alt="crates.io", height="300">
10
+ </p>
11
+ <p align="center">
12
+ <a href="https://doi.org/10/p5d4">
13
+ <img src="https://img.shields.io/badge/doi-10.26434%2Fchemrxiv--2025--0bfhd-lightgrey" alt="DOI:10.26434/chemrxiv-2025-0bfhd">
14
+ </a>
15
+ <a href="https://doi.org/10.5281/zenodo.15772003">
16
+ <img src="https://zenodo.org/badge/DOI/10.5281/zenodo.15772003.svg" alt="Zenodo">
17
+ </a>
18
+ <a href="https://colab.research.google.com/github/mlund/duello/blob/master/scripts/colab.ipynb">
19
+ <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab">
20
+ </a>
21
+ <a href="https://opensource.org/licenses/Apache-2.0">
22
+ <img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg">
23
+ </a>
24
+ <a href="https://github.com/mlund/duello/actions/workflows/rust.yml">
25
+ <img src="https://github.com/mlund/duello/actions/workflows/rust.yml/badge.svg">
26
+ </a>
27
+ </p>
28
+
29
+ -----
30
+
31
+ <p align = "center">
32
+ <b>Duello</b></br>
33
+ <i>Virial Coefficient and Dissociation Constant Estimation for Rigid Macromolecules</i>
34
+ </p>
35
+
36
+ -----
37
+
38
+ # Introduction
39
+
40
+ Duello is a tool to calculate the potential of mean force (PMF) between two rigid bodies, performing a
41
+ statistical mechanical average over inter-molecular orientations using subdivided icosahedrons.
42
+ For each mass center separation, _R_, the static contribution to the partition function,
43
+ $\mathcal{Z}(R) = \sum_{\mathbf{\Omega}} e^{-V(R,\mathbf{\Omega})/k_BT}$, is explicitly
44
+ evaluated to obtain the potential of mean force,
45
+ $w(R) = -k_BT \ln \mathcal{Z}(R)$
46
+ and the thermally averaged energy,
47
+
48
+ $$
49
+ U(R) = \frac{\sum V(R,\mathbf{\Omega}) e^{-V(R,\mathbf{\Omega})/k_BT}} {\mathcal{Z}(R)}
50
+ $$
51
+
52
+ where $V(R,\mathbf{\Omega})$ is the total inter-body interaction energy and $\mathbf{\Omega}$ represents a 5D angular space (_e.g._ two spherical coordinates for each body plus a dihedral angle around the connection line).
53
+
54
+ The osmotic second virial coefficient, which has dimensions of _volume_, reports on exactly two-body interactions:
55
+
56
+ $$
57
+ \begin{align}
58
+ B_2 & = -\frac{1}{16\pi^2} \int_{\mathbf{\Omega}} \int_0^{\infty}
59
+ \left (
60
+ e^{-V(R,\mathbf{\Omega})/k_BT} - 1
61
+ \right )
62
+ R^2 dR d\mathbf{\Omega}\\
63
+ & = -2\pi \int_0^{\infty} \left ( e^{-w(R)/k_BT} -1 \right )R^2 dR \\
64
+ & = B_2^{hs} -2\pi \int_{\sigma}^{\infty} \left ( e^{-w(R)/k_BT} -1 \right )R^2 dR\\
65
+ \end{align}
66
+ $$
67
+
68
+ where $B_2^{hs} = 2\pi\sigma^3/3$ is the hard-sphere contribution and $\sigma$ is a distance
69
+ of closest approach where $w(R\lt \sigma)=\infty$ is assumed.
70
+ For systems with net attractive interactions, the dissociation constant, $K_d$, can be estimated by,
71
+
72
+ $$
73
+ K_d^{-1} = 2 N_A\left (B_2^{hs} - B_2\right )
74
+ $$
75
+
76
+ <p align="center">
77
+ <img src="assets/illustration.png" alt="crates.io", height="200">
78
+ </p>
79
+
80
+ # Installation
81
+
82
+ Binary packages are available for Linux and MacOS through PyPI.org:
83
+
84
+ ```console
85
+ pip install duello
86
+ ```
87
+
88
+ If you have a [Rust toolchain](https://www.rust-lang.org/learn/get-started) installed,
89
+ you may alternatively build and install directly from the source code:
90
+
91
+ ```sh
92
+ cargo install --git https://github.com/mlund/duello
93
+ ```
94
+
95
+ # Usage
96
+
97
+ The command-line tool `duello` does the 6D scanning and calculates
98
+ the angularly averaged potential of mean force, _A(R)_ which
99
+ is used to derive the 2nd virial coefficient and twobody dissociation constant, $K_d$.
100
+ The two input structures should be in `.xyz` format and all particle names must
101
+ be defined in the topology file under `atoms`.
102
+ The topology also defines the particular pair-potential to use, see below.
103
+ Note that currently, a coulomb potential is automatically added and should
104
+ hence _not_ be specified in the topology.
105
+
106
+ ```sh
107
+ duello scan \
108
+ --mol1 cppm-p18.xyz \
109
+ --mol2 cppm-p18.xyz \
110
+ --rmin 37 --rmax 50 --dr 0.5 \
111
+ --top topology.yaml \
112
+ --resolution 0.8 \
113
+ --cutoff 1000 \
114
+ --molarity 0.05 \
115
+ --temperature 298.15 \
116
+ --backend auto \
117
+ --grid "type=powerlaw2,size=2000,shift=true"
118
+ ```
119
+
120
+ ## Spline Grid Options
121
+
122
+ The `--grid` option controls interpolation of pair potentials:
123
+
124
+ | Key | Values | Default | Description |
125
+ |---------|----------------------|-------------|------------------------------------------|
126
+ | `type` | `powerlaw2`, `invr2` | `powerlaw2` | Grid spacing (invr2 avoids sqrt in eval) |
127
+ | `size` | integer | `2000` | Number of grid points |
128
+ | `shift` | `true`, `false` | `true` | Shift energy to zero at cutoff |
129
+
130
+ Example: `--grid "type=invr2,size=1500,shift=false"`
131
+
132
+ ## Backend Performance
133
+
134
+ The program is written in Rust and attempts to use either GPU or all available CPU cores.
135
+ The following backends are available, with performance measured on the Calvados3 lysozyme example
136
+ (2.4M poses, 128 atoms per molecule, Apple M4):
137
+
138
+ | Backend | Description | Poses/ms | Speedup |
139
+ |-------------|--------------------------------|----------|---------|
140
+ | `reference` | Exact potentials (validation) | 48 | 1.0x |
141
+ | `cpu` | Splined potentials | 102 | 2.1x |
142
+ | `simd` | NEON (aarch64) / AVX2 (x86) | 131 | 2.7x |
143
+ | `gpu` | wgpu compute shaders | 1065 | 22x |
144
+
145
+ The `auto` backend (default) selects GPU if available, otherwise SIMD.
146
+ All but `reference` use Cubic Hermite splines for pair potentials.
147
+
148
+ ## Preparing PDB files
149
+
150
+ The following uses `pdb2xyz` to create a coarse grained XYZ file and Calvados topology for Duello:
151
+
152
+ ```sh
153
+ pip install pdb2xyz
154
+ pdb2xyz -i 4lzt.pdb -o 4lzt.xyz --pH 7.0 --sidechains
155
+ duello scan \
156
+ -1 4lzt.xyz -2 4lzt.xyz \
157
+ --rmin 24 --rmax 80 --dr 0.5 \
158
+ --resolution 0.6 \
159
+ --top topology.yaml \
160
+ --molarity 0.05
161
+ ```
162
+
163
+ If `pdb2xyz` give errors, you may be able to correct your PDB file with
164
+ [pdbfixer](https://github.com/openmm/pdbfixer?tab=readme-ov-file).
165
+
166
+ ## Examples
167
+
168
+ Ready run scripts examples are provided in the `scripts/` directory:
169
+
170
+ Command | Description
171
+ ---------------------- | ------------------------------------------------------------
172
+ `scripts/cppm.sh` | Spherical, multipolar particles using the CPPM model
173
+ `scripts/calvados3.sh` | Two coarse grained lysozyme molecules w. Calvados3 interactions
174
+
175
+
176
+ ## Interaction models
177
+
178
+ Each macromolecule is represented by a rigid constellation of beads with
179
+ properties defined under `atoms` in the topology file.
180
+ The inter-molecular energy, $V(R,\Omega)$ is calculated by summing all pairwise interactions
181
+ between beads using a customizable pair potential, $u_{ij}$.
182
+ If needed, different pair-potentials can be explicitly defined for
183
+ specific atom pairs.
184
+
185
+ The provided examples illustrate the following schemes:
186
+
187
+ - Screened `Coulomb` + `AshbaughHatch`, for the Calvados model.
188
+ - Screened `Coulomb` + `WeeksChandlerAndersen` for the CPPM model.
189
+
190
+ Many more pair-potentials are available through the
191
+ [`interatomic`](https://docs.rs/interatomic/latest/interatomic/twobody/index.html) library,
192
+ _e.g._ `LennardJones`, `HardSphere` etc.
193
+
194
+ __Warning:__ The electrostatic term, `Coulomb` is
195
+ always automatically added and should therefore _not_ be specified in the topology.
196
+
197
+ # Development
198
+
199
+ This is for development purposes only and details how to create and publish a
200
+ binary package on pipy.org.
201
+
202
+ ## Create `pip` package using Maturin via a Docker image:
203
+
204
+ Run this on MacOS, linux (x86 and arm) to get all architectures:
205
+
206
+ ```sh
207
+ docker run --rm -v $(pwd):/io ghcr.io/pyo3/maturin::v1.11.5 publish -u __token__ -p PYPI_TOKEN
208
+ ```
209
+
210
+
211
+ For local Maturin installs, follow the steps below.
212
+
213
+ ```sh
214
+ pip install ziglang pipx
215
+ pipx install maturin # on ubuntu; then restart shell
216
+ maturin publish -u __token__ -p PYPI_TOKEN --target=x86_64-unknown-linux-gnu --zig
217
+ ```
218
+
219
+ MacOS targets can be generated without `--zig` using the targets
220
+ `x86_64-apple-darwin` and `aarch64-apple-darwin`.
221
+
222
+ ```sh
223
+ rustup target list
224
+ rustup target add x86_64-apple-darwin
225
+ ```
226
+
227
+
@@ -194,10 +194,13 @@ binary package on pipy.org.
194
194
 
195
195
  ## Create `pip` package using Maturin via a Docker image:
196
196
 
197
+ Run this on MacOS, linux (x86 and arm) to get all architectures:
198
+
197
199
  ```sh
198
- docker run --rm -v $(pwd):/io ghcr.io/pyo3/maturin publish -u __token__ -p PYPI_TOKEN
200
+ docker run --rm -v $(pwd):/io ghcr.io/pyo3/maturin::v1.11.5 publish -u __token__ -p PYPI_TOKEN
199
201
  ```
200
202
 
203
+
201
204
  For local Maturin installs, follow the steps below.
202
205
 
203
206
  ```sh
@@ -11,7 +11,8 @@ compatibility = "manylinux2014"
11
11
 
12
12
  [project]
13
13
  name = "duello"
14
- version = "0.2.0"
14
+ version = "0.2.1"
15
+ readme = "README.md"
15
16
  dependencies = [
16
17
  "pdb2xyz>=0.1.2",
17
18
  ]
duello-0.2.0/CLAUDE.md DELETED
@@ -1,9 +0,0 @@
1
- - Performance benchmarks should be based on:
2
- ~~~
3
- cd examples/calvados3/
4
- duello scan -1 4lzt.xyz -2 4lzt.xyz --rmin 26 --rmax 60 --dr 0.5 --top topology.yaml --resolution 0.5 --cutoff 150 --molarity 0.02`
5
- ~~~
6
- - Avoid lenghty Rust functions
7
- - Reduce nested code with helper functions
8
- - Prefer *why* over *what* in code comments
9
- - For git commits, be brief and don't add (co)-authorship
duello-0.2.0/PKG-INFO DELETED
@@ -1,5 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: duello
3
- Version: 0.2.0
4
- Requires-Dist: pdb2xyz>=0.1.2
5
- License-File: LICENSE
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes