spheropack.rejection_free.System#
- class spheropack.rejection_free.System(positions=None, *, n=None, density=None, box=None, potential, kT=1.0, seed=None, dim=3, method='collisions', chain_length=1.0, irreversible=True)#
Particles interacting with a pair potential in a periodic box, sampled with the rejection-free method.
- Parameters:
positions (np.ndarray | None) – Initial positions, shape
(n, dim). If omitted,nparticles are placed uniformly at random (for strongly repulsive potentials start from a packing instead, e.g.sp.pack(...).positions, to avoid huge initial energies).n (int | None) – Number of particles and number density; with
boxomitted, a cube (square fordim=2) of the matching size is used.density (float | None) – Number of particles and number density; with
boxomitted, a cube (square fordim=2) of the matching size is used.box (Box | None) – Periodic box (
spheropack.PeriodicBox()); edges at least twice the cutoff.potential (PairPotential) – The pair potential.
kT (float) – Temperature.
seed (int | None) – Random seed.
Nonedraws one.dim (int) – Dimension when neither positions nor box are given.
method (Literal['collisions', 'event_chain']) –
"collisions"(default): all particles move simultaneously and pairs reflect (the first implementation of the paper)."event_chain": one particle moves at a time along a coordinate axis and passes its motion to the partner at a reflection (the straight event-chain variant), usually faster for dense systems.chain_length (float) – Displacement per chain (
event_chainonly).irreversible (bool) –
event_chainonly: cycle the directions +x, +y, +z (default, faster; global balance) instead of random axes and signs (detailed balance).methods (Time is measured as the mean displacement per particle in both)
with (moves every particle along its path for t (collisions) or performs chains)
chain). (a total displacement n * t (event)
- __init__(positions=None, *, n=None, density=None, box=None, potential, kT=1.0, seed=None, dim=3, method='collisions', chain_length=1.0, irreversible=True)#
Methods
__init__([positions, n, density, box, kT, ...])potential_energy()Total potential energy of the current configuration.
redraw_velocities()Draws new move velocities (standard normal);
collisionsmethod only.run(time)Advances the simulation by
time.samples(n_samples, interval[, redraw_velocities])Yields the positions
n_samplestimes, everyintervalof simulation time.set_velocities(velocities)Sets the move velocities, shape
(n, dim);collisionsmethod only.snapshot()The current configuration as a
Packing(spheres of diametersigma), forspheropack.analysisandspheropack.io.Attributes
densityNumber density.
dimnn_reflectionsNumber of reflections (lifts in the event-chain method).
positionsCurrent positions (a copy), wrapped into the box.
timethe mean displacement per particle.
velocitiesCurrent move velocities (a copy);
collisionsmethod only.