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 potentialsmlphonon- Calculate phonon properties and band structuresmlgap- Predict band gap using ML potentialsmlsinglepoint- Single point energy/forces/stress calculationsmlsupercell- Generate supercells with various transformation matricesmlrattle- Generate rattled structure datasets for trainingmlbatch- Batch process trajectories with ML potentialsmlcompare- Compare calculated properties between two trajectoriesmlneb- Nudged elastic band calculations for reaction pathwaysmlcollect- Collect structures from many files into one trajectorymlconvert- Convert structures between ASE-supported file formatsmlmetastable- Explore symmetry-mode metastable structuresmlddb- Write ABINIT-style DDB files from phonopy and ML finite-difference workflowsmlhist- Convert between ABINIT HIST.nc and ASE trajectory filesmltraining- 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:
- docs/singlepoint.md - Single point calculations
- docs/supercell.md - Supercell generation
- docs/rattle.md - Dataset generation
- docs/batch.md - Batch trajectory processing
- docs/compare.md - Trajectory comparison
- docs/relax.md - Structure relaxation
- docs/phonon.md - Phonon calculations
- docs/md.md - Molecular dynamics
- docs/multibinit.md - MULTIBINIT calculator usage through pymultibinit
- docs/ddb.md - ABINIT-style DDB writer
- docs/hist_training.md - ABINIT HIST and MULTIBINIT training artifacts
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file atomchain-0.2.0.tar.gz.
File metadata
- Download URL: atomchain-0.2.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81409cbaf7fc312ab6d026de4b5d96c584b25d788536db25980da33fb3cb626c
|
|
| MD5 |
8b12e3a6a63b13436e62ed95a175f0d5
|
|
| BLAKE2b-256 |
7805cc255a883c444f7860d2d82977e890ccdc20edcf69036abffdb1bdbd11de
|
File details
Details for the file atomchain-0.2.0-py3-none-any.whl.
File metadata
- Download URL: atomchain-0.2.0-py3-none-any.whl
- Upload date:
- Size: 106.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be987516c94f7ee192eacacd3186c781ce8a25ee800be0ee996cfd8c8cff6719
|
|
| MD5 |
f977f24111eca2be11876bfd9a2d3ecd
|
|
| BLAKE2b-256 |
2a8838f6687a74450900322b2ea8c75894c2d4c511060650b8697ce9d0b4aaf0
|