Skip to main content

Display and Edit Molecular Structures and Trajectories in the Browser.

Project description

zincware PyPI version DOI codecov 'Threejs

ZnDraw

Install via pip install zndraw. If you have pip install pywebview installed, ZnDraw will open in a dedicated window instead of your default browser.

CLI

You can use ZnDraw to view a file using the CLI zndraw traj.xyz. Supported file formats include everything that ase.io can read and additionally h5 files in the H5MD standard.

If you want to view the frames while they are added to the scene you can use zndraw -mp traj.xyz. See zndraw --help for more CLI options.

Python

ZnDraw provides a Python interface. The zndraw.ZnDraw object offers append, extend as well as assignment operations. More information is available in the example notebook.

from zndraw import ZnDraw
import ase

vis = ZnDraw()

vis.socket.sleep(2) # give it some time to fully connect
vis[0] = ase.Atoms(
  "H2O", positions=[[0.75, -0.75, 0], [0.75, 0.75, 0], [0, 0, 0]]
  )

ZnDraw also provides an interface to the Python logging library, including support for formatters and different logging levels.

import logging

log = logging.getLogger(__name__)
log.addHandler(vis.get_logging_handler())
log.critical("Critical Message")

Modifier

You can register modifier to change the scene via the interactions menu.

import typing as t

from zndraw import ZnDraw, Extension
import ase

vis = ZnDraw()

class MyModifier(UpdateScene):
  name: str = "H2O"

  def run(self, vis: ZnDraw, **kwargs) -> None:
    vis.append(molecule(self.name))

vis.register_modifier(
  MyModifier, public=True, run_kwargs={}
)

User Interface

ZnDraw UI

ZnDraw UI3

Development

ZnDraw is developed using https://python-poetry.org/. Furthermore, the javascript packages have to be installed using https://www.npmjs.com/.

cd zndraw/static/
npm install

Docker

This package is available as a docker container and can be used via

docker run -pythonf/zndraw

References

If you use ZnDraw in your research and find it helpful please cite us.

@misc{elijosiusZeroShotMolecular2024,
  title = {Zero {{Shot Molecular Generation}} via {{Similarity Kernels}}},
  author = {Elijo{\v s}ius, Rokas and Zills, Fabian and Batatia, Ilyes and Norwood, Sam Walton and Kov{\'a}cs, D{\'a}vid P{\'e}ter and Holm, Christian and Cs{\'a}nyi, G{\'a}bor},
  year = {2024},
  eprint = {2402.08708},
  archiveprefix = {arxiv},
}

Acknowledgements

The creation of ZnDraw was supported by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) in the framework of the priority program SPP 2363, “Utilization and Development of Machine Learning for Molecular Applications - Molecular Machine Learning” Project No. 497249646. Further funding though the DFG under Germany's Excellence Strategy - EXC 2075 - 390740016 and the Stuttgart Center for Simulation Science (SimTech) was provided.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zndraw-0.4.0a5.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

zndraw-0.4.0a5-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file zndraw-0.4.0a5.tar.gz.

File metadata

  • Download URL: zndraw-0.4.0a5.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.5 Darwin/23.5.0

File hashes

Hashes for zndraw-0.4.0a5.tar.gz
Algorithm Hash digest
SHA256 e7b96fab282a80d1289bf22453dd477a11fb5630a2607922f20463d435aa0981
MD5 61c2ca06b5157da25ddbf60aaf8ced5f
BLAKE2b-256 d0e16ffd3430c59f6ca2310db6acc51be8f6968868bb6e7dc2b7e19729254edf

See more details on using hashes here.

File details

Details for the file zndraw-0.4.0a5-py3-none-any.whl.

File metadata

  • Download URL: zndraw-0.4.0a5-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.5 Darwin/23.5.0

File hashes

Hashes for zndraw-0.4.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 c4d740a7d62aa11fefad7b31405c8446ccbcfac3e581cff9c12025ffbf5e3d15
MD5 54903d329dd17f8403ad00cc4db6da55
BLAKE2b-256 17ee5f5e9ab7c176d7b66e99798c0c4ad15bef817b03bd19cfd29d6d6f0b9b88

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page