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

Python maintenance #4489

Merged
merged 10 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions doc/sphinx/system_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Lees--Edwards boundary conditions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Lees--Edwards boundary conditions (LEbc) are special periodic boundary
conditions to simulation systems under shear stress :cite:`lees72a`.
conditions to simulate systems under shear stress :cite:`lees72a`.
Periodic images of particles across the shear boundary appear with a
time-dependent position offset. When a particle crosses the shear boundary,
it appears to the opposite side of the simulation box with a position offset
Expand Down Expand Up @@ -227,13 +227,13 @@ The properties of the cell system can be accessed by

* :py:attr:`~espressomd.cellsystem.CellSystem.node_grid`

(int[3]) 3D node grid for real space domain decomposition (optional, if
3D node grid for real space domain decomposition (optional, if
unset an optimal set is chosen automatically). The domain decomposition
can be visualized with :file:`samples/visualization_cellsystem.py`.

* :py:attr:`~espressomd.cellsystem.CellSystem.skin`

(float) Skin for the Verlet list. This value has to be set, otherwise the simulation will not start.
Skin for the Verlet list. This value has to be set, otherwise the simulation will not start.

Details about the cell system can be obtained by :meth:`espressomd.system.System.cell_system.get_state() <espressomd.cellsystem.CellSystem.get_state>`:

Expand Down
53 changes: 29 additions & 24 deletions src/python/espressomd/lees_edwards.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,23 @@
@script_interface_register
class LeesEdwards(ScriptInterfaceHelper):

"""Interface to the Lees-Edwards boundary conditions.
"""
Interface to the :ref:`Lees-Edwards boundary conditions`.

See documentation.
Attributes
----------
protocol : :obj:`object`
Lees--Edwards protocol.
reinaual marked this conversation as resolved.
Show resolved Hide resolved
shear_velocity: :obj:`float`
Current shear velocity.
pos_offset : :obj:`float`
Current position offset
shear_direction : :obj:`int`
Shear direction: 0 for the *x*-axis, 1 for the *y*-axis,
2 for the *z*-axis.
shear_plane_normal : :obj:`int`
Shear plane normal: 0 for the *x*-axis, 1 for the *y*-axis,
2 for the *z*-axis.

"""

Expand All @@ -34,25 +48,21 @@ class LeesEdwards(ScriptInterfaceHelper):
@script_interface_register
class Off(ScriptInterfaceHelper):

"""Lees-Edwards protocol resulting in un-shifted boundaries."""
"""Lees--Edwards protocol resulting in un-shifted boundaries."""
_so_name = "LeesEdwards::Off"


@script_interface_register
class LinearShear(ScriptInterfaceHelper):

"""Lees-Edwards protocol for linear shear.
"""Lees--Edwards protocol for linear shear.

Parameters
----------
shear_direction
Cartesian coordinate of the shear direction (0=x, 1=y, 2=z)
shear_plane_normal
Cartesian coordinate of the shear plane normal
initial_pos_offset
Positional offset at the Lees-Edwards boundary at t=0
shear_velocity
Shear velocity (velocity jump) across the Lees-Edwards boundary
initial_pos_offset : :obj:`float`
Positional offset at the Lees--Edwards boundary at t=0.
shear_velocity : :obj:`float`
Shear velocity (velocity jump) across the Lees--Edwards boundary.

"""
_so_name = "LeesEdwards::LinearShear"
Expand All @@ -61,21 +71,16 @@ class LinearShear(ScriptInterfaceHelper):
@script_interface_register
class OscillatoryShear(ScriptInterfaceHelper):

"""Lees-Edwards protocol for oscillatory shear.
"""Lees--Edwards protocol for oscillatory shear.

Parameters
----------
shear_direction
Cartesian coordinate of the shear direction (0=x, 1=y, 2=z)
shear_plane_normal
Cartesian coordinate of the shear plane normal
amplitude
Maximum amplitude of the positional offset at the Lees-Edwards boundary
frequency
Frequency of the shear
time_0
Time offset of the oscillation

amplitude : :obj:`float`
Maximum amplitude of the positional offset at the Lees--Edwards boundary.
omega : :obj:`float`
Radian frequency of the oscillation.
time_0 : :obj:`float`
Time offset of the oscillation.

"""
_so_name = "LeesEdwards::OscillatoryShear"
28 changes: 14 additions & 14 deletions testsuite/scripts/importlib_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,23 @@ def configure_and_import(filepath,

Parameters
----------
filepath : str
filepath : :obj:`str`
python script to import
gpu : bool
gpu : :obj:`bool`
whether GPU is necessary or not
substitutions : function
substitutions : :obj:`function`
custom text replacement operation (useful to edit out calls to the
OpenGL or Mayavi visualizers' ``run()`` method)
cmd_arguments : list
cmd_arguments : :obj:`list`
command line arguments, i.e. sys.argv without the script path
script_suffix : str
script_suffix : :obj:`str`
suffix to append to the configured script (useful when a single
module is being tested by multiple tests in parallel)
mock_visualizers : bool
if ``True``, substitute ES visualizers with `Mock()` classes in case
of `ImportError()` (use ``False`` if an `ImportError()` is relevant
mock_visualizers : :obj:`bool`
if ``True``, substitute ES visualizers with ``Mock`` classes in case
of ``ImportError`` (use ``False`` if an ``ImportError`` is relevant
to your test)
move_to_script_dir : bool
move_to_script_dir : :obj:`bool`
if ``True``, move to the script's directory (useful when the script
needs to load files hardcoded as relative paths, or when files are
generated and need cleanup); this is enabled by default
Expand Down Expand Up @@ -203,12 +203,12 @@ def substitute_variable_values(code, strings_as_is=False, keep_original=True,

Parameters
----------
code : str
code : :obj:`str`
Source code to edit.
strings_as_is : bool
strings_as_is : :obj:`bool`
If ``True``, consider all values in \*\*parameters are strings and
substitute them in-place without formatting by ``repr()``.
keep_original : bool
keep_original : :obj:`bool`
Keep the original value (e.g. ``N = 10; _N__original = 1000``), helps
with debugging.
\*\*parameters :
Expand Down Expand Up @@ -569,9 +569,9 @@ def visit_ImportFrom(self, node):

def mock_es_visualization(code):
"""
Replace ``import espressomd.visualization_<backend>`` by a ``MagicMock()``
Replace ``import espressomd.visualization_<backend>`` by a ``MagicMock``
when the visualization module is unavailable, by catching the
``ImportError()`` exception. Please note that ``espressomd.visualization``
``ImportError`` exception. Please note that ``espressomd.visualization``
is deferring the exception, thus requiring additional checks.

Import aliases are supported, however please don't use
Expand Down