Skip to main content

Motif-aware initial magnetic moment seeding for spin-polarized DFT on carbon-rich materials.

Project description

spinit logo

Physically informed spin initialisation for atomistic structures

spinit seeds initial magnetic moments to ase.Atoms using local chemistry, topology, and geometry criteria to provide physically motivated spin initialisation. This is useful for e.g. spin-polarised DFT of large structures where spins cannot (reasonably) be manually assigned.

It is designed for carbon-rich systems, including graphenic, nanoporous, and amorphous carbon, as well as mixed chemistries containing heteroatoms such as H, O, and N.

Scientific Scope

spinit is a heuristic spin seed generator.

  • It does not prove magnetic ground states.
  • It provides physically motivated initial spin patterns to improve exploration of plausible spin solutions.
  • It combines undercoordination, local geometry/strain, ring topology, and explicit motif detection.
  • Motif labels are heuristic local-environment descriptors (*_like) and do not by themselves assign formal bond order, oxidation state, or molecular charge.

Features

  • PBC-aware bond graph construction (ASE + MIC vectors).
  • Ring/topology analysis from local graph cycles.
  • Hybridization-like local classification (sp, sp2, sp3, distorted variants).
  • Motif-aware handling of O/N/H/C-centered local environments.
  • Connectivity-aware classification of network-bound vs molecular fragments.
  • Transparent additive scoring with configurable thresholds and weights.
  • Multiple assignment strategies:
    • fm
    • afm_clusters
    • random_candidates

Installation

git clone https://github.com/joehart2001/spinit.git
cd spinit
pip install -e .

Optional reporting extras:

pip install -e .[reporting]

Quickstart

from ase.io import read
from spinit.api import assign_initial_magnetic_moments

atoms = read("structure.xyz")

magmoms, feature_dict, graph, ring_info = assign_initial_magnetic_moments(
    atoms,
    strategy="afm_clusters",
    cutoff=1.85,
    maxlength=12,
    k_hops=5,
    seed=0,
)

atoms.set_initial_magnetic_moments(magmoms)

Package Layout

  • spinit.api: high-level end-to-end API.
  • spinit.config: defaults and config merge helpers.
  • spinit.graph: graph/ring/geometry/topology utilities.
  • spinit.chemistry: hybridization, motif detection, and per-atom feature construction.
  • spinit.seeding: magnetic scoring and moment assignment strategies.
  • spinit.output: reporting/summary utilities.

Development

pip install -e .[dev]
pytest

Citation

If you use spinit in scientific work, please cite:

@software{spinit,
  author  = {Hart, Joseph},
  title   = {spinit: Physically informed spin initialisation for atomistic structures},
  year    = {2026},
  version = {0.1.0},
  url     = {https://github.com/joehart2001/spinit}
}

Full machine-readable metadata is available in CITATION.cff.

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

spinit-0.0.1.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

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

spinit-0.0.1-py3-none-any.whl (31.5 kB view details)

Uploaded Python 3

File details

Details for the file spinit-0.0.1.tar.gz.

File metadata

  • Download URL: spinit-0.0.1.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for spinit-0.0.1.tar.gz
Algorithm Hash digest
SHA256 afb36e2d5166c43883ee4f2b8c37e4f8685d70c22628031ef28f169da05a65f0
MD5 fea1e0305ecb5bc39757ef6164cb26c4
BLAKE2b-256 2a2e927dbe343fbd7f144e3cada78e1655235a5cb86e888e0b550ea6d5e774ef

See more details on using hashes here.

File details

Details for the file spinit-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: spinit-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 31.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for spinit-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 433b8bb4c70efdf661f80c19839fb6c11f17ff225a6d8820b00510194ebfab80
MD5 c890a31862480ba4311b71ffe73cee62
BLAKE2b-256 d342040ea3ff45f1de10bb03e14e21a323028cb1fd475136448e74a48df3afab

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