Soft matter
Soft matter: Brownian particles, optical traps, anomalous diffusion, and noise-driven transitions.
BrownianParticleElement(label, visual=POINTS, *, x=0.0, gamma=1.0, temperature=1.0)
Bases: Element
Overdamped Brownian particle at the position x, with the friction gamma and the thermal energy temperature.
The particle moves by dx = F / gamma dt + sqrt(2 temperature / gamma) dW, with the thermal noise of
ThermalNoiseInteraction and the forces of other interactions, which divide by gamma.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the particle or the group. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
POINTS
|
x
|
Annotated[ArrayLike, StateSpec(vector=True, role=position)]
|
The initial position. |
0.0
|
gamma
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The friction coefficient. |
1.0
|
temperature
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The thermal energy. |
1.0
|
Examples:
>>> from skcomplex.models.physics.soft_matter import BrownianParticleElement
>>> BrownianParticleElement('bead', temperature=2.0).temperature
2.0
Source code in src/skcomplex/models/physics/soft_matter/_brownian_particle.py
46 47 48 49 50 51 52 53 54 55 56 57 58 | |
ColoredNoiseParticleElement(label, visual=None, *, v=0.0, xi=0.0, gamma=1.0, D=1.0, tau=1.0)
Bases: Element
Particle with the velocity v, driven by the noise xi of correlation time tau.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the particle. |
required |
visual
|
VisualSpec | None
|
How the particle is drawn, or |
None
|
v
|
Annotated[float, StateSpec()]
|
The initial velocity. |
0.0
|
xi
|
Annotated[float, StateSpec()]
|
The initial noise. |
0.0
|
gamma
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The friction coefficient. |
1.0
|
D
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The noise intensity. |
1.0
|
tau
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The correlation time of the noise. |
1.0
|
Examples:
>>> from skcomplex.models.physics.soft_matter import ColoredNoiseParticleElement
>>> ColoredNoiseParticleElement('particle', tau=0.5).tau
0.5
Source code in src/skcomplex/models/physics/soft_matter/_colored_noise.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
ContinuousTimeWalkerElement(label, visual=POINTS, *, x=0.0, alpha=0.5, tau0=1.0, sigma=1.0)
Bases: Element
Walker that waits a power-law time tau0 r^(-1 / alpha) for r uniform, then jumps by a Gaussian step.
The jumps are a jump interaction of the model, which resets the position after every waiting time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the walker or the group. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
POINTS
|
x
|
Annotated[ArrayLike, StateSpec(vector=True, role=position)]
|
The initial position. |
0.0
|
alpha
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The tail exponent of the waiting times, below 1 for waiting times without a mean. |
0.5
|
tau0
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The shortest waiting time. |
1.0
|
sigma
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The standard deviation of the jumps along every axis. |
1.0
|
Examples:
>>> from skcomplex.models.physics.soft_matter import ContinuousTimeWalkerElement
>>> ContinuousTimeWalkerElement('walker', alpha=0.7).alpha
0.7
Source code in src/skcomplex/models/physics/soft_matter/_continuous_time_walker.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
DoubleWellElement(label, visual=None, *, x=-1.0, amplitude=0.1, frequency=0.01, D=0.12)
Bases: Element
Particle at the position x in the double well x^4 / 4 - x^2 / 2, forced periodically and by noise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the particle. |
required |
visual
|
VisualSpec | None
|
How the particle is drawn, or |
None
|
x
|
Annotated[float, StateSpec(role=position)]
|
The initial position. |
-1.0
|
amplitude
|
Annotated[float, ParameterSpec()]
|
The amplitude of the periodic forcing. |
0.1
|
frequency
|
Annotated[float, ParameterSpec()]
|
The frequency of the forcing. |
0.01
|
D
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The noise intensity. |
0.12
|
Examples:
>>> from skcomplex.models.physics.soft_matter import DoubleWellElement
>>> DoubleWellElement('particle', D=0.2).D
0.2
Source code in src/skcomplex/models/physics/soft_matter/_double_well.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
FlashingSawtoothInteraction(label, *, target, barrier=1.0, L=1.0, asymmetry=0.1, switches=())
Bases: RateInteraction
Sawtooth potential on overdamped particles on a line, 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
|
Annotated[str, RoleSpec()]
|
The path of the particle or the group. |
required |
barrier
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The height of the sawtooth. |
1.0
|
L
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The period of the sawtooth. |
1.0
|
asymmetry
|
Annotated[float, ParameterSpec(domain=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.models.physics.soft_matter import FlashingSawtoothInteraction
>>> FlashingSawtoothInteraction('ratchet', target='beads', switches=(1.0, 2.5)).switches
(1.0, 2.5)
Source code in src/skcomplex/models/physics/soft_matter/_flashing_sawtooth.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
FractionalWalkerElement(label, visual=POINTS, *, x=0.0, D=1.0, H=0.3)
Bases: Element
Walker driven by fractional Brownian motion, dx = sqrt(2 D) dB_H, whose increments are correlated in time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the walker or the group. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
POINTS
|
x
|
Annotated[ArrayLike, StateSpec(vector=True, role=position)]
|
The initial position. |
0.0
|
D
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The diffusion coefficient. |
1.0
|
H
|
Annotated[float, ParameterSpec(domain=open(0, 1))]
|
The Hurst index of the driving fractional Brownian motion. |
0.3
|
Examples:
>>> from skcomplex.models.physics.soft_matter import FractionalWalkerElement
>>> FractionalWalkerElement('walker', H=0.3).H
0.3
Source code in src/skcomplex/models/physics/soft_matter/_fractional_walker.py
42 43 44 45 46 47 48 49 50 51 52 53 54 | |
FrictionalBlockElement(label, visual=None, *, x=0.0, v=0.0, m=1.0, 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: Element
Block of a chain on a rough floor, at the position x with the velocity v, joined to its neighbours.
The springs of stiffness k and an anchor spring pull the block, Coulomb friction holds it while the force stays
below mu_s and slows it by mu_d while it slides, and periodic shaking of amplitude amplitude kicks it during
the first shake_time of every shake_time + relax_time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the block. |
required |
visual
|
VisualSpec | None
|
How the block is drawn, or |
None
|
x
|
Annotated[float, StateSpec()]
|
The initial position. |
0.0
|
v
|
Annotated[float, StateSpec()]
|
The initial velocity. |
0.0
|
m
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The mass. |
1.0
|
k
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The stiffness of the springs between neighbours. |
1.0
|
anchor
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The stiffness of the spring to the rest position. |
0.0
|
mu_s
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The static friction force. |
1.0
|
mu_d
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The dynamic friction force. |
0.8
|
amplitude
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The amplitude of the shaking force. |
2.0
|
shake_time
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The duration of every shaking. |
2.0
|
relax_time
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The time between shakings. |
8.0
|
v_stick
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The speed below which the block can stick. |
0.02
|
Examples:
>>> from skcomplex.models.physics.soft_matter import FrictionalBlockElement
>>> FrictionalBlockElement('block', mu_s=2.0).mu_s
2.0
Source code in src/skcomplex/models/physics/soft_matter/_friction.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
LevyFlierElement(label, visual=POINTS, *, x=0.0, mu=1.2, l0=1.0)
Bases: Element
Walker that jumps at every step by a length of power-law tail l^(-1 - mu) in a random direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the walker or the group. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
POINTS
|
x
|
Annotated[ArrayLike, StateSpec(vector=True, role=position)]
|
The initial position. |
0.0
|
mu
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The tail exponent of the jump lengths, below 2 for jumps of infinite variance. |
1.2
|
l0
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The shortest jump length. |
1.0
|
Examples:
>>> from skcomplex.models.physics.soft_matter import LevyFlierElement
>>> LevyFlierElement('walker', mu=1.2).mu
1.2
Source code in src/skcomplex/models/physics/soft_matter/_levy_flier.py
42 43 44 45 46 47 48 49 50 51 52 53 54 | |
LevyWalkerElement(label, visual=POINTS, *, x=0.0, v=0.0, sigma=1.5, tau0=1.0, speed=1.0)
Bases: Element
Walker that flies at constant speed in a random direction for a power-law flight time, then turns.
The flight is a rate interaction of the position, and the turns a jump interaction that resets the velocity after every flight time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the walker or the group. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
POINTS
|
x
|
Annotated[ArrayLike, StateSpec(vector=True, role=position)]
|
The initial position. |
0.0
|
v
|
Annotated[ArrayLike, StateSpec(vector=True, role=velocity)]
|
The initial velocity. |
0.0
|
sigma
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The tail exponent of the flight times, between 1 and 2 for superdiffusion. |
1.5
|
tau0
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The shortest flight time. |
1.0
|
speed
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The speed of every flight. |
1.0
|
Examples:
>>> from skcomplex.models.physics.soft_matter import LevyWalkerElement
>>> LevyWalkerElement('walker', speed=2.0).speed
2.0
Source code in src/skcomplex/models/physics/soft_matter/_levy_walker.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
ModulatedParticleElement(label, visual=None, *, x=50.0, s0=1.0, ds=1.8, L=100.0)
Bases: Element
Particle at the position x in a box [0, L] whose walls reflect it.
The noise amplitude sigma = s0 + ds (x / L - 1/2) grows across the box. The walls reflect the particle at every
frame, so frames must be short against the time to cross the box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the particle or the group. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
None
|
x
|
Annotated[float, StateSpec(role=position)]
|
The initial position. |
50.0
|
s0
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The noise amplitude at the middle of the box. |
1.0
|
ds
|
Annotated[float, ParameterSpec()]
|
The change of the noise amplitude across the box. |
1.8
|
L
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The length of the box. |
100.0
|
Examples:
>>> from skcomplex.models.physics.soft_matter import ModulatedParticleElement
>>> ModulatedParticleElement('bead').ds
1.8
Source code in src/skcomplex/models/physics/soft_matter/_modulated_particle.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
OpticalTrapInteraction(label, *, target, k=1.0, amplitude=0.0, frequency=0.0, blink_period=None, duty=0.5)
Bases: GradientInteraction
Harmonic optical trap on overdamped particles, the potential sum_d k_d (x_d - c_d(t))^2 / 2 of 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
|
Annotated[str, RoleSpec()]
|
The path of the particle or the group. |
required |
k
|
Annotated[ArrayLike, ParameterSpec(vector=True)]
|
The stiffness along every axis. |
1.0
|
amplitude
|
Annotated[ArrayLike, ParameterSpec(vector=True)]
|
The amplitude of the oscillation of the center along every axis. |
0.0
|
frequency
|
Annotated[float, ParameterSpec(domain=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
|
duty
|
float
|
The fraction of every blinking period during which the trap is on. |
0.5
|
Examples:
>>> from skcomplex.models.physics.soft_matter import OpticalTrapInteraction
>>> OpticalTrapInteraction('tweezers', target='bead', k=[1.0, 0.25]).k
[1.0, 0.25]
Source code in src/skcomplex/models/physics/soft_matter/_optical_trap.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
ScaledWalkerElement(label, visual=None, *, x=0.0, K=1.0, alpha=0.5, t0=0.01)
Bases: Element
Walker at the position x whose diffusion coefficient K alpha (t + t0)^(alpha - 1) changes in time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the walker or the group. |
required |
visual
|
VisualSpec | None
|
How the walker is drawn, or |
None
|
x
|
Annotated[float, StateSpec(role=position)]
|
The initial position. |
0.0
|
K
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The generalized diffusion coefficient. |
1.0
|
alpha
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The anomalous diffusion exponent. |
0.5
|
t0
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The time offset of the diffusion coefficient. |
0.01
|
Examples:
>>> from skcomplex.models.physics.soft_matter import ScaledWalkerElement
>>> ScaledWalkerElement('walker', alpha=1.5).alpha
1.5
Source code in src/skcomplex/models/physics/soft_matter/_scaled_walker.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
SpeckleFieldInteraction(label, *, target, strength=1.0, centers=(), intensities=(), lengths=())
Bases: GradientInteraction
Random optical speckle field of Gaussian hotspots, which 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
|
Annotated[str, RoleSpec()]
|
The path of the particle or the group. |
required |
strength
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The product |
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.models.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/models/physics/soft_matter/_speckle_field.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
ThermalNoiseInteraction(label, *, target, state='x')
Bases: RateInteraction
Thermal noise of overdamped particles, the random force sqrt(2 gamma temperature) dW divided by gamma.
The friction gamma and the thermal energy temperature are parameters of the target, so every component of the
position diffuses with the coefficient temperature / gamma.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Annotated[str, RoleSpec()]
|
The path of the particle or the group. |
required |
state
|
str
|
The name of the state that holds the positions. |
'x'
|
Examples:
>>> from skcomplex.models.physics.soft_matter import ThermalNoiseInteraction
>>> ThermalNoiseInteraction('bath', target='beads').divisor
'gamma'
Source code in src/skcomplex/models/physics/soft_matter/_thermal_noise.py
37 38 | |
TiltedWashboardInteraction(label, *, target, U0=1.0, L=1.0, f=0.0)
Bases: GradientInteraction
Tilted periodic potential U(x) - f x, with U(x) = U0 cos(2 pi x / L), on overdamped particles on a line.
The force divides by the friction gamma of the target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Annotated[str, RoleSpec()]
|
The path of the particle or the group. |
required |
U0
|
Annotated[float, ParameterSpec(domain=closed_open(0, oo))]
|
The amplitude of the periodic potential, half its barrier height. |
1.0
|
L
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The period of the potential. |
1.0
|
f
|
Annotated[float, ParameterSpec()]
|
The constant non-conservative force that tilts the potential. |
0.0
|
Examples:
>>> from skcomplex.models.physics.soft_matter import TiltedWashboardInteraction
>>> TiltedWashboardInteraction('washboard', target='beads', f=0.5).f
0.5
Source code in src/skcomplex/models/physics/soft_matter/_tilted_washboard.py
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
TransientWalkerElement(label, visual=VisualSpec('points', {'position': 'x', 'color_by': 'D', 'color_range': (0.0, 1.0)}), *, x=0.0, D=0.5, sigma=0.5, gamma=1.0)
Bases: Element
Brownian walker whose diffusion coefficient D is redrawn after waiting times of mean D^(-gamma).
The coefficient takes values of density sigma D^(sigma - 1) on (0, 1), the beta distribution B(sigma, 1), so
slow walkers wait long before they change.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the walker or the group. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
VisualSpec('points', {'position': 'x', 'color_by': 'D', 'color_range': (0.0, 1.0)})
|
x
|
Annotated[ArrayLike, StateSpec(vector=True, role=position)]
|
The initial position. |
0.0
|
D
|
Annotated[float, StateSpec(domain=open(0, oo))]
|
The initial diffusion coefficient. |
0.5
|
sigma
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The exponent of the density of diffusion coefficients near zero. |
0.5
|
gamma
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The exponent of the mean waiting time |
1.0
|
Examples:
>>> from skcomplex.models.physics.soft_matter import TransientWalkerElement
>>> TransientWalkerElement('walker', gamma=2.0).gamma
2.0
Source code in src/skcomplex/models/physics/soft_matter/_transient_walker.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
TrapSiteElement(label, visual=None, *, occupied=0.0, visited=0.0, clock=0.0, tau=1.0)
Bases: Element
Site of a line of traps, which 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 hops to the next site after tau
steps, and every site keeps a record of whether a walker has visited it. A walker hops 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.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the site or the lattice group. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
None
|
occupied
|
Annotated[float, StateSpec(domain=FiniteEnumeratedSet([0, 1]))]
|
Whether a walker is on the site. |
0.0
|
visited
|
Annotated[float, StateSpec(domain=FiniteEnumeratedSet([0, 1]))]
|
Whether a walker has been on the site. |
0.0
|
clock
|
Annotated[float, StateSpec(domain=NN)]
|
The number of steps the walker has spent on the site. |
0.0
|
tau
|
Annotated[float, StateSpec(domain=open(0, oo))]
|
The trapping time of the site. |
1.0
|
Examples:
>>> from skcomplex.models.physics.soft_matter import TrapSiteElement
>>> TrapSiteElement('site', tau=3.0).tau
3.0
Source code in src/skcomplex/models/physics/soft_matter/_traps.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
WallParticleElement(label, visual=None, *, z=1.0, D0=1.0, a=1.0, drift=0.2)
Bases: Element
Brownian particle at the distance z from a wall, which reflects it, and whose diffusion slows near the wall.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the particle. |
required |
visual
|
VisualSpec | None
|
How the element is drawn, or |
None
|
z
|
Annotated[float, StateSpec(domain=closed_open(0, oo))]
|
The distance from the wall. |
1.0
|
D0
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The diffusion coefficient far from the wall. |
1.0
|
a
|
Annotated[float, ParameterSpec(domain=open(0, oo))]
|
The distance over which the wall slows diffusion. |
1.0
|
drift
|
Annotated[float, ParameterSpec()]
|
The settling velocity far from the wall. |
0.2
|
Examples:
>>> from skcomplex.models.physics.soft_matter import WallParticleElement
>>> WallParticleElement('bead').a
1.0
Source code in src/skcomplex/models/physics/soft_matter/_wall_particle.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
annealed_transient_time_motion(n_walkers=500, *, sigma=0.5, gamma=1.0, n_dim=2, random_state=0)
Return annealed transient time motion, Brownian walkers whose diffusion coefficient 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).
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 |
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import annealed_transient_time_motion
>>> annealed_transient_time_motion(10, gamma=2.0).elements[0].values['gamma']
2.0
Source code in src/skcomplex/models/physics/soft_matter/_anomalous.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
biased_trap_walk(n_walkers=100, *, n_sites=300, alpha=0.5, tau0=1.0, random_state=0)
Return walkers that hop always to the right through quenched traps with broadly distributed trapping times.
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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the lattice |
Examples:
>>> from skcomplex.models.physics.soft_matter import biased_trap_walk
>>> biased_trap_walk(4, n_sites=10).elements[0].check().prepare().size_
40
Source code in src/skcomplex/models/physics/soft_matter/_traps.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 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 158 159 160 161 162 163 164 165 166 | |
brownian_motion(n_particles=500, *, inertial=True, m=1.0, gamma=1.0, kT=1.0, n_dim=1, random_state=0)
Return free Brownian particles with inertia, m x'' = -gamma x' + sqrt(2 kT gamma) W, or without it.
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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import brownian_motion
>>> brownian_motion(10, inertial=False).elements[0].element.__name__
'BrownianParticleElement'
Source code in src/skcomplex/models/physics/soft_matter/_diffusion.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
brownian_near_wall(z=1.0, *, D0=1.0, a=1.0, drift=0.2, convention='anti-ito')
Return a Brownian particle whose diffusion slows near a wall, D(z) = D0 z² / (z² + a²), as it settles on it.
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.
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, |
'anti-ito'
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the distance |
Examples:
>>> from skcomplex.models.physics.soft_matter import brownian_near_wall
>>> brownian_near_wall(convention='ito').interactions[0].convention
'ito'
Source code in src/skcomplex/models/physics/soft_matter/_brownian.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
colored_noise_langevin(n_particles=500, *, gamma=1.0, D=1.0, tau=1.0, random_state=0)
Return particles whose velocity dv/dt = -gamma v + xi is driven by Ornstein-Uhlenbeck noise 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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the velocities |
Examples:
>>> from skcomplex.models.physics.soft_matter import colored_noise_langevin
>>> colored_noise_langevin(10, tau=0.5).elements[0].values['tau']
0.5
Source code in src/skcomplex/models/physics/soft_matter/_colored_noise.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
continuous_time_random_walk(n_walkers=500, *, alpha=0.5, tau0=1.0, sigma=1.0, n_dim=2)
Return the continuous-time random walk, Gaussian jumps after 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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import continuous_time_random_walk
>>> continuous_time_random_walk(10, alpha=0.7).elements[0].values['alpha']
0.7
Source code in src/skcomplex/models/physics/soft_matter/_anomalous.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
diffusion_in_a_speckle_field(n_particles=100, *, n_hotspots=50, size=100.0, strength=30.0, length=10.0, D=1.0, random_state=0)
Return Brownian particles in a random speckle field, 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.
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 |
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import diffusion_in_a_speckle_field
>>> len(diffusion_in_a_speckle_field(5, n_hotspots=3).interactions[0].centers)
3
Source code in src/skcomplex/models/physics/soft_matter/_diffusion.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | |
flashing_ratchet(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)
Return the on-off flashing ratchet, Brownian particles 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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import flashing_ratchet
>>> len(flashing_ratchet(10, rate=2.0, duration=5.0).interactions[0].switches) > 0
True
Source code in src/skcomplex/models/physics/soft_matter/_ratchets.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 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 158 159 160 161 162 163 | |
fractional_brownian_motion(n_walkers=500, *, H=0.3, D=1.0, n_dim=2)
Return fractional Brownian motion, dx = sqrt(2 D) dB_H, with <x^2> = 2 D t^(2 H) along every axis.
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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import fractional_brownian_motion
>>> fractional_brownian_motion(10, H=0.7).elements[0].values['H']
0.7
Source code in src/skcomplex/models/physics/soft_matter/_anomalous.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 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
kramers_escape(n_particles=200, *, D=0.1, random_state=0)
Return particles that escape over the barrier of U = x^4 / 4 - x^2 / 2 by thermal noise of 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)).
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import kramers_escape
>>> kramers_escape(10, D=0.2).elements[0].values['D']
0.2
Source code in src/skcomplex/models/physics/soft_matter/_diffusion.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
levy_flight(n_walkers=500, *, mu=1.2, l0=1.0, n_dim=2)
Return the Lévy flight, a walk whose jumps have lengths with the tail l^(-1 - mu) in random directions.
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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import levy_flight
>>> levy_flight(10, mu=1.5).elements[0].values['mu']
1.5
Source code in src/skcomplex/models/physics/soft_matter/_anomalous.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
levy_walk(n_walkers=500, *, sigma=1.5, tau0=1.0, speed=1.0, n_dim=2, random_state=0)
Return the Lévy walk, flights at constant speed in random directions for 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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import levy_walk
>>> levy_walk(10, sigma=1.2).elements[0].values['sigma']
1.2
Source code in src/skcomplex/models/physics/soft_matter/_anomalous.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 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 158 159 160 161 162 163 | |
multiplicative_noise(n_particles=500, *, s0=1.0, ds=1.8, L=100.0, convention='anti-ito')
Return free particles in a box with position-dependent noise, 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.
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, |
'anti-ito'
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import multiplicative_noise
>>> multiplicative_noise(10, convention='ito').interactions[0].convention
'ito'
Source code in src/skcomplex/models/physics/soft_matter/_diffusion.py
223 224 225 226 227 228 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 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
optical_trap(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)
Return overdamped particles in a harmonic optical trap, still, oscillating, or blinking.
In a still trap every coordinate is normal with variance kT / k and relaxes in the time gamma / k.
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
|
duty
|
float
|
The fraction of every blinking period during which the trap is on. |
0.5
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import optical_trap
>>> optical_trap(10, blink_period=2.0).interactions[0].blink_period
2.0
Source code in src/skcomplex/models/physics/soft_matter/_diffusion.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
scaled_brownian_motion(n_particles=500, *, alpha=0.5, K=1.0, t0=0.01)
Return scaled Brownian motion, dx = sqrt(2 K alpha (t + t0)^(alpha - 1)) dW, with <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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import scaled_brownian_motion
>>> scaled_brownian_motion(10, alpha=1.5).elements[0].values['alpha']
1.5
Source code in src/skcomplex/models/physics/soft_matter/_diffusion.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |
shaken_spring_block(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)
Return a chain of blocks joined by springs on a frictional substrate, 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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import shaken_spring_block
>>> shaken_spring_block(5).elements[0].check().prepare().size_
5
Source code in src/skcomplex/models/physics/soft_matter/_friction.py
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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
stochastic_resonance(x=-1.0, *, amplitude=0.1, frequency=0.01, D=0.12)
Return a particle in a double well, 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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the position |
Examples:
>>> from skcomplex.models.physics.soft_matter import stochastic_resonance
>>> stochastic_resonance(D=0.2).elements[0].D
0.2
Source code in src/skcomplex/models/physics/soft_matter/_brownian.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
tilted_periodic_potential(n_particles=500, *, f=1.0, U0=0.5, L=1.0, gamma=1.0, kT=0.5)
Return overdamped particles in the tilted periodic potential 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.
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
|
Returns:
| Name | Type | Description |
|---|---|---|
system |
System
|
The model, with the positions |
Examples:
>>> from skcomplex.models.physics.soft_matter import tilted_periodic_potential
>>> tilted_periodic_potential(10, f=2.0).interactions[0].f
2.0
Source code in src/skcomplex/models/physics/soft_matter/_ratchets.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |