Skip to main content

gridmlip

License

Contents

About

gridmlip is a library for the symmetry-aware grid-based sampling of the energy landscape of mobile species in solids using machine learning interatomic potentials (MLIPs).

(!) Note: The API and functionality may change. Errors are expected. The library is under development.

Installation

pip install gridmlip

or

git clone https://github.com/dembart/gridmlip
cd gridmlip
pip install .

How to use

Here we describe the pipeline in general. For a specific example, see Notebooks.

Percolation analysis

from gridmlip import Grid
from gridmlip.integrations.sevennet import evaluate_atoms_list # sevenn must be installed

file = './data/Li10Ge(PS6)2_mp.cif'
specie = 3

### Create grid
g = Grid.from_file(
    file,
    specie,
    r_min=0.8,
    r_cut=5.0,
    resolution=0.2,
    symprec=0.1,
    empty_framework=True,
    verbose=True
)

### Prepare inequivalent atomic configurations
atoms_list = g.construct_cfgs(config_format='ase')

### Predict energies
energy_list, forces_list = evaluate_atoms_list(
    atoms_list,
    model_path='./data/checkpoint_sevennet_0.pth',
    device='cuda',
    compute_force=False,
    batch_size=256
)

### Load energies
g.load_energies(energy_list)

### Determine percolation barriers
barriers = g.percolation_barriers(n_jobs=-1)

### Save .grd file for visualization in VESTA 3.0
g.write_grd('test.grd')

Generate defected configurations for MLIP pre-training

from ase.io import read
from gridmlip._generate import DefectGenerator

GENERATOR_PARAMS = {
    'specie': 3,
    'resolution': 0.25,
    'r_min': 1.3,
    'r_cut': 7.5,
    'symprec': 0.1,
    'max_sep_dist': 'auto',
    'upper_bound': 6.0,
}

gen = DefectGenerator(atoms, **GENERATOR_PARAMS)

### Symmetrically distinct defect configurations
cfgs_int = gen.generate_dataset(defect_type='int') 
cfgs_vac= gen.generate_dataset(defect_type='vac')
cfgs_frk = gen.generate_dataset(defect_type='frenkel')

Find voids

from ase.io import read
from gridmlip._void_search import clustered_local_minima

atoms = read('file.cif')

g = Grid(atoms, specie=3, empty_framework=False)
g.generate_mesh()

clusters = clustered_local_minima(
    -g.min_distances_data, # can be any data computed for the generated grid
    min_distance=2.0,
    relative_max_value=0.5,
    cell=g.atoms.cell,
    coord_type='cart'
)

for (pos, energy, n) in clusters:
    print('Site', pos)
    print('Site energy', energy) # here, energy is the minimal distances
    print('Number of points in a cluster', n)

Bond valence site energy calculations

from ase.io import read
from ions.decorate import assign_oxidation_states
from gridmlip.integrations.bvse import bvse_distribution

atoms = read('LiFePO4.cif')
atoms = assign_oxidation_states(atoms)

PARAMS = {
    "mobile_ion": "Li+",
    "resolution": 0.2,
    "r_min": 0.8,
    "r_cut": 10.0,
    "empty_framework": True,
    "k": 100,
    "f": 0.74,
}

grid, energies = bvse_distribution(atoms, **PARAMS)
grid.percolation_barriers() # energies already loaded via grid.load_energies(energies)

Notebooks

How to cite

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

Metadata

Release files for gridmlip 0.2.6.2

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.2.6.2
File Size Uploaded Provenance Actions
gridmlip-0.2.6.2.tar.gz 29.1 kB Without provenance Details for gridmlip-0.2.6.2.tar.gz

Built distribution (wheel)

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

Total release size: 62.6 kB

Release files / gridmlip-0.2.6.2.tar.gz

Download URL gridmlip-0.2.6.2.tar.gz
Size 29.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b38626dbf72ee774609743284e1651fea8b51895b3242fd9d5df7575f858831f
BLAKE2b-256 checksum
How to use checksums
b59cc20ec0ad8035e72edeaef26dd1c61375e33d37896e1460aa02dae00adb0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.5

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

Download URL gridmlip-0.2.6.2-py3-none-any.whl
Size 33.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcbb36868e26bffeb1e8293ffa18e03a11d0b0e1c5b7cb22b3acc42239e96d1b
BLAKE2b-256 checksum
How to use checksums
354f7b62e1ac80f6e4b1eec955554a656659d19a7b942612da27f5b4b8ef5f5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.5

Security for gridmlip 0.2.6.2

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