espresso icon indicating copy to clipboard operation
espresso copied to clipboard

Add more ZnDraw-features

Open phohenberger opened this issue 1 year ago • 8 comments

  • [x] Move len(zndraw) call in update loop to avoid socket-call
  • [ ] ~~Allow non-Jupyter use~~ postponed due to unsolved runaway server problems
  • [x] Allow multiple frames in the same file using different tokens
  • [x] ~~Asynchronous Server startup~~
  • [x] ~~Add color gradients for particle colors depending on the distance to reference~~
  • [x] Make constraints proportionate to the box dimension, update ZnDraw shape
    • Add clipping mechanism for 2D shapes that cross the box boundaries
  • [x] Make the box center the origin, instead of a box corner (confusing when rotating the box view)
  • [x] Expose the ZnDraw script interface to Python
    • At least provide a way to set the camera angle from Python
  • [ ] Fix inconsistencies in server communication
    • [X] 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
  • [x] ~~Find out if datamodel-code-generator can be made a soft dependency (it has a lot of dependencies)~~ not possible
  • [ ] Visualize ext_forces

phohenberger avatar Aug 06 '24 09:08 phohenberger

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 = {

jngrad avatar Aug 12 '24 12:08 jngrad

  • [ ] Visualize ext_forces

PythonFZ avatar Aug 14 '24 06:08 PythonFZ

@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?

phohenberger avatar Aug 16 '24 16:08 phohenberger

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

jngrad avatar Aug 16 '24 19:08 jngrad

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

jngrad avatar Aug 22 '24 09:08 jngrad

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?

phohenberger avatar Aug 22 '24 22:08 phohenberger

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

jngrad avatar Aug 23 '24 05:08 jngrad

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

jngrad avatar Aug 23 '24 16:08 jngrad