Python API#

pack([n, radii, container, density, ...])

Packs spheres (disks in 2D) with the Lubachevsky-Stillinger algorithm.

Packing(positions, radii, container, status, ...)

A sphere (disk) packing.

Box(lengths[, periodic, ball])

Rectangular box spanning [0, L_k) along each axis.

PeriodicBox(lengths[, dim])

Fully periodic box.

PackingWarning

A packing run stopped before reaching its target.

PackingError(message, packing)

Raised with strict=True when a run stops before its target.

load(path)

Loads a packing written by save().

neighbor_pairs(packing, cutoff)

All pairs closer than cutoff (centre to centre).

contacts(packing[, tol])

Pairs in contact: centre distance at most (r_i + r_j) * (1 + tol).

contact_numbers(packing[, tol])

Number of contacts of every sphere (see contacts() for tol).

rattlers(packing[, tol, method, force_threshold])

Boolean mask of rattlers: spheres that carry no force in a jammed packing.

radial_distribution(packing[, r_max, bins])

Pair distribution function of the sphere centres.

radial_profile(packing[, bins, n_theta])

Local solid fraction as a function of the distance from the axis of a cylinder, or from the centre of a spherical container or disk.

bond_order(packing[, l, cutoff])

Bond-orientational order parameter of order l.

crystalline(packing[, cutoff, threshold, ...])

Boolean mask of spheres in a crystalline environment.

isostaticity(packing[, tol, method])

Ratio of the number of contacts among non-rattlers to the isostatic number.

density_profile(packing[, axis, bins])

Local volume (area) fraction as a function of position along axis.

write_xyz(packing, path, *[, species, ...])

Writes an extended XYZ file (Lattice, pbc and a radius column).

write_lammps_dump(packing, path, *[, types, ...])

Writes a LAMMPS text dump (id type x y z radius), one frame.

write_lammps_data(packing, path, *[, ...])

Writes a LAMMPS data file for atom_style sphere (id type diameter density x y z).

write_vtp(packing, path, *[, ...])

Writes the sphere centres as VTK XML PolyData with radius and diameter.

write_container_vtp(packing_or_container, path)

Writes the outline of the container (box edges, or circles and generators of a cylinder, or great circles of a sphere) as VTK lines, to show with the spheres.

write_stl(packing, path, *[, subdivisions, ...])

Writes the sphere surfaces as a binary STL mesh (icospheres, 20 * 4**subdivisions triangles per sphere; 320 for the default).

write_pov(packing, path, *[, ...])

Writes a POV-Ray scene with camera, light and one sphere per particle.

save(packing, path)

Saves a packing, its container and run statistics to a NumPy .npz file.

load(path)

Loads a packing written by save().

System([positions, n, density, box, kT, ...])

Particles interacting with a pair potential in a periodic box, sampled with the rejection-free method.

radial_distribution(system, n_samples, interval)

Pair distribution function averaged over n_samples configurations taken every interval of simulation time (the system advances by n_samples * interval).

PairPotential(kind[, epsilon, sigma, ...])

Isotropic pair potential with at most one minimum and zero at the cutoff.

LennardJones([epsilon, sigma, cutoff])

Truncated and shifted Lennard-Jones potential, \(4\epsilon[(\sigma/r)^{12} - (\sigma/r)^6] - U_\mathrm{LJ}(r_c)\) for \(r < r_c\).

WCA([epsilon, sigma])

Weeks-Chandler-Andersen potential: Lennard-Jones truncated and shifted at its minimum.

DPD([a, cutoff])

Conservative DPD potential \(\frac{a}{2}(1 - r/r_c)^2\) for \(r < r_c\).

SoftSpheres([epsilon, sigma, alpha])

Soft repulsion \(\frac{\epsilon}{\alpha}(1 - r/\sigma)^\alpha\) for \(r < \sigma\) (harmonic for \(\alpha = 2\), Hertzian for \(\alpha = 5/2\)).

HardSpheres([diameter])

Hard spheres: every approach to contact reflects (event-driven hard-sphere dynamics).

Jammed([pressure, relax_windows, step, ...])

Compress quasi-statically until the packing is jammed.

Pressure([value])

Stop when the reduced pressure Z = PV/(N kT) exceeds value.

Stall([tol, window])

Stop when the radii grew by less than tol (relative) during the last window collisions per sphere.

Collisions([total, per_particle])

Stop after total collisions, or per_particle collisions per sphere.

Timeout(seconds)

Stop after seconds of wall-clock time (not reproducible between machines).