morphogen.models.hardcore

Hard-core (non-overlapping) spheres: random sequential addition, dense packings grown by the Lubachevsky–Stillinger algorithm, and penetrable spheres with impenetrable cores (the cherry-pit model of Torquato).

morphogen.models.hardcore.METHODS = ('rsa', 'lubachevsky_stillinger')

Methods of the hard-core spheres.

morphogen.models.hardcore.largest_first(radii, box, gap: float, rng, max_attempts: int) → ndarray[source]

Positions (in [0, box), in the order of radii) of non-overlapping spheres placed by random sequential addition, the largest first: drawn late among polydisperse spheres, a large one may find no room left (radii uniform between 0.8 and 1.2 and 0.05 apart jam from a fraction of 0.31 in the order of their draw; the largest first, they still fill 0.41).

morphogen.models.hardcore.grown_packing(radii, box, rng, *, growth_rate: float = 0.01, max_events=None)[source]

Positions (in [0, box)) of non-overlapping spheres of the given radii in a periodic box, grown by the Lubachevsky–Stillinger algorithm (morphogen.kernels.packing): from the positions of a random sequential addition of the spheres shrunk to a packing fraction of at most 0.25, the largest first (drawn late, a large sphere may find no room left), with Gaussian velocities of the mean radius per unit time, the radii growing at growth_rate times themselves per unit time. Raises RuntimeError when the packing jams before the spheres reach their radii (after max_events, 20000 per sphere by default).

class morphogen.models.hardcore.HardcoreSpheres(radius: Distribution = Constant(value=1.0), volume_fraction: float | None = None, number: int | None = None, min_gap: float = 0.0, max_attempts: int | None = None, method: str = 'rsa', growth_rate: float = 0.01, *, anisotropy: Anisotropy | None = None)[source]

Bases: Model

Non-overlapping spheres, by random sequential addition (RSA) or grown into dense packings by the Lubachevsky–Stillinger algorithm.

RSA adds the spheres one at a time at uniformly random positions, the largest first, a trial being rejected when the sphere would come closer than min_gap to an existing one: the process jams near a volume fraction of 0.38 for equal spheres. The Lubachevsky–Stillinger algorithm grows the spheres of a hard-sphere fluid (an event-driven molecular dynamics) until they reach their radii (plus half the gap): fast growths jam equal spheres near 0.64 (the maximally random jammed state), slow ones let them order.

Generation always takes place in a periodic box; for non-periodic domains the box is enlarged by two grain diameters and cropped, which avoids wall effects.

phases: ClassVar[dict[int, str]] = {0: 'matrix', 1: 'spheres'}

Meaning of the phase indices of the voxel images.

count_label: ClassVar[str] = 'spheres'

Objects counted by expected_count() (fibres, spheres, cells…).

generate(domain: Domain, seed: int | SeedSequence | Generator | None = None) → PrimitiveUnion[source]

One realization of the model in domain.

expected_count(domain: Domain) → float | None[source]

Number of sphere centres in the domain (given a volume fraction).

theory(domain: Domain | None = None) → dict[str, float][source]

Theoretical morphological characteristics known in closed form (may be empty).

Some values depend on the domain (e.g. the intensity implied by a number of cells).

class morphogen.models.hardcore.PenetrableSpheres(radius: Distribution = Constant(value=1.0), impenetrability: float = 0.5, reduced_density: float | None = None, number: int | None = None, method: str = 'rsa', growth_rate: float = 0.01, max_attempts: int | None = None, *, anisotropy: Anisotropy | None = None)[source]

Bases: Model

Penetrable spheres with impenetrable cores: the cherry-pit model of Torquato (1984), or penetrable-concentric-shell model.

Each sphere of radius R has a core of radius λR that no other core overlaps: the cores are placed by random sequential addition, the largest first (or grown into dense packings by the Lubachevsky–Stillinger algorithm), and the shells interpenetrate. λ = 0 gives fully penetrable spheres (independent uniform centres), λ = 1 hard spheres; phase 1 is the union of the spheres, whose fraction lies between 1 - e^{-η} and η for the reduced density η (the number of spheres per unit volume times their mean volume).

phases: ClassVar[dict[int, str]] = {0: 'matrix', 1: 'spheres'}

Meaning of the phase indices of the voxel images.

count_label: ClassVar[str] = 'spheres'

Objects counted by expected_count() (fibres, spheres, cells…).

generate(domain: Domain, seed: int | SeedSequence | Generator | None = None) → PrimitiveUnion[source]

One realization of the model in domain.

expected_count(domain: Domain) → float | None[source]

Mean number of objects of the model in domain (None when undefined).

Used to express RVE sizes as numbers of fibres, grains or cells (Dirrenberger et al. 2014, Table 10).

theory(domain: Domain | None = None) → dict[str, float][source]

The reduced density, the fraction of the cores (λ^3 η), and the fraction and specific surface of the union in the two limits: 1 - e^{-η} and its surface 3 η E[R^2] / E[R^3] e^{-η} for fully penetrable spheres (large boxes), η and 3 η E[R^2] / E[R^3] for hard spheres.