Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve user guide chapters on observables and constraints #4898

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ run_tutorials:
paths:
- build/doc/tutorials
expire_in: 1 week
timeout: 2h
tags:
- espresso
- cuda
Expand Down
56 changes: 36 additions & 20 deletions src/python/espressomd/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,19 @@ def total_normal_force(self):

@script_interface_register
class HomogeneousMagneticField(Constraint):

"""
Homogeneous magnetic field :math:`\\vec{H}`.
The resulting force :math:`\\vec{F}`, torque :math:`\\vec{\\tau}`
and energy `U` on the particles are then

:math:`\\vec{F} = \\vec{0}`

:math:`\\vec{\\tau} = \\vec{\\mu} \\times \\vec{H}`

:math:`U = -\\vec{\\mu} \\cdot \\vec{H}`

where :math:`\\vec{\\mu}` is the particle dipole moment.

Attributes
----------
H : (3,) array_like of :obj:`float`
Expand Down Expand Up @@ -393,12 +404,12 @@ class Gravity(Constraint):
"""
Gravity force

:math:`F = m \\cdot g`
:math:`\\vec{F} = m \\cdot \\vec{g}`

Arguments
----------
g : (3,) array_like of :obj:`float`
The gravitational acceleration.
The gravitational constant.

"""

Expand All @@ -420,21 +431,21 @@ class LinearElectricPotential(Constraint):
"""
Electric potential of the form

:math:`\\phi = -E \\cdot x + \\phi_0`,
:math:`\\phi = -\\vec{E} \\cdot \\vec{x} + \\phi_0`,

resulting in the electric field E
everywhere. (E.g. in a plate capacitor).
resulting in the electric field :math:`\\vec{E}` everywhere.
The resulting force on the particles are then

:math:`F = q \\cdot E`
:math:`\\vec{F} = q \\cdot \\vec{E}`

where :math:`q` is the charge of the particle.
where :math:`q` and :math:`\\vec{x}` are the particle charge and position
in folded coordinates.
This can be used to model a plate capacitor.

Arguments
----------
E : array_like of :obj:`float`
The electric field.

phi0 : :obj:`float`
The potential at the origin

Expand Down Expand Up @@ -463,15 +474,18 @@ class ElectricPlaneWave(Constraint):
"""
Electric field of the form

:math:`E = E0 \\cdot \\sin(k \\cdot x + \\omega \\cdot t + \\phi)`
:math:`\\vec{E} = \\vec{E_0} \\cdot \\sin(\\vec{k} \\cdot \\vec{x} + \\omega \\cdot t + \\phi)`

The resulting force on the particles are then

:math:`F = q \\cdot E`
:math:`\\vec{F} = q \\cdot \\vec{E}`

where :math:`q` is the charge of the particle.
where :math:`q` and :math:`\\vec{x}` are the particle charge and position
in folded coordinates.
This can be used to generate a homogeneous AC
field by setting k to zero.
field by setting :math:`\\vec{k}` to the null vector.
For periodic systems, :math:`\\vec{k}` must be an integer multiple
of :math:`2\\pi \\vec{L}^{-1}` with :math:`\\vec{L}` the box length.

Arguments
----------
Expand All @@ -482,7 +496,7 @@ class ElectricPlaneWave(Constraint):
omega : :obj:`float`
Frequency of the wave
phi : :obj:`float`, optional
Phase shift
Phase

"""

Expand Down Expand Up @@ -520,9 +534,10 @@ class FlowField(_Interpolated):
Viscous coupling to a flow field that is
interpolated from tabulated data like

:math:`F = -\\gamma \\cdot \\left( u(r) - v \\right)`
:math:`\\vec{F} = -\\gamma \\cdot \\left( \\vec{u}(\\vec{x}) - \\vec{v} \\right)`

where :math:`v` is the velocity of the particle.
where :math:`\\vec{v}` and :math:`\\vec{x}` are the particle velocity and position
in folded coordinates, and :math:`\\vec{u}(\\vec{x})` is a 3D flow field on a grid.

Arguments
----------
Expand All @@ -549,9 +564,10 @@ class HomogeneousFlowField(Constraint):
Viscous coupling to a flow field that is
constant in space with the force

:math:`F = -\\gamma \\cdot (u - v)`
:math:`\\vec{F} = -\\gamma \\cdot (\\vec{u} - \\vec{v})`

where :math:`v` is the velocity of the particle.
where :math:`\\vec{v}` is the velocity of the particle
and :math:`\\vec{u}` is the constant flow field.

Attributes
----------
Expand Down Expand Up @@ -580,11 +596,11 @@ class ElectricPotential(_Interpolated):

"""
Electric potential interpolated from
provided data. The electric field E is
provided data. The electric field :math:`\\vec{E}` is
calculated numerically from the potential,
and the resulting force on the particles are

:math:`F = q \\cdot E`
:math:`\\vec{F} = q \\cdot \\vec{E}`

where :math:`q` is the charge of the particle.

Expand Down
Loading
Loading