Metadata-Version: 2.1
Name: zndraw
Version: 0.2.0a2
Summary: 
License: Apache-2.0
Author: zincwarecode
Author-email: zincwarecode@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Provides-Extra: webview
Requires-Dist: ase (>=3.22.1,<4.0.0)
Requires-Dist: flask (>=2.2.3,<3.0.0)
Requires-Dist: networkx (>=3.1,<4.0)
Requires-Dist: pandas (>=2.0.1,<3.0.0)
Requires-Dist: plotly (>=5.14.1,<6.0.0)
Requires-Dist: pydantic (>=1.10.7,<2.0.0)
Requires-Dist: pywebview (>=4.0.2,<5.0.0) ; extra == "webview"
Requires-Dist: tqdm (>=4.65.0,<5.0.0)
Requires-Dist: typer[all] (>=0.7.0,<0.8.0)
Requires-Dist: znh5md (>=0.1.6,<0.2.0)
Project-URL: repository, https://github.com/zincware/ZnDraw
Description-Content-Type: text/markdown

[![zincware](https://img.shields.io/badge/Powered%20by-zincware-darkcyan)](https://github.com/zincware)
[![PyPI version](https://badge.fury.io/py/zndraw.svg)](https://badge.fury.io/py/zndraw)
!['Threejs](https://img.shields.io/badge/threejs-black?style=for-the-badge&logo=three.js&logoColor=white)

# 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:

```python
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.

```python
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`.

![ZnDraw UI](https://raw.githubusercontent.com/zincware/ZnDraw/main/misc/zndraw_ui.png "ZnDraw UI")

![ZnDraw UI2](https://raw.githubusercontent.com/zincware/ZnDraw/main/misc/zndraw_protein.png "ZnDraw UI2")

![ZnDraw UI3](https://raw.githubusercontent.com/zincware/ZnDraw/main/misc/zndraw_draw.png "ZnDraw UI3")

# Development

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

```bash
cd zndraw/static/
npm install
```

