The schmeud library, inspired by freud, is a collection of tools for analyzing molecular dynamics trajectories, but with a particular focus towards the study of granular materials, polymers, supercooled liquids, and other glassy systems. This library, like freud, aims to be performant yet easy to use as a Python library. To achieve this we write core functionality in the Rust programming language and use pyo3 to interop between Rust and Python.
This project is in an alpha state! APIs are being experimented with and are not stable between releases (until maybe a version 1.0).
At the moment, you're welcome to install the library from this repo. Once I pin down the feature set, I'll throw a release back on PyPI.
pip install git+https://github.com/ianrgraham/schmeud.git
from schmeud.ml import SoftnessDescriptor
from schmeud.filter import Type, Tag
from schmeud.dynamics import Phop
import gsd.hoomd
import numpy as np
rads = np.linspace(0.1, 3.0, 30)
mu = 0.1
types = ['A', 'B']
soft_desc = SoftnessDescriptor.parrinello_radial(rads, mu, types)
traj = gsd.hoomd.open("my-sim.gsd")
filter = Type('A')
phop = Phop(tr=11)
phop_result = phop.compute(system=traj, filter=filter)
training_mask = np.logical_and(phop_result > 0.2, phop_result < 0.05)
training_classes = np.where(phop_result[training_mask] > 0.2, 1, 0)
training_filter = Tag(training_mask)
struc_funcs = soft_desc.compute_sf(system=traj, filter=training_filter)
soft_desc.train(struc_funcs, training_classes)
soft_desc.print_metrics()