Reference¶
spack: a package for spherical packing analysis
-
class
spack.
Packing
(rs, diameters, shear=0.0, L=1.0)[source]¶ A class representing a packing of spheres in a periodic box.
-
DM
(masses=None)[source]¶ Dynamical matrix for array rs, size ds. Assumes epsilon is the same for all.
Parameters: masses : an array of length N of the masses of the particles.
-
DM_freqs
(masses=None)[source]¶ Find the frequencies corresponding to the eigenvalues of the dynamical matrix.
This is just a short wrapper around DM().
-
cages
(M=10000, R=None, Rfactor=1.2, padding=0.1, Mfactor=0.1)[source]¶ Find all cages in the current “packing”.
The algorithm uses Monte Carlo: it finds M random points within a sphere of radius R from each particle, and sees if that particle could sit there without conflicting with other particles. Then (number of accepted points) / (number of test points) * (volume of sphere) is the volume of the cage.
The algorithm is adaptive: if not enough test points are accepted (n < M * Mfactor), it tries more test points. If any test points are within padding of the edge, R is (temporarily) expanded.
Parameters: M : Number of points in the sphere to test
R : Size of sphere to test (will be expanded if necessary)
Rfactor : How much to increase R by when the cage doesn’t fit
padding : How much larger the sphere should be than the cage (if it isn’t, the sphere is
expanded)
Mfactor : Mfactor * M is the minimum number of points to find per cage. If they aren’t
found, more points are tested.
Returns: points : a list of (A x 3) lists, A indeterminate (but larger than M * Mfactor), with each
list corresponding to the points within one cage.
Vs : The approximate volumes of each cage.
-
contacts
(tol=1e-08)[source]¶ Returns (number of backbone contacts, stable number, number of floaters)
-
forces
()[source]¶ Find Fij on each particle, assuming a harmonic potential, U = 1/2 (1 - r/σ)^2
Returns a dxNxN matrix.
-
neighbors
(tol=1e-08)[source]¶ For a set of particles at xs,ys with diameters diameters, finds the distance vector matrix (d x N x N) and the adjacency matrix.
Assumes box size 1, returns (adjacency matrix, diffs)
-
plot_contacts
(ax=None, tol=0, reshape=True, **kw)[source]¶ Designed for use with plot_disks, this will plot a line between neighboring particles.
-
plot_disks
(ax=None, color=None, alpha=0.4, reshape=True)[source]¶ Plot the packing as a set of disks.
Color can be None (uses the standard sets), ‘diameter’ (colors by diameter), or a list of colors.
‘reshape’ means set axis scaled, etc.
-
scene
(pack, cmap=None, rot=0, camera_height=0.7, camera_dist=1.5, angle=None, lightstrength=1.1, orthographic=False, pad=None, floatercolor=(0.6, 0.6, 0.6), bgcolor=[1, 1, 1])[source]¶ Render a 3D scene.
Requires vapory package, which requires the povray binary.
Parameters: cmap : a colormap Returns: scene : vapory.Scene, which can be rendered using its .render() method.
-