Skip to content

Soft matter

Soft matter systems.

The package covers Brownian particles, optical and hydrodynamically coupled traps, anomalous diffusion, and transitions.

AnisotropicBrownianParticlesSystem(n_particles=200, *, D_par=1.0, D_perp=1.0, D_r=0.75, D_spin=0.75, D_c=0.0, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Overdamped axisymmetric Brownian particles in three dimensions.

The particles translate and rotate.

Every particle diffuses with D_par along its axis u and with D_perp across it, its axis diffuses on the unit sphere with D_r, so that <u(t) . u(0)> = exp(-2 D_r t), and it spins about its axis with D_spin. The defaults are a Janus sphere of unit radius, D_par = D_perp = D_t and D_r = 3 D_t / 4, whose orientation is visible although its diffusion is isotropic. A prolate ellipsoid has D_par > D_perp from Perrin's factors, so its displacement over times shorter than 1 / D_r is elongated along its axis. A chiral body, such as a spiral, has a coupling D_c of the translation along its axis and the rotation about it, <dr_par dpsi> = 2 D_c dt. These are Challenges 5.1 to 5.3 of Argun et al. The axis is held as a unit vector and rescaled to unit length after every step, and the particles start at the origin with axes drawn uniformly on the sphere. The system has the positions particles.x, particles.y, particles.z, the axes particles.ux, particles.uy, particles.uz, and the spins particles.psi.

Parameters:

Name Type Description Default
n_particles int

The number of particles.

200
D_par float

The translational diffusion coefficient along the axis.

1.0
D_perp float

The translational diffusion coefficient across the axis.

1.0
D_r float

The rotational diffusion coefficient of the axis.

0.75
D_spin float

The rotational diffusion coefficient about the axis.

0.75
D_c float

The coupling of the translation along the axis and the rotation about it.

0.0
random_state int | Generator | None

The seed or generator of the initial axes.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Raises:

Type Description
ParameterError

The coupling exceeds sqrt(D_par D_spin).

Examples:

>>> from skcomplex.systems.physics.soft_matter import AnisotropicBrownianParticlesSystem
>>> AnisotropicBrownianParticlesSystem(5, D_par=1.5, D_perp=0.8).prepare().system_.interactions[0].D_perp
0.8
Source code in src/skcomplex/systems/physics/soft_matter/_rigid_bodies.py
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
def __init__(
    self,
    n_particles: int = 200,
    *,
    D_par: float = 1.0,
    D_perp: float = 1.0,
    D_r: float = 0.75,
    D_spin: float = 0.75,
    D_c: float = 0.0,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_particles = n_particles
    self.D_par = D_par
    self.D_perp = D_perp
    self.D_r = D_r
    self.D_spin = D_spin
    self.D_c = D_c
    self.random_state = random_state

AnisotropicDiffusionInteraction(label, *, target, D_par=1.0, D_perp=1.0, D_r=0.75, D_spin=0.75, D_c=0.0)

Bases: Interaction

Diffusion of axisymmetric particles whose diffusion tensor turns with their axis.

The position r = (x, y, z) diffuses with D_par along the unit axis u = (ux, uy, uz) and with D_perp across it, dr = (sqrt(2 D_par) u u + sqrt(2 D_perp) (I - u u)) dW. The axis diffuses on the unit sphere, du = -2 D_r u dt + sqrt(2 D_r) (I - u u) dW_r in the Itô form, and a boundary rescales it to unit length after every step against the drift of the discrete steps. The spin psi about the axis diffuses with D_spin, and its noise is correlated with the displacement along the axis through the coupling D_c of a chiral body, so that <dr_par dpsi> = 2 D_c dt, which needs D_c² <= D_par D_spin. It is a Janus colloid, an ellipsoid, or a bacterium shaped as a spiral.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the particles.

required
D_par Annotated[float, open(0, oo)]

The translational diffusion coefficient along the axis.

1.0
D_perp Annotated[float, closed_open(0, oo)]

The translational diffusion coefficient across the axis.

1.0
D_r Annotated[float, closed_open(0, oo)]

The rotational diffusion coefficient of the axis.

0.75
D_spin Annotated[float, closed_open(0, oo)]

The rotational diffusion coefficient about the axis.

0.75
D_c float

The coupling of the translation along the axis and the rotation about it.

0.0

Examples:

>>> from skcomplex.systems.physics.soft_matter import AnisotropicDiffusionInteraction
>>> AnisotropicDiffusionInteraction('diffusion', target='particles', D_perp=0.5).D_perp
0.5
Source code in src/skcomplex/systems/physics/soft_matter/_rigid_bodies.py
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
def __init__(
    self,
    label: str,
    *,
    target: Role,
    D_par: Annotated[float, RealSet.open(0, oo)] = 1.0,
    D_perp: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    D_r: Annotated[float, RealSet.closed_open(0, oo)] = 0.75,
    D_spin: Annotated[float, RealSet.closed_open(0, oo)] = 0.75,
    D_c: float = 0.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.D_par = D_par
    self.D_perp = D_perp
    self.D_r = D_r
    self.D_spin = D_spin
    self.D_c = D_c

AnisotropicParticleElement(label, *, x=0.0, y=0.0, z=0.0, ux=0.0, uy=0.0, uz=1.0, psi=0.0, size=None)

Bases: Element

Axisymmetric particles in three dimensions, with a position, a unit axis, and a spin about the axis.

Parameters:

Name Type Description Default
label str

The label of the particles.

required
x object

The initial first coordinate, one per particle or shared.

0.0
y object

The initial second coordinate, one per particle or shared.

0.0
z object

The initial third coordinate, one per particle or shared.

0.0
ux object

The initial first component of the axis, one per particle or shared.

0.0
uy object

The initial second component of the axis, one per particle or shared.

0.0
uz object

The initial third component of the axis, one per particle or shared.

1.0
psi object

The initial spin angle about the axis, one per particle or shared.

0.0
size int | None

The number of particles, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import AnisotropicParticleElement
>>> AnisotropicParticleElement('janus').uz
1.0
Source code in src/skcomplex/systems/physics/soft_matter/_rigid_bodies.py
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
def __init__(
    self,
    label: str,
    *,
    x: object = 0.0,
    y: object = 0.0,
    z: object = 0.0,
    ux: object = 0.0,
    uy: object = 0.0,
    uz: object = 1.0,
    psi: object = 0.0,
    size: int | None = None,
) -> None:
    super().__init__(label, size=size)
    self.x = x
    self.y = y
    self.z = z
    self.ux = ux
    self.uy = uy
    self.uz = uz
    self.psi = psi

AnnealedTransientTimeMotionSystem(n_walkers=500, *, sigma=0.5, gamma=1.0, n_dim=2, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Annealed transient time motion.

The diffusion coefficient of Brownian walkers changes at random times.

Every walker diffuses with a coefficient D of density sigma D^(sigma - 1) on (0, 1) and keeps it for an exponential time of mean D^(-gamma), so slow walkers stay slow for long. For sigma < gamma the ensemble mean squared displacement grows as t^(sigma / gamma). The system has the positions walkers.x, the coefficients walkers.D, and the change count changes.renewals.

Parameters:

Name Type Description Default
n_walkers int

The number of independent walkers.

500
sigma float

The exponent of the density of diffusion coefficients near zero.

0.5
gamma float

The exponent of the mean waiting time D^(-gamma).

1.0
n_dim int

The number of dimensions.

2
random_state int | Generator | None

The seed or generator of the first diffusion coefficients.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import AnnealedTransientTimeMotionSystem
>>> AnnealedTransientTimeMotionSystem(10, gamma=2.0).prepare().system_.interactions[0].gamma
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
def __init__(
    self,
    n_walkers: int = 500,
    *,
    sigma: float = 0.5,
    gamma: float = 1.0,
    n_dim: int = 2,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_walkers = n_walkers
    self.sigma = sigma
    self.gamma = gamma
    self.n_dim = n_dim
    self.random_state = random_state

BeadElement(label, x=0.0, *, m=1.0, values=None, size=None, space=None)

Bases: MassPointElement

Point mass drawn as a point at its position.

Examples:

>>> from skcomplex.systems.physics.soft_matter import BeadElement
>>> BeadElement('bead', m=2.0).m
2.0
Source code in src/skcomplex/systems/physics/common/particles/_mass_point.py
48
49
50
51
52
53
54
55
56
57
58
59
def __init__(
    self,
    label: str,
    x: npt.ArrayLike = 0.0,
    *,
    m: Annotated[float, RealSet.open(0, oo)] = 1.0,
    values: Mapping[str, object] | None = None,
    size: int | None = None,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, x=x, values=values, size=size, space=space)
    self.m = m

BiasedHopInteraction(label, *, target)

Bases: Interaction

Hops of walkers that always move to the right out of their traps.

A walker on a site hops to the next site after tau steps there, and only onto a site of positive trapping time, so on a lattice that reads -1 outside its edges a walker on the last site stays there. It is a carrier driven through a disordered wire, or a motor protein stalling on a damaged track.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the lattice of sites.

required

Examples:

>>> from skcomplex.systems.physics.soft_matter import BiasedHopInteraction
>>> BiasedHopInteraction('hops', target='traps').target
'traps'
Source code in src/skcomplex/systems/physics/soft_matter/_traps.py
106
107
108
def __init__(self, label: str, *, target: Role) -> None:
    super().__init__(label)
    self.target = target

BiasedTrapWalkSystem(n_walkers=100, *, n_sites=300, alpha=0.5, tau0=1.0, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Walkers that hop always to the right through quenched traps.

The trapping times are broadly distributed.

Every walker moves along its own line of sites and stays tau_i steps on site i before it hops to site i + 1. The trapping times are drawn once, as ceil(tau0 u^(-1 / alpha)) for uniform numbers u, so their distribution decays as tau0^alpha / tau^(1 + alpha). For alpha < 1 their mean diverges, the time to cross N sites grows as N^(1 / alpha), and the displacement grows subdiffusively as x ~ (t / tau0)^alpha, with the mean <x> = (t / tau0)^alpha sin(pi alpha) / (pi alpha) at long times. The walkers start on the first site. The system has the lattice traps of shape (n_walkers, n_sites) and the mean displacement position.

Parameters:

Name Type Description Default
n_walkers int

The number of walkers, each in its own landscape.

100
n_sites int

The number of sites of every landscape.

300
alpha float

The exponent of the distribution of trapping times.

0.5
tau0 float

The smallest trapping time.

1.0
random_state int | Generator | None

The seed or generator of the trapping times.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import BiasedTrapWalkSystem
>>> BiasedTrapWalkSystem(4, n_sites=10).prepare().system_.elements[0].space.prepare().size_
40
Source code in src/skcomplex/systems/physics/soft_matter/_traps.py
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
def __init__(
    self,
    n_walkers: int = 100,
    *,
    n_sites: int = 300,
    alpha: float = 0.5,
    tau0: float = 1.0,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_walkers = n_walkers
    self.n_sites = n_sites
    self.alpha = alpha
    self.tau0 = tau0
    self.random_state = random_state

BlinkingTrapsInteraction(label, *, target, k=1.0, on_time=1.0, off_time=0.0, tensor='rotne-prager-yamakawa', root='cholesky', radius=1.0, viscosity=1.0, temperature=1.0, dt=0.01)

Bases: StokesianMobilityInteraction

Blinking optical traps on spheres that move through a shared fluid.

The spheres move in steps of Brownian dynamics.

Every sphere feels the harmonic force -k (x - center) of its own trap while the traps are on, for on_time of every period on_time + off_time, and no force while they are off. The mobility turns the forces on all spheres into their velocities, and the thermal energy temperature adds Brownian displacements whose correlations between spheres follow the same mobility, so spheres released from their traps diffuse together (Batchelor 1976). Every step lasts dt, and the time of the system counts steps.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the group of spheres.

required
k Annotated[float, closed_open(0, oo)]

The stiffness of every trap.

1.0
on_time float

The time the traps stay on in every period.

1.0
off_time float

The time the traps stay off in every period.

0.0
tensor str

'free-draining', 'oseen', or 'rotne-prager-yamakawa'.

'rotne-prager-yamakawa'
root str

'cholesky' or 'lanczos'.

'cholesky'
radius Annotated[float, open(0, oo)]

The radius of the spheres.

1.0
viscosity Annotated[float, open(0, oo)]

The viscosity of the fluid.

1.0
temperature Annotated[float, closed_open(0, oo)]

The thermal energy kT.

1.0
dt Annotated[float, open(0, oo)]

The length of a step.

0.01

Examples:

>>> from skcomplex.systems.physics.soft_matter import BlinkingTrapsInteraction
>>> BlinkingTrapsInteraction('tweezers', target='beads', off_time=0.2).form
'map'
Source code in src/skcomplex/systems/physics/soft_matter/_coupled_traps.py
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
def __init__(
    self,
    label: str,
    *,
    target: Role,
    k: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    on_time: float = 1.0,
    off_time: float = 0.0,
    tensor: str = 'rotne-prager-yamakawa',
    root: str = 'cholesky',
    radius: Annotated[float, RealSet.open(0, oo)] = 1.0,
    viscosity: Annotated[float, RealSet.open(0, oo)] = 1.0,
    temperature: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    dt: Annotated[float, RealSet.open(0, oo)] = 0.01,
) -> None:
    super().__init__(
        label,
        target=target,
        tensor=tensor,
        form='map',
        force=self._get_trap_force,
        root=root,
        radius=radius,
        viscosity=viscosity,
        temperature=temperature,
        dt=dt,
    )
    self.k = k
    self.on_time = on_time
    self.off_time = off_time

BrownianMotionSystem(n_particles=500, *, inertial=True, m=1.0, gamma=1.0, kT=1.0, n_dim=1, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Free Brownian particles with or without inertia.

With inertia they follow m x'' = -gamma x' + sqrt(2 kT gamma) W.

With inertia the motion is ballistic, <x^2> = kT t^2 / m, below the momentum relaxation time m / gamma, and diffusive, <x^2> = 2 kT t / gamma per axis, above it. Without inertia it is diffusive at every time. The system has the positions beads.x.

Parameters:

Name Type Description Default
n_particles int

The number of particles.

500
inertial bool

Whether the particles have inertia.

True
m float

The mass, used with inertia.

1.0
gamma float

The friction coefficient.

1.0
kT float

The thermal energy.

1.0
n_dim int

The number of dimensions.

1
random_state int | Generator | None

The seed or generator of the thermal initial velocities.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for Euler-Maruyama with the step 0.005.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import BrownianMotionSystem
>>> type(BrownianMotionSystem(10, inertial=False).prepare().system_.elements[0]).__name__
'BrownianParticleElement'
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
def __init__(
    self,
    n_particles: int = 500,
    *,
    inertial: bool = True,
    m: float = 1.0,
    gamma: float = 1.0,
    kT: float = 1.0,
    n_dim: int = 1,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_particles = n_particles
    self.inertial = inertial
    self.m = m
    self.gamma = gamma
    self.kT = kT
    self.n_dim = n_dim
    self.random_state = random_state

BrownianNearWallSystem(z=1.0, *, D0=1.0, a=1.0, drift=0.2, convention='anti-ito', label='system', solver='auto', backend='auto')

Bases: BaseSystem

A Brownian particle that settles on a wall.

Its diffusion slows near the wall, D(z) = D0 z² / (z² + a²).

The diffusion is a smooth form of the hydrodynamic hindrance that vanishes at the wall, and the drift is the settling velocity scaled by the same mobility. Diffusion that depends on the position makes the noise multiplicative, and the anti-Itô convention gives the equilibrium of physical particles. The laws are symmetric about the wall at z = 0, which reflects the particle at every frame. The system has the distance particle.z.

Parameters:

Name Type Description Default
z float

The initial distance from the wall.

1.0
D0 float

The diffusion coefficient far from the wall.

1.0
a float

The distance over which the wall slows diffusion, such as the particle radius.

1.0
drift float

The settling velocity far from the wall.

0.2
convention str

The convention of the noise, 'ito', 'stratonovich', or 'anti-ito'.

'anti-ito'
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import BrownianNearWallSystem
>>> BrownianNearWallSystem(convention='ito').prepare().system_.interactions[0].convention
'ito'
Source code in src/skcomplex/systems/physics/soft_matter/_brownian.py
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
def __init__(
    self,
    z: float = 1.0,
    *,
    D0: float = 1.0,
    a: float = 1.0,
    drift: float = 0.2,
    convention: str = 'anti-ito',
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.z = z
    self.D0 = D0
    self.a = a
    self.drift = drift
    self.convention = convention

BrownianParticleElement(label, *, x=0.0, gamma=1.0, temperature=1.0, size=None, space=None)

Bases: Element

Overdamped Brownian particle at the position x, with the friction gamma and the thermal energy temperature.

A ThermalNoiseInteraction makes it diffuse, dx = sqrt(2 temperature / gamma) dW.

Parameters:

Name Type Description Default
label str

The label of the particle or the group.

required
x object

The initial position.

0.0
gamma Annotated[float, open(0, oo)]

The friction coefficient.

1.0
temperature Annotated[float, closed_open(0, oo)]

The thermal energy.

1.0
size int | None

The number of particles, or None for one.

None
space BaseSpace | None

The continuous space of the particles, or None for none.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import BrownianParticleElement
>>> BrownianParticleElement('bead', temperature=2.0).temperature
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
401
402
403
404
405
406
407
408
409
410
411
412
413
414
def __init__(
    self,
    label: str,
    *,
    x: object = 0.0,
    gamma: Annotated[float, RealSet.open(0, oo)] = 1.0,
    temperature: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    size: int | None = None,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, size=size, space=space)
    self.x = x
    self.gamma = gamma
    self.temperature = temperature

ColoredNoiseInteraction(label, *, target, gamma=1.0, D=1.0, tau=1.0)

Bases: Interaction

Friction and Ornstein-Uhlenbeck noise xi of finite correlation time on the velocity v.

The velocity follows dv/dt = -gamma v + xi and the noise tau dxi = -xi dt + sqrt(2 D) dW. It is a colloid in an active bath, or a particle pushed by a fluctuating field with a memory.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the particles.

required
gamma Annotated[float, open(0, oo)]

The friction coefficient.

1.0
D Annotated[float, closed_open(0, oo)]

The noise intensity.

1.0
tau Annotated[float, open(0, oo)]

The correlation time of the noise.

1.0

Examples:

>>> from skcomplex.systems.physics.soft_matter import ColoredNoiseInteraction
>>> ColoredNoiseInteraction('langevin', target='particles', tau=0.5).tau
0.5
Source code in src/skcomplex/systems/physics/soft_matter/_colored_noise.py
86
87
88
89
90
91
92
93
94
95
96
97
98
99
def __init__(
    self,
    label: str,
    *,
    target: Role,
    gamma: Annotated[float, RealSet.open(0, oo)] = 1.0,
    D: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    tau: Annotated[float, RealSet.open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.gamma = gamma
    self.D = D
    self.tau = tau

ColoredNoiseLangevinSystem(n_particles=500, *, gamma=1.0, D=1.0, tau=1.0, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Particles whose velocity is driven by Ornstein-Uhlenbeck noise xi.

The velocity follows dv/dt = -gamma v + xi.

The noise follows tau dxi = -xi dt + sqrt(2 D) dW, so its correlation is <xi(t) xi(t')> = D / tau exp(-|t - t'| / tau), and it tends to the white noise of intensity 2 D as tau goes to 0. The stationary velocity variance is <v^2> = D / (gamma (1 + gamma tau)), which is D / gamma in the white noise limit. The velocities start at 0 and the noise starts in its stationary state. Solver steps must be short against tau. The system has the velocities particles.v and the noise particles.xi.

Parameters:

Name Type Description Default
n_particles int

The number of independent particles.

500
gamma float

The friction coefficient.

1.0
D float

The noise intensity.

1.0
tau float

The correlation time of the noise.

1.0
random_state int | Generator | None

The seed or generator of the initial noise values.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import ColoredNoiseLangevinSystem
>>> ColoredNoiseLangevinSystem(10, tau=0.5).prepare().system_.interactions[0].tau
0.5
Source code in src/skcomplex/systems/physics/soft_matter/_colored_noise.py
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
def __init__(
    self,
    n_particles: int = 500,
    *,
    gamma: float = 1.0,
    D: float = 1.0,
    tau: float = 1.0,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_particles = n_particles
    self.gamma = gamma
    self.D = D
    self.tau = tau
    self.random_state = random_state

ColoredNoiseParticleElement(label, *, v=0.0, xi=0.0, size=None)

Bases: Element

Particles with the velocities v, driven by the noise xi.

Parameters:

Name Type Description Default
label str

The label of the particles.

required
v object

The initial velocity, one per particle or shared.

0.0
xi object

The initial noise, one per particle or shared.

0.0
size int | None

The number of particles, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import ColoredNoiseParticleElement
>>> ColoredNoiseParticleElement('particle', xi=0.5).xi
0.5
Source code in src/skcomplex/systems/physics/soft_matter/_colored_noise.py
50
51
52
53
def __init__(self, label: str, *, v: object = 0.0, xi: object = 0.0, size: int | None = None) -> None:
    super().__init__(label, size=size)
    self.v = v
    self.xi = xi

ContinuousTimeRandomWalkSystem(n_walkers=500, *, alpha=0.5, tau0=1.0, sigma=1.0, n_dim=2, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The continuous-time random walk.

Gaussian jumps follow waiting times with the tail tau^(-1 - alpha).

For alpha < 1 the waiting times have no mean, so the number of jumps grows as t^alpha and the ensemble mean squared displacement grows as t^alpha, slower than Brownian motion. The walkers renew on their own clocks. The system has the positions walkers.x and the jump count jumps.renewals.

Parameters:

Name Type Description Default
n_walkers int

The number of independent walkers.

500
alpha float

The tail exponent of the waiting times.

0.5
tau0 float

The shortest waiting time.

1.0
sigma float

The standard deviation of the jumps along every axis.

1.0
n_dim int

The number of dimensions.

2
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import ContinuousTimeRandomWalkSystem
>>> ContinuousTimeRandomWalkSystem(10, alpha=0.7).prepare().system_.interactions[0].alpha
0.7
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
def __init__(
    self,
    n_walkers: int = 500,
    *,
    alpha: float = 0.5,
    tau0: float = 1.0,
    sigma: float = 1.0,
    n_dim: int = 2,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_walkers = n_walkers
    self.alpha = alpha
    self.tau0 = tau0
    self.sigma = sigma
    self.n_dim = n_dim

ContinuousTimeWalkerElement(label, *, x=(0.0, 0.0), size=None)

Bases: Element

Walkers at the positions x that wait and jump.

Parameters:

Name Type Description Default
label str

The label of the walkers.

required
x object

The initial position, one row per walker or shared.

(0.0, 0.0)
size int | None

The number of walkers, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import ContinuousTimeWalkerElement
>>> ContinuousTimeWalkerElement('walkers', x=(1.0, 0.0), size=10).x
(1.0, 0.0)
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
48
49
50
def __init__(self, label: str, *, x: object = (0.0, 0.0), size: int | None = None) -> None:
    super().__init__(label, size=size)
    self.x = x

DiffusionInASpeckleFieldSystem(n_particles=100, *, n_hotspots=50, size=100.0, strength=30.0, length=10.0, D=1.0, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Brownian particles in a random speckle field.

The particles are trapped at hotspots for longer as the field grows stronger.

The hotspots sit at random places in a square, with intensities r^(-1/2) and decay lengths length r^(-1/2) for independent uniform numbers r. The particles start at random places in the middle half of the square.

The default strength 30 draws the particles into the hotspots over the first ten time units and lets them escape now and then, so from time 10 to 60 their mean squared displacement grows as t^0.36, a tenth of free diffusion. A strength of 100 or more traps every particle within the first frames and leaves only the rattling inside one hotspot, with a flat mean squared displacement. The system has the positions beads.x.

Parameters:

Name Type Description Default
n_particles int

The number of independent particles.

100
n_hotspots int

The number of hotspots.

50
size float

The side of the square of the hotspots.

100.0
strength float

The product u I0 of the polarizability constant and the reference intensity.

30.0
length float

The reference decay length of the hotspots.

10.0
D float

The diffusion coefficient.

1.0
random_state int | Generator | None

The seed or generator of the hotspots and the initial positions.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import DiffusionInASpeckleFieldSystem
>>> len(DiffusionInASpeckleFieldSystem(5, n_hotspots=3).prepare().system_.interactions[0].centers)
3
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
def __init__(
    self,
    n_particles: int = 100,
    *,
    n_hotspots: int = 50,
    size: float = 100.0,
    strength: float = 30.0,
    length: float = 10.0,
    D: float = 1.0,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_particles = n_particles
    self.n_hotspots = n_hotspots
    self.size = size
    self.strength = strength
    self.length = length
    self.D = D
    self.random_state = random_state

DimerElement(label, *, c=(0.0, 0.0), phi=0.0, theta1=0.0, theta2=0.0, size=None)

Bases: Element

Dimers of two spheres joined by a rigid rod, described by the centre c and the angle phi of the rod.

The spheres have the orientations theta1 and theta2, along which active spheres swim, and which wrap around the circle.

Parameters:

Name Type Description Default
label str

The label of the dimers.

required
c object

The initial centre, one row per dimer or shared.

(0.0, 0.0)
phi object

The initial angle of the rod, one per dimer or shared.

0.0
theta1 Annotated[object, Period(2 * pi)]

The initial orientation of the first sphere, one per dimer or shared.

0.0
theta2 Annotated[object, Period(2 * pi)]

The initial orientation of the second sphere, one per dimer or shared.

0.0
size int | None

The number of dimers, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import DimerElement
>>> DimerElement('molecule', phi=1.0).phi
1.0
Source code in src/skcomplex/systems/physics/soft_matter/_rigid_bodies.py
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
def __init__(
    self,
    label: str,
    *,
    c: object = (0.0, 0.0),
    phi: object = 0.0,
    theta1: Annotated[object, Period(2 * math.pi)] = 0.0,
    theta2: Annotated[object, Period(2 * math.pi)] = 0.0,
    size: int | None = None,
) -> None:
    super().__init__(label, size=size)
    self.c = c
    self.phi = phi
    self.theta1 = theta1
    self.theta2 = theta2

DoubleWellElement(label, *, x=-1.0, size=None)

Bases: Element

Particles at the positions x in a double well.

Parameters:

Name Type Description Default
label str

The label of the particles.

required
x object

The initial position, one per particle or shared.

-1.0
size int | None

The number of particles, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.common.particles import DoubleWellElement
>>> DoubleWellElement('particle', x=1.0).x
1.0
Source code in src/skcomplex/systems/physics/common/particles/_double_well.py
41
42
43
def __init__(self, label: str, *, x: object = -1.0, size: int | None = None) -> None:
    super().__init__(label, size=size)
    self.x = x

FlashingRatchetSystem(n_particles=500, *, barrier=1.0, asymmetry=0.1, L=1.0, rate=1.0, duration=100.0, gamma=1.0, kT=0.05, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The on-off flashing ratchet.

Brownian particles move in a sawtooth potential switched on and off at random.

The potential switches at the rate rate, so on and off phases last 1 / rate on average. While it is off the particles diffuse freely, and while it is on they slide to the minima of the sawtooth. A potential that rises over a short fraction asymmetry of its period sends more particles over its near maximum than over its far one, so the particles drift with a mean velocity of the sign of 0.5 - asymmetry, and a symmetric potential gives no current. The switching times are drawn once, as a Poisson process over duration shared by every particle. The particles start at the minimum at the origin. The system has the positions particles.x.

Parameters:

Name Type Description Default
n_particles int

The number of independent particles.

500
barrier float

The height of the sawtooth.

1.0
asymmetry float

The fraction of the period over which the potential rises, 0.5 for a symmetric potential.

0.1
L float

The period of the sawtooth.

1.0
rate float

The rate at which the potential switches.

1.0
duration float

The time span of the drawn switching times.

100.0
gamma float

The friction coefficient.

1.0
kT float

The thermal energy.

0.05
random_state int | Generator | None

The seed or generator of the switching times.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import FlashingRatchetSystem
>>> len(FlashingRatchetSystem(10, rate=2.0, duration=5.0).prepare().system_.interactions[0].switches) > 0
True
Source code in src/skcomplex/systems/physics/soft_matter/_ratchets.py
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
def __init__(
    self,
    n_particles: int = 500,
    *,
    barrier: float = 1.0,
    asymmetry: float = 0.1,
    L: float = 1.0,
    rate: float = 1.0,
    duration: float = 100.0,
    gamma: float = 1.0,
    kT: float = 0.05,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_particles = n_particles
    self.barrier = barrier
    self.asymmetry = asymmetry
    self.L = L
    self.rate = rate
    self.duration = duration
    self.gamma = gamma
    self.kT = kT
    self.random_state = random_state

FlashingSawtoothInteraction(label, *, target, barrier=1.0, L=1.0, asymmetry=0.1, switches=())

Bases: Interaction

Sawtooth potential on overdamped particles on a line.

The potential is turned on and off at given times.

Its force is the rate of the position, divided by the friction gamma of the target.

The potential of period L has a minimum at every multiple of L, rises linearly by barrier over the fraction asymmetry of the period, and falls back over the rest. It is on from time 0 to the first of the switches, off until the next one, and so on, and it keeps its state after the last one.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the particles, whose positions are x and friction gamma.

required
barrier Annotated[float, closed_open(0, oo)]

The height of the sawtooth.

1.0
L Annotated[float, open(0, oo)]

The period of the sawtooth.

1.0
asymmetry Annotated[float, open(0, oo)]

The fraction of the period over which the potential rises, 0.5 for a symmetric potential.

0.1
switches tuple[float, ...]

The increasing times at which the potential turns off and on in turn.

()

Examples:

>>> from skcomplex.systems.physics.soft_matter import FlashingSawtoothInteraction
>>> FlashingSawtoothInteraction('ratchet', target='beads', switches=(1.0, 2.5)).switches
(1.0, 2.5)
Source code in src/skcomplex/systems/physics/soft_matter/_ratchets.py
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
def __init__(
    self,
    label: str,
    *,
    target: Role,
    barrier: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    L: Annotated[float, RealSet.open(0, oo)] = 1.0,
    asymmetry: Annotated[float, RealSet.open(0, oo)] = 0.1,
    switches: tuple[float, ...] = (),
) -> None:
    super().__init__(label)
    self.target = target
    self.barrier = barrier
    self.L = L
    self.asymmetry = asymmetry
    self.switches = switches

FractionalBrownianMotionSystem(n_walkers=500, *, H=0.3, D=1.0, n_dim=2, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Fractional Brownian motion, dx = sqrt(2 D) dB_H.

Along every axis <x^2> = 2 D t^(2 H).

The increments are correlated over the whole run: they anticorrelate for H < 1/2, which makes the walkers subdiffusive, and correlate for H > 1/2, which makes them superdiffusive. The system has the positions walkers.x.

Parameters:

Name Type Description Default
n_walkers int

The number of independent walkers.

500
H float

The Hurst index.

0.3
D float

The diffusion coefficient.

1.0
n_dim int

The number of dimensions.

2
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import FractionalBrownianMotionSystem
>>> FractionalBrownianMotionSystem(10, H=0.7).prepare().system_.interactions[0].H
0.7
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
def __init__(
    self,
    n_walkers: int = 500,
    *,
    H: float = 0.3,
    D: float = 1.0,
    n_dim: int = 2,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_walkers = n_walkers
    self.H = H
    self.D = D
    self.n_dim = n_dim

FractionalNoiseInteraction(label, *, target, D=1.0, H=0.3)

Bases: Interaction

Fractional Brownian noise, dx = sqrt(2 D) dB_H, whose increments are correlated in time.

The increments of the position x anticorrelate for a Hurst index H < 1/2 and correlate for H > 1/2. It is a monomer of a long polymer, a tracer in a viscoelastic gel, or the level of a river over the years.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the walkers.

required
D Annotated[float, open(0, oo)]

The diffusion coefficient.

1.0
H Annotated[float, open(0, 1)]

The Hurst index of the driving fractional Brownian motion.

0.3

Examples:

>>> from skcomplex.systems.physics.soft_matter import FractionalNoiseInteraction
>>> FractionalNoiseInteraction('noise', target='walkers', H=0.7).H
0.7
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
164
165
166
167
168
169
170
171
172
173
174
175
def __init__(
    self,
    label: str,
    *,
    target: Role,
    D: Annotated[float, RealSet.open(0, oo)] = 1.0,
    H: Annotated[float, RealSet.open(0, 1)] = 0.3,
) -> None:
    super().__init__(label)
    self.target = target
    self.D = D
    self.H = H

FractionalWalkerElement(label, *, x=(0.0, 0.0), size=None)

Bases: Element

Walkers at the positions x, driven by fractional Brownian motion.

Parameters:

Name Type Description Default
label str

The label of the walkers.

required
x object

The initial position, one row per walker or shared.

(0.0, 0.0)
size int | None

The number of walkers, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import FractionalWalkerElement
>>> FractionalWalkerElement('walkers', x=(1.0, 0.0), size=10).x
(1.0, 0.0)
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
132
133
134
def __init__(self, label: str, *, x: object = (0.0, 0.0), size: int | None = None) -> None:
    super().__init__(label, size=size)
    self.x = x

FrictionalBlockElement(label, *, x=0.0, v=0.0, m=1.0, space=None)

Bases: Element

Blocks of a chain on a rough floor, at the positions x with the velocities v.

Parameters:

Name Type Description Default
label str

The label of the blocks.

required
x object

The initial position, one per block or shared.

0.0
v object

The initial velocity, one per block or shared.

0.0
m Annotated[float, open(0, oo)]

The mass.

1.0
space BaseSpace | None

The lattice of the chain, or None for one block.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import FrictionalBlockElement
>>> FrictionalBlockElement('block', m=2.0).m
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_friction.py
54
55
56
57
58
59
60
61
62
63
64
65
66
def __init__(
    self,
    label: str,
    *,
    x: object = 0.0,
    v: object = 0.0,
    m: Annotated[float, RealSet.open(0, oo)] = 1.0,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, space=space)
    self.x = x
    self.v = v
    self.m = m

HydrodynamicallyCoupledTrapsSystem(separation=3.0, *, tensor='rotne-prager-yamakawa', root='cholesky', radius=1.0, viscosity=0.001, kT=0.0041, k=0.2, on_time=0.3, off_time=0.1, step=0.005, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Two Brownian spheres in blinking optical traps.

The free motion of the spheres is correlated through the fluid.

The traps hold the spheres at a distance separation along x, and switch off for off_time after every on_time. While they are off the spheres diffuse freely, and the force on one moves the other through the mobility, so their displacements correlate as M_12 / M_11. That is about 3 a / (2 r) along the line of centres and 3 a / (4 r) across it. The units are micrometres, seconds, and piconewtons, so the defaults are spheres of radius 1 um in water at room temperature, and each step of the system lasts step seconds. The system has the positions spheres.x.

Parameters:

Name Type Description Default
separation float

The distance between the centres of the traps.

3.0
tensor str

'free-draining', 'oseen', or 'rotne-prager-yamakawa'.

'rotne-prager-yamakawa'
root str

'cholesky' or 'lanczos'.

'cholesky'
radius float

The radius of the spheres.

1.0
viscosity float

The viscosity of the fluid.

0.001
kT float

The thermal energy.

0.0041
k float

The stiffness of the traps.

0.2
on_time float

The time the traps stay on in every period.

0.3
off_time float

The time the traps stay off in every period.

0.1
step float

The length of a step, in seconds.

0.005
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import HydrodynamicallyCoupledTrapsSystem
>>> HydrodynamicallyCoupledTrapsSystem(4.0).prepare().system_.elements[0].center
[[-2.0, 0.0], [2.0, 0.0]]
Source code in src/skcomplex/systems/physics/soft_matter/_coupled_traps.py
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
def __init__(
    self,
    separation: float = 3.0,
    *,
    tensor: str = 'rotne-prager-yamakawa',
    root: str = 'cholesky',
    radius: float = 1.0,
    viscosity: float = 1e-3,
    kT: float = 4.1e-3,
    k: float = 0.2,
    on_time: float = 0.3,
    off_time: float = 0.1,
    step: float = 5e-3,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.separation = separation
    self.tensor = tensor
    self.root = root
    self.radius = radius
    self.viscosity = viscosity
    self.kT = kT
    self.k = k
    self.on_time = on_time
    self.off_time = off_time
    self.step = step

KramersEscapeSystem(n_particles=200, *, D=0.1, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Particles that escape over the barrier of U = x^4 / 4 - x^2 / 2 by noise.

The noise is thermal with the intensity D.

The particles start in the left well, and they hop between the wells at the Kramers rate sqrt(U''(-1) |U''(0)|) / (2 pi) exp(-1 / (4 D)), which is sqrt(2) / (2 pi) exp(-1 / (4 D)). The system has the positions particles.x.

Parameters:

Name Type Description Default
n_particles int

The number of independent particles.

200
D float

The noise intensity.

0.1
random_state int | Generator | None

The seed or generator of the small initial spread in the left well.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import KramersEscapeSystem
>>> KramersEscapeSystem(10, D=0.2).prepare().system_.interactions[0].D
0.2
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
719
720
721
722
723
724
725
726
727
728
729
730
731
732
def __init__(
    self,
    n_particles: int = 200,
    *,
    D: float = 0.1,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_particles = n_particles
    self.D = D
    self.random_state = random_state

LevyFlierElement(label, *, x=(0.0, 0.0), size=None)

Bases: Element

Walkers at the positions x that jump at every step.

Parameters:

Name Type Description Default
label str

The label of the walkers.

required
x object

The initial position, one row per walker or shared.

(0.0, 0.0)
size int | None

The number of walkers, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import LevyFlierElement
>>> LevyFlierElement('walkers', x=(1.0, 0.0), size=10).x
(1.0, 0.0)
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
207
208
209
def __init__(self, label: str, *, x: object = (0.0, 0.0), size: int | None = None) -> None:
    super().__init__(label, size=size)
    self.x = x

LevyFlightSystem(n_walkers=500, *, mu=1.2, l0=1.0, n_dim=2, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The Lévy flight.

The walk jumps in random directions by lengths with the tail l^(-1 - mu).

For mu < 2 the jump lengths have no variance, so the walk is dominated by its longest jumps and the typical distance travelled after n steps grows as n^(1 / mu), faster than the n^(1/2) of a random walk. The system has the positions walkers.x.

Parameters:

Name Type Description Default
n_walkers int

The number of independent walkers.

500
mu float

The tail exponent of the jump lengths.

1.2
l0 float

The shortest jump length.

1.0
n_dim int

The number of dimensions.

2
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import LevyFlightSystem
>>> LevyFlightSystem(10, mu=1.5).prepare().system_.interactions[0].mu
1.5
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
def __init__(
    self,
    n_walkers: int = 500,
    *,
    mu: float = 1.2,
    l0: float = 1.0,
    n_dim: int = 2,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_walkers = n_walkers
    self.mu = mu
    self.l0 = l0
    self.n_dim = n_dim

LevyFlightTimeInteraction(label, *, target, sigma=1.5, tau0=1.0, speed=1.0)

Bases: Interaction

Flights at constant speed in random directions that last power-law flight times.

The position x moves with the velocity v, and after a flight time tau0 r^(-1 / sigma) for r uniform the velocity turns to a uniformly random direction at the speed speed. It is a bacterium that runs and tumbles, a tracer in a turbulent flow, or the gaze of an eye that scans a scene.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the walkers.

required
sigma Annotated[float, open(0, oo)]

The tail exponent of the flight times, between 1 and 2 for superdiffusion.

1.5
tau0 Annotated[float, open(0, oo)]

The shortest flight time.

1.0
speed Annotated[float, open(0, oo)]

The speed of every flight.

1.0

Examples:

>>> from skcomplex.systems.physics.soft_matter import LevyFlightTimeInteraction
>>> LevyFlightTimeInteraction('turns', target='walkers', speed=2.0).speed
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
332
333
334
335
336
337
338
339
340
341
342
343
344
345
def __init__(
    self,
    label: str,
    *,
    target: Role,
    sigma: Annotated[float, RealSet.open(0, oo)] = 1.5,
    tau0: Annotated[float, RealSet.open(0, oo)] = 1.0,
    speed: Annotated[float, RealSet.open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.sigma = sigma
    self.tau0 = tau0
    self.speed = speed

LevyJumpInteraction(label, *, target, mu=1.2, l0=1.0)

Bases: Interaction

Jumps at every step in a random direction, with lengths of the power-law tail l^(-1 - mu).

The length of a jump is l0 r^(-1 / mu) for r uniform, and its direction is uniform. It is an albatross that forages, a photon in a hot gas, or a bank note passed between towns.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the walkers.

required
mu Annotated[float, open(0, oo)]

The tail exponent of the jump lengths, below 2 for jumps of infinite variance.

1.2
l0 Annotated[float, open(0, oo)]

The shortest jump length.

1.0

Examples:

>>> from skcomplex.systems.physics.soft_matter import LevyJumpInteraction
>>> LevyJumpInteraction('flights', target='walkers', mu=1.5).mu
1.5
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
240
241
242
243
244
245
246
247
248
249
250
251
def __init__(
    self,
    label: str,
    *,
    target: Role,
    mu: Annotated[float, RealSet.open(0, oo)] = 1.2,
    l0: Annotated[float, RealSet.open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.mu = mu
    self.l0 = l0

LevyWalkSystem(n_walkers=500, *, sigma=1.5, tau0=1.0, speed=1.0, n_dim=2, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

The Lévy walk.

Flights at constant speed in random directions last times with the tail tau^(-1 - sigma).

For 1 < sigma < 2 the flight times have a mean but no variance, so long flights dominate and the ensemble mean squared displacement grows as t^(3 - sigma), faster than Brownian motion and slower than ballistic motion. The system has the positions walkers.x, the velocities walkers.v, and the turn count turns.renewals.

Parameters:

Name Type Description Default
n_walkers int

The number of independent walkers.

500
sigma float

The tail exponent of the flight times.

1.5
tau0 float

The shortest flight time.

1.0
speed float

The speed of every flight.

1.0
n_dim int

The number of dimensions.

2
random_state int | Generator | None

The seed or generator of the directions of the first flights.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import LevyWalkSystem
>>> LevyWalkSystem(10, sigma=1.2).prepare().system_.interactions[0].sigma
1.2
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
def __init__(
    self,
    n_walkers: int = 500,
    *,
    sigma: float = 1.5,
    tau0: float = 1.0,
    speed: float = 1.0,
    n_dim: int = 2,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_walkers = n_walkers
    self.sigma = sigma
    self.tau0 = tau0
    self.speed = speed
    self.n_dim = n_dim
    self.random_state = random_state

LevyWalkerElement(label, *, x=(0.0, 0.0), v=(0.0, 0.0), size=None)

Bases: Element

Walkers at the positions x that fly with the velocities v.

Parameters:

Name Type Description Default
label str

The label of the walkers.

required
x object

The initial position, one row per walker or shared.

(0.0, 0.0)
v object

The initial velocity, one row per walker or shared.

(0.0, 0.0)
size int | None

The number of walkers, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import LevyWalkerElement
>>> LevyWalkerElement('walkers', v=(1.0, 0.0), size=10).v
(1.0, 0.0)
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
295
296
297
298
def __init__(self, label: str, *, x: object = (0.0, 0.0), v: object = (0.0, 0.0), size: int | None = None) -> None:
    super().__init__(label, size=size)
    self.x = x
    self.v = v

ModulatedNoiseInteraction(label, *, target, s0=1.0, ds=1.8, L=100.0, convention='anti-ito')

Bases: Interaction

Noise whose amplitude grows across a box [0, L] whose walls reflect the particles.

The noise amplitude is sigma = s0 + ds (x / L - 1/2), read in the Itô, Stratonovich, or anti-Itô sense. The walls reflect the particles at every frame, so frames must be short against the time to cross the box. It is a colloid in a temperature gradient, or a particle whose mobility changes with its place.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the particles.

required
s0 Annotated[float, open(0, oo)]

The noise amplitude at the middle of the box.

1.0
ds float

The change of the noise amplitude across the box.

1.8
L Annotated[float, open(0, oo)]

The length of the box.

100.0
convention str

The convention of the noise, 'ito', 'stratonovich', or 'anti-ito'.

'anti-ito'

Examples:

>>> from skcomplex.systems.physics.soft_matter import ModulatedNoiseInteraction
>>> ModulatedNoiseInteraction('noise', target='beads').ds
1.8
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
def __init__(
    self,
    label: str,
    *,
    target: Role,
    s0: Annotated[float, RealSet.open(0, oo)] = 1.0,
    ds: float = 1.8,
    L: Annotated[float, RealSet.open(0, oo)] = 100.0,
    convention: str = 'anti-ito',
) -> None:
    super().__init__(label)
    self.target = target
    self.s0 = s0
    self.ds = ds
    self.L = L
    self.convention = convention

ModulatedParticleElement(label, *, x=50.0, size=None)

Bases: Element

Particles at the positions x in a box.

Parameters:

Name Type Description Default
label str

The label of the particles.

required
x object

The initial position, one per particle or shared.

50.0
size int | None

The number of particles, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import ModulatedParticleElement
>>> ModulatedParticleElement('beads', x=5.0, size=10).x
5.0
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
57
58
59
def __init__(self, label: str, *, x: object = 50.0, size: int | None = None) -> None:
    super().__init__(label, size=size)
    self.x = x

MultiplicativeNoiseSystem(n_particles=500, *, s0=1.0, ds=1.8, L=100.0, convention='anti-ito', label='system', solver='auto', backend='auto')

Bases: BaseSystem

Free particles in a box with position-dependent noise.

The noise is read in the Itô, Stratonovich, or anti-Itô sense.

Only the anti-Itô convention gives the flat stationary density of particles at thermal equilibrium without forces. The particles start at the middle of the box. The system has the positions particles.x.

Parameters:

Name Type Description Default
n_particles int

The number of independent particles.

500
s0 float

The noise amplitude at the middle of the box.

1.0
ds float

The change of the noise amplitude across the box.

1.8
L float

The length of the box.

100.0
convention str

The convention of the noise, 'ito', 'stratonovich', or 'anti-ito'.

'anti-ito'
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import MultiplicativeNoiseSystem
>>> MultiplicativeNoiseSystem(10, convention='ito').prepare().system_.interactions[0].convention
'ito'
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
def __init__(
    self,
    n_particles: int = 500,
    *,
    s0: float = 1.0,
    ds: float = 1.8,
    L: float = 100.0,
    convention: str = 'anti-ito',
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_particles = n_particles
    self.s0 = s0
    self.ds = ds
    self.L = L
    self.convention = convention

OpticalTrapInteraction(label, *, target, k=(1.0,), amplitude=(0.0,), frequency=0.0, blink_period=None, duty=0.5)

Bases: Interaction

Harmonic optical trap on overdamped particles.

The potential is sum_d k_d (x_d - c_d(t))^2 / 2 over every axis.

The center oscillates as c(t) = amplitude sin(2 pi frequency t), and a blinking trap is on for the first duty fraction of every blink_period and off for the rest. The force divides by the friction gamma of the target.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the particles, whose positions are x and friction gamma.

required
k Sequence[float]

The stiffness along every axis.

(1.0,)
amplitude Sequence[float]

The amplitude of the oscillation of the center along every axis.

(0.0,)
frequency Annotated[float, closed_open(0, oo)]

The frequency of the oscillation of the center.

0.0
blink_period float | None

The period of a blinking trap, or None for a trap that is always on.

None
duty float

The fraction of every blinking period during which the trap is on.

0.5

Examples:

>>> from skcomplex.systems.physics.soft_matter import OpticalTrapInteraction
>>> OpticalTrapInteraction('tweezers', target='bead', k=[1.0, 0.25]).k
[1.0, 0.25]
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
def __init__(
    self,
    label: str,
    *,
    target: Role,
    k: Sequence[float] = (1.0,),
    amplitude: Sequence[float] = (0.0,),
    frequency: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
    blink_period: float | None = None,
    duty: float = 0.5,
) -> None:
    super().__init__(label)
    self.target = target
    self.k = k
    self.amplitude = amplitude
    self.frequency = frequency
    self.blink_period = blink_period
    self.duty = duty

OpticalTrapSystem(n_particles=200, *, k=(1.0, 0.25), gamma=1.0, kT=1.0, amplitude=(0.0, 0.0), frequency=0.0, blink_period=None, duty=0.5, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Overdamped particles in a harmonic optical trap.

The trap is still, oscillating, or blinking.

In a still trap every coordinate is normal with variance kT / k and relaxes in the time gamma / k. The system has the positions beads.x.

Parameters:

Name Type Description Default
n_particles int

The number of independent particles.

200
k Sequence[float]

The stiffness along each axis.

(1.0, 0.25)
gamma float

The friction coefficient.

1.0
kT float

The thermal energy.

1.0
amplitude Sequence[float]

The amplitude of the oscillation of the center along each axis.

(0.0, 0.0)
frequency float

The frequency of the oscillation of the center.

0.0
blink_period float | None

The period of a blinking trap, or None for a trap that is always on.

None
duty float

The fraction of every blinking period during which the trap is on.

0.5
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import OpticalTrapSystem
>>> OpticalTrapSystem(10, blink_period=2.0).prepare().system_.interactions[0].blink_period
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
def __init__(
    self,
    n_particles: int = 200,
    *,
    k: Sequence[float] = (1.0, 0.25),
    gamma: float = 1.0,
    kT: float = 1.0,
    amplitude: Sequence[float] = (0.0, 0.0),
    frequency: float = 0.0,
    blink_period: float | None = None,
    duty: float = 0.5,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_particles = n_particles
    self.k = k
    self.gamma = gamma
    self.kT = kT
    self.amplitude = amplitude
    self.frequency = frequency
    self.blink_period = blink_period
    self.duty = duty

RigidDimersSystem(n_dimers=100, *, L=1.0, v0=0.0, D_t=0.1, D_r=1.0, random_state=0, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Colloidal molecules.

Pairs of Brownian or active spheres are joined by rigid rods, free in the plane.

Each sphere diffuses with D_t, and an active sphere also swims at the speed v0 along its own orientation, which diffuses with D_r. The rod keeps the spheres at the distance L. Diffusing both spheres freely and then restoring their distance, the scheme of Problem 5.1 of Argun et al., gives in the limit of small steps a centre that diffuses with D_t / 2 and a rod angle that diffuses with 2 D_t / L², so the rotational diffusion of the molecule falls as L^-2 in this free-draining model. Active spheres, Problem 9.3, swim together along the mean of their orientations and turn the rod with the part of their difference across it, which raises the long-time diffusion of the centre to D_t / 2 + v0² / (4 D_r). The dimers start at the origin with random rod angles and orientations. The system has the centres dimers.c, the rod angles dimers.phi, and the orientations dimers.theta1 and dimers.theta2. The spheres sit at c ± (L / 2) (cos phi, sin phi).

Parameters:

Name Type Description Default
n_dimers int

The number of dimers.

100
L float

The length of the rod.

1.0
v0 float

The swimming speed of each sphere, 0 for Brownian spheres.

0.0
D_t float

The translational diffusion coefficient of each sphere.

0.1
D_r float

The rotational diffusion coefficient of the orientation of each sphere.

1.0
random_state int | Generator | None

The seed or generator of the initial angles and orientations.

0
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import RigidDimersSystem
>>> RigidDimersSystem(5, L=2.0).prepare().system_.interactions[0].L
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_rigid_bodies.py
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
def __init__(
    self,
    n_dimers: int = 100,
    *,
    L: float = 1.0,
    v0: float = 0.0,
    D_t: float = 0.1,
    D_r: float = 1.0,
    random_state: int | np.random.Generator | None = 0,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_dimers = n_dimers
    self.L = L
    self.v0 = v0
    self.D_t = D_t
    self.D_r = D_r
    self.random_state = random_state

RigidRodInteraction(label, *, target, L=1.0, v0=0.0, D_t=0.1, D_r=1.0)

Bases: Interaction

Motion of two Brownian or active spheres joined by a rigid rod of length L.

Each sphere diffuses with D_t and swims at the speed v0 along its own orientation, theta1 or theta2, which diffuse with D_r, and the rod keeps them at the distance L. Moving both spheres freely and then restoring their distance moves the centre c by the mean of their displacements and turns the rod by the part of their relative displacement across it, so in the limit of small steps dc = v0 (n1 + n2) / 2 dt + sqrt(D_t) dW and dphi = v0 (n1 - n2) . e / L dt + 2 sqrt(D_t) / L dW, with e = (-sin phi, cos phi) across the rod. It is a colloidal molecule, or a pair of swimming bacteria stuck together.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the dimers.

required
L Annotated[float, open(0, oo)]

The length of the rod.

1.0
v0 Annotated[float, closed_open(0, oo)]

The swimming speed of each sphere, 0 for Brownian spheres.

0.0
D_t Annotated[float, closed_open(0, oo)]

The translational diffusion coefficient of each sphere.

0.1
D_r Annotated[float, closed_open(0, oo)]

The rotational diffusion coefficient of the orientation of each sphere.

1.0

Examples:

>>> from skcomplex.systems.physics.soft_matter import RigidRodInteraction
>>> RigidRodInteraction('rod', target='dimers', L=2.0).L
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_rigid_bodies.py
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
def __init__(
    self,
    label: str,
    *,
    target: Role,
    L: Annotated[float, RealSet.open(0, oo)] = 1.0,
    v0: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
    D_t: Annotated[float, RealSet.closed_open(0, oo)] = 0.1,
    D_r: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.L = L
    self.v0 = v0
    self.D_t = D_t
    self.D_r = D_r

ScaledBrownianMotionSystem(n_particles=500, *, alpha=0.5, K=1.0, t0=0.01, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Scaled Brownian motion, dx = sqrt(2 K alpha (t + t0)^(alpha - 1)) dW.

Its mean squared displacement is <x^2> ~ 2 K t^alpha.

The diffusion coefficient changes deterministically in time, which is the same as running Brownian motion on the rescaled clock t^alpha. The offset t0 keeps the coefficient finite at the start. The system has the positions walkers.x.

Parameters:

Name Type Description Default
n_particles int

The number of independent walkers.

500
alpha float

The anomalous diffusion exponent, below 1 for subdiffusion and above 1 for superdiffusion.

0.5
K float

The generalized diffusion coefficient.

1.0
t0 float

The time offset of the diffusion coefficient.

0.01
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import ScaledBrownianMotionSystem
>>> ScaledBrownianMotionSystem(10, alpha=1.5).prepare().system_.interactions[0].alpha
1.5
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
def __init__(
    self,
    n_particles: int = 500,
    *,
    alpha: float = 0.5,
    K: float = 1.0,
    t0: float = 0.01,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_particles = n_particles
    self.alpha = alpha
    self.K = K
    self.t0 = t0

ScaledNoiseInteraction(label, *, target, K=1.0, alpha=0.5, t0=0.01)

Bases: Interaction

Noise whose diffusion coefficient K alpha (t + t0)^(alpha - 1) changes in time.

The position follows dx = sqrt(2 K alpha (t + t0)^(alpha - 1)) dW, Brownian motion on the rescaled clock t^alpha. It is a tracer in a cooling or ageing medium, or a walker whose steps shrink or grow in time.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the walkers.

required
K Annotated[float, open(0, oo)]

The generalized diffusion coefficient.

1.0
alpha Annotated[float, open(0, oo)]

The anomalous diffusion exponent.

0.5
t0 Annotated[float, open(0, oo)]

The time offset of the diffusion coefficient.

0.01

Examples:

>>> from skcomplex.systems.physics.soft_matter import ScaledNoiseInteraction
>>> ScaledNoiseInteraction('noise', target='walkers', alpha=1.5).alpha
1.5
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
183
184
185
186
187
188
189
190
191
192
193
194
195
196
def __init__(
    self,
    label: str,
    *,
    target: Role,
    K: Annotated[float, RealSet.open(0, oo)] = 1.0,
    alpha: Annotated[float, RealSet.open(0, oo)] = 0.5,
    t0: Annotated[float, RealSet.open(0, oo)] = 0.01,
) -> None:
    super().__init__(label)
    self.target = target
    self.K = K
    self.alpha = alpha
    self.t0 = t0

ScaledWalkerElement(label, *, x=0.0, size=None)

Bases: Element

Walkers at the positions x.

Parameters:

Name Type Description Default
label str

The label of the walkers.

required
x object

The initial position, one per walker or shared.

0.0
size int | None

The number of walkers, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import ScaledWalkerElement
>>> ScaledWalkerElement('walkers', x=1.0, size=10).x
1.0
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
148
149
150
def __init__(self, label: str, *, x: object = 0.0, size: int | None = None) -> None:
    super().__init__(label, size=size)
    self.x = x

ShakenFrictionInteraction(label, *, target, k=1.0, anchor=0.0, mu_s=1.0, mu_d=0.8, amplitude=2.0, shake_time=2.0, relax_time=8.0, v_stick=0.02)

Bases: Interaction

Springs, Coulomb friction, and periodic shaking of a chain of blocks.

The springs of stiffness k between neighbours and an anchor spring pull every block, Coulomb friction holds it while the force stays below mu_s and slows it by mu_d while it slides, and a random force of amplitude amplitude shakes it during the first shake_time of every shake_time + relax_time. It is a granular pile that is tapped, or a fault whose blocks stick and slip.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the blocks, whose positions are x, velocities v, and mass m.

required
k Annotated[float, closed_open(0, oo)]

The stiffness of the springs between neighbours.

1.0
anchor Annotated[float, closed_open(0, oo)]

The stiffness of the spring to the rest position.

0.0
mu_s Annotated[float, closed_open(0, oo)]

The static friction force.

1.0
mu_d Annotated[float, closed_open(0, oo)]

The dynamic friction force.

0.8
amplitude Annotated[float, closed_open(0, oo)]

The amplitude of the shaking force.

2.0
shake_time Annotated[float, open(0, oo)]

The duration of every shaking.

2.0
relax_time Annotated[float, open(0, oo)]

The time between shakings.

8.0
v_stick Annotated[float, open(0, oo)]

The speed below which a block can stick.

0.02

Examples:

>>> from skcomplex.systems.physics.soft_matter import ShakenFrictionInteraction
>>> ShakenFrictionInteraction('friction', target='chain', mu_s=2.0).mu_s
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_friction.py
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
def __init__(
    self,
    label: str,
    *,
    target: Role,
    k: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    anchor: Annotated[float, RealSet.closed_open(0, oo)] = 0.0,
    mu_s: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    mu_d: Annotated[float, RealSet.closed_open(0, oo)] = 0.8,
    amplitude: Annotated[float, RealSet.closed_open(0, oo)] = 2.0,
    shake_time: Annotated[float, RealSet.open(0, oo)] = 2.0,
    relax_time: Annotated[float, RealSet.open(0, oo)] = 8.0,
    v_stick: Annotated[float, RealSet.open(0, oo)] = 0.02,
) -> None:
    super().__init__(label)
    self.target = target
    self.k = k
    self.anchor = anchor
    self.mu_s = mu_s
    self.mu_d = mu_d
    self.amplitude = amplitude
    self.shake_time = shake_time
    self.relax_time = relax_time
    self.v_stick = v_stick

ShakenSpringBlockSystem(n_blocks=50, *, k=1.0, anchor=0.0, mu_s=1.0, mu_d=0.8, amplitude=2.0, shake_time=2.0, relax_time=8.0, v_stick=0.02, label='system', solver='auto', backend='auto')

Bases: BaseSystem

A chain of blocks joined by springs on a frictional substrate.

The chain is shaken and relaxed in turn.

Every block of unit weight feels the springs to its neighbours, k (x_{i+1} + x_{i-1} - 2 x_i), an optional spring of stiffness anchor to its rest position, and Coulomb friction. A sliding block feels the dynamic friction -mu_d sign(v), and a block at rest stays at rest while the spring force on it is below the static friction mu_s. In every cycle a random force of intensity amplitude^2 shakes the blocks for shake_time, and then the chain relaxes for relax_time to a blocked configuration, where the elongations xi_i = x_{i+1} - x_i satisfy k |xi_{i+1} - xi_i| < mu_s. Repeated cycles sample blocked configurations, whose energy per spring grows with the shaking, and whose elongations are correlated over a length that grows with that energy. Without springs between blocks and with an anchor, the blocks are independent, and their blocked positions satisfy |x_i| < mu_s / anchor. A block counts as at rest below the speed v_stick, which must exceed the change of speed (mu_s + mu_d) h of a solver step h. The ends of the chain are free, and the blocks start at rest. The system has the positions chain.x and velocities chain.v of the blocks.

Parameters:

Name Type Description Default
n_blocks int

The number of blocks.

50
k float

The stiffness of the springs between neighbouring blocks.

1.0
anchor float

The stiffness of the springs that hold every block to its rest position.

0.0
mu_s float

The static friction coefficient.

1.0
mu_d float

The dynamic friction coefficient.

0.8
amplitude float

The amplitude of the random shaking force.

2.0
shake_time float

The duration of the shaking in every cycle.

2.0
relax_time float

The duration of the relaxation in every cycle.

8.0
v_stick float

The speed below which a block counts as at rest.

0.02
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import ShakenSpringBlockSystem
>>> ShakenSpringBlockSystem(5).prepare().simulate(until=10.0).get_values('chain.x').shape
(2, 5)
Source code in src/skcomplex/systems/physics/soft_matter/_friction.py
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
def __init__(
    self,
    n_blocks: int = 50,
    *,
    k: float = 1.0,
    anchor: float = 0.0,
    mu_s: float = 1.0,
    mu_d: float = 0.8,
    amplitude: float = 2.0,
    shake_time: float = 2.0,
    relax_time: float = 8.0,
    v_stick: float = 0.02,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_blocks = n_blocks
    self.k = k
    self.anchor = anchor
    self.mu_s = mu_s
    self.mu_d = mu_d
    self.amplitude = amplitude
    self.shake_time = shake_time
    self.relax_time = relax_time
    self.v_stick = v_stick

SpeckleFieldInteraction(label, *, target, strength=1.0, centers=(), intensities=(), lengths=())

Bases: Interaction

Random optical speckle field of Gaussian hotspots.

The field drags particles up its gradient at u grad(I).

The potential is -u I(x), with the intensity I(x) = sum_i I_i exp(-|x - c_i|^2 / d_i^2) of hotspots whose centers, intensities relative to strength, and decay lengths are fixed when the field is created.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the particles, whose positions are x.

required
strength Annotated[float, closed_open(0, oo)]

The product u I0 of the polarizability constant and the reference intensity.

1.0
centers tuple[tuple[float, float], ...]

The centers of the hotspots.

()
intensities tuple[float, ...]

The intensities of the hotspots in units of the reference intensity.

()
lengths tuple[float, ...]

The decay lengths of the hotspots.

()

Examples:

>>> from skcomplex.systems.physics.soft_matter import SpeckleFieldInteraction
>>> SpeckleFieldInteraction(
...     'speckle', target='bead', centers=((0.0, 0.0),), intensities=(1.0,), lengths=(1.0,)
... ).strength
1.0
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
def __init__(
    self,
    label: str,
    *,
    target: Role,
    strength: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    centers: tuple[tuple[float, float], ...] = (),
    intensities: tuple[float, ...] = (),
    lengths: tuple[float, ...] = (),
) -> None:
    super().__init__(label)
    self.target = target
    self.strength = strength
    self.centers = centers
    self.intensities = intensities
    self.lengths = lengths

StochasticResonanceSystem(x=-1.0, *, amplitude=0.1, frequency=0.01, D=0.12, label='system', solver='auto', backend='auto')

Bases: BaseSystem

A particle in a double well.

The particle follows dx = (x - x^3 + A cos(2 pi f t)) dt + sqrt(2 D) dW.

The forcing alone is too weak to move the particle between the wells, but noise of the right intensity makes the hops follow the forcing. The system has the position particle.x.

Parameters:

Name Type Description Default
x float

The initial position.

-1.0
amplitude float

The amplitude of the periodic forcing.

0.1
frequency float

The frequency of the forcing.

0.01
D float

The noise intensity.

0.12
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import StochasticResonanceSystem
>>> StochasticResonanceSystem(D=0.2).prepare().system_.interactions[0].D
0.2
Source code in src/skcomplex/systems/physics/soft_matter/_brownian.py
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
def __init__(
    self,
    x: float = -1.0,
    *,
    amplitude: float = 0.1,
    frequency: float = 0.01,
    D: float = 0.12,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.x = x
    self.amplitude = amplitude
    self.frequency = frequency
    self.D = D

ThermalNoiseInteraction(label, *, target, state='x')

Bases: Interaction

Thermal noise of overdamped particles, the random force sqrt(2 gamma temperature) dW over gamma.

The friction gamma and the thermal energy temperature are values of the target, so every component of the position diffuses with the coefficient temperature / gamma. It is a bead in water, a protein in a cell, or a pollen grain under a microscope.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the particle or the group.

required
state str

The name of the position of the target.

'x'

Examples:

>>> from skcomplex.systems.physics.soft_matter import ThermalNoiseInteraction
>>> ThermalNoiseInteraction('bath', target='beads').state
'x'
Source code in src/skcomplex/systems/physics/soft_matter/_diffusion.py
442
443
444
445
def __init__(self, label: str, *, target: Role, state: str = 'x') -> None:
    super().__init__(label)
    self.target = target
    self.state = state

TiltedPeriodicPotentialSystem(n_particles=500, *, f=1.0, U0=0.5, L=1.0, gamma=1.0, kT=0.5, label='system', solver='auto', backend='auto')

Bases: BaseSystem

Overdamped particles in a tilted periodic potential.

The potential is V(x) = U0 cos(2 pi x / L) - f x.

The force f breaks the left and right symmetry, so the particles reach a nonequilibrium steady state with a uniform probability current J. Their mean velocity is J L = L (1 - exp(-f L / kT)) / int_0^L dx int_0^L dy exp((V(x) - V(x - y)) / kT) kT / gamma, which is f / gamma without the potential and exponentially small in the barrier for a weak force. The particles start at the origin. The system has the positions particles.x.

Parameters:

Name Type Description Default
n_particles int

The number of independent particles.

500
f float

The constant force that tilts the potential.

1.0
U0 float

The amplitude of the periodic potential.

0.5
L float

The period of the potential.

1.0
gamma float

The friction coefficient.

1.0
kT float

The thermal energy.

0.5
label str

The label of the system, which names it when it is nested in another one.

'system'
solver BaseSolver | str

The solver of the problem, or 'auto' for the one the system chooses.

'auto'
backend BaseBackend | str

The backend that evaluates the compiled functions, or 'auto' for the one the system chooses.

'auto'

Examples:

>>> from skcomplex.systems.physics.soft_matter import TiltedPeriodicPotentialSystem
>>> TiltedPeriodicPotentialSystem(10, f=2.0).prepare().system_.interactions[0].f
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_ratchets.py
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
def __init__(
    self,
    n_particles: int = 500,
    *,
    f: float = 1.0,
    U0: float = 0.5,
    L: float = 1.0,
    gamma: float = 1.0,
    kT: float = 0.5,
    label: str = 'system',
    solver: BaseSolver | str = 'auto',
    backend: BaseBackend | str = 'auto',
) -> None:
    super().__init__(label, solver=solver, backend=backend)
    self.n_particles = n_particles
    self.f = f
    self.U0 = U0
    self.L = L
    self.gamma = gamma
    self.kT = kT

TiltedWashboardInteraction(label, *, target, U0=1.0, L=1.0, f=0.0)

Bases: Interaction

Tilted periodic potential U(x) - f x on overdamped particles on a line.

The periodic part is U(x) = U0 cos(2 pi x / L).

The force divides by the friction gamma of the target.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the particles, whose positions are x and friction gamma.

required
U0 Annotated[float, closed_open(0, oo)]

The amplitude of the periodic potential, half its barrier height.

1.0
L Annotated[float, open(0, oo)]

The period of the potential.

1.0
f float

The constant non-conservative force that tilts the potential.

0.0

Examples:

>>> from skcomplex.systems.physics.soft_matter import TiltedWashboardInteraction
>>> TiltedWashboardInteraction('washboard', target='beads', f=0.5).f
0.5
Source code in src/skcomplex/systems/physics/soft_matter/_ratchets.py
133
134
135
136
137
138
139
140
141
142
143
144
145
146
def __init__(
    self,
    label: str,
    *,
    target: Role,
    U0: Annotated[float, RealSet.closed_open(0, oo)] = 1.0,
    L: Annotated[float, RealSet.open(0, oo)] = 1.0,
    f: float = 0.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.U0 = U0
    self.L = L
    self.f = f

TransientDiffusionInteraction(label, *, target, sigma=0.5, gamma=1.0)

Bases: Interaction

Brownian motion whose diffusion coefficient D is redrawn at random times.

The position x diffuses with D, and after an exponential waiting time of mean D^(-gamma) the coefficient is redrawn from the density sigma D^(sigma - 1) on (0, 1), the beta distribution B(sigma, 1), so slow walkers wait long before they change. It is a protein that binds and unbinds in a cell membrane, or a tracer in a heterogeneous gel.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the walkers.

required
sigma Annotated[float, open(0, oo)]

The exponent of the density of diffusion coefficients near zero.

0.5
gamma Annotated[float, open(0, oo)]

The exponent of the mean waiting time D^(-gamma).

1.0

Examples:

>>> from skcomplex.systems.physics.soft_matter import TransientDiffusionInteraction
>>> TransientDiffusionInteraction('changes', target='walkers', gamma=2.0).gamma
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
426
427
428
429
430
431
432
433
434
435
436
437
def __init__(
    self,
    label: str,
    *,
    target: Role,
    sigma: Annotated[float, RealSet.open(0, oo)] = 0.5,
    gamma: Annotated[float, RealSet.open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.sigma = sigma
    self.gamma = gamma

TransientWalkerElement(label, *, x=(0.0, 0.0), D=0.5, size=None)

Bases: Element

Brownian walkers at the positions x with the diffusion coefficients D.

Parameters:

Name Type Description Default
label str

The label of the walkers.

required
x object

The initial position, one row per walker or shared.

(0.0, 0.0)
D object

The initial diffusion coefficient, one per walker or shared.

0.5
size int | None

The number of walkers, or None for one.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import TransientWalkerElement
>>> TransientWalkerElement('walkers', D=0.2, size=10).D
0.2
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
391
392
393
394
def __init__(self, label: str, *, x: object = (0.0, 0.0), D: object = 0.5, size: int | None = None) -> None:
    super().__init__(label, size=size)
    self.x = x
    self.D = D

TrapSiteElement(label, *, occupied=0.0, visited=0.0, clock=0.0, tau=1.0, space=None)

Bases: Element

Site of a line of traps.

The site holds a walker for its trapping time tau before the walker hops to the right.

The walker on a site counts the steps it has spent there with clock, and every site keeps a record of whether a walker has visited it.

Parameters:

Name Type Description Default
label str

The label of the site or the lattice of sites.

required
occupied Annotated[object, FiniteEnumeratedSet([0, 1])]

Whether a walker is on the site.

0.0
visited Annotated[object, FiniteEnumeratedSet([0, 1])]

Whether a walker has been on the site.

0.0
clock Annotated[object, NN]

The number of steps the walker has spent on the site.

0.0
tau Annotated[object, open(0, oo)]

The trapping time of the site.

1.0
space BaseSpace | None

The lattice whose sites hold one site each, or None for one site.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import TrapSiteElement
>>> TrapSiteElement('site', tau=3.0).tau
3.0
Source code in src/skcomplex/systems/physics/soft_matter/_traps.py
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
def __init__(
    self,
    label: str,
    *,
    occupied: Annotated[object, FiniteEnumeratedSet([0, 1])] = 0.0,
    visited: Annotated[object, FiniteEnumeratedSet([0, 1])] = 0.0,
    clock: Annotated[object, NN] = 0.0,
    tau: Annotated[object, RealSet.open(0, oo)] = 1.0,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, space=space)
    self.occupied = occupied
    self.visited = visited
    self.clock = clock
    self.tau = tau

TrappedSphereElement(label, *, x=0.0, center=0.0, size=None, space=None)

Bases: Element

Colloidal sphere at the position x, held by an optical trap.

The trap is centred at center.

The sphere has no friction of its own. A mobility interaction moves it through the fluid it shares with the other spheres, and its trap is one of the forces the mobility turns into velocities.

Parameters:

Name Type Description Default
label str

The label of the sphere or the group.

required
x ArrayLike

The initial position.

0.0
center ArrayLike

The centre of the trap of the sphere.

0.0
size int | None

The number of spheres, or None for one.

None
space BaseSpace | None

The continuous space of the spheres, or None for none.

None

Examples:

>>> from skcomplex.systems.physics.soft_matter import TrappedSphereElement
>>> TrappedSphereElement('bead', center=[3.0, 0.0]).center
[3.0, 0.0]
Source code in src/skcomplex/systems/physics/soft_matter/_coupled_traps.py
63
64
65
66
67
68
69
70
71
72
73
74
def __init__(
    self,
    label: str,
    *,
    x: npt.ArrayLike = 0.0,
    center: npt.ArrayLike = 0.0,
    size: int | None = None,
    space: BaseSpace | None = None,
) -> None:
    super().__init__(label, size=size, space=space)
    self.x = x
    self.center = center

WaitingJumpInteraction(label, *, target, alpha=0.5, tau0=1.0, sigma=1.0)

Bases: Interaction

Jumps by Gaussian steps after power-law waiting times.

The waiting time is tau0 r^(-1 / alpha) for r uniform, and every jump adds a normal step of standard deviation sigma to every coordinate of the position x. It is a tracer trapped in a porous rock, a charge carrier in an amorphous semiconductor, or a molecule in a crowded cell.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the walkers.

required
alpha Annotated[float, open(0, oo)]

The tail exponent of the waiting times, below 1 for waiting times without a mean.

0.5
tau0 Annotated[float, open(0, oo)]

The shortest waiting time.

1.0
sigma Annotated[float, open(0, oo)]

The standard deviation of the jumps along every axis.

1.0

Examples:

>>> from skcomplex.systems.physics.soft_matter import WaitingJumpInteraction
>>> WaitingJumpInteraction('jumps', target='walkers', alpha=0.7).alpha
0.7
Source code in src/skcomplex/systems/physics/soft_matter/_anomalous.py
84
85
86
87
88
89
90
91
92
93
94
95
96
97
def __init__(
    self,
    label: str,
    *,
    target: Role,
    alpha: Annotated[float, RealSet.open(0, oo)] = 0.5,
    tau0: Annotated[float, RealSet.open(0, oo)] = 1.0,
    sigma: Annotated[float, RealSet.open(0, oo)] = 1.0,
) -> None:
    super().__init__(label)
    self.target = target
    self.alpha = alpha
    self.tau0 = tau0
    self.sigma = sigma

WallMobilityInteraction(label, *, target, D0=1.0, a=1.0, drift=0.2, convention='anti-ito')

Bases: Interaction

Settling of a Brownian particle on a wall that reflects it and slows its diffusion.

The diffusion is D(z) = D0 z² / (z² + a²) at the distance z from the wall, and the drift is the settling velocity scaled by the same mobility, so dz = -drift z |z| / (z² + a²) dt + sqrt(2 D(z)) dW. The laws are symmetric about the wall at z = 0, which reflects the particle at every frame. It is a colloid settling on a microscope slide, or a protein near a membrane.

Parameters:

Name Type Description Default
label str

The label of the interaction.

required
target Role

The path of the particle.

required
D0 Annotated[float, open(0, oo)]

The diffusion coefficient far from the wall.

1.0
a Annotated[float, open(0, oo)]

The distance over which the wall slows diffusion.

1.0
drift float

The settling velocity far from the wall.

0.2
convention str

The convention of the noise, 'ito', 'stratonovich', or 'anti-ito'.

'anti-ito'

Examples:

>>> from skcomplex.systems.physics.soft_matter import WallMobilityInteraction
>>> WallMobilityInteraction('mobility', target='bead').a
1.0
Source code in src/skcomplex/systems/physics/soft_matter/_brownian.py
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
def __init__(
    self,
    label: str,
    *,
    target: Role,
    D0: Annotated[float, RealSet.open(0, oo)] = 1.0,
    a: Annotated[float, RealSet.open(0, oo)] = 1.0,
    drift: float = 0.2,
    convention: str = 'anti-ito',
) -> None:
    super().__init__(label)
    self.target = target
    self.D0 = D0
    self.a = a
    self.drift = drift
    self.convention = convention

WallParticleElement(label, *, z=1.0)

Bases: Element

Brownian particle at the distance z from a wall.

Parameters:

Name Type Description Default
label str

The label of the particle.

required
z Annotated[float, closed_open(0, oo)]

The distance from the wall.

1.0

Examples:

>>> from skcomplex.systems.physics.soft_matter import WallParticleElement
>>> WallParticleElement('bead', z=2.0).z
2.0
Source code in src/skcomplex/systems/physics/soft_matter/_brownian.py
43
44
45
def __init__(self, label: str, *, z: Annotated[float, RealSet.closed_open(0, oo)] = 1.0) -> None:
    super().__init__(label)
    self.z = z