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 (ndarray)
radii (ndarray)
container (Box)
status (str)
density (float)
reduced_pressure (float)
n_collisions (int)
n_events (int)
sim_time (float)
wall_time (float)
min_gap (float)
shrink_factor (float)
seed (int)
growth_rate (float)
median_pressure (float)
sphere_pressure (ndarray | None)
history (dict | None)
max_contact_error (float)
collision_rule (str)
stop (tuple)
stopped_by (object)
success (bool)
_velocities (ndarray | None)
- positions#
Centres, shape
(n, dim), inside the container.- Type:
- radii#
Radii, shape
(n,).- Type:
- container#
The container the spheres are packed in.
- 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:
- success#
True if the target was reached, or with
density="max"if an arrest criterion fired.- Type:
- reduced_pressure#
Last measured reduced pressure
PV/(NkT)(mean over spheres); 0 if the run was too short to complete a measurement window.- Type:
- median_pressure#
Median over spheres of the per-sphere reduced pressure in the last window.
- Type:
- sphere_pressure#
Per-sphere reduced pressure in the last window, shape
(n,); its mean isreduced_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_collisionsandphase(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:
- min_gap#
Smallest
distance / contact distance - 1over all pairs and walls before overlaps were removed. Values around -1e-15 are round-off.- Type:
- shrink_factor#
Uniform factor applied to the radii to remove round-off overlaps (1 if none).
- Type:
- __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:
positions (ndarray)
radii (ndarray)
container (Box)
status (str)
density (float)
reduced_pressure (float)
n_collisions (int)
n_events (int)
sim_time (float)
wall_time (float)
min_gap (float)
shrink_factor (float)
seed (int)
growth_rate (float)
median_pressure (float)
sphere_pressure (ndarray | None)
history (dict | None)
max_contact_error (float)
collision_rule (str)
stop (tuple)
stopped_by (object)
success (bool)
_velocities (ndarray | None)
- 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 withspheropack.load().to_csv(path, *[, legacy_order, header])Writes one sphere per line as
x,y,z,r(x,y,rin 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_rulediametersdimnstopn_collisionsn_eventssim_timewall_timeseedgrowth_rate