Skip to main content

A library to chain the atomic models with applications

Project description

atomchain

AtomChain provides CLI tools and Python APIs for atomic structure manipulation, ML-potential calculations, phonon/DDB workflows, and ABINIT HIST/MULTIBINIT training artifact preparation.

CLI Tools

AtomChain includes several command-line tools for common atomistic workflows:

  • mlrelax - Relax atomic structures using ML potentials
  • mlphonon - Calculate phonon properties and band structures
  • mlgap - Predict band gap using ML potentials
  • mlsinglepoint - Single point energy/forces/stress calculations
  • mlsupercell - Generate supercells with various transformation matrices
  • mlrattle - Generate rattled structure datasets for training
  • mlbatch - Batch process trajectories with ML potentials
  • mlcompare - Compare calculated properties between two trajectories
  • mlneb - Nudged elastic band calculations for reaction pathways
  • mlcollect - Collect structures from many files into one trajectory
  • mlconvert - Convert structures between ASE-supported file formats
  • mlmetastable - Explore symmetry-mode metastable structures
  • mlddb - Write ABINIT-style DDB files from phonopy and ML finite-difference workflows
  • mlhist - Convert between ABINIT HIST.nc and ASE trajectory files
  • mltraining - Generate MULTIBINIT training trajectories/artifacts and delegate training to pymultibinit

Installation

uv sync

For editable installation with pip, use pip install -e . from the repository root.

Quick Start

Single Point Calculation

mlsinglepoint input.vasp --model chgnet --output_file results.yaml

Generate Supercell

mlsupercell input.vasp --size 2 --output supercell.vasp

Generate Training Dataset

mlrattle input.vasp --stdev 0.05 --nstruct 100 --output structures.traj

Batch Process Trajectory

mlbatch structures.traj --calculator chgnet --output results.traj

Compare Trajectories

mlcompare dft.traj ml.traj --labels "DFT" "CHGNet" --output comparison.png

Relax Structure

mlrelax input.vasp --model chgnet --output_file relaxed.vasp

Calculate Phonons

mlphonon input.vasp --model chgnet --ndim 2 2 2

Write DDB From Phonopy

mlddb BaTiO3.vasp --phonopy-yaml phonon_save/phonopy_params.yaml --output BaTiO3.ddb --validate

Write ABINIT HIST From Trajectory

mlhist training.traj training_HIST.nc --to hist

Generate Training Trajectory

mltraining generate BaTiO3.vasp --sources md phonon_modes --model mace-r2scan --output training.traj

Documentation

Detailed documentation for each tool is available in the docs/ directory:

Python API

All CLI tools have corresponding Python APIs for programmatic use:

from ase.io import read
from atomchain import (
    calculate_single_point,
    calculate_trajectory_batch,
    calculate_neb,
    compare_trajectories,
    explore_metastable_states,
    generate_multibinit_training_artifacts,
    generate_rattle_dataset,
    generate_training_trajectory,
    init_calc,
    make_supercell_structure,
    phonon_with_ml,
    read_abinit_hist,
    relax_with_ml,
    write_ddb_from_finite_difference,
    write_ddb_from_phonopy,
    write_abinit_hist,
)

atoms = read("structure.vasp")

# Relax structure
relaxed_atoms = relax_with_ml(atoms, calc="chgnet")

# Calculate phonons
phonon_with_ml(atoms, calc="chgnet", ndim=[[2, 0, 0], [0, 2, 0], [0, 0, 2]])

# Single point calculation
results = calculate_single_point(atoms, calc="chgnet")

# Generate supercell
supercell = make_supercell_structure(atoms, 2)

# Generate dataset
generate_rattle_dataset(
    atoms,
    stdev=0.05,
    n_struct=100,
    output="dataset.traj"
)

# Batch process trajectory
results = calculate_trajectory_batch(
    "dataset.traj",
    calculator="chgnet",
    output="results.traj"
)

# Compare trajectories
compare_trajectories("dft.traj", "ml.traj", labels=["DFT", "CHGNet"])

# NEB calculation
initial = read("initial.vasp")
final = read("final.vasp")
calculate_neb(initial, final, calculator="chgnet")

# HIST conversion and training trajectory generation
frames = generate_training_trajectory(atoms, sources=["phonon_modes"], evaluate=False)
write_abinit_hist(frames, "training_HIST.nc", strict=False)
loaded_frames = read_abinit_hist("training_HIST.nc")

Requirements

  • Python 3.8+
  • ASE (Atomic Simulation Environment)
  • Phonopy
  • Optional: CHGNet, M3GNet, matgl, MACE, DeePMD-kit, atomic_potential_xq, and pymultibinit depending on selected calculator/workflow

License

BSD-2-Clause

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

atomchain-0.2.1.tar.gz (13.6 MB view details)

Uploaded Source

Built Distribution

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

atomchain-0.2.1-py3-none-any.whl (112.6 kB view details)

Uploaded Python 3

File details

Details for the file atomchain-0.2.1.tar.gz.

File metadata

  • Download URL: atomchain-0.2.1.tar.gz
  • Upload date:
  • Size: 13.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for atomchain-0.2.1.tar.gz
Algorithm Hash digest
SHA256 927ee000376dafb8609f229d1b6fd2ea3fcf6d9bdcc6d5afe13a96a37236da60
MD5 ca9eb9431aa60ae233e16b0ae91052cc
BLAKE2b-256 f82f0549d88059fa82d2bf2911aa3c849c65e45c4b502550a1aa9b9985041390

See more details on using hashes here.

File details

Details for the file atomchain-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: atomchain-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 112.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for atomchain-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d226546fe50e0578b8263f47707556f20266547c28f3ad31b9f7399d6450a8f2
MD5 518b96b0099bdc883b38a26055c86152
BLAKE2b-256 5014972dd1ce25963a2e3bba122d5f9284d98d38f75ffd329e1b435e62ba5a58

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