Particles
Particle realizations shared by the physics packages.
The package holds point masses, active and Brownian particles, forces, relaxation, and the Stokesian mobility.
ActiveDiffusionInteraction(label, *, target, D_t=0.1, D_r=1.0, omega=0.0)
Bases: Interaction
Diffusion of the position and the orientation of active particles.
The position follows dx = sqrt(2 D_t) dW and the orientation dtheta = omega dt + sqrt(2 D_r) dW. With omega =
0 it is an active Brownian particle, and otherwise a chiral one. It is a bacterium, a Janus colloid, or a robot
that loses its heading.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the particles, whose position is |
required |
D_t
|
Annotated[float, closed_open(0, oo)]
|
The translational diffusion coefficient. |
0.1
|
D_r
|
Annotated[float, closed_open(0, oo)]
|
The rotational diffusion coefficient. |
1.0
|
omega
|
float
|
The angular velocity of a chiral particle. |
0.0
|
Examples:
>>> import numpy as np
>>> from skcomplex.core.components.spaces import ContinuousSpace
>>> from skcomplex.core.engine.solvers import EulerMaruyamaSolver
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.physics.common.particles import ActiveDiffusionInteraction, ActiveParticleElement
>>> plane = ContinuousSpace(n_dim=2)
>>> swimmers = ActiveParticleElement('swimmers', x=np.zeros((4000, 2)), size=4000, space=plane)
>>> diffusion = ActiveDiffusionInteraction('diffusion', target='swimmers', D_r=0.5)
>>> system = System(elements=[swimmers], interactions=[diffusion], solver=EulerMaruyamaSolver(dt=0.1))
>>> angles = system.prepare().simulate(until=2.0, dt=2.0, random_state=0).get_values('swimmers.theta')[-1]
>>> round(float((angles**2).mean()), 1)
2.0
Source code in src/skcomplex/systems/physics/common/particles/_active_diffusion.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
ActiveParticleElement(label, *, x=(0.0, 0.0), theta=0.0, size=None, space=None)
Bases: Element
Active particle in the plane with the position x and the orientation theta.
A SelfPropulsionInteraction moves the position along the orientation, and an ActiveDiffusionInteraction makes
both diffuse and the orientation turn.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the particle or the group. |
required |
x
|
object
|
The initial position, one row per particle or shared. |
(0.0, 0.0)
|
theta
|
Annotated[object, Period(2 * pi)]
|
The initial orientation, one per particle or shared. |
0.0
|
size
|
int | None
|
The number of particles, or |
None
|
space
|
BaseSpace | None
|
The continuous space of the particles, or |
None
|
Examples:
>>> from skcomplex.systems.physics.common.particles import ActiveParticleElement
>>> ActiveParticleElement('swimmer', theta=1.0).theta
1.0
Source code in src/skcomplex/systems/physics/common/particles/_active_particle.py
48 49 50 51 52 53 54 55 56 57 58 59 | |
ConstantForceInteraction(label, *, target, F=0.0, state='x')
Bases: Interaction
Constant force F on a particle of mass m.
The position follows x'' = F / m. It is gravity near the ground, an electric field on a charge, or the pull of
optical tweezers far from their center. A number applies to every component of a vector position. The LAMMPS
solver runs it as fix addforce.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the particle or the group of particles. |
required |
F
|
ArrayLike
|
The force vector, or a number for every component. |
0.0
|
state
|
str
|
The name of the position of the target. |
'x'
|
Examples:
>>> import numpy as np
>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.physics.common.particles import ConstantForceInteraction
>>> ball = Element('ball', values={'x': np.array([0.0, 10.0]), 'm': 1.0})
>>> gravity = ConstantForceInteraction('gravity', target='ball', F=[0.0, -9.81])
>>> system = System(elements=[ball], interactions=[gravity]).prepare()
>>> system.simulate(until=1.0, dt=1.0).get_values('ball.x')[-1].round(3).tolist()
[0.0, 5.095]
Source code in src/skcomplex/systems/physics/common/particles/_constant_force.py
55 56 57 58 59 60 61 62 63 64 65 66 | |
DampingInteraction(label, *, target, gamma=0.1, state='x')
Bases: Interaction
Linear damping, a force -gamma x' against the velocity x' of a particle of mass m.
The position follows x'' = -gamma x' / m, component by component for a vector. It is the viscous drag on a bead
in water, the friction of a sliding block, or the loss of a damped spring. The LAMMPS solver runs it as
fix viscous.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the particle or the group of particles. |
required |
gamma
|
Annotated[float, closed_open(0, oo)]
|
The damping coefficient. |
0.1
|
state
|
str
|
The name of the position of the target. |
'x'
|
Examples:
>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.physics.common.particles import DampingInteraction
>>> ball = Element('ball', values={'x': 0.0, "x'": 1.0, 'm': 1.0})
>>> system = System(elements=[ball], interactions=[DampingInteraction('air', target='ball', gamma=0.5)])
>>> round(float(system.prepare().simulate(until=2.0, dt=1.0).get_values("ball.x'")[-1]), 3)
0.368
Source code in src/skcomplex/systems/physics/common/particles/_damping.py
53 54 55 56 57 58 59 60 61 62 63 64 | |
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
|
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 | |
DoubleWellInteraction(label, *, target, amplitude=0.1, frequency=0.01, D=0.12)
Bases: Interaction
Overdamped motion in the double well x^4 / 4 - x^2 / 2, forced periodically and by noise.
The position follows dx = (x - x^3 + amplitude cos(2 pi frequency t)) dt + sqrt(2 D) dW. It is a particle that
hops between two wells, a bistable switch, or the climate between two states.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the particles. |
required |
amplitude
|
float
|
The amplitude of the periodic forcing. |
0.1
|
frequency
|
float
|
The frequency of the forcing. |
0.01
|
D
|
Annotated[float, closed_open(0, oo)]
|
The noise intensity. |
0.12
|
Examples:
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.physics.common.particles import DoubleWellElement, DoubleWellInteraction
>>> well = DoubleWellInteraction('well', target='particle', amplitude=0.0, D=0.0)
>>> system = System(elements=[DoubleWellElement('particle', x=0.5)], interactions=[well]).prepare()
>>> round(float(system.simulate(until=20.0, dt=1.0).get_values('particle.x')[-1]), 3)
1.0
Source code in src/skcomplex/systems/physics/common/particles/_double_well.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
FrictionNoiseInteraction(label, *, target, temperature=1.0)
Bases: Interaction
Thermal noise of overdamped particles with the friction gamma.
The random force sqrt(2 gamma temperature) dW divides by the friction gamma of the target, so every component
of the position x diffuses with the coefficient temperature / gamma. It is a colloid in water, a bead in an
optical trap, or a protein in the cytoplasm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the particles, whose friction is |
required |
temperature
|
Annotated[float, closed_open(0, oo)]
|
The thermal energy of the bath. |
1.0
|
Examples:
>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.engine.solvers import EulerMaruyamaSolver
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.physics.common.particles import FrictionNoiseInteraction
>>> beads = Element('beads', values={'x': 0.0, 'gamma': 2.0}, size=4000)
>>> bath = FrictionNoiseInteraction('bath', target='beads', temperature=1.0)
>>> system = System(elements=[beads], interactions=[bath], solver=EulerMaruyamaSolver(dt=0.1)).prepare()
>>> positions = system.simulate(until=4.0, dt=4.0, random_state=0).get_values('beads.x')[-1]
>>> round(float((positions**2).mean()), 1)
4.0
Source code in src/skcomplex/systems/physics/common/particles/_friction_noise.py
52 53 54 55 56 57 58 59 60 61 | |
LangevinThermostatInteraction(label, *, target, temperature=1.0, gamma=1.0, state='x')
Bases: Interaction
Langevin thermostat, a drag -gamma x' and a random force that hold particles at a temperature.
The velocity x' of every particle of mass m follows dx' = -gamma x' / m dt + sqrt(2 gamma temperature) / m
dW, with the temperature in energy units, so the velocities relax over the time m / gamma to the
Maxwell-Boltzmann distribution at that temperature. It is the solvent around a colloid, the heat bath of a
molecular simulation, or the gas around a dust grain. The LAMMPS solver runs it as fix langevin.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the particle or particle group. |
required |
temperature
|
Annotated[float, closed_open(0, oo)]
|
The temperature in energy units. |
1.0
|
gamma
|
Annotated[float, open(0, oo)]
|
The friction coefficient. |
1.0
|
state
|
str
|
The name of the position of the particles. |
'x'
|
Examples:
>>> from skcomplex.systems.physics.common.particles import LangevinThermostatInteraction
>>> LangevinThermostatInteraction('bath', target='gas', temperature=2.0).temperature
2.0
Source code in src/skcomplex/systems/physics/common/particles/_langevin_thermostat.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
LennardJonesInteraction(label, *, target, cutoff=1.0, epsilon=1.0, sigma=1.0)
Bases: Interaction
Lennard-Jones pair potential without a shift.
The potential is U(r) = 4 epsilon ((sigma / r)^12 - (sigma / r)^6), and every member feels the force -U'(r)
along the line of centres from each member within the cutoff, x_i'' += sum_j -U'(r_ij) (x_i - x_j) / (r_ij m_i).
In a periodic box the separations are minimum images. It is the force between atoms of a noble gas, a model fluid
of molecular dynamics, or colloids with a short-range attraction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the group of particles. |
required |
cutoff
|
Annotated[float, open(0, oo)]
|
The distance beyond which pairs do not interact. |
1.0
|
epsilon
|
Annotated[float, open(0, oo)]
|
The depth of the potential well. |
1.0
|
sigma
|
Annotated[float, open(0, oo)]
|
The distance at which the potential is zero. |
1.0
|
Examples:
>>> from skcomplex.systems.physics.common.particles import LennardJonesInteraction
>>> LennardJonesInteraction('lj', target='gas', cutoff=2.5).sigma
1.0
Source code in src/skcomplex/systems/physics/common/particles/_lennard_jones.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 | |
LinearDragInteraction(label, *, target, gamma=0.1, coordinates=('x',))
Bases: Interaction
Linear drag, a force -gamma v against the velocity v of a mass m.
Every coordinate x of the target follows x'' = -gamma x' / m. It is air resistance on a slow ball, the
friction of a pendulum bob, or the dashpot of a car suspension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the mass. |
required |
gamma
|
Annotated[float, closed_open(0, oo)]
|
The drag coefficient. |
0.1
|
coordinates
|
Sequence[str]
|
The names of the coordinates of the target that the drag slows, such as |
('x',)
|
Examples:
>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.physics.common.particles import LinearDragInteraction
>>> ball = Element('ball', values={'x': 0.0, 'm': 1.0})
>>> system = System(elements=[ball], interactions=[LinearDragInteraction('air', target='ball', gamma=0.5)])
>>> trajectory = system.prepare().simulate(until=2.0, dt=1.0, initial_state={"ball.x'": 1.0})
>>> round(float(trajectory.get_values("ball.x'")[-1]), 3)
0.368
Source code in src/skcomplex/systems/physics/common/particles/_linear_drag.py
53 54 55 56 57 58 59 60 61 62 63 64 | |
MassPointElement(label, x=0.0, *, m=1.0, values=None, size=None, space=None)
Bases: PointElement
Point mass, a point at the position x with the mass m.
The forces on the point give the acceleration x'' of its position divided by its mass, and its velocity is the
value x'. It is an atom of a gas, a bead of a polymer, or a star of a cluster.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the point. |
required |
x
|
ArrayLike
|
The initial position. A number applies to every component. |
0.0
|
m
|
Annotated[float, open(0, oo)]
|
The mass. |
1.0
|
values
|
Mapping[str, object] | None
|
Further values by name, such as the starting velocity |
None
|
size
|
int | None
|
The number of points, or |
None
|
space
|
BaseSpace | None
|
The space whose sites hold one point each, or |
None
|
Examples:
>>> from skcomplex.systems.physics.common.particles import MassPointElement
>>> MassPointElement('ball', x=[0.0, 1.0], m=2.0, values={"x'": [1.0, 0.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 | |
PeriodicForceInteraction(label, *, target, F=0.0, omega=1.0, coordinates=('x',))
Bases: Interaction
Periodic force F cos(omega t) on a mass m.
Every coordinate x of the target follows x'' = F cos(omega t) / m. It is the motor that shakes a driven
oscillator, an alternating voltage on a circuit, or the push of a parent on a swing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the mass. |
required |
F
|
float
|
The amplitude of the force. |
0.0
|
omega
|
Annotated[float, closed_open(0, oo)]
|
The angular frequency of the force. |
1.0
|
coordinates
|
Sequence[str]
|
The names of the coordinates of the target that the force drives. |
('x',)
|
Examples:
>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.physics.common.particles import PeriodicForceInteraction
>>> ball = Element('ball', values={'x': 0.0, 'm': 2.0})
>>> force = PeriodicForceInteraction('drive', target='ball', F=2.0, omega=1.0)
>>> trajectory = System(elements=[ball], interactions=[force]).prepare().simulate(until=1.0, dt=1.0)
>>> round(float(trajectory.get_values('ball.x')[-1]), 3)
0.46
Source code in src/skcomplex/systems/physics/common/particles/_periodic_force.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
PropulsionStepInteraction(label, *, target, speed=1.0, state='x', heading='theta')
Bases: Interaction
Step x(t + 1) = x + speed (cos theta, sin theta) of a position in the plane.
The step is along a heading, in discrete time.
The step reads the heading at the start of the step, as every map of the step does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
target
|
Role
|
The path of the particle or the group whose positions move. |
required |
speed
|
Annotated[float, closed_open(0, oo)]
|
The distance moved in one step. |
1.0
|
state
|
str
|
The name of the vector state that holds the position. |
'x'
|
heading
|
str
|
The name of the state that holds the heading. |
'theta'
|
Examples:
>>> from types import SimpleNamespace
>>> from sage.all__sagemath_symbolics import var, vector
>>> from skcomplex.systems.physics.common.particles import PropulsionStepInteraction
>>> target = SimpleNamespace(x=vector([var('x1'), var('x2')]), theta=var('theta'))
>>> step = PropulsionStepInteraction('propulsion', target='flock')
>>> [law.value for law in step.prepare(SimpleNamespace(target=target, speed=var('v'), t=var('t'))).laws_]
[(v*cos(theta) + x1, v*sin(theta) + x2)]
Source code in src/skcomplex/systems/physics/common/particles/_propulsion_step.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
RestoringForceInteraction(label, *, target, k=1.0, center=0.0, coordinates=('x',))
Bases: Interaction
Restoring force -k (x - center) on a mass m, from the potential k |x - center|² / 2.
Every coordinate x of the target follows x'' = -k (x - center) / m. It is a mass on a spring tied to a wall, a
pendulum swinging through small angles, or an atom held in a crystal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the mass. |
required |
k
|
Annotated[float, open(0, oo)]
|
The stiffness. |
1.0
|
center
|
float
|
The center, the same for every coordinate. |
0.0
|
coordinates
|
Sequence[str]
|
The names of the coordinates of the target that the force pulls. |
('x',)
|
Examples:
>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.physics.common.particles import RestoringForceInteraction
>>> ball = Element('ball', values={'x': 1.0, 'm': 1.0})
>>> spring = RestoringForceInteraction('spring', target='ball', k=1.0)
>>> trajectory = System(elements=[ball], interactions=[spring]).prepare().simulate(until=3.0, dt=3.0)
>>> round(float(trajectory.get_values('ball.x')[-1]), 3)
-0.99
Source code in src/skcomplex/systems/physics/common/particles/_restoring_force.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
SelfPropulsionInteraction(label, *, target, speed=1.0, state='x', heading='theta')
Bases: Interaction
Self-propulsion x' += speed (cos theta, sin theta) of a position in the plane.
The position drifts along a heading theta, which other laws turn and diffuse. It is a swimming bacterium, a
Janus colloid, or a walking robot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction. |
required |
target
|
Role
|
The path of the particle or the group whose positions move. |
required |
speed
|
Annotated[float, closed_open(0, oo)]
|
The self-propulsion speed. |
1.0
|
state
|
str
|
The name of the vector value that holds the position. |
'x'
|
heading
|
str
|
The name of the value that holds the heading. |
'theta'
|
Examples:
>>> import math
>>> from skcomplex.core.components.spaces import ContinuousSpace
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.physics.common.particles import ActiveParticleElement, SelfPropulsionInteraction
>>> swimmer = ActiveParticleElement('swimmer', theta=math.pi / 2)
>>> propulsion = SelfPropulsionInteraction('propulsion', target='swimmer', speed=2.0)
>>> system = System(elements=[swimmer], interactions=[propulsion], space=ContinuousSpace(n_dim=2))
>>> trajectory = system.prepare().simulate(until=1.0, dt=1.0)
>>> trajectory.get_values('swimmer.x')[-1].round(6).tolist()
[0.0, 2.0]
Source code in src/skcomplex/systems/physics/common/particles/_self_propulsion.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
StokesianMobilityInteraction(label, *, target, position='x', orientation=None, tensor='rotne-prager-yamakawa', form='rate', force=None, torque=None, velocity=None, stresslet=None, dipole=None, potential=None, cutoff=None, root='cholesky', tolerance=1e-06, radius=1.0, viscosity=1.0, temperature=0.0, dt=0.01)
Bases: Interaction
Stokesian mobility of spheres in a Stokes fluid.
Physics names it the mobility of Stokesian dynamics. It is the linear map from forces and torques to velocities and
spins. Every member of the group target of spheres of radius a in a fluid of viscosity eta moves at the
velocity U_i and spins at the angular velocity Omega_i of
(U_i, Omega_i) = sum_j M_ij (F_j, T_j) + (V_i, 0) + sum_{j != i} (u_j(x_i), w_j(x_i) / 2)
where M is the grand mobility, F_j and T_j the force and torque on member j, V_i an intrinsic velocity,
and u_j and w_j the flow and vorticity of the force-free sources of member j. The self mobilities are
1 / (6 pi eta a) and 1 / (8 pi eta a^3). Between members at the separation r = x_i - x_j the translational
block is the Oseen tensor (I + r r / r^2) / (8 pi eta r), or with tensor='rotne-prager-yamakawa' the
Rotne-Prager-Yamakawa tensor, which adds the finite size a^2 (I / 3 - r r / r^2) / (4 pi eta r^3) and turns
to its regularized form when the spheres overlap. The rotlet couples a torque on j to the velocity
T_j x r / (8 pi eta r^3) of i, a force on j to the angular velocity F_j x r / (8 pi eta r^3) of i, and a
torque to the angular velocity (3 r r / r^2 - I) T_j / (16 pi eta r^3). With tensor='free-draining' no member
moves another, the baseline without hydrodynamic interactions.
The sources are a stresslet S_j, a symmetric traceless tensor whose flow is -3 (r.S.r) r / (8 pi eta r^5), and
a potential dipole D_j, whose flow is (3 r r / r^2 - I) D_j / r^3. Together with the intrinsic velocity they
carry the active slip of a swimmer. These are point singularities, accurate at separations of a few radii. The
forces of a pair potential(namespace, r) of the distance, a function of the distance and of the parameters of
the interaction, act on every pair closer than cutoff, and add to the forces F_j. With an orientation, a unit
vector state, the orientation turns as dp/dt = Omega x p.
In the form 'rate' the velocities are the rates of the position and the orientation in continuous time. In the
form 'map', in discrete time, every step of length dt is the Ermak-McCammon step
x + U dt + sqrt(2 kT dt) (B xi)_x at the temperature kT, where B B^T = M and xi is standard normal, and the
orientation turns by Omega dt + sqrt(2 kT dt) (B xi)_p and is normalized. The divergence of both tensors vanishes
in an unbounded fluid, so the step needs no drift correction. root='cholesky' factors the dense mobility, and
root='lanczos' applies a Krylov approximation of its square root to xi with the matrix-free product, until the
relative change of the sample falls below tolerance. In the map form the time of the namespace counts steps, so
a force of the physical time reads s.t * s.dt.
Positions in the plane are the plane z = 0 of a three-dimensional fluid. A torque is then a number, the torque
about z, and the stresslet is its block in the plane. The product costs O(N^2) per evaluation, Cholesky
O(N^3), and every evaluation runs as one call over the group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
label
|
str
|
The label of the interaction, unique among the components of its system. |
required |
target
|
Role
|
The path of the group of spheres. |
required |
position
|
str
|
The name of the vector state of the positions, of two or three components. |
'x'
|
orientation
|
str | None
|
The name of the vector state of unit orientations, or |
None
|
tensor
|
str
|
|
'rotne-prager-yamakawa'
|
form
|
str
|
|
'rate'
|
force
|
NamespaceFunction | None
|
The force on a member, a callable of the namespace that returns a vector, or |
None
|
torque
|
NamespaceFunction | None
|
The torque on a member, a callable of the namespace that returns a vector, a number in the plane, or |
None
|
velocity
|
NamespaceFunction | None
|
The intrinsic velocity of a member, a callable of the namespace that returns a vector, or |
None
|
stresslet
|
NamespaceFunction | None
|
The stresslet of a member, a callable of the namespace that returns a square matrix or nested sequences,
or |
None
|
dipole
|
NamespaceFunction | None
|
The potential dipole of a member, a callable of the namespace that returns a vector, or |
None
|
potential
|
PairPotential | None
|
The pair potential, a callable of the namespace and the distance, or |
None
|
cutoff
|
float | None
|
The largest distance of a pair of the potential, or |
None
|
root
|
str
|
|
'cholesky'
|
tolerance
|
float
|
The relative change of the Lanczos sample at which its iteration stops. |
1e-06
|
radius
|
Annotated[float, open(0, oo)]
|
The radius |
1.0
|
viscosity
|
Annotated[float, open(0, oo)]
|
The viscosity |
1.0
|
temperature
|
Annotated[float, closed_open(0, oo)]
|
The thermal energy |
0.0
|
dt
|
Annotated[float, open(0, oo)]
|
The length of a step of the map form. |
0.01
|
Raises:
| Type | Description |
|---|---|
ValidationError
|
A variant is unknown, a function is not callable, the rate form has a positive temperature, the positions have neither two nor three components, or noise draws from an Oseen mobility that is not positive definite. |
Examples:
>>> import math
>>> from sage.all__sagemath_symbolics import vector
>>> from skcomplex.core.components.elements import Element
>>> from skcomplex.core.components.spaces import ContinuousSpace
>>> from skcomplex.core.systems import System
>>> from skcomplex.systems.physics.common.particles import StokesianMobilityInteraction
>>> pull = StokesianMobilityInteraction('stokes', target='spheres', force=lambda s: vector([1.0, 0.0, 0.0]))
>>> space = ContinuousSpace(n_dim=3)
>>> spheres = Element('spheres', values={'x': [[0, 0, 0], [0, 4, 0]]}, size=2, space=space)
>>> trajectory = System(elements=[spheres], interactions=[pull]).prepare().simulate(until=1.0, dt=1.0)
>>> (trajectory.get_values('spheres.x')[-1, :, 0] * 6 * math.pi).round(4).tolist()
[1.1953, 1.1953]
Source code in src/skcomplex/systems/physics/common/particles/_stokesian_mobility.py
315 316 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 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | |