spheropack.Packing#

class spheropack.Packing(positions, radii, container, status, density, reduced_pressure, n_collisions, n_events, sim_time, wall_time, min_gap, shrink_factor, seed, growth_rate, median_pressure=0.0, sphere_pressure=None, history=None, max_contact_error=0.0, collision_rule='elastic_growing', stop=(), stopped_by=None, success=True, _velocities=None)#

A sphere (disk) packing.

Parameters:
positions#

Centres, shape (n, dim), inside the container.

Type:

numpy.ndarray

radii#

Radii, shape (n,).

Type:

numpy.ndarray

container#

The container the spheres are packed in.

Type:

spheropack.containers.Box

status#

Why the run stopped: "target" (density or radii reached), or the name of the stopping criterion that fired: "pressure", "stall", "collisions", "timeout"; "box_limit" when the largest sphere grew as large as the container allows (a periodic edge, the distance between two flat walls, or the diameter of a curved wall); "no_events" if nothing moves.

Type:

str

success#

True if the target was reached, or with density="max" if an arrest criterion fired.

Type:

bool

stopped_by#

The criterion object that ended the run, or None.

Type:

object

density#

Volume (area) fraction of the spheres.

Type:

float

reduced_pressure#

Last measured reduced pressure PV/(NkT) (mean over spheres); 0 if the run was too short to complete a measurement window.

Type:

float

median_pressure#

Median over spheres of the per-sphere reduced pressure in the last window.

Type:

float

sphere_pressure#

Per-sphere reduced pressure in the last window, shape (n,); its mean is reduced_pressure. Spheres that carry no force (rattlers) have values near 1.

Type:

numpy.ndarray | None

history#

One entry per pressure window: arrays time, density, scale (the factor multiplying the radii passed to the engine), reduced_pressure, median_pressure, kT, n_collisions and phase (0 growing, 1 relaxing, 2 growth step of the jamming protocol).

Type:

dict | None

max_contact_error#

Largest relative deviation |distance / contact distance - 1| at any collision; a measure of the accumulated round-off (around 1e-13).

Type:

float

min_gap#

Smallest distance / contact distance - 1 over all pairs and walls before overlaps were removed. Values around -1e-15 are round-off.

Type:

float

shrink_factor#

Uniform factor applied to the radii to remove round-off overlaps (1 if none).

Type:

float

__init__(positions, radii, container, status, density, reduced_pressure, n_collisions, n_events, sim_time, wall_time, min_gap, shrink_factor, seed, growth_rate, median_pressure=0.0, sphere_pressure=None, history=None, max_contact_error=0.0, collision_rule='elastic_growing', stop=(), stopped_by=None, success=True, _velocities=None)#
Parameters:
Return type:

None

Methods

__init__(positions, radii, container, ...[, ...])

periodic_images([axes])

Copy with extra periodic images of every sphere that cuts a periodic face.

save(path)

Saves the packing to .npz; read it back with spheropack.load().

to_csv(path, *[, legacy_order, header])

Writes one sphere per line as x,y,z,r (x,y,r in 2D).

to_lammps_data(path, **kwargs)

LAMMPS data file (atom_style sphere); see spheropack.io.write_lammps_data().

to_lammps_dump(path, **kwargs)

LAMMPS dump for OVITO and LAMMPS; see spheropack.io.write_lammps_dump().

to_pov(path, **kwargs)

POV-Ray scene; see spheropack.io.write_pov().

to_stl(path, **kwargs)

Binary STL surface mesh of the spheres; see spheropack.io.write_stl().

to_vtp(path, **kwargs)

VTK XML PolyData for ParaView; see spheropack.io.write_vtp().

to_xyz(path, **kwargs)

Extended XYZ for OVITO and ASE; see spheropack.io.write_xyz().

Attributes

collision_rule

diameters

dim

history

max_contact_error

median_pressure

n

sphere_pressure

stop

stopped_by

success

positions

radii

container

status

density

reduced_pressure

n_collisions

n_events

sim_time

wall_time

min_gap

shrink_factor

seed

growth_rate