Skip to main content

spinmc

Project description

SpinMC

SpinMC is an open-source Monte Carlo simulation package for classical spin models, designed for studying magnetic systems and phase transitions in statistical physics.

✨ Features

  • Multiple Spin Models:

    • Ising model
    • XY model
    • Heisenberg model
  • Support Interactions:

    • Exchange coupling (isotropic)
    • Automatic exchange neighbor generation by coordination shell or distance range
    • Single-ion anisotropy
    • [Planned] Anisotropic exchange coupling
    • [Planned] External magnetic field
  • Support Algorithms:

    • Metropolis
    • Wolff cluster algorithm
    • [Planned] Parallel Tempering (Replica Exchange)
  • Simulation Capabilities:

    • Energy, Heat capacity
    • Magnetization, Susceptibility
    • Absolute magnetization, absolute susceptibility
    • Group-wise (sublattice) magnetization & susceptibility
    • Group-wise (sublattice) Absolute magnetization & susceptibility
    • [planned] magnetic hysteresis loop
    • [planned] binder cumulant (u4)

📦 Installation

Requirements

  • Python 3.9+ (for pip installation)
  • Rust 1.88+ (for source compilation)

From PyPI

pip install spinmc

From Pre-built Releases

  1. Visit the Releases page
  2. Download the package for your OS
  3. Unpack the archive and run the executable

From source:

git clone https://github.com/mxmf/spinmc.git
cd spinmc
cargo build --release

🚀 Quick Start

  1. Create a configuration file (e.g., ising.toml):
[grid]
dimensions = [50, 50, 1]
sublattices = 1
spin_magnitudes = [1.0]
periodic_boundary = [true, true, false]

[simulation]
initial_state = "random"
boltzmann_constant = 1
model = "ising"
equilibration_steps = 10000
measurement_steps = 100000
algorithm = "wolff"
num_threads = 10
temperature_range = [
  { start = 1, end = 3, step = 0.1 },
]

[output]
outfile = "result.txt"
energy = true
heat_capacity = true
magnetization = true
susceptibility = true
magnetization_abs = true
susceptibility_abs = true

[[exchange]]
from_sublattice = 0
to_sublattice = 0
offsets = [[0, -1, 0], [0, 1, 0], [-1, 0, 0], [1, 0, 0]]
strength = 1.0

Exchange interactions can also be generated from the [structure] section instead of listing every offset manually. The structure can be written directly with cell and positions, or loaded from an external structure file:

[structure]
file = "POSCAR"
# format = "poscar"          # Optional; POSCAR/CONTCAR and .vasp files are detected automatically.
# magnetic_indices = [0, 2]  # Optional; select magnetic atoms when the file also contains non-magnetic atoms.
tolerance = 0.0001

Use neighbor_order = 1 for the first coordination shell, or distance_range = [min, max] to include every pair whose distance falls within the given range in Å. Specify both from_sublattice and to_sublattice to target one pair, only from_sublattice to target all destinations from one source sublattice, or neither to apply the rule to all sublattice pairs.

See examples/heisenberg_2d_cri3_poscar for a CrI3 monolayer example loaded from a POSCAR file.

  1. Run the simulation:
spinmc run -i ising.toml
  1. Results will be saved in result.txt with the requested measurements.

  2. If spinmc is installed via Python, you can plot the results with:

spinmc plot -i result.txt

📚 See more examples in the examples folder.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spinmc-0.2.2.tar.gz (125.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

spinmc-0.2.2-py3-none-musllinux_1_2_x86_64.whl (291.4 kB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

spinmc-0.2.2-py3-none-musllinux_1_2_i686.whl (311.7 kB view details)

Uploaded Python 3musllinux: musl 1.2+ i686

spinmc-0.2.2-py3-none-musllinux_1_2_armv7l.whl (493.0 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARMv7l

spinmc-0.2.2-py3-none-musllinux_1_2_aarch64.whl (260.4 kB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

spinmc-0.2.2-cp310-abi3-win_amd64.whl (4.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

spinmc-0.2.2-cp310-abi3-win32.whl (4.5 MB view details)

Uploaded CPython 3.10+Windows x86

spinmc-0.2.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

spinmc-0.2.2-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ i686

spinmc-0.2.2-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.1 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARMv7l

spinmc-0.2.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

spinmc-0.2.2-cp310-abi3-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

spinmc-0.2.2-cp310-abi3-macosx_10_12_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file spinmc-0.2.2.tar.gz.

File metadata

  • Download URL: spinmc-0.2.2.tar.gz
  • Upload date:
  • Size: 125.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for spinmc-0.2.2.tar.gz
Algorithm Hash digest
SHA256 4212375a406b1ef8f4d38933475eb70af8159836be6fa7fdcaf8d50cf6d080ea
MD5 c20f993731b897a216161afd5a9e3e51
BLAKE2b-256 136a1468913752e92588827d85d5627b848398cda3cf3b5aa8e77749e6238d3c

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for spinmc-0.2.2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0477d68c47cf90fca67cd36e7dbfecaaf0c61ff7031f8c0f7be21e927512f56e
MD5 48197c76812d76b273264b62cdc63a57
BLAKE2b-256 1936f768a054091032fa29becdf6a1a89590c6626db5be24961ecf3d3c11e88d

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-py3-none-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for spinmc-0.2.2-py3-none-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 da4a04791bc102fc15434199eda294460b9704eeb1f6200bb7ba96fd83fbe2ac
MD5 0070b98923c48f5737e4a0370b86b8fa
BLAKE2b-256 ae56ab6f136b0e24066e4d0472b6cb1ae30602c7c9bdd5d486b237cd673b9b33

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-py3-none-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for spinmc-0.2.2-py3-none-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 6f3c14a0008b30bae47157468cf6d7aa9c29823e6610da03437105a52d6ed7d5
MD5 f77e7ddc0da4e46f58001b620ce5a7a0
BLAKE2b-256 4e598a212b997b5b7ac79cc4af4b7a5dc58be1260355dc863ba95d0d7a1a53c2

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for spinmc-0.2.2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 dee8d1b424305153961ebb7ddbdbd40be8f5a6b4cf1ebccf0b7cc09a7cc1b928
MD5 cc90f7d0cab5ea9698df79867fb58f70
BLAKE2b-256 04e399a60311d2cd2f66908cf5eaa2e540854cbbd4f899a7452dd691d9579095

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: spinmc-0.2.2-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for spinmc-0.2.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 860d2ff2c4f470bf331144fcd195aa23ff8e273320943d65496891c8d2ee477c
MD5 cb5d482a0e9889c0c9cbb66c20d67f92
BLAKE2b-256 c106d2c680bac7eb76d7bf39c2427e12b3935b3eb943a65a27152b282ac3f9f7

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-cp310-abi3-win32.whl.

File metadata

  • Download URL: spinmc-0.2.2-cp310-abi3-win32.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: CPython 3.10+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for spinmc-0.2.2-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 746fb40bde3b348d1b6750eeace4180fc7b580cdb4c4cc8c59f88aa479d7e9cc
MD5 a839658a765eff42ddeb1772dedfd45b
BLAKE2b-256 cec1726032f2ce1b47354da0e84a82e239b71523ea48371c662dccad9122c9c1

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for spinmc-0.2.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5f3fb4bfafb73b3a5bdd68fe91e7a6f95118b99eda4f6c089ec4c4655943c785
MD5 296dd7a3a8d5355ca5eb3e7cf9d4e235
BLAKE2b-256 d63d30d1eac917fb3f669f3dc89fad5fe465ced06200062c99a2198d8404414e

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for spinmc-0.2.2-cp310-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 e403305213fcf52763edce0cddbf187700b09a978328d17111ea575b092768e0
MD5 a5680023d9cf270178169650c77adfac
BLAKE2b-256 cb16c4e002fff7cfa0bb737e349a347b5af684cb9427670f4f119f6d4045a22b

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for spinmc-0.2.2-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 420d1e556a829aa9190cdb012cb4103b399c558eaf85f1ca57f4ab1be5b07d4e
MD5 82c99d966bb11dea466a67f493dfdb22
BLAKE2b-256 044eb7e2d08e80f9803dd6617c787d383faa0812945add4a40eb708d61f6194a

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spinmc-0.2.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4e7e7db64b4cc70a46e423e66551a2343c823d9941b5b1950886583cdd07395e
MD5 c915e07391aff86880e6b258cdcc8f25
BLAKE2b-256 b0e905c980f6ed30e9c6cc837f4c2d6950c84aaa7a6e9fb47f62da0f64cacc4a

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for spinmc-0.2.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8171296a79e0cb01d252d6122d2c353f73ea9eb2ca1710b6d89692650767841
MD5 f01f8d61cd7eee1765d99edac3c760fb
BLAKE2b-256 db11ef912115d65157f23072c02009cfcafc1b74f680645d46a56f02621d3f5c

See more details on using hashes here.

File details

Details for the file spinmc-0.2.2-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for spinmc-0.2.2-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a1b7a79dae9b1210bca0f03cedc847d8eb928a7bb8954555f2769d876cfb6e0a
MD5 af617cd0fd7de8cd9bf88a096b3ea984
BLAKE2b-256 5d8594d2d6476594f99c6c4592ff79e0c7ce006d6d2ef69994db249b07716690

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page