Skip to content

alawein/maglogic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

125 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

MagLogic

Status: frozen Category: research Owner: alawein Visibility: public Purpose: Magnetic logic gates and device simulation research. Next action: continue

Public value

MagLogic is a research-portfolio candidate if it clearly presents the nanomagnetic logic model, simulation assumptions, and relation to any published or prior work. Public polish should make the scientific context legible before emphasizing implementation details.

Publication boundaries

  • Keep claims tied to reproducible scripts, notebooks, or documented figures.
  • Confirm data provenance and license status before public promotion.
  • Separate archived experiments from canonical results.
  • Avoid publishing machine-local outputs or unpublished manuscript material unless explicitly cleared.

License: MIT Python 3.8+

About

Python tools for simulating nanomagnetic logic devices using OOMMF and MuMax3 backends. Implements nanomagnetic logic simulations from Alawein et al. (IEEE Magnetics Letters, 2019) for triangular element logic gates and cellular automata, designed for reproducible research and teaching.

Features

  • Micromagnetic simulations via OOMMF and MuMax3
  • Reconfigurable logic gate analysis (NAND/NOR, majority gates)
  • Magnetization pattern analysis and domain structure detection
  • Energy landscape calculation and topological feature detection
  • Cross-platform Docker support
  • Automated truth-table verification

Installation

Docker

git clone https://github.com/alawein/maglogic.git
cd maglogic
docker compose up --build

Local

conda env create -f environment.yml
conda activate maglogic
pip install -e ".[dev]"
python scripts/validate-structure.py
PYTHONPATH=python python -c "import maglogic"

Quick Usage

PYTHONPATH=python python examples/demo_truth_table.py
from maglogic.demos import demo_nand_nor
result = demo_nand_nor.generate_truth_table()
print(result["truth_table"])

Layout Model

MagLogic intentionally uses a language-boundary layout:

  • python/maglogic/ is the canonical Python package
  • python/tests/ is the canonical Python test surface
  • oommf/ and mumax3/ hold simulation assets and reference inputs
  • matlab/ holds MATLAB reference implementations
  • docs/ holds repo-local documentation
  • scripts/ holds repo-local validation and maintenance helpers

This repo does not use src/<package> as its Python boundary.

See docs/architecture/STRUCTURE_DECISION.md for the canonical structure decision.

Roadmap

  • Near term: modernize OOMMF/MuMax3 docker images, add reproducible seeds for demos.
  • Mid term: expand majority-gate library and energy landscape visualizations.
  • Future: add JAX-backed differentiable simulators and more CA examples.

Usage

from maglogic.demos import demo_nand_nor

# NAND mode (clock = +60 degrees)
result_nand = demo_nand_nor.run_simulation(clock_angle=60, input_A=1, input_B=1)
print(f"NAND(1,1) = {result_nand['logic_output']}")

# Generate a complete truth table
truth_table = demo_nand_nor.generate_truth_table()

Project Structure

maglogic/
├── python/
│   ├── maglogic/       # Canonical Python package
│   └── tests/          # Python test suite
├── matlab/             # MATLAB reference implementations
├── oommf/              # OOMMF simulation files
├── mumax3/             # MuMax3 simulation files
├── examples/           # Demo scripts and notebooks
├── docker/             # Docker configuration
├── docs/               # Documentation
│   └── architecture/   # Structure decisions
└── scripts/            # Repo-local validation and maintenance helpers

Validation

python scripts/validate-structure.py
PYTHONPATH=python python -c "import maglogic"

Representative tests, when dependencies are installed:

PYTHONPATH=python python -m pytest -s python/tests/test_constants.py python/tests/test_analysis.py

Documentation

Citation

@article{alawein2019multistate,
  title={Multistate nanomagnetic logic using equilateral permalloy triangles},
  author={Alawein, Meshal and others},
  journal={IEEE Magnetics Letters},
  volume={10},
  pages={1--5},
  year={2019},
  doi={10.1109/LMAG.2019.2912398}
}

License

MIT License. See LICENSE.

Ownership

About

Magnetic logic simulation framework

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors