API reference#
Napoleon autodoc of the Python helpers. Human lookup of
Frame, IceCounts,
CageScore,
DensityProfile,
ContactPairs,
DomainStats, read(),
pydseams.features, and
ASE is the Python surface page.
The public constructors live on the pydseams package:
from_ase(), from_arrays(),
from_xyz(), from_chemfiles(),
from_con(), to_solvis().
to_ase() is the inverse of
from_ase().
The compiled extension is nanobind pydseams.yoda.
_core and cyoda are aliases of yoda. Trajectory is an alias
of Frame.
Classification (chill_plus(),
cages()) does not write files. Prism,
monolayer, and rdf_2d() do.
rdf() does not.
d-SEAMS Python front end.
pydseams is the package. The compiled nanobind module is
pydseams.yoda. Helpers (Frame,
read(), ASE, solvis) sit on that surface.
_core and cyoda are aliases of yoda. Trajectory is an
alias of Frame.
Load a frame and ask for ice:
import pydseams as ds
frame = ds.read("water.lammpstrj")
print(frame.chill_plus())
print(frame.cages())
ASE Atoms work the same way:
frame = ds.from_ase(atoms) # default: oxygen
atoms = frame.to_ase()
- pydseams.from_ase(atoms, select='O', cutoff=None, bonded='auto')#
Build a
Framefrom an ASEAtoms.- Parameters:
atoms (
ase.Atoms) – Configuration with a nonsingular cell periodic in all three directions.select (
str,intorsequence, optional) – Chemical symbol or atomic number of the species to analyse. Default"O".Nonekeeps every atom. A sequence such as("O", "Na", "Cl")keeps the listed species and analyses the first, so ions stay in the cloud forpydseams.features.ion_environment().cutoff (
float, optional) – Neighbour cutoff in Angstroms. DefaultSEAMS_CUTOFFor3.5.bonded (
{"auto", "hbond", "cutoff"}, optional) – Graph for rings."auto"uses hydrogen bonds when theAtomscontain H and the selected analysis cloud excludes H; otherwise it uses the cutoff neighbour list. Explicit"hbond"also requires a heavy-atom selection.
- Returns:
Analysable oxygen (or selected-species) configuration.
- Return type:
Frame- Raises:
ImportError – If ASE is not installed (
pip install 'pydseamslib[ase]').TypeError – If
atomsis not an ASEAtoms.ValueError – If the cell is singular, is not fully periodic, or
selectmatches no atom, or ifbonded="hbond"selects hydrogen.
- pydseams.from_arrays(positions, cell, numbers=None, cutoff=None, bonded='cutoff')#
Build a
Framefrom coordinates and box lengths.- Parameters:
positions (
sequenceof(x,y,z)) – Cartesian coordinates, shape(N, 3).cell (
sequenceoffloat) – Three orthorhombic box lengths or six LAMMPS restricted-triclinic bound spans and tilts.numbers (
sequenceofint, optional) – Per-atom type codes stored asc_type. Default1for every particle.cutoff (
float, optional) – Neighbour cutoff in Angstroms. DefaultSEAMS_CUTOFFor3.5.bonded (
{"auto", "hbond", "cutoff"}, optional) – Graph for rings. Default"cutoff"because this constructor does not attach a hydrogen cloud.
- Return type:
Frame- Raises:
ValueError – If
positionsis empty orcellis not three or six values.
- pydseams.from_chemfiles(path, frame=1, **kwargs)#
Build a
Framethrough chemfiles.- Parameters:
path (
path-like) – Trajectory chemfiles can read (PDB, GRO, DCD, …).frame (
int, optional) – 1-indexed frame. Default1.**kwargs – Forwarded to
Frame.from_chemfiles()(cutoff,bonded,atom_type,type_filter).
- Return type:
Frame- Raises:
RuntimeError – If this build of seams-core did not link chemfiles.
- pydseams.from_con(path, frame=1, **kwargs)#
Build a
Framefrom an eOn.confile.- Parameters:
path (
path-like) – eOn.contrajectory.frame (
int, optional) – 1-indexed frame. Default1.**kwargs – Forwarded to
Frame.from_con()(cutoff,bonded,atom_type).
- Return type:
Frame- Raises:
RuntimeError – If this build of seams-core did not link readcon-core.
- pydseams.from_xyz(path, **kwargs)#
Build a
Framefrom an XYZ file.- Parameters:
path (
path-like) – XYZ structure.**kwargs – Forwarded to
Frame.from_xyz()(cutoff,bonded,atom_type).
- Return type:
Frame- Raises:
RuntimeError – If this build of seams-core has no
readXYZ.
- pydseams.to_solvis(frame, expand_box=True)#
Wrap a
Frameas asolvis.System.- Parameters:
frame (
Frame) – Configuration to view. Converted throughFrame.to_ase().expand_box (
bool, optional) – Passed tosolvis.system.System. DefaultTrue.
- Return type:
solvis.system.System- Raises:
ImportError – If solvis is not installed (
pip install 'pydseamslib[solvis]').
Frame#
User-facing one-frame handle.
Load a LAMMPS dump, an ASE Atoms, or raw arrays, then call
Frame.chill_plus() or Frame.cages(). Classification does
not write files. Rings use the bonded graph (hydrogen bonds when
hydrogens are available, otherwise the cutoff neighbour list).
- class pydseams.frame.IceCounts#
Bases:
dictCHILL / CHILL+ histogram of ice labels on one frame.
Keys are the
AtomStateTypenames written by the classifier (cubic,hexagonal,water,interfacial,clathrate,interClathrate,unclassified,reCubic,reHex). Missing keys read as0via attribute access, socounts.cubicandcounts['cubic']are equivalent.Notes
repromits zero-count labels.
- class pydseams.frame.CageScore(hc, ddc)#
Bases:
objectPer-atom hexagonal-cage (HC) and double-diamond-cage (DDC) flags.
A molecule in an HC is ice Ih; a molecule in a DDC is ice Ic. Membership is a boolean per analysed atom.
- Parameters:
- property n_ih#
Number of atoms flagged HC (ice Ih).
- property n_ic#
Number of atoms flagged DDC (ice Ic).
- property n_water#
Number of atoms in neither cage.
- class pydseams.frame.DensityProfile(centres, rho, axis, atom_type=None, site_kind=None)#
Bases:
objectCartesian number-density profile returned by
Frame.density().
- class pydseams.frame.ContactPairs(pairs, count, n_cation, n_anion)#
Bases:
objectMutual nearest unlike ion pairs returned by
Frame.pairs().
- class pydseams.frame.DomainStats(site_kind, n, largest, percolation)#
Bases:
objectLargest connected site domain returned by
Frame.domain().
- class pydseams.frame.Frame(filename=None, frame=None, atom_type=None, cutoff=None, bonded='auto', region=None, all_atoms=False, *, cloud=None, h_cloud=None, symbols=None, cell_rotation=None)#
Bases:
objectOne configuration: neighbours, rings, CHILL(+), and cage membership.
Load a LAMMPS dump, an ASE
Atoms, or raw arrays, then callchill_plus()orcages(). Classification does not write files. Preferpydseams.io.read(),from_ase(), orfrom_arrays()over constructing this class by filename.- Parameters:
filename (
path-like, optional) – LAMMPS dump. Types 1 and 2 are treated as hydrogen and oxygen unlessatom_typeis set.frame (
int, optional) – 1-indexed frame. Default1.atom_type (
intorNone, optional) – Species to analyse.Nonepicks oxygen (type 2) if that type is present, otherwise type 1 (mW-style single-site dumps).cutoff (
float, optional) – Neighbour cutoff in Angstroms. Default3.5.bonded (
{"auto", "hbond", "cutoff"}, optional) – Graph for rings."auto"uses hydrogen bonds when hydrogens are available, otherwise the cutoff neighbour list.region (
((xlo,ylo,zlo),(xhi,yhi,zhi))orNone, optional) – Rectangular slice passed topydseams.yoda.readLammpsTrjreduced(). An axis withlo == hiis unconstrained. The cloud’snopis the kept count.all_atoms (
bool, optional) – Keep every LAMMPS atom type instead of filtering toatom_type.atom_typestill selects the species used by neighbour and ice analyses. Cannot be combined withregion.
- Raises:
ValueError – If
bondedis not one ofauto,hbond,cutoff, or if a LAMMPS dump has no atoms of type 1 or 2.TypeError – If neither a filename nor a pre-built cloud is supplied.
Notes
Keyword-only
cloud,h_cloud, andsymbolsare the constructor plumbing used byfrom_ase()andfrom_arrays().- classmethod from_file(filename, frame=None, atom_type=None, cutoff=None, bonded='auto', region=None, all_atoms=False)#
Load a LAMMPS dump.
- Parameters:
filename (
path-like) – LAMMPS dump (.lammpstrj,.dump,.lammps).frame (
int, optional) – 1-indexed frame. Default1.atom_type (
intorNone, optional) – Species to keep.Nonetries type 2 (oxygen) then type 1.cutoff (
float, optional) – Neighbour cutoff in Angstroms. Default3.5.bonded (
{"auto", "hbond", "cutoff"}, optional) – Graph for rings.region (
((xlo,ylo,zlo),(xhi,yhi,zhi))orNone, optional) – Optional rectangular slice.all_atoms (
bool, optional) – Keep every LAMMPS atom type.atom_typestill selects the species used by neighbour and ice analyses. Cannot be combined withregion.
- Return type:
- classmethod from_arrays(positions, cell, numbers=None, cutoff=None, bonded='cutoff', box_low=None)#
Build a frame from
(N, 3)positions and a periodic box.- Parameters:
positions (
sequenceof(x,y,z)) – Cartesian coordinates.cell (
sequenceoffloat) – Orthorhombic lengths[lx, ly, lz]or LAMMPS restricted triclinic bound spans and tilts[xspan, yspan, zspan, xy, xz, yz].numbers (
sequenceofint, optional) – Per-atom type codes stored asc_type. Default1.cutoff (
float, optional) – Neighbour cutoff in Angstroms. Default3.5.bonded (
{"auto", "hbond", "cutoff"}, optional) – Graph for rings. Default"cutoff".box_low (
sequenceoffloat, optional) – Box origin. Default(0, 0, 0).
- Return type:
- Raises:
ValueError – If
positionsis empty orcellis not three or six values.
- classmethod from_xyz(filename, cutoff=None, bonded='cutoff', atom_type=None)#
Load an XYZ file through
pydseams.yoda.readXYZ().- Parameters:
- Return type:
- Raises:
RuntimeError – If this build has no
readXYZ.
- classmethod from_chemfiles(filename, frame=None, type_filter=-1, cutoff=None, bonded='cutoff', atom_type=None)#
Load PDB/GRO/DCD (or any chemfiles format) when chemfiles is linked.
- Parameters:
filename (
path-like) – Trajectory chemfiles can read.frame (
int, optional) – 1-indexed frame. Default1.type_filter (
int, optional) – Chemfiles type filter.-1keeps every type.cutoff (
float, optional) – Neighbour cutoff in Angstroms. Default3.5.bonded (
{"auto", "hbond", "cutoff"}, optional) – Graph for rings. Default"cutoff".atom_type (
intorNone, optional) – Species to analyse.Noneuses the first particle’sc_type.
- Return type:
- Raises:
RuntimeError – If chemfiles is not linked in this build of seams-core.
- classmethod from_con(filename, frame=None, cutoff=None, bonded='cutoff', atom_type=None)#
Load an eOn
.confile when readcon-core is linked.- Parameters:
filename (
path-like) – eOn.contrajectory.frame (
int, optional) – 1-indexed frame. Default1.cutoff (
float, optional) – Neighbour cutoff in Angstroms. Default3.5.bonded (
{"auto", "hbond", "cutoff"}, optional) – Graph for rings. Default"cutoff".atom_type (
intorNone, optional) – Species to analyse.Noneuses the first particle’sc_type.
- Return type:
- Raises:
RuntimeError – If readcon-core is not linked in this build of seams-core.
- classmethod from_ase(atoms, select='O', cutoff=None, bonded='auto')#
Load an ASE
Atoms.selectis a symbol, atomic number, sequence, or None.- Parameters:
atoms (
ase.Atoms) – Configuration with a nonsingular cell periodic in all three directions.select (
str,intorsequence, optional) – Chemical symbol or atomic number of the species to analyse. Default"O".Nonekeeps every atom. A sequence such as("O", "Na", "Cl")keeps the listed species and analyses the first, so ions ride along forpydseams.features.ion_environment().cutoff (
float, optional) – Neighbour cutoff in Angstroms. Default3.5.bonded (
{"auto", "hbond", "cutoff"}, optional) – Graph for rings."auto"uses hydrogen bonds when theAtomscontain H and the selected analysis cloud excludes H; otherwise it uses the cutoff neighbour list. Explicit"hbond"also requires a heavy-atom selection.
- Return type:
- to_ase()#
ASE
Atomsfor this frame.- Returns:
Orthorhombic cell,
pbc=True. Afterchill_plus()(orchill()),arrays['ice_type']holds the labels. Aftercages(),arrays['hc']andarrays['ddc']hold the cage flags.- Return type:
ase.Atoms
- to_solvis(expand_box=True)#
solvis.Systemfor this frame.- Parameters:
expand_box (
bool, optional) – Passed tosolvis.system.System. DefaultTrue.- Return type:
solvis.system.System
Notes
Optional extra:
pip install 'pydseamslib[solvis]'.
- property n_atoms#
Number of particles in the analysed cloud (
cloud.nop).
- property box#
Engine box as lengths or LAMMPS restricted-triclinic values.
Orthorhombic boxes have three lengths. Triclinic boxes have dump bound spans followed by
xy,xz, andyztilts.
- property positions#
List of
(x, y, z)coordinates for the analysed particles.
- property neighbor_list#
Cutoff neighbour list from
pydseams.yoda.neighListO().Built once per loaded frame and cached. Rows are atom IDs of neighbours within
cutoffforatom_type.
- property hbonds#
Hydrogen-bond neighbour list.
Uses
pydseams.yoda.populateHbondsWithInputClouds()when an ASE hydrogen cloud is attached, otherwisepydseams.yoda.populateHbonds()on the LAMMPS dump.- Raises:
ValueError – If no hydrogens are available (arrays-only frame, or
bonded='hbond'without H).
- load_frame(frame)#
Reload a later (or earlier) frame from the same trajectory file.
- Parameters:
frame (
int) – 1-indexed frame to read.- Raises:
ValueError – If this
Framewas built from arrays or ASE and has no trajectory path.
Notes
Clears cached neighbours, hydrogen bonds, rings, and cages.
- property bonds_by_index#
Index-based bonded graph used for rings.
Hydrogen-bond list when
bondedis"hbond", otherwise the cutoff neighbour list. Converted withpydseams.yoda.neighbourListByIndex().
- property rings#
Primitive rings up to size 6 on
bonds_by_index.Computed by
pydseams.yoda.RingUpdaterand cached.
- property rings_recomputed_sources#
Sources recomputed by the last
RingUpdaterpass.
- chill_plus()#
CHILL+ labels for every analysed atom. Does not write a file.
Calls
pydseams.yoda.getCorrelPlus()thenpydseams.yoda.getIceTypePlusNoPrint()onneighbor_list. Mutatescloud.pts[].iceType.- Returns:
Histogram of CHILL+ labels on this frame.
- Return type:
- chill()#
CHILL labels for every analysed atom. Does not write a file.
Calls
pydseams.yoda.getCorrel()thenpydseams.yoda.getIceTypeNoPrint()onneighbor_list. Mutatescloud.pts[].iceType.- Returns:
Histogram of CHILL labels on this frame.
- Return type:
- classify_chill_plus()#
Alias of
chill_plus().
- cages(seeded=True, k=4, candidate_cutoff=None, ring_adjacent=False)#
Ice score: HC = Ih, DDC = Ic, neither = water.
- Parameters:
seeded (
bool, optional) –True(default) is the hysteresis construction: mutual four-nearest seeds, union-graph completion (seeded_affiliation()).Falseis cutoff-graph affiliation on this frame’s six-rings (cage_affiliation()).k (
int, optional) – Neighbours kept in the seeded k-nearest graphs. Default4.ring_adjacent (
bool, optional) – Ring completion of the seeded assignment (fill the last vertex of a six-ring whose other vertices carry a label). DefaultFalse.candidate_cutoff (
floatorNone, optional) – Candidate-list cutoff for the k-nearest graphs.Noneusescutoff+ 1.5.
- Returns:
Per-atom HC/DDC flags. Cached as
_cagesforto_ase().- Return type:
- cages_by_signature(signature, max_ring_size=None)#
Closed polyhedra matching a ring-size census.
- Parameters:
- Returns:
Each dict has
signature,faces,vertices, andcertificate.- Return type:
- cage_affiliation()#
Order-free per-ring HC/DDC flags on this frame’s six-rings.
Uses
pydseams.yoda.AffiliationUpdateron the cutoff-or-hbond six-rings.- Returns:
six_rings(list of 6-cycles),hcandddc(per-ring bools), andreclassified(updater delta).- Return type:
- seeded_affiliation(k=4, candidate_cutoff=None, ring_adjacent=False)#
Seeded (hysteresis) per-atom cage flags.
Strict-graph seeds from a mutual k-nearest list, permissive completion on the union k-nearest list. Delegates to
pydseams.yoda.seededCageAffiliation().- Parameters:
k (
int, optional) – Neighbours kept in each k-nearest graph. Default4.candidate_cutoff (
floatorNone, optional) – Candidate-list cutoff.Noneusescutoff+ 1.5.ring_adjacent (
bool, optional) – Fill the last vertex of any union-graph six-ring whose other vertices carry a label, repeated to a fixed point. A frame with no accepted ring stays empty. DefaultFalse.
- Return type:
- fingerprint(hops=2, max_ring_size=7, colour_types=False)#
Label-independent topology keys of the bonded graph.
- Parameters:
hops (
int, optional) – Bonds from the centre in each local key. Default2.max_ring_size (
int, optional) – Largest primitive ring counted in the census. Default7.colour_types (
bool, optional) – Colour vertices byc_type(atom type or atomic number), so species never match across types. DefaultFalse.
- Returns:
keynames the frame (same for any relabelling of the same bonded graph),atomKeysone class per atom,classesthe histogram,ringCensus[s]the primitive rings of sizes.methodis"nauty"when the engine links nauty, else"wl".- Return type:
pydseams.yoda.FrameFingerprint
- ion_environment(ion_types, k=4, ring_adjacent=True, cutoff=None)#
Class every ion by its first water shell against the seeded cages.
- Parameters:
ion_types (
iterableofint) –c_typecodes of the ions (LAMMPS types, or atomic numbers for frames built through ASE).k (
int, optional) – Neighbours kept in the seeded k-nearest graphs. Default4.ring_adjacent (
bool, optional) – Passed toseeded_affiliation(). DefaultTrue.cutoff (
float, optional) – First-shell radius in Angstrom. Defaultself.cutoff.
- Returns:
ion(cloud indices),shell,iceFraction,state(pydseams.yoda.IonState) and the countsnIce,nFront,nLiquid.- Return type:
pydseams.yoda.IonEnvironment
- hydration_shell_rings(ion_types, k=4, ring_adjacent=True, cutoff=None)#
Rings of the water network through each ion’s first shell.
- Parameters:
ion_types (
iterableofint) –c_typecodes of the ions, as inion_environment().k – As in
ion_environment().ring_adjacent – As in
ion_environment().cutoff – As in
ion_environment().
- Returns:
(env, census): thepydseams.yoda.IonEnvironmentand a list with one row per ion,census[i][s]counting the primitive rings of sizes(up to six, the ringsringskeeps) with a vertex in ioni’s shell. An ion is not a vertex of the network, so the rings it would have closed are gone; the shell census measures how far the network survives around it.- Return type:
- topology_library(label, hops=2, max_ring_size=7, colour_types=False, library=None)#
Add this frame’s local keys to a key library under
label.Returns the
pydseams.yoda.KeyLibrary(a new one unlesslibraryis given).yoda.writeLibraryturns it into text.
- classify_topology(library, hops=2, max_ring_size=7, colour_types=False)#
Name every analysed atom by one key library, or by several at different hop counts.
- Parameters:
library (
pydseams.yoda.KeyLibrary,str, ora sequenceofthem) – A library or its text form fromyoda.writeLibrary. A sequence of libraries built at differenthopsnames each atom by the deepest library that holds its key, so a molecule whose wide neighbourhood is disturbed still gets a name from its inner shells;hopsis then ignored.hops – As in
fingerprint();colour_typesmust match the colouring the libraries were built with.max_ring_size – As in
fingerprint();colour_typesmust match the colouring the libraries were built with.colour_types – As in
fingerprint();colour_typesmust match the colouring the libraries were built with.
- Returns:
labelsper atom (""when no reference matches),countsper label,depthper atom (the hops of the library that named it,0when none) andmatched.- Return type:
pydseams.yoda.LibraryMatch
- guest_occupancy(cages, guest_types, radius=4.0)#
Place guests (methane, THF, ions) in enumerated cages.
- Parameters:
cages (
sequenceofsequencesofint) – Vertex indices intoself.cloud.ptsfor each cage.guest_types (
iterableofint) –c_typecodes of the guests (LAMMPS types, or atomic numbers for frames built through ASE).radius (
float, optional) – A guest belongs to the nearest cage centroid within this distance in Angstrom. Default4.0, about the radius of a 5^12 cage.
- Returns:
guestsPerCage,cageOfGuest(-1when free),centreDistanceand the countsoccupied,multiplyandfree.- Return type:
pydseams.yoda.GuestOccupancy
- find_prisms(output_dir='output/', max_depth=6, shape_matching=False)#
Identify prism blocks and write engine output under
output_dir.- Parameters:
Notes
This path writes files.
chill_plus()andcages()do not.
- monolayer_rings(output_dir, sheet_area, max_depth=4)#
Classify quasi-2D polygon rings and read coverage back.
- Parameters:
- Returns:
{ring_size: {"count": int, "coverage_xy": float}}parsed fromtopoMonolayer/coverageAreaXY.dat.- Return type:
- rdf(type_i, type_j, cutoff=12.0, binwidth=0.05)#
Partial 3D radial distribution function.
- Parameters:
- Returns:
r, g – Bin centres and
g_IJ(r)frompydseams.yoda.partialRdf().- Return type:
- cn(type_i, type_j, cutoff, binwidth=0.05)#
Site-site coordination number integrated to
cutoff.Uses
pydseams.yoda.partialRdfHist()andpydseams.yoda.coordinationNumber()withrho_J = nJ / dumpVolume.
- running_cn(type_i, type_j, cutoff=12.0, binwidth=0.05)#
Running site-site coordination number.
- Parameters:
- Returns:
Running CN at each bin outer edge from
pydseams.yoda.partialRdfHist()andpydseams.yoda.runningCN()withrho_J = nJ / dumpVolume.- Return type:
- density(bins=None, axis='z', atom_type=0, *, table=None, kind=None)#
Cartesian number density by particle type or mapped site kind.
- Parameters:
bins (
intorNone, optional) – Number of equal-width slabs.Noneuses about 0.1 Angstrom spacing along the selected restricted-cell axis.axis (
{"x", "y", "z", 0, 1, 2}, optional) – Profile axis. Default"z".atom_type (
int, optional) – Particle type to count;0counts every particle. Ignored whentableandkindare supplied.table (optional) – A
pydseams.yoda.SiteTableand matchingpydseams.yoda.SiteKindfor a chemistry-resolved profile.kind (optional) – A
pydseams.yoda.SiteTableand matchingpydseams.yoda.SiteKindfor a chemistry-resolved profile.
- Return type:
- ion_cloud(table)#
One COM vertex per ion molecule.
- Parameters:
table (
pydseams.yoda.SiteTable) – Type-to-kind map. Cation molecules restamp to type 1, anions to type 2.
- pairs(table)#
Mutual nearest cation-anion pairs in an ion COM cloud.
Pair indices refer to the ion cloud returned by
ion_cloud().
- domain(table, kind, cutoff=None)#
Largest cutoff-connected component of a mapped site subset.
- hbonds_from_donors(donor_hs, h_cloud=None, dist=2.42, angle=30.0)#
Hydrogen-bond network from an explicit donor-H index list.
- Parameters:
donor_hs (
sequenceofint) –hCloudindices. Each H is paired with the heavy atom that shares itsmolID.h_cloud (
PointCloudDouble, optional) – Hydrogen cloud. Defaults to the ASE hydrogen cloud.dist (
float, optional) – Acceptor-H distance and acceptor-centered O-O-H angle.angle (
float, optional) – Acceptor-H distance and acceptor-centered O-O-H angle.
- rdf_2d(output_dir, cutoff=12.0, binwidth=0.05)#
2D radial distribution function for identical atom types.
- Parameters:
- Returns:
r, g – Bin centres and
g(r)parsed fromtopoMonolayer/rdf.dat.- Return type:
- steinhardt(order_l=6)#
Local and neighbour-averaged Steinhardt parameters.
- steinhardt_voronoi(order_l=6, cutoff=None)#
Voronoi facet-area weighted Steinhardt parameters.
- classify_templates(k_neigh=12)#
IRA/Horn overlay onto FCC, HCP, BCC, and SC neighbour shells.
- soap(iatom=None, n_max=3, l_max=6, rcut=None)#
SOAP power spectrum of one particle, or of every particle.
- Parameters:
iatom (
intorNone, optional) – Particle index.None(default) computes every particle viapydseams.yoda.soapSpectrumAll().n_max (
int, optional) – Radial basis size. Default3.l_max (
int, optional) – Angular momentum cutoff. Default6.rcut (
floatorNone, optional) – SOAP cutoff.Noneusescutoff.
- Returns:
One spectrum, or one spectrum per particle.
- Return type:
- voronoi_features(cutoff=None)#
Per-atom
[q4, q6, q8]from one Voronoi-weighted pass.
- fit_classifier(X, y, labels=None)#
Fit a
pydseams.yoda.LinearClassifieron feature rows.
- predict_class(x)#
Predict a class for one feature row.
- Parameters:
x (
sequenceoffloat) – Feature vector matching the lastfit_classifier()fit.- Returns:
Predicted class index.
- Return type:
- Raises:
RuntimeError – If
fit_classifier()has not been called.
Features#
Per-frame kinetic-model vectors and ion first-shell classes.
pydseams.features is the walkthrough on the
features how-to. Human lookup is the
Python surface page.
I/O#
Suffix dispatch onto the compiled I/O readers.
The compiled module stays thin. This helper picks LAMMPS, XYZ,
chemfiles, or readcon from the path suffix and returns a
Frame.
- pydseams.io.read(path, frame=1, **kwargs)#
Load one configuration. Format follows the file suffix.
- Parameters:
path (
path-like) – Trajectory or structure file.frame (
int, optional) – 1-indexed frame for multi-frame formats (LAMMPS, chemfiles,.con). Ignored for XYZ. Default1.**kwargs – Forwarded to the matching
Frameconstructor (cutoff,bonded,atom_type,region,all_atoms, …).all_atoms=Trueretains every LAMMPS type for mixed-site analyses such as ionic pairs and domains.
- Returns:
Analysable configuration.
- Return type:
Frame
Notes
Suffix dispatch:
.xyz–Frame.from_xyz().con–Frame.from_con().pdb,.gro,.dcd–Frame.from_chemfiles()otherwise –
Frame.from_file()(LAMMPS dump)
.lammpstrj,.dump, and.lammpstake the LAMMPS path. Builds without chemfiles or readcon raiseRuntimeErrorwhen those suffixes are used.
- pydseams.io.available_readers()#
Report which compiled I/O readers this build linked.
- Returns:
lammpsis alwaysTrue.xyz,chemfiles, andreadconareTruewhen the matchingpydseams.yodasymbol exists (readXYZ,readChemfiles,readCon).- Return type:
ASE helpers#
Implementation of from_ase() and
to_ase(). Optional extra:
pip install 'pydseamslib[ase]'.
ASE Atoms in and out of a Frame.
Optional extra: pip install 'pydseamslib[ase]'. The compiled engine
does not import ASE; this module is the adapter.
- pydseams.aseio.frame_from_ase(cls, atoms, select='O', cutoff=3.5, bonded='auto')#
Construct
cls(aFrame) from ASEAtoms.- Parameters:
atoms (
ase.Atoms) – Configuration with a nonsingular cell periodic in all three directions.select (
str,intorsequence, optional) – Chemical symbol or atomic number kept for analysis. Default"O".Nonekeeps every atom. A sequence such as("O", "Na", "Cl")keeps every listed species in the cloud and analyses the first; the others stay as their atomic numbers inc_type, which is whatpydseams.features.ion_environment()reads.cutoff (
float, optional) – Neighbour cutoff in Angstroms. Default3.5.bonded (
{"auto", "hbond", "cutoff"}, optional) – Graph for rings."auto"becomes"hbond"when theAtomscontain hydrogen and the selected analysis cloud excludes hydrogen; otherwise it becomes"cutoff". Explicit"hbond"also requires a heavy-atom selection.
- Returns:
Selected-species cloud plus an optional hydrogen cloud for hydrogen-bond analysis.
- Return type:
Frame- Raises:
ImportError – If ASE is not installed.
TypeError – If
atomshas noget_positions.ValueError – If the cell is singular, is not fully periodic, or
selectmatches no atom, or ifbonded="hbond"selects hydrogen.
Notes
For a heavy-atom selection, hydrogens stay in a side cloud so the analysed species remain the CHILL / ring particles. General cells are rotated into LAMMPS restricted form for analysis and restored by
frame_to_ase(). An ASEmol-idarray supplies molecule ownership. Without it, each hydrogen belongs to the nearest selected atom under the minimum-image convention.
- pydseams.aseio.frame_to_ase(frame)#
Build an ASE
Atomsfrom aFrame.- Parameters:
frame (
Frame) – Configuration to export.- Returns:
Periodic cell in its imported orientation. Symbols come from the ASE import when present; LAMMPS-only frames fall back to
O.- Return type:
ase.Atoms
Notes
After
chill_plus()(orchill()),atoms.arrays['ice_type']holds the per-atom labels. Aftercages(),atoms.arrays['hc']andatoms.arrays['ddc']hold the cage flags.atoms.info['dseams_n_atoms']is the analysed particle count.
solvis#
Implementation of to_solvis() and
to_solvis(). Optional extra:
pip install 'pydseamslib[solvis]'.
Optional solvis (PyVista) view of a Frame.
solvis takes an ASE Atoms. This helper is the same pattern as
metatomic’s ASE adapter: the C++ core does not know about the viewer.
Install with pip install 'pydseamslib[solvis]'.
- pydseams.solvis.to_solvis(frame, expand_box=True)#
Wrap a
Frameas asolvis.System.- Parameters:
- Return type:
solvis.system.System- Raises:
ImportError – If solvis is not installed (
pip install 'pydseamslib[solvis]').
Compiled module (pydseams.yoda)#
yoda is mocked in the Sphinx build (autodoc_mock_imports), so
automodule cannot list live signatures. The tables below are every
public name registered in src/bindings.cpp: 134 names (113
functions, 19 types, and the Kind / Family type aliases). Four
functions are compile-gated and absent
from builds that did not link the extra:
readChemfiles (SEAMS_HAS_CHEMFILES), readCon
(SEAMS_HAS_READCON), ira_match and sofi_point_group
(SEAMS_HAS_IRA).
Application code uses Frame /
read() / from_ase(). Call yoda
directly for the raw engine.
I/O#
name |
role |
|---|---|
|
Read atom coordinates from an XYZ file. |
|
One LAMMPS frame, one type. With |
|
One LAMMPS frame, one type (the |
|
One LAMMPS frame, every atom type. |
|
Read bond connectivity from a formatted bond file. |
|
True when each component is in the closed interval, or that axis has |
|
Read any trajectory format supported by chemfiles (PDB, GRO, DCD, …). Linked when |
|
Read a |
|
Write a LAMMPS dump file for the current point cloud. |
Neighbours and hydrogen bonds#
name |
role |
|---|---|
|
Free memory for a neighbour list. |
|
Build a neighbour list by index using a distance cutoff. |
|
Exact k-nearest bonded graph, union- or mutually-symmetrized. |
|
Certificate pair (max k-th distance, min (k+1)-th distance) for the exact reduction of the k-nearest graph to a cutoff graph. |
|
Build a half neighbour list (each pair stored once) for one atom type. |
|
Convert an atom-ID neighbour list to an index-based neighbour list. |
|
Build a full neighbour list for two atom types within a cutoff. |
|
Build a full neighbour list for a single atom type within a cutoff. |
|
I-J neighbour list (like-type reuses |
|
Type-to-kind map. Type 1 is not a chemistry. |
|
Aliases of |
|
Cloud indices whose mapped site kind matches, including polar/apolar unions. |
|
Unique LAMMPS type mapped to a site kind. |
|
One COM vertex per ion |
|
Mutual nearest pairs between two particle types under periodic boundaries. |
|
Partial 3D RDF as |
|
Running site-site CN ( |
|
Site-site CN to |
|
H-bond net from a flat list of |
|
One donor-acceptor O-O-H test. |
|
Create bond connectivity from rings and cage information. |
|
Compute the O-H hydrogen bond distance between two atoms. |
|
Build the hydrogen-bond network from a trajectory and neighbour list. |
|
Build hydrogen bonds from pre-loaded oxygen and hydrogen point clouds. |
|
Remove duplicate bonds from a bond list. |
neighListPair, SiteTable, parseSiteSpec, ionCloud,
partialRdfHist, coordinationNumber, runningCN,
firstMinimumBin, populateHbondsFromDonors, and
donatedHydrogenBond are bound. Frame.rdf returns (r, g).
Frame.cn, Frame.running_cn, Frame.ion_cloud, and
Frame.hbonds_from_donors call the new symbols.
Rings and cages#
name |
role |
|---|---|
|
Free memory for a graph object. |
|
Find all possible rings (including non-shortest-path) up to |
|
Find all primitive (shortest-path) rings up to |
|
Order-free per-ring cage classification: |
|
Closed polyhedra matching a ring-size census or named table entry. |
|
Seeded (hysteresis) per-atom cage flags: strict-graph seeds, permissive-graph completion. |
|
Exact incremental primitive rings for a neighbour list. |
|
Exact incremental per-ring cage classification for one frame. |
|
Create a graph object from an index-based neighbour list. |
|
Create a graph object from an atom-ID neighbour list and point cloud. |
|
Remove non-shortest-path rings using the Franzblau criterion. |
|
Restore graph edges from an index-based neighbour list. |
Ring classification#
name |
role |
|---|---|
|
Assign atom types based on the ring size of n-membered rings. |
|
Assign atom types for atoms belonging to prism rings. |
|
Free memory for a list of rings. |
|
Check whether two unordered rings contain the same elements. |
|
Check whether three rings share at least one common element. |
|
Get atom type values for deformed prisms. |
|
Discard duplicate 4-membered ring pairs that are parallel in one dimension. |
|
Identify which rings form prism blocks. |
|
Return the common elements shared by two rings. |
|
Search for a triplet of atoms within a ring. |
|
Extract rings of a specific size from a list of all rings. |
|
Check whether two rings share any common elements. |
|
Test whether two rings satisfy strict basal prism conditions. |
|
Test whether two rings satisfy relaxed prism conditions (at least one bond). |
|
Select edge molecules in rings that straddle the slice boundary. |
|
Select edge molecules in rings and write slice output files. |
Topology writers#
name |
role |
|---|---|
|
Classify rings in a quasi-2D monolayer and write output. |
|
Classify rings in a bulk system and write output. |
|
Prism identification on rings up to |
|
Remove axial translations from an ice nanotube for visualization. |
Topological unit matching#
name |
role |
|---|---|
|
Get atom indices belonging to cages in a given cluster. |
|
Average the per-atom RMSD over the number of shared cages. |
|
Build a reference double-diamond cage from a template XYZ file. |
|
Build a reference hexagonal cage from a template XYZ file. |
|
Cluster cages using Stillinger’s algorithm and write XYZ output. |
|
Shape-match a target double-diamond cage against a reference. |
|
Shape-match a target hexagonal cage against a reference. |
|
Find HCs and DDCs in a bulk system using topological criteria. |
|
Run full topological unit matching for bulk water. |
|
Update per-atom RMSD from a cage shape-matching result. |
Selection#
name |
role |
|---|---|
|
Extract a point cloud containing only atoms of a given type. |
|
Mark atoms inside a rectangular volume slice. |
|
Mark whole molecules as in-slice if any atom is inside the region. |
|
Set the |
CHILL / CHILL+#
name |
role |
|---|---|
|
Bond-classification rule set (staggered / eclipsed windows). |
|
The CHILL water rule set. |
|
The CHILL+ water rule set. |
|
Look up a registered bond-classification rule set by name. |
|
Register (or replace) a named bond-classification rule set. |
|
Names of every registered bond-classification rule set. |
|
Compute and classify bond correlations under an arbitrary rule set. |
|
Compute CHILL+ bond-order correlations and classify bond types. |
|
Classify each atom’s ice type using CHILL+. Does not write a file. |
|
Classify each atom’s ice type using CHILL+ and write to file. |
|
Compute CHILL bond-order correlations and classify bond types. |
|
Classify each atom’s ice type using CHILL. Does not write a file. |
|
Classify each atom’s ice type using CHILL and write to file. |
|
Compute the q6 bond order parameter for all atoms. |
|
Reclassify water molecules using averaged q6 and q3 parameters. |
|
Print the ice type classification for the current frame. |
Descriptors#
name |
role |
|---|---|
|
Local and neighbour-averaged Steinhardt parameters of degree |
|
Voronoi facet-area weighted Steinhardt parameters. |
|
IRA/Horn overlay onto FCC, HCP, BCC, and SC neighbour shells. |
|
SOAP power spectrum of one particle. |
|
SOAP power spectrum of every particle. |
|
Per-atom |
|
|
|
Voronoi facet neighbours and area weights for every particle. |
|
Linear classifier used by |
|
True when this build linked libira (IRA/SOFI). |
|
IRA overlay of two |
|
SOFI point group of an |
|
Lookup table for Q4 ( |
|
Lookup table for Q4 at a single |
|
Lookup table for Q8 ( |
|
Lookup table for Q8 at a single |
Clustering and RDF#
name |
role |
|---|---|
|
Cluster ice-like particles and return the largest ice cluster. |
|
Recenter a cluster point cloud for visualization. |
|
2D radial distribution function for identical atom types. |
|
Partial 3D RDF |
|
Running CN |
|
Cartesian number-density histogram by particle type or mapped site kind and axis. |
|
Size and fraction of the largest connected component in a selected subset. |
Types#
name |
role |
|---|---|
|
Histogram from |
|
Collection of points for a single frame, with box dimensions. |
|
Per-particle data: coordinates, type, molecule ID, ice classification. |
|
Per-particle Steinhardt |
|
Per-atom ice phase classification from CHILL / CHILL+ / q6. |
|
Bond classification: staggered, eclipsed, or |
|
Bond correlation result: |
|
Crystal template kind: |
|
IRA/Horn overlay hit: |
|
Facet-sharing neighbours and facet-area weights of one particle. |
|
Number-density result: bin centres |
|
Connected-domain result: subset size, largest component, and percolation fraction. |