hillclimber 0.1.0a1__tar.gz → 0.1.0a2__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.

Potentially problematic release.


This version of hillclimber might be problematic. Click here for more details.

Files changed (52) hide show
  1. hillclimber-0.1.0a2/.claude/settings.local.json +16 -0
  2. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/.gitignore +1 -0
  3. hillclimber-0.1.0a2/AGENTS.md +32 -0
  4. hillclimber-0.1.0a2/CLAUDE.md +1 -0
  5. hillclimber-0.1.0a2/Getting_started.md +253 -0
  6. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/PKG-INFO +1 -1
  7. hillclimber-0.1.0a2/TODO.md +623 -0
  8. hillclimber-0.1.0a2/examples/01_distance_metad.py +199 -0
  9. hillclimber-0.1.0a2/examples/02_torsion_metad.py +186 -0
  10. hillclimber-0.1.0a2/examples/03_coordination_number.py +212 -0
  11. hillclimber-0.1.0a2/examples/04_2d_metad.py +210 -0
  12. hillclimber-0.1.0a2/examples/05_opes_sampling.py +189 -0
  13. hillclimber-0.1.0a2/examples/06_walls_restraints.py +255 -0
  14. hillclimber-0.1.0a2/examples/README.md +362 -0
  15. hillclimber-0.1.0a2/hillclimber/__init__.py +29 -0
  16. hillclimber-0.1.0a2/hillclimber/actions.py +56 -0
  17. hillclimber-0.1.0a2/hillclimber/biases.py +293 -0
  18. hillclimber-0.1.0a2/hillclimber/cvs.py +1038 -0
  19. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/hillclimber/interfaces.py +45 -5
  20. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/hillclimber/metadynamics.py +11 -9
  21. hillclimber-0.1.0a2/hillclimber/opes.py +342 -0
  22. hillclimber-0.1.0a2/hillclimber/selectors.py +221 -0
  23. hillclimber-0.1.0a2/hillclimber/virtual_atoms.py +335 -0
  24. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/pyproject.toml +1 -1
  25. hillclimber-0.1.0a2/tests/test_biases.py +210 -0
  26. hillclimber-0.1.0a2/tests/test_cv_angle.py +242 -0
  27. hillclimber-0.1.0a2/tests/test_cv_coordination.py +244 -0
  28. hillclimber-0.1.0a2/tests/test_cv_distance.py +190 -0
  29. hillclimber-0.1.0a2/tests/test_cv_distance_new.py +253 -0
  30. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/tests/test_metad.py +28 -21
  31. hillclimber-0.1.0a2/tests/test_opes.py +495 -0
  32. hillclimber-0.1.0a2/tests/test_selectors.py +163 -0
  33. hillclimber-0.1.0a2/tests/test_virtual_atoms.py +164 -0
  34. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/uv.lock +1 -1
  35. hillclimber-0.1.0a1/.claude/settings.local.json +0 -10
  36. hillclimber-0.1.0a1/hillclimber/__init__.py +0 -18
  37. hillclimber-0.1.0a1/hillclimber/actions.py +0 -30
  38. hillclimber-0.1.0a1/hillclimber/cvs.py +0 -646
  39. hillclimber-0.1.0a1/hillclimber/selectors.py +0 -96
  40. hillclimber-0.1.0a1/tests/test_cv_coordination.py +0 -104
  41. hillclimber-0.1.0a1/tests/test_cv_distance.py +0 -181
  42. hillclimber-0.1.0a1/tests/test_selectors.py +0 -29
  43. hillclimber-0.1.0a1/tmp/cvs.ipynb +0 -275
  44. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/.python-version +0 -0
  45. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/LICENSE +0 -0
  46. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/README.md +0 -0
  47. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/hillclimber/calc.py +0 -0
  48. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/hillclimber/nodes.py +0 -0
  49. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/main.py +0 -0
  50. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/tests/conftest.py +0 -0
  51. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/tests/test_cv_gyration.py +0 -0
  52. {hillclimber-0.1.0a1 → hillclimber-0.1.0a2}/tests/test_cv_torsion.py +0 -0
@@ -0,0 +1,16 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "mcp__context7__resolve-library-id",
5
+ "mcp__context7__get-library-docs",
6
+ "Bash(find:*)",
7
+ "Bash(uv run pytest:*)",
8
+ "WebFetch(domain:www.plumed.org)",
9
+ "WebSearch",
10
+ "Bash(uv run:*)",
11
+ "WebFetch(domain:www.plumed-nest.org)"
12
+ ],
13
+ "deny": [],
14
+ "ask": []
15
+ }
16
+ }
@@ -9,3 +9,4 @@ wheels/
9
9
  # Virtual environments
10
10
  .venv
11
11
  *.local
12
+ tmp/
@@ -0,0 +1,32 @@
1
+ # Hillclimber
2
+ A Python wrapper around PLUMED.
3
+
4
+ This package uses numpy style docstrings and type hinting.
5
+ Use `t.Literal[]` instead of plain strings for fixed options.
6
+ To run tests, use `uv run pytest tests/`.
7
+ There must be unit tests added for all new functionality!
8
+ The test should expect the full output like
9
+ ```
10
+ expected = [
11
+ "d12_g1_0_com: COM ATOMS=1,2,3,4,5,6,7,8,9",
12
+ "d12_g2_0_com: COM ATOMS=19,20,21",
13
+ "d12: DISTANCE ATOMS=d12_g1_0_com,d12_g2_0_com",
14
+ ]
15
+
16
+ assert plumed_str == expected
17
+ ```
18
+ and not just parts of it, e.g.
19
+ ```
20
+ assert any("COM ATOMS=1,2,3,4,5,6,7,8,9" in cmd for cmd in plumed_str)
21
+ ```
22
+
23
+ The goal of the package is to provide abstractions for collective variables and biases and to interface with ASE and ZnTrack.
24
+
25
+ The package uses ASE units, e.g. distances are in Angstrom, energies in eV and time in fs.
26
+ If available, reference the `https://www.plumed.org/doc-master/user-doc/html/` inside the docstrings to get more information about the underlying PLUMED functionality!
27
+
28
+ This is a new package, backwards compatibility is not required!
29
+ Make design decisions for good code structure and usability, not for backwards compatibility!
30
+ Use KISS, DRY, SOLID and YAGNI principles.
31
+
32
+ Ask before you create or plan summary documents!
@@ -0,0 +1 @@
1
+ AGENTS.md
@@ -0,0 +1,253 @@
1
+ # 🚀 HillClimber Quick Start Guide
2
+
3
+ Selectors pick atoms.
4
+ VirtualAtoms reduce groups (COM/COG).
5
+ CVs measure things (distance, coordination, etc.).
6
+
7
+ Three clean layers, one clear mental model. 🧠
8
+
9
+ ---
10
+
11
+ ## 1. Selectors — "Pick What You Want"
12
+
13
+ Selectors identify groups of atoms in your system.
14
+ Every selector returns a list of groups, each a list of atom indices:
15
+
16
+ [[atoms_of_group_0], [atoms_of_group_1], ...]
17
+
18
+ **Example:**
19
+
20
+ ```python
21
+ ethanol_sel = hc.SMARTSSelector("CCO") # Matches 2 ethanols
22
+ water_sel = hc.SMARTSSelector("O") # Matches 3 waters
23
+ ```
24
+
25
+ ---
26
+
27
+ ### Indexing — Two Levels Deep
28
+
29
+ - **Level 1:** Pick which groups
30
+ - **Level 2:** Pick which atoms within those groups
31
+
32
+ | Syntax | Meaning |
33
+ |--------|---------|
34
+ | `sel` | All groups |
35
+ | `sel[0]` | First group |
36
+ | `sel[0:2]` | First two groups |
37
+ | `sel[[0, 2]]` | Groups 0 and 2 |
38
+ | `sel[:][0]` | First atom of each group |
39
+ | `sel[0][0]` | First atom of the first group |
40
+
41
+ ```python
42
+ # First oxygen of each water
43
+ oxygens = water_sel[:][0]
44
+
45
+ # First two waters only
46
+ first_two = water_sel[0:2]
47
+ ```
48
+
49
+ ---
50
+
51
+ ### Combining Selectors
52
+
53
+ Combine any selectors using `+`:
54
+
55
+ ```python
56
+ all_mols = water_sel + ethanol_sel
57
+ ```
58
+
59
+ → "Select all waters and ethanols."
60
+
61
+ ---
62
+
63
+ ## 2. VirtualAtoms — "Reduce to COM/COG"
64
+
65
+ A VirtualAtom creates virtual sites (e.g., centers of mass).
66
+
67
+ **Key concept:** One virtual site per group in the selector.
68
+
69
+ ```python
70
+ water_coms = hc.VirtualAtom(water_sel, "com") # 3 COMs
71
+ ethanol_coms = hc.VirtualAtom(ethanol_sel, "com") # 2 COMs
72
+ ```
73
+
74
+ ### Common Patterns
75
+
76
+ | Code | Meaning |
77
+ |------|---------|
78
+ | `VirtualAtom(sel, "com")` | COM of each group |
79
+ | `VirtualAtom(sel[0], "com")` | COM of the first group only |
80
+ | `VirtualAtom(va, "com")` | COM of COMs (nested) |
81
+ | `va1 + va2` | Combine multiple COM sets |
82
+
83
+ **Example:**
84
+
85
+ ```python
86
+ # COM for each water
87
+ water_coms = hc.VirtualAtom(water_sel, "com")
88
+
89
+ # COM for ethanol[0]
90
+ ethanol_0_com = hc.VirtualAtom(ethanol_sel[0], "com")
91
+
92
+ # Combine both
93
+ all_coms = ethanol_0_com + water_coms
94
+ ```
95
+
96
+ 💡 **Important:** Indexing happens at the selector, not the VirtualAtom.
97
+
98
+ ---
99
+
100
+ ## 3. CVs — "Measure Things Between Groups or COMs"
101
+
102
+ CVs use Selectors or VirtualAtoms as inputs.
103
+
104
+ ### DistanceCV
105
+
106
+ Measures distances between atom groups or virtual sites.
107
+
108
+ ```python
109
+ # Distance between ethanol[0] COM and water[0] COM
110
+ dist = hc.DistanceCV(
111
+ x1=hc.VirtualAtom(ethanol_sel[0], "com"),
112
+ x2=hc.VirtualAtom(water_sel[0], "com"),
113
+ prefix="d_com"
114
+ )
115
+ ```
116
+
117
+ **One-to-Many / Many-to-Many:**
118
+
119
+ ```python
120
+ # Distance from one ethanol to each water
121
+ dist = hc.DistanceCV(
122
+ x1=hc.VirtualAtom(ethanol_sel[0], "com"),
123
+ x2=hc.VirtualAtom(water_sel, "com"),
124
+ )
125
+ # → Creates 3 CVs: d_0, d_1, d_2
126
+ ```
127
+
128
+ ---
129
+
130
+ ### CoordinationCV
131
+
132
+ Measures how "close" groups are — like solvation or clustering.
133
+
134
+ ```python
135
+ cn = hc.CoordinationCV(
136
+ x1=hc.VirtualAtom(water_sel, "com"),
137
+ x2=hc.VirtualAtom(water_sel, "com"),
138
+ r_0=5.0,
139
+ prefix="cn_water"
140
+ )
141
+ # → One CV: coordination among all water COMs
142
+ ```
143
+
144
+ ---
145
+
146
+ ### Flattening
147
+
148
+ Controls whether multi-atom groups are flattened or grouped in PLUMED:
149
+
150
+ | Option | Effect | PLUMED Output |
151
+ |--------|--------|---------------|
152
+ | `flatten=True` | Atoms merged into one list | `DISTANCE ATOMS=1,2,3,4` |
153
+ | `flatten=False` | Each group becomes a GROUP | `G1: GROUP ATOMS=...` |
154
+
155
+ ```python
156
+ dist = hc.DistanceCV(
157
+ x1=water_sel[0],
158
+ x2=ethanol_sel[0],
159
+ flatten=False
160
+ )
161
+ ```
162
+
163
+ ---
164
+
165
+ ## 4. Quick Visual Cheat Sheet
166
+
167
+ ```
168
+ Selector → picks atoms or groups
169
+ e.g. water_sel[0:2]
170
+
171
+ VirtualAtom → reduces groups (COM/COG)
172
+ e.g. VirtualAtom(water_sel, "com")
173
+
174
+ CV → measures between selectors or virtual sites
175
+ e.g. DistanceCV(x1, x2)
176
+ ```
177
+
178
+ ---
179
+
180
+ ## 5. Common Real-World Examples
181
+
182
+ | Goal | Code | Output |
183
+ |------|------|--------|
184
+ | Distance between two specific atoms | `hc.DistanceCV(x1=sel1[0][0], x2=sel2[0][0])` | `DISTANCE ATOMS=1,2` |
185
+ | Distance between molecule COMs | `hc.DistanceCV(x1=hc.VirtualAtom(sel1[0],"com"), x2=hc.VirtualAtom(sel2[0],"com"))` | `COM ATOMS=...` |
186
+ | Distance from one COM to all COMs | `hc.DistanceCV(x1=va1[0], x2=va2)` | Multiple CVs |
187
+ | Coordination between all COMs | `hc.CoordinationCV(x1=va, x2=va, r_0=5.0)` | One CN CV |
188
+ | COM of COMs (e.g., cluster center) | `hc.VirtualAtom(hc.VirtualAtom(sel, "com"), "com")` | Single virtual site |
189
+
190
+ ---
191
+
192
+ ## 6. Mental Model
193
+
194
+ | You Think | You Write | PLUMED Thinks |
195
+ |-----------|-----------|---------------|
196
+ | "Select these atoms" | `selector` | atom indices |
197
+ | "Group them by molecule" | `selector[0:2]` | grouped atoms |
198
+ | "Compute their COM" | `VirtualAtom(selector, "com")` | `COM ATOMS=...` |
199
+ | "Measure a distance" | `DistanceCV(x1, x2)` | `DISTANCE ATOMS=...` |
200
+ | "Compute coordination" | `CoordinationCV(x1, x2)` | `COORDINATION GROUPA=...,GROUPB=...` |
201
+
202
+ ---
203
+
204
+ ## 7. Golden Rules
205
+
206
+ 1. **Selectors select.**
207
+ - Always use selectors for picking atoms and groups.
208
+ 2. **VirtualAtoms reduce.**
209
+ - Use them only for COM/COG — never for indexing.
210
+ 3. **CVs measure.**
211
+ - They combine selectors or virtual sites to produce observables.
212
+ 4. **Index at the selector level.**
213
+ - e.g., `VirtualAtom(sel[0], "com")`, not `VirtualAtom(sel, "com")[0]`.
214
+ 5. **Combine with `+`.**
215
+ - `sel1 + sel2` or `va1 + va2` to merge sets.
216
+ 6. **Flatten mindfully.**
217
+ - `flatten=True` → single atom list
218
+ - `flatten=False` → PLUMED GROUPs
219
+
220
+ ---
221
+
222
+ ## 8. Typical PLUMED Translations
223
+
224
+ | Python Expression | PLUMED Output |
225
+ |-------------------|---------------|
226
+ | `hc.VirtualAtom(water_sel, "com")` | `water_0_com: COM ATOMS=...` |
227
+ | `hc.DistanceCV(x1=va1, x2=va2)` | `DISTANCE ATOMS=va1_0,va2_0` |
228
+ | `hc.CoordinationCV(x1=va, x2=va, r_0=5.0)` | `COORDINATION GROUPA=va_0,... GROUPB=va_0,... R_0=5.0` |
229
+
230
+ ---
231
+
232
+ ## 9. Summary of Best Practices
233
+
234
+ | Task | Recommended Approach |
235
+ |------|---------------------|
236
+ | Select atoms or molecules | SMARTSSelector, use indexing |
237
+ | Combine multiple groups | `sel1 + sel2` |
238
+ | Create COM/COG | `VirtualAtom(sel, "com" / "cog")` |
239
+ | Compute distances | `DistanceCV(x1, x2)` |
240
+ | Compute coordination numbers | `CoordinationCV(x1, x2)` |
241
+ | Preserve group structure | `flatten=False` |
242
+ | Build hierarchical centers | `VirtualAtom(VirtualAtom(sel, "com"), "com")` |
243
+
244
+ ---
245
+
246
+ ## TL;DR
247
+
248
+ Think modular:
249
+ - **Selectors** → choose what
250
+ - **VirtualAtoms** → define where
251
+ - **CVs** → measure how
252
+
253
+ No hidden behavior. No implicit COMs. Just clean, explicit, composable logic — fully PLUMED-compatible.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hillclimber
3
- Version: 0.1.0a1
3
+ Version: 0.1.0a2
4
4
  Summary: Python interfaces for the plumed library with enhanced sampling.
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.11