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 more ZnDraw-features #4972

Open
9 of 12 tasks
phohenberger opened this issue Aug 6, 2024 · 8 comments
Open
9 of 12 tasks

Add more ZnDraw-features #4972

phohenberger opened this issue Aug 6, 2024 · 8 comments

Comments

@phohenberger
Copy link
Contributor

phohenberger commented Aug 6, 2024

  • Move len(zndraw) call in update loop to avoid socket-call
  • Allow non-Jupyter use postponed due to unsolved runaway server problems
  • Allow multiple frames in the same file using different tokens
  • Asynchronous Server startup
  • Add color gradients for particle colors depending on the distance to reference
  • Make constraints proportionate to the box dimension, update ZnDraw shape
    • Add clipping mechanism for 2D shapes that cross the box boundaries
  • Make the box center the origin, instead of a box corner (confusing when rotating the box view)
  • Expose the ZnDraw script interface to Python
    • At least provide a way to set the camera angle from Python
  • Fix inconsistencies in server communication
    • on lama, ZnDraw creates a white rectangle in Jupyter instead of displaying the GUI (works fine in Chrome, on Firefox one can still click on the server URL to open the visualizer in a new tab and see everything)
      • solution: completely deactivate cookie blocking in the web browser settings (not just from third-party or unvisited sites, allow all cookies)
    • on CIP pool machines, using Firefox, once a ZnDraw server was used in a Notebook, when opening another Notebook in the same Jupyter session, ZnDraw cannot load the particle data
    • on other web browsers like GNOME Web, ZnDraw cannot load the particle data
  • Find out if datamodel-code-generator can be made a soft dependency (it has a lot of dependencies) not possible
  • Visualize ext_forces
@jngrad
Copy link
Member

jngrad commented Aug 12, 2024

Here is a one-line change to make the complete CI/CD pipeline happy:

diff --git a/testsuite/scripts/importlib_wrapper.py b/testsuite/scripts/importlib_wrapper.py
index f3dd8e5b44..5bc879338c 100644
--- a/testsuite/scripts/importlib_wrapper.py
+++ b/testsuite/scripts/importlib_wrapper.py
@@ -396,3 +396,3 @@ class GetEspressomdVisualizerImports(ast.NodeVisitor):
     def __init__(self):
-        self.visualizers = {"visualization"}
+        self.visualizers = {"visualization", "zn"}
         self.namespace_visualizers = {

@PythonFZ
Copy link
Contributor

  • Visualize ext_forces

@phohenberger
Copy link
Contributor Author

@jngrad Regarding the cookie issue, are you sure that you have enable all cookies? On firefox for example I worked fine when using blocking cross-site tracking cookies and isolate other cross-site cookies or is this lama specific?

@jngrad
Copy link
Member

jngrad commented Aug 16, 2024

I did not try all options, but the two specifically mentioned were not resolving the issue. I gave up and allowed everything.

@jngrad
Copy link
Member

jngrad commented Aug 22, 2024

After updating to ZnDraw 0.4.6, I can no longer start a ZnDraw server on Chrome and Firefox:

Starting ZnDraw server, this may take a few seconds
WARNING:zndraw.zndraw:Connection failed. Retrying...
WARNING:zndraw.zndraw:Connection failed. Retrying...
WARNING:zndraw.zndraw:Connection failed. Retrying...
WARNING:zndraw.zndraw:Connection failed. Retrying...
ConnectionError                           Traceback (most recent call last)
/work/jgrad/espresso-fork-PR/zndraw/lib/python3.10/site-packages/zndraw/zndraw.py in __post_init__(self)
    118                 self.socket.sleep(self.timeout["connection"])
    119                 if idx == self.timeout["connect_retries"]:
--> 120                     raise socketio.exceptions.ConnectionError(
    121                         f"Unable to connect to ZnDraw server at '{self.url}'. Is the server running?"
    122                     ) from err
ConnectionError: Unable to connect to ZnDraw server at 'ws://127.0.0.1:1234'. Is the server running?
pip freeze
(zndraw) jgrad@lama:/work/jgrad/espresso-fork-PR$ pip freeze
amqp==5.2.0
annotated-types==0.7.0
argcomplete==3.5.0
ase==3.23.0
async-timeout==4.0.3
bidict==0.23.1
billiard==4.2.0
black==24.8.0
blinker==1.8.2
celery==5.4.0
certifi==2024.7.4
charset-normalizer==3.3.2
click==8.1.7
click-didyoumean==0.3.1
click-plugins==1.1.1
click-repl==0.3.0
contourpy==1.2.1
cycler==0.12.1
datamodel-code-generator==0.25.9
dnspython==2.6.1
email_validator==2.2.0
eventlet==0.36.1
Flask==2.3.3
Flask-SocketIO==5.3.6
fonttools==4.53.1
genson==1.3.0
greenlet==3.0.3
h11==0.14.0
idna==3.7
inflect==5.6.2
isort==5.13.2
itsdangerous==2.2.0
Jinja2==3.1.4
kiwisolver==1.4.5
kombu==5.4.0
lazy_loader==0.4
markdown-it-py==3.0.0
MarkupSafe==2.1.5
matplotlib==3.9.2
mdurl==0.1.2
mypy-extensions==1.0.0
networkx==3.3
numpy==1.26.4
packaging==24.1
pandas==2.2.2
pathspec==0.12.1
pillow==10.4.0
platformdirs==4.2.2
plotly==5.23.0
prompt_toolkit==3.0.47
pydantic==2.8.2
pydantic_core==2.20.1
Pygments==2.18.0
pyparsing==3.1.2
python-dateutil==2.9.0.post0
python-engineio==4.9.1
python-socketio==5.11.3
pytz==2024.1
PyYAML==6.0.2
redis==5.0.8
requests==2.32.3
rich==13.7.1
scipy==1.14.1
shellingham==1.5.4
simple-websocket==1.0.0
six==1.16.0
splines==0.3.2
SQLAlchemy==2.0.32
tenacity==9.0.0
toml==0.10.2
tomli==2.0.1
tqdm==4.66.5
typer==0.12.4
typing_extensions==4.12.2
tzdata==2024.1
urllib3==2.2.2
vine==5.1.0
wcwidth==0.2.13
websocket-client==1.8.0
Werkzeug==3.0.4
wsproto==1.2.0
zndraw==0.4.6
znjson==0.2.4
znsocket==0.1.8

@phohenberger
Copy link
Contributor Author

phohenberger commented Aug 22, 2024

What. I tested in on some of the most common browsers. Chrome, Firefox, Edge, Brave all worked with no issues at all. The internal ZnDraw tests for starting a server also passed.

Is the problem you are facing simply using the Visualizer as provided by the PR, or your work on making it run on binder?

@jngrad
Copy link
Member

jngrad commented Aug 23, 2024

I used your PR on the lama workstation, and accepted cookies.

@jngrad
Copy link
Member

jngrad commented Aug 23, 2024

We created a new user account to get a fresh Firefox/Chrome/JupyterLab installation, and your PR now works.

kodiakhq bot added a commit that referenced this issue Aug 23, 2024
Partial fix for #4972

Description of changes:
- Remove unnecessary socket-call in the update loop
- Allow multiple instances of the visualizer in the same notebook
- Have only one server run in the background when initializing the first `Visualizer`-instance
- Center the camera on initialization
- Clip wall shape at the box boundaries
- Expose the `self.zndraw`-object for direct manipulation of `ZnDraw`
- Bump to 'ZnDraw 0.4.6'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants