peapods 0.1.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.
@@ -0,0 +1,23 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ check:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - uses: actions/setup-python@v5
15
+ with:
16
+ python-version: "3.13"
17
+
18
+ - name: Rust cache
19
+ uses: Swatinem/rust-cache@v2
20
+
21
+ - run: cargo fmt --check
22
+ - run: cargo clippy -- -D warnings
23
+ - run: cargo test
@@ -0,0 +1,75 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ build:
13
+ strategy:
14
+ matrix:
15
+ include:
16
+ - os: ubuntu-latest
17
+ target: x86_64-unknown-linux-gnu
18
+ - os: ubuntu-latest
19
+ target: aarch64-unknown-linux-gnu
20
+ - os: macos-latest
21
+ target: x86_64-apple-darwin
22
+ - os: macos-latest
23
+ target: aarch64-apple-darwin
24
+ - os: windows-latest
25
+ target: x86_64-pc-windows-msvc
26
+ runs-on: ${{ matrix.os }}
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ - uses: actions/setup-python@v5
31
+ with:
32
+ python-version: "3.13"
33
+
34
+ - name: Build wheels
35
+ uses: PyO3/maturin-action@v1
36
+ with:
37
+ target: ${{ matrix.target }}
38
+ args: --release --out dist -i python3.10 python3.11 python3.12 python3.13
39
+ manylinux: auto
40
+
41
+ - uses: actions/upload-artifact@v4
42
+ with:
43
+ name: wheels-${{ matrix.target }}
44
+ path: dist/
45
+
46
+ sdist:
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v4
50
+
51
+ - name: Build sdist
52
+ uses: PyO3/maturin-action@v1
53
+ with:
54
+ command: sdist
55
+ args: --out dist
56
+
57
+ - uses: actions/upload-artifact@v4
58
+ with:
59
+ name: wheels-sdist
60
+ path: dist/
61
+
62
+ publish:
63
+ needs: [build, sdist]
64
+ runs-on: ubuntu-latest
65
+ environment: pypi
66
+ permissions:
67
+ id-token: write
68
+ steps:
69
+ - uses: actions/download-artifact@v4
70
+ with:
71
+ pattern: wheels-*
72
+ merge-multiple: true
73
+ path: dist/
74
+
75
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,7 @@
1
+ **/__pycache__/
2
+ *.so
3
+ .idea
4
+ .ipynb_checkpoints
5
+ **/playground*
6
+ **/target/
7
+ paper/
@@ -0,0 +1,15 @@
1
+ repos:
2
+ - repo: local
3
+ hooks:
4
+ - id: cargo-fmt
5
+ name: cargo fmt
6
+ entry: cargo fmt --
7
+ language: system
8
+ types: [rust]
9
+
10
+ - repo: https://github.com/astral-sh/ruff-pre-commit
11
+ rev: v0.9.10
12
+ hooks:
13
+ - id: ruff
14
+ args: [--fix]
15
+ - id: ruff-format
@@ -0,0 +1,12 @@
1
+ # Project: Peapods
2
+
3
+ - Only refactor when new changes would introduce duplicate code; keep refactors light, and ask the user before doing heavy or multi-file ones.
4
+ - Never speculate about APIs or code behavior; explore definitions or ask the user when unsure.
5
+ - Do not modify code when the user is only asking questions; only change code on explicit triggers like "can you" or "ship it."
6
+ - Only run lint at the very end; if lint errors look stale, re-run once or leave them.
7
+ - Never run `cargo check`, `cargo build`, or `cargo test` after Rust changes; the user will handle compilation.
8
+ - Prefer structured and concise error messages.
9
+ - Favor denested control flow when possible (e.g., use let else or early returns instead of nested conditionals).
10
+ - All module imports should be placed at the top of the file; avoid inline imports.
11
+ - Do not add comments to code that is self-explanatory.
12
+ - When running Python commands, always use the project's virtual environment: `.venv/bin/python` or `.venv/bin/pip`.
@@ -0,0 +1,409 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
10
+
11
+ [[package]]
12
+ name = "cfg-if"
13
+ version = "1.0.4"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
16
+
17
+ [[package]]
18
+ name = "crossbeam-deque"
19
+ version = "0.8.6"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
22
+ dependencies = [
23
+ "crossbeam-epoch",
24
+ "crossbeam-utils",
25
+ ]
26
+
27
+ [[package]]
28
+ name = "crossbeam-epoch"
29
+ version = "0.9.18"
30
+ source = "registry+https://github.com/rust-lang/crates.io-index"
31
+ checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
32
+ dependencies = [
33
+ "crossbeam-utils",
34
+ ]
35
+
36
+ [[package]]
37
+ name = "crossbeam-utils"
38
+ version = "0.8.21"
39
+ source = "registry+https://github.com/rust-lang/crates.io-index"
40
+ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
41
+
42
+ [[package]]
43
+ name = "either"
44
+ version = "1.15.0"
45
+ source = "registry+https://github.com/rust-lang/crates.io-index"
46
+ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
47
+
48
+ [[package]]
49
+ name = "getrandom"
50
+ version = "0.2.17"
51
+ source = "registry+https://github.com/rust-lang/crates.io-index"
52
+ checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"
53
+ dependencies = [
54
+ "cfg-if",
55
+ "libc",
56
+ "wasi",
57
+ ]
58
+
59
+ [[package]]
60
+ name = "heck"
61
+ version = "0.5.0"
62
+ source = "registry+https://github.com/rust-lang/crates.io-index"
63
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
64
+
65
+ [[package]]
66
+ name = "indoc"
67
+ version = "2.0.7"
68
+ source = "registry+https://github.com/rust-lang/crates.io-index"
69
+ checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
70
+ dependencies = [
71
+ "rustversion",
72
+ ]
73
+
74
+ [[package]]
75
+ name = "libc"
76
+ version = "0.2.182"
77
+ source = "registry+https://github.com/rust-lang/crates.io-index"
78
+ checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
79
+
80
+ [[package]]
81
+ name = "matrixmultiply"
82
+ version = "0.3.10"
83
+ source = "registry+https://github.com/rust-lang/crates.io-index"
84
+ checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08"
85
+ dependencies = [
86
+ "autocfg",
87
+ "rawpointer",
88
+ ]
89
+
90
+ [[package]]
91
+ name = "memoffset"
92
+ version = "0.9.1"
93
+ source = "registry+https://github.com/rust-lang/crates.io-index"
94
+ checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
95
+ dependencies = [
96
+ "autocfg",
97
+ ]
98
+
99
+ [[package]]
100
+ name = "ndarray"
101
+ version = "0.16.1"
102
+ source = "registry+https://github.com/rust-lang/crates.io-index"
103
+ checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841"
104
+ dependencies = [
105
+ "matrixmultiply",
106
+ "num-complex",
107
+ "num-integer",
108
+ "num-traits",
109
+ "portable-atomic",
110
+ "portable-atomic-util",
111
+ "rawpointer",
112
+ ]
113
+
114
+ [[package]]
115
+ name = "num-complex"
116
+ version = "0.4.6"
117
+ source = "registry+https://github.com/rust-lang/crates.io-index"
118
+ checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
119
+ dependencies = [
120
+ "num-traits",
121
+ ]
122
+
123
+ [[package]]
124
+ name = "num-integer"
125
+ version = "0.1.46"
126
+ source = "registry+https://github.com/rust-lang/crates.io-index"
127
+ checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
128
+ dependencies = [
129
+ "num-traits",
130
+ ]
131
+
132
+ [[package]]
133
+ name = "num-traits"
134
+ version = "0.2.19"
135
+ source = "registry+https://github.com/rust-lang/crates.io-index"
136
+ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
137
+ dependencies = [
138
+ "autocfg",
139
+ ]
140
+
141
+ [[package]]
142
+ name = "numpy"
143
+ version = "0.24.0"
144
+ source = "registry+https://github.com/rust-lang/crates.io-index"
145
+ checksum = "a7cfbf3f0feededcaa4d289fe3079b03659e85c5b5a177f4ba6fb01ab4fb3e39"
146
+ dependencies = [
147
+ "libc",
148
+ "ndarray",
149
+ "num-complex",
150
+ "num-integer",
151
+ "num-traits",
152
+ "pyo3",
153
+ "pyo3-build-config",
154
+ "rustc-hash",
155
+ ]
156
+
157
+ [[package]]
158
+ name = "once_cell"
159
+ version = "1.21.3"
160
+ source = "registry+https://github.com/rust-lang/crates.io-index"
161
+ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
162
+
163
+ [[package]]
164
+ name = "peapods"
165
+ version = "0.1.0"
166
+ dependencies = [
167
+ "numpy",
168
+ "pyo3",
169
+ "rand",
170
+ "rand_xoshiro",
171
+ "rayon",
172
+ ]
173
+
174
+ [[package]]
175
+ name = "portable-atomic"
176
+ version = "1.13.1"
177
+ source = "registry+https://github.com/rust-lang/crates.io-index"
178
+ checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
179
+
180
+ [[package]]
181
+ name = "portable-atomic-util"
182
+ version = "0.2.5"
183
+ source = "registry+https://github.com/rust-lang/crates.io-index"
184
+ checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5"
185
+ dependencies = [
186
+ "portable-atomic",
187
+ ]
188
+
189
+ [[package]]
190
+ name = "ppv-lite86"
191
+ version = "0.2.21"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
194
+ dependencies = [
195
+ "zerocopy",
196
+ ]
197
+
198
+ [[package]]
199
+ name = "proc-macro2"
200
+ version = "1.0.106"
201
+ source = "registry+https://github.com/rust-lang/crates.io-index"
202
+ checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
203
+ dependencies = [
204
+ "unicode-ident",
205
+ ]
206
+
207
+ [[package]]
208
+ name = "pyo3"
209
+ version = "0.24.2"
210
+ source = "registry+https://github.com/rust-lang/crates.io-index"
211
+ checksum = "e5203598f366b11a02b13aa20cab591229ff0a89fd121a308a5df751d5fc9219"
212
+ dependencies = [
213
+ "cfg-if",
214
+ "indoc",
215
+ "libc",
216
+ "memoffset",
217
+ "once_cell",
218
+ "portable-atomic",
219
+ "pyo3-build-config",
220
+ "pyo3-ffi",
221
+ "pyo3-macros",
222
+ "unindent",
223
+ ]
224
+
225
+ [[package]]
226
+ name = "pyo3-build-config"
227
+ version = "0.24.2"
228
+ source = "registry+https://github.com/rust-lang/crates.io-index"
229
+ checksum = "99636d423fa2ca130fa5acde3059308006d46f98caac629418e53f7ebb1e9999"
230
+ dependencies = [
231
+ "once_cell",
232
+ "target-lexicon",
233
+ ]
234
+
235
+ [[package]]
236
+ name = "pyo3-ffi"
237
+ version = "0.24.2"
238
+ source = "registry+https://github.com/rust-lang/crates.io-index"
239
+ checksum = "78f9cf92ba9c409279bc3305b5409d90db2d2c22392d443a87df3a1adad59e33"
240
+ dependencies = [
241
+ "libc",
242
+ "pyo3-build-config",
243
+ ]
244
+
245
+ [[package]]
246
+ name = "pyo3-macros"
247
+ version = "0.24.2"
248
+ source = "registry+https://github.com/rust-lang/crates.io-index"
249
+ checksum = "0b999cb1a6ce21f9a6b147dcf1be9ffedf02e0043aec74dc390f3007047cecd9"
250
+ dependencies = [
251
+ "proc-macro2",
252
+ "pyo3-macros-backend",
253
+ "quote",
254
+ "syn",
255
+ ]
256
+
257
+ [[package]]
258
+ name = "pyo3-macros-backend"
259
+ version = "0.24.2"
260
+ source = "registry+https://github.com/rust-lang/crates.io-index"
261
+ checksum = "822ece1c7e1012745607d5cf0bcb2874769f0f7cb34c4cde03b9358eb9ef911a"
262
+ dependencies = [
263
+ "heck",
264
+ "proc-macro2",
265
+ "pyo3-build-config",
266
+ "quote",
267
+ "syn",
268
+ ]
269
+
270
+ [[package]]
271
+ name = "quote"
272
+ version = "1.0.44"
273
+ source = "registry+https://github.com/rust-lang/crates.io-index"
274
+ checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"
275
+ dependencies = [
276
+ "proc-macro2",
277
+ ]
278
+
279
+ [[package]]
280
+ name = "rand"
281
+ version = "0.8.5"
282
+ source = "registry+https://github.com/rust-lang/crates.io-index"
283
+ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
284
+ dependencies = [
285
+ "libc",
286
+ "rand_chacha",
287
+ "rand_core",
288
+ ]
289
+
290
+ [[package]]
291
+ name = "rand_chacha"
292
+ version = "0.3.1"
293
+ source = "registry+https://github.com/rust-lang/crates.io-index"
294
+ checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
295
+ dependencies = [
296
+ "ppv-lite86",
297
+ "rand_core",
298
+ ]
299
+
300
+ [[package]]
301
+ name = "rand_core"
302
+ version = "0.6.4"
303
+ source = "registry+https://github.com/rust-lang/crates.io-index"
304
+ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
305
+ dependencies = [
306
+ "getrandom",
307
+ ]
308
+
309
+ [[package]]
310
+ name = "rand_xoshiro"
311
+ version = "0.6.0"
312
+ source = "registry+https://github.com/rust-lang/crates.io-index"
313
+ checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
314
+ dependencies = [
315
+ "rand_core",
316
+ ]
317
+
318
+ [[package]]
319
+ name = "rawpointer"
320
+ version = "0.2.1"
321
+ source = "registry+https://github.com/rust-lang/crates.io-index"
322
+ checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
323
+
324
+ [[package]]
325
+ name = "rayon"
326
+ version = "1.11.0"
327
+ source = "registry+https://github.com/rust-lang/crates.io-index"
328
+ checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f"
329
+ dependencies = [
330
+ "either",
331
+ "rayon-core",
332
+ ]
333
+
334
+ [[package]]
335
+ name = "rayon-core"
336
+ version = "1.13.0"
337
+ source = "registry+https://github.com/rust-lang/crates.io-index"
338
+ checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
339
+ dependencies = [
340
+ "crossbeam-deque",
341
+ "crossbeam-utils",
342
+ ]
343
+
344
+ [[package]]
345
+ name = "rustc-hash"
346
+ version = "2.1.1"
347
+ source = "registry+https://github.com/rust-lang/crates.io-index"
348
+ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
349
+
350
+ [[package]]
351
+ name = "rustversion"
352
+ version = "1.0.22"
353
+ source = "registry+https://github.com/rust-lang/crates.io-index"
354
+ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
355
+
356
+ [[package]]
357
+ name = "syn"
358
+ version = "2.0.117"
359
+ source = "registry+https://github.com/rust-lang/crates.io-index"
360
+ checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
361
+ dependencies = [
362
+ "proc-macro2",
363
+ "quote",
364
+ "unicode-ident",
365
+ ]
366
+
367
+ [[package]]
368
+ name = "target-lexicon"
369
+ version = "0.13.5"
370
+ source = "registry+https://github.com/rust-lang/crates.io-index"
371
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
372
+
373
+ [[package]]
374
+ name = "unicode-ident"
375
+ version = "1.0.24"
376
+ source = "registry+https://github.com/rust-lang/crates.io-index"
377
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
378
+
379
+ [[package]]
380
+ name = "unindent"
381
+ version = "0.2.4"
382
+ source = "registry+https://github.com/rust-lang/crates.io-index"
383
+ checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
384
+
385
+ [[package]]
386
+ name = "wasi"
387
+ version = "0.11.1+wasi-snapshot-preview1"
388
+ source = "registry+https://github.com/rust-lang/crates.io-index"
389
+ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
390
+
391
+ [[package]]
392
+ name = "zerocopy"
393
+ version = "0.8.39"
394
+ source = "registry+https://github.com/rust-lang/crates.io-index"
395
+ checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a"
396
+ dependencies = [
397
+ "zerocopy-derive",
398
+ ]
399
+
400
+ [[package]]
401
+ name = "zerocopy-derive"
402
+ version = "0.8.39"
403
+ source = "registry+https://github.com/rust-lang/crates.io-index"
404
+ checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517"
405
+ dependencies = [
406
+ "proc-macro2",
407
+ "quote",
408
+ "syn",
409
+ ]
@@ -0,0 +1,16 @@
1
+ [package]
2
+ name = "peapods"
3
+ version = "0.1.0"
4
+ edition = "2021"
5
+ readme = "README.md"
6
+
7
+ [lib]
8
+ name = "_core"
9
+ crate-type = ["cdylib"]
10
+
11
+ [dependencies]
12
+ pyo3 = { version = "0.24", features = ["extension-module"] }
13
+ numpy = "0.24"
14
+ rand = "0.8"
15
+ rand_xoshiro = "0.6"
16
+ rayon = "1.10"
peapods-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: peapods
3
+ Version: 0.1.0
4
+ Requires-Dist: numpy
5
+ Requires-Python: >=3.10
@@ -0,0 +1,74 @@
1
+ # PeaPods
2
+
3
+ The goal of this project is to build a Python library for simulating spin systems with modern efficient Monte-Carlo methods.
4
+ The core simulation loop is written in Rust (via PyO3) for performance, with a thin Python wrapper for ease of use.
5
+
6
+ <div style="text-align:center">
7
+ <img src="./docs/csd.png" alt="CSD" style="width:70%"/>
8
+ </div>
9
+
10
+ ## Description
11
+
12
+ Currently, this project is at the very early stages,
13
+ and only supports simulating Ising ferromagnets and spin glasses.
14
+ Development for other spin classes (Potts, clock, and O(N) models) are planned,
15
+ including their disordered and quantum counterparts.
16
+
17
+ The following algoritms are currently supported:
18
+
19
+ - Single-spin flips (Metropolis and Gibbs sampling)
20
+ - [Swendsen-Wang cluster updates](https://en.wikipedia.org/wiki/Swendsen%E2%80%93Wang_algorithm)
21
+ - [Wolff cluster updates](https://en.wikipedia.org/wiki/Wolff_algorithm)
22
+ - [Parallel tempering](https://en.wikipedia.org/wiki/Parallel_tempering)
23
+
24
+ The following algorithms are planned:
25
+
26
+ - Cluster updates for frustrated spin systems
27
+ (e.g. [KBD algorithm](https://en.wikipedia.org/wiki/KBD_algorithm#:~:text=The%20KBD%20algorithm%20is%20an,algorithm%20more%20efficient%20in%20comparison.))
28
+ - [Replica cluster moves](https://en.wikipedia.org/wiki/Replica_cluster_move#:~:text=Replica%20cluster%20move%20in%20condensed,replicas%20instead%20of%20just%20one.)
29
+ (e.g. [Houdayer move](https://arxiv.org/abs/cond-mat/0101116),
30
+ [Jorg move](https://arxiv.org/abs/cond-mat/0410328)
31
+ )
32
+
33
+ ## Quickstart
34
+
35
+ It is very easy to get started with simulating an (ensemble of) spin models.
36
+ For example, if we want to simulate an ensemble of 16 independent Ising ferromagnets
37
+ shaped 20 x 20, we can do the following:
38
+
39
+ ```python
40
+ from spin_models import IsingEnsemble
41
+
42
+ ising_ensemble = IsingEnsemble(lattice_shape=(20, 20), n_ensemble=16)
43
+ ising_ensemble.sample(n_sweeps=2**14)
44
+ ```
45
+
46
+ Note that code will try to start 16 parallel workers for simulation,
47
+ where each worker will maintain its own set of Ising models at different temperatures,
48
+ and simulate them for 2^14 sweeps.
49
+
50
+ For a more complete example, check out this [tutorial](tutorial.ipynb).
51
+
52
+ ## Building
53
+
54
+ The Rust backend must be compiled before use. You need [maturin](https://www.maturin.rs/) and a Rust toolchain:
55
+
56
+ ```bash
57
+ cd peapods_core
58
+ maturin develop --release
59
+ ```
60
+
61
+ ## Dependencies
62
+
63
+ - Rust toolchain (for building the core)
64
+ - maturin
65
+ - numpy
66
+ - joblib (for `IsingEnsemble`)
67
+
68
+ ## Contribution
69
+
70
+ This is an open-source project, so everyone is welcomed to contribute!
71
+
72
+ Please open an issue if you spotted a bug or suggest any feature enhancements.
73
+ Submit a pull request if appropriate.
74
+ Alternatively, contact me at yanrpei@gmail.com if you wish to be a contributor to this project.