Skip to main content

gridmlip

License

gridmlip samples the energy landscape of a mobile ion in a crystal on a symmetry-reduced grid, using machine learning interatomic potentials (MLIPs) or bond valence site energies, and finds percolation barriers. It also generates defect configurations and training sets for MLIPs.

The library is under development; the API may change.

Contents

Installation

pip install gridmlip
pip install "gridmlip[fast]"     # numba: 10-100x faster percolation analysis
pip install "gridmlip[ml]"       # training-set tools: SOAP, FPS, rattling

MLIPs are used if installed: pip install mace-torch, sevenn or gnn_lib; any ASE calculator works.

Percolation barriers with a batched MLIP

from ase.io import read
import gridmlip as gm
from gridmlip.predictors import mace

atoms = read("Li10Ge(PS6)2_mp.cif")
grid = gm.Grid(atoms, specie="Li", resolution=0.2, r_min=0.8)

emap = grid.evaluate(mace("medium-mpa-0", device="cuda"))
emap.percolation_barriers()

Other batched predictors:

from gridmlip.predictors import sevennet, gnn_lib

emap = grid.evaluate(sevennet("7net-mf-ompa", modal="mpa"))
emap = grid.evaluate(gnn_lib("cgcnn.pth", r_cut=5.0))
emap = grid.evaluate(my_function)  # any callable: list[Atoms] -> energies

ASE calculators

MACE and SevenNet calculators are batched automatically; other calculators run one structure at a time.

from mace.calculators import mace_mp

emap = grid.evaluate(mace_mp(model="medium"))

External calculations (MTP, DFT, cluster jobs)

grid.prepare_configurations(supercell_cutoff=5.0, filename="cfgs.cfg")
emap = grid.load("processed.cfg")
emap.percolation_barriers()

Bond valence site energy

emap = gm.bvse(atoms, "Li+", resolution=0.2)
emap.percolation_barriers()

Oxidation states are taken from atoms.arrays["oxi_states"] or assigned with pymatgen's BVAnalyzer.

Forces, stress and descriptors

pred = mace("medium-mpa-0", device="cuda")
out = pred.predict(grid.prepare_configurations(), ("energy", "forces", "stress", "descriptors"))

Saving and visualization

emap.write("li.grd")
emap.save("li.npz")
emap = gm.EnergyMap.load("li.npz")

.grd and .cube files open in VESTA.

Local minima and percolation radii

emap.local_minima(min_distance=2.0, energy_window=0.5)
grid.percolation_radii()

Interactive view

emap.view()
emap.view(level=0.6, supercell=(1, 2, 2), theme="light")
emap.view().save("map.html")
emap.view().open()

Inline in Jupyter, or a standalone page that works offline: atoms and polyhedra in VESTA's default colors and bond rules, an isosurface at the 1D percolation barrier, hover labels, click-to-measure distances, angles and polyhedra, and controls for the level, supercell and layers.

Defect configurations

from gridmlip.defects import interstitials, vacancies, frenkel_pairs

params = dict(resolution=0.25, r_min=1.3, r_cut=7.5)
cfgs = interstitials(atoms, 3, **params) + vacancies(atoms, 3, **params) + frenkel_pairs(atoms, 3, **params)

Training datasets

Defects → SOAP → farthest point sampling → reproducible rattling, one .xyz per material.

gridmlip dataset --print-config > dataset.yaml
gridmlip dataset structures.xyz --config dataset.yaml --output datasets/li --dry-run
gridmlip dataset structures.xyz --config dataset.yaml --output datasets/li
from gridmlip.dataset import build_dataset

build_dataset("structures.xyz", config="dataset.yaml", output_dir="datasets/li")

On a cluster:

#SBATCH --array=0-31
gridmlip dataset structures.xyz --config dataset.yaml --output datasets/li --chunk ${SLURM_ARRAY_TASK_ID}/32

Notebooks

How to cite

If you use the gridmlip library, please consider citing this repository.

Metadata

Release files for gridmlip 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gridmlip 0.3.0
File Size Uploaded Provenance Actions
gridmlip-0.3.0.tar.gz 244.8 kB Without provenance Details for gridmlip-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gridmlip 0.3.0
File Interpreter ABI Platform Actions
gridmlip-0.3.0-py3-none-any.whl Python 3 none any Details for gridmlip-0.3.0-py3-none-any.whl

Total release size: 504.2 kB

Release files / gridmlip-0.3.0.tar.gz

Download URL gridmlip-0.3.0.tar.gz
Size 244.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4591d191696852e506a626d1fe1c70e2548d66d427dd8a9b2f7be0dd1eaf65db
BLAKE2b-256 checksum
How to use checksums
6d5e920297f972371cb761a6a8dae449ee97ecd002638a53d98524643220d632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.5

Release files / gridmlip-0.3.0-py3-none-any.whl

Download URL gridmlip-0.3.0-py3-none-any.whl
Size 259.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0acb65885dec8b5631db88dd1f627df565d5eacb866b775f90a9968b62aaf708
BLAKE2b-256 checksum
How to use checksums
0b947e284994cef4fb5aab542baa929b6ad583f7edf68c929f6c250246b3a14e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.5

Security for gridmlip 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page