Skip to main content

MagTrans: Magnetic Transition Estimator

Project description

MagTrans — Magnetic Transition Estimator

License: MIT
Python

MagTrans is a fully automated pipeline for predicting magnetic transition temperatures (Curie and Néel) from first principles:

  • Enumerates all collinear spin configurations in a crystal (1D, 2D, 3D)
  • Performs ab initio DFT relaxations, static, and SOC calculations via VASP + Custodian
  • Fits a Heisenberg + anisotropy Hamiltonian
  • Executes Monte Carlo simulations to extract transition temperatures

🚀 Features

  • End-to-end automation: enumeration → DFT → Hamiltonian → Monte Carlo
  • Symmetry-aware collinear spin enumeration using KD-Tree + space group reduction
  • Lightweight config via a plain-text input file
  • Support for high-accuracy functionals, GPU acceleration
  • Compatible with PBE, SCAN, R2SCAN, RVV10, DFT+U, and vdW corrections
  • Modular execution with flags: --only-mc, --jij

📦 Installation

  1. Clone the repository:

    git clone https://github.com/your-org/MagTrans.git
    cd MagTrans
    
  2. Create & activate a virtual environment:

    python3 -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
    
  3. Ensure dependencies such as VASP, Custodian, ASE, and pymatgen are installed and configured properly.


⚙️ Input File (input)

Place a plain-text file named input in the working directory. Below is an annotated example for BaNiCl₃:

system_dimension         = 2D
structure_file           = BaNiCl3.vasp
XC_functional            = PBE
DFT_supercell_size       = 1 1 1
VASP_command_std         = mpirun -np 2 vasp_std
VASP_command_ncl         = mpirun -np 2 vasp_ncl
accuracy                 = high

# Magnetic enumeration
mag_prec                 = 0.003
enum_prec                = 1e-7
max_neighbors            = 4
mag_from                 = OSZICAR

# GPU and layer flags
GPU_accel                = True
more_than_2_metal_layers = False

# DFT+U and vdW
dftu                     = false
LDAUTYPE                 = 2
LDAUU                    = Ni 6.0
LDAUJ                    = Ni 1.0
LVDW                     = True

# Plane-wave basis
ENCUT                    = 450
NSIM                     = 4
KPAR                     = 2
NPAR                     = 2
NCORE                    = 1

# k-points
kpoints_density_relax    = 10
kpoints_density_static   = 20

# I/O
log_filename             = BaNiCl3.log
potential_directory      = /home/potential

💡 Tip: Any missing tags are automatically filled with defaults at runtime.


🛠️ Usage

From the project root:

# Full workflow: spin enumeration → DFT → fit Hamiltonian → Monte Carlo
./MagTrans

# Run only Monte Carlo (requires existing input_MC + DFT outputs)
./magtrans --only-mc

# Generate exchange interaction file (Jij) for Vampire simulations
./magtrans --jij [--exc_type isotropic|tensorial]

📖 How It Works

  1. parse_input()
    Parses the input file and sets global parameters.

  2. Structure Preparation
    Converts structure with ASE → pymatgen; applies vacuum or strain if needed.

  3. Spin Enumeration
    Uses KD-tree + symmetry operators to enumerate unique collinear configs.

  4. DFT Execution
    Performs relaxation → static → SOC DFT runs, using Custodian for error handling.

  5. Hamiltonian Fitting
    Symbolically solves or fits via least-squares a Heisenberg + anisotropy model (up to 4 shells).

  6. Monte Carlo Simulation
    Computes temperature-dependent properties using Metropolis / Hybrid / SSE-QMC.

  7. Output & Visualization

    • *_Heisenberg_mc.png — Plots of energy, magnetization, $C_v$, and susceptibility
    • heisenberg_mc_data.txt — Full thermodynamic dataset

📂 Project Structure

├── file.vasp              # Input structure file (POSCAR)
├── input                     # Input parameter file
├── MagTrans                      # Main executable script
├── run_CurieD.py             # Core workflow module
├── exchange_generator.py     # Jij generator for MC/Vampire
├── mc_class.py               # Monte Carlo implementation
├── requirements.txt          # Python dependencies
├── README.md                 # ← This file
└── examples/                 # Sample cases and output

🧑‍💻 Contributing

We welcome contributions!

  1. Fork the repo & clone it locally
  2. Create a new feature branch
  3. Add tests + documentation for your changes
  4. Submit a pull request (PR)

Please follow PEP8 and write clear commit messages.


📜 License

This project is licensed under the MIT License. See LICENSE for details.


✉️ Contact

Chinedu Ekuma
Department of Physics, Lehigh University
📧 cekuma1@gmail.com | che218@lehigh.edu

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

magtrans-1.0.tar.gz (70.6 kB view details)

Uploaded Source

Built Distribution

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

magtrans-1.0-py3-none-any.whl (74.5 kB view details)

Uploaded Python 3

File details

Details for the file magtrans-1.0.tar.gz.

File metadata

  • Download URL: magtrans-1.0.tar.gz
  • Upload date:
  • Size: 70.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for magtrans-1.0.tar.gz
Algorithm Hash digest
SHA256 370eb8825e586a270b293227e548159984774bc8b171acc30d7e3cb6247cfd31
MD5 8b588c6746242dfa076e2a8ec471ac60
BLAKE2b-256 7397c891b610aaa374e4f4b6154dfb94f06c8ce292be864a71035e70120ea6b8

See more details on using hashes here.

File details

Details for the file magtrans-1.0-py3-none-any.whl.

File metadata

  • Download URL: magtrans-1.0-py3-none-any.whl
  • Upload date:
  • Size: 74.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for magtrans-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5107ff5f83673a6184b1f4c54df0692861b9b134e3bfe72594489fb581cab9ee
MD5 faaaba48e6e6b41daa4054d6d3dd3554
BLAKE2b-256 574fc79f548557cf72699f2d95698f757dd2faf57d98df4c6119aec370514af2

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