Metadata-Version: 2.4
Name: magnetics
Version: 0.1.0a0
Summary: A NumPy-native finite-difference micromagnetics simulation engine
Author: Parasveer
License: MIT
Project-URL: Homepage, https://pypi/project/magnetics
Project-URL: GitHub, https://github.com/Parasveer/magnetics
Project-URL: Bug Tracker, https://github.com/Parasveer/magnetics/issues
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.26
Requires-Dist: scipy>=1.11
Provides-Extra: gpu
Requires-Dist: cupy-cuda12x; extra == "gpu"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Dynamic: license-file

# Magnetics

A NumPy-native finite-difference micromagnetics simulation engine.

Unlike closed, script-driven binaries (e.g. MuMax3), Magnetics keeps
magnetization state and field data as ordinary NumPy (or CuPy) arrays, so
they compose directly with the rest of the scientific Python ecosystem:
autodiff frameworks, ML surrogates, batched parameter sweeps, and Jupyter
workflows.

**Status**: under active development. Core layers (mesh, materials, backend
abstraction, macrospin LLG, exchange field) are implemented and tested.
Zeeman/anisotropy/demag/DMI fields, full-mesh LLG, energy bookkeeping, and
I/O are not yet available.

Documentation and web presence are handled separately, outside this repo.

## Installation

```bash
pip install magnetics
```

For GPU (CuPy) support:

```bash
pip install cupy-cuda12x # or any other version
pip install magnetics
```

## Quick example

```python
from magnetics import Mesh, Material, MaterialMap

grid = Mesh(nx=100, ny=100, nz=1, dx=2e-9, dy=2e-9, dz=2e-9)
grid.set_ring(r_outer=80e-9, r_inner=40e-9)

X, Y, Z = grid.cell_centres()
grid.set_region(X < 100e-9, region_id=1)
grid.set_region(X >= 100e-9, region_id=2)

mm = MaterialMap()
mm.register(1, Material(name="Permalloy", Ms=8.6e5, Aex=1.3e-11))
mm.register(2, Material(name="CoFeB", Ms=1.0e6, Aex=1.5e-11, Ku=8e5))

params = mm.build_param_arrays(grid)
```

## Structure

```
magnetics/
  __init__.py        public API re-exports
  backend.py          NumPy <-> CuPy array-module abstraction
  constants.py         shared physical constants (MU0)
  mesh.py              Mesh: grid, geometry masking, region indexing
  materials.py          Material, MaterialMap: per-cell parameter lookup
  llg/                  macrospin LLG solver (full-mesh: not yet implemented)
  fields/               exchange field/energy (Zeeman, anisotropy, demag, dmi: not yet implemented)
  energy/                [not yet implemented] energy bookkeeping
  io/                    [not yet implemented] OVF read/write
  api/                   [not yet implemented] scripting DSL
tests/                 verification suite, one file per module
examples/              runnable scripts, numbered by layer
PLAN.md                living build plan: layer order + verification gates
.github/workflows/      CI (test matrix)
```

## License

MIT — see [`LICENSE`](LICENSE).
