Compute¶
Trajectory and structure analyses. Import with from molpy.compute import....
Numerical kernels live in the native backend, and there is no second science
implementation in molpy. Every public name on molpy.compute is the backend
class or function re-exported by identity
(molpy.compute.RDF is molrs.compute.density.RDF); molpy adds no wrapper.
Pair-based analyses take neighbour tables built with the core
mp.NeighborList (nl.build(frame.coords, frame.box), then
nl.neighbors()).
Compose raw Computes with Fits (and an optional SI scale) yourself. The
all-in-one recipe classes (IonicConductivity, DielectricSusceptibility, and
their ConductivityResult / DielectricSusceptibilityResult) that used to wrap
that pipeline in one call were removed in 0.15 — they buried the fit window and
the unit conversion in a library default. Compose EinsteinConductivity →
LinearFit → your own prefactor, as the PMSD and
Dielectric pages show.
Time unit when migrating from IonicConductivity
IonicConductivity took its frame spacing dt in picoseconds. The
composed route works in femtoseconds: pass dt in fs to
EinsteinConductivity().compute(...), and the S/m prefactor on the
PMSD page (\(3.0988\times10^{9}\)) assumes a slope in
\(e^2\,\text{Å}^2\,\text{fs}^{-1}\). Reusing an old picosecond dt makes the
lag axis 1000× too short and the conductivity 1000× too large.
Like freud’s API modules, each analysis family has its own page under Compute with an overview table and full signatures. This page is the index plus the shared contract / result types.
Analysis units (LAMMPS real)
Length Å, charge e, time fs, volume ų, temperature K.
Vibrational spectra take dt_fs in femtoseconds and report cm⁻¹.
GROMACS trajectories are nm-native — scale lengths ×10 before analysis.
MSD / Einstein routes need unwrapped coordinates.
Architecture: raw Compute → Fit → scale¶
| Layer | Role | Examples |
|---|---|---|
| Raw Compute | Correlation / MSD / ACF curve only | EinsteinConductivity, GreenKuboConductivity, DebyeRelaxation, MSD |
| Fit | Integrate or slope-fit the curve | CumulativeTrapezoid, LinearFit, DebyeFit, EinsteinHelfandSpectrum, GreenKuboSpectrum |
| Scale | MD → SI prefactor in your script | \(1/(6 V k_B T)\) (Einstein conductivity), \(1/(3 V k_B T)\) (Green–Kubo conductivity), \(1/(2d)\) (self-diffusion from an MSD slope in \(d\) dimensions, so \(1/6\) in 3D) |
Self-diffusion uses MSD (Einstein) and Acf / signal.acf_fft (Green–Kubo);
see the MSD and VACF guides.
Family index¶
| Family | Exports on molpy.compute |
Guide |
|---|---|---|
| neighbour search | mp.NeighborList, mp.Neighbors (core, not on molpy.compute) |
NeighborList |
| rdf | RDF |
RDF |
| density | LocalDensity, GaussianDensity |
Density |
| diffraction | StaticStructureFactorDebye |
Diffraction |
| pmft | PMFTXY |
PMFT |
| distribution | distance / angle / dihedral / combined DF | Distribution |
| spatial | SpatialDistribution |
Spatial |
| order | Steinhardt family | Order |
| environment | BondOrder |
Environment |
| shape | COM, gyration, inertia, \(R_g\) | Shape |
| cluster | Cluster, ClusterCenters, ClusterProperties |
Cluster |
| decomposition | DescriptorRow, Pca2, KMeans |
Decomposition |
| hbond | HBonds, HBondCriterion |
HBond |
| voronoi | radical Voronoi tessellation | Voronoi |
| msd | MSD |
MSD |
| pmsd | EinsteinConductivity |
PMSD |
| jacf | GreenKuboConductivity |
JACF |
| onsager | Onsager |
Onsager |
| persist | Persist |
Persist |
| van hove | VanHove |
Van Hove |
| reorientation | LegendreReorientation |
Reorientation |
signal |
acf_fft, windows, frequency grid |
Signal |
Two more families:
| Family | Exports on molpy.compute |
Guide |
|---|---|---|
| Dielectric response | Dielectric, DebyeRelaxation, DebyeFit, EinsteinHelfandSpectrum, GreenKuboSpectrum |
Dielectric |
| Vibrational spectra | PowerSpectrum (VDOS), IRSpectrum, RamanSpectrum, ResonanceRamanSpectrum, VcdSpectrum, RoaSpectrum |
Spectra |
Shared types¶
The Compute contract¶
Compute is not a base class to inherit from. It is a structural
typing.Protocol owned by the molrs backend and re-exported here
(molpy.compute.Compute is molrs.compute.Compute): any class that defines a
compute(...) method satisfies it, with no subclassing and no registration.
Writing one is covered in
Adding a Compute Operation.
Compute ¶
Bases: Protocol
Structured analysis kernel: one method, compute.