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

Add ZnDraw visualizer #4967

Merged
merged 1 commit into from
Aug 5, 2024
Merged

Conversation

phohenberger
Copy link
Contributor

@phohenberger phohenberger commented Jul 31, 2024

Description of changes:

  • add support for the ZnDraw visualizer

@phohenberger phohenberger marked this pull request as draft July 31, 2024 11:18
@phohenberger
Copy link
Contributor Author

phohenberger commented Jul 31, 2024

Use the ZnDraw-Visualizer to live visualize ESPResSo simulations in Jupyter Notebooks.

First you need to install pip install zndraw==0.4.5

Then you can import the relevant classes from the /src/python/espressomd/zn.py file.

Example usage:

from espressomd.zn import Visualizer, LBField

color = {0: "red", 1: "#ff00ff"} # particle type mapping, there are some standard colors but you can also add hex
radii = {0: 0.2, 1: 0.5} # particle type mapping

LBField(system, step_x = 2, step_y=2,  step_z=2, scale=3.0)

vis = Visualizer(system=system, colors=color, radii=radii, vector_field = LBField, bonds=False, folded=False)

# Some integration loop
for i in range(1000):
    system.integrator.run(10)
    vis.update()

Of course stuff like bonds, vector_field are optional and can be left away.

This currently only works in jupyter as the server closes down if the script is finished running to ensure no runaway processes.

@phohenberger
Copy link
Contributor Author

phohenberger commented Jul 31, 2024

Some screenshots

image

image

@phohenberger phohenberger marked this pull request as ready for review August 2, 2024 12:17
src/python/espressomd/zn.py Outdated Show resolved Hide resolved
src/python/espressomd/zn.py Outdated Show resolved Hide resolved
src/python/espressomd/zn.py Show resolved Hide resolved
src/python/espressomd/zn.py Outdated Show resolved Hide resolved
src/python/espressomd/zn.py Outdated Show resolved Hide resolved
src/python/espressomd/zn.py Outdated Show resolved Hide resolved
src/python/espressomd/zn.py Outdated Show resolved Hide resolved
src/python/espressomd/zn.py Outdated Show resolved Hide resolved
src/python/espressomd/zn.py Outdated Show resolved Hide resolved
src/python/espressomd/zn.py Outdated Show resolved Hide resolved
Co-authored-by: Jean-Noël Grad <jgrad@icp.uni-stuttgart.de>
@jngrad jngrad added the automerge Merge with kodiak label Aug 5, 2024
@kodiakhq kodiakhq bot merged commit 8c90c3d into espressomd:python Aug 5, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge with kodiak New Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants