Potential Energy Surfaces on Graphs
Project description
graph-pes - Potential Energy Surfaces on Graphs
graph-pes is a Python framework for training Potential Energy Surface (PES)
models that operate on graph representations of atomic structures.
Under-the-hood, this relies on Pytorch/Geometric for efficient tensor operations.
Batteries are included:
- easy data manipulations : see docs relating to
AtomicGraph, intuitive batching, easy conversion from ase etc. - easy construction of PES models : implement
predict_local_energies, easy to save, load and share - useful primitives : PerSpeciesParameter
- easy training : forces, energies, well conditioned losses etc.
Installation
pip install graph-pes
Minimal example
from graph_pes import GraphPESModel
from graph_pes.data import convert_to_graphs, AtomicGraph
from graph_pes.training import train_model
from ase.io import read
import torch
# 1. define a model
class LennardJones(GraphPES):
def __init__(self):
super().__init__()
self.sigma = nn.Parameter(torch.tensor(1.0))
self.epsilon = nn.Parameter(torch.tensor(1.0))
def predict_local_energies(self, graph: AtomicGraph) -> torch.Tensor:
central_atoms, neighbours = graph.neighbour_index
distances = graph.neighbour_distances
# calculate pairwise interactions
x = (self.sigma / distances)**6
pairwise_interaction = 4 * self.epsilon * (x**2 - x)
# sum over neighbours to get per-atom contributions
return torch.scatter_add(
torch.zeros(graph.n_atoms, device=graph.device),
central_atoms,
pairwise_interaction
)
# 2. load some structures
structures = read('structures.xyz', index=':10')
# 3. convert to graphs (e.g. using a radius cutoff)
graphs = convert_to_graphs(structures, cutoff=5.0)
# 4. train the model
model = LennardJones()
train_model(model, graphs, max_epochs=100)
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
graph-pes-0.0.0.tar.gz
(36.5 kB
view details)
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
graph_pes-0.0.0-py3-none-any.whl
(38.3 kB
view details)
File details
Details for the file graph-pes-0.0.0.tar.gz.
File metadata
- Download URL: graph-pes-0.0.0.tar.gz
- Upload date:
- Size: 36.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dfc6e7df91b6ef3ca3c9a5cb60b100d8385ee3a7271a333933e1fc24a8d060a
|
|
| MD5 |
e4089ce8aa3dd47ff9e4d25fa4db44cb
|
|
| BLAKE2b-256 |
f387d475def87e30daed24a8a781aceb432e3106716e04be55b77979b86167a7
|
File details
Details for the file graph_pes-0.0.0-py3-none-any.whl.
File metadata
- Download URL: graph_pes-0.0.0-py3-none-any.whl
- Upload date:
- Size: 38.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
330290a61f9512dba78189cc228a16aba3d3da8af718750e81a06607b96efbb6
|
|
| MD5 |
a7edcf3e6e723c579548b957ba415ff8
|
|
| BLAKE2b-256 |
54a73eeb53cfe2b0d4b554bc47bb28503c5b558e4057a9df6fb5d837a793e11c
|