No project description provided
Project description
ZnDraw
Install via pip install zndraw
or pip install zndraw[webview]
to open zndraw
in a dedicated window.
CLI
You can use ZnDraw with the CLI zndraw atoms.xyz
. For a full list of arguments
use zndraw --help
.
ZnDraw is designed to work with your Python scripts. To interface you can
inherit from zndraw.examples.UpdateScene
or follow this base class:
import abc
from pydantic import BaseModel
class UpdateScene(BaseModel, abc.ABC):
@abc.abstractmethod
def run(self, atom_ids: list[int], atoms: ase.Atoms, **kwargs) -> list[ase.Atoms]:
pass
The run
method expects as inputs
- atom_ids: list[int], the ids of the currently selected atoms
- atoms: ase.Atoms, the configuration as
ase.Atoms
file where atom_ids where selected. - kwargs: dict could be additional information from the scene
and as an output:
- list[ase.Atoms], a list of ase Atoms objects to display.
You can define the parameters using pydantic.Field
which will be displayed in
the UI.
class MyUpdateCls(UpdateScene):
steps: int = Field(100, le=1000, ge=1)
x: float = Field(0.5, le=5, ge=0)
symbol: str = Field("same")
To add your method click on the +
on the right side of the window. Your should
be able to add your method from the working directory via module.MyUpdateCls
as long as it can be imported via from module import MyUpdateCls
.
ZnTrack Integration
You can use ZnDraw to view data that is made accessible via ZnTrack. For this example we use https://github.com/IPSProjects/SDR. All requirements described in this repository are required.
zndraw Acetone-x10:atoms --remote https://github.com/IPSProjects/SDR --rev acetone
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
You can also use the docker image via
docker run -it -p 5003:5003 -v "$(pwd)":/src pythonf/zndraw /src/traj.h5
.
This will display the file traj.h5
from the current working directory on
http://localhost:5003
.
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
Built Distribution
File details
Details for the file zndraw-0.2.0a5.tar.gz
.
File metadata
- Download URL: zndraw-0.2.0a5.tar.gz
- Upload date:
- Size: 15.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.8 Linux/5.19.0-50-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4244632c0c64e40c1650163c52ffa8395222a2dfc7a3eee7c2fb04b7b1622106 |
|
MD5 | 89e0d16e9f3b2a2209a4f4855c33976a |
|
BLAKE2b-256 | b94de9d239cf7054a626fc64aa3f28517c625613546f1ab433284baeef30c658 |
File details
Details for the file zndraw-0.2.0a5-py3-none-any.whl
.
File metadata
- Download URL: zndraw-0.2.0a5-py3-none-any.whl
- Upload date:
- Size: 16.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.10.8 Linux/5.19.0-50-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3b7a4b0f7934f095c3dbc8bf2201ac64bc95bb79c803e7e1f1532ebbc1f20e7 |
|
MD5 | a6951245ff5dbb60fad6a5820f1c5f9a |
|
BLAKE2b-256 | f85b6c9fa515cb16723184169d8020e91a23df4f2627a71efb99ebb776b43c28 |