Metadata-Version: 2.4
Name: ase-weas-widget
Version: 0.2.0
Summary: Visualizer plugin to use ase with weas-widget
Project-URL: Documentation, https://github.com/zhubonan/ase-weas-widget#readme
Project-URL: Issues, https://github.com/zhubonan/ase-weas-widget/issues
Project-URL: Source, https://github.com/zhubonan/ase-weas-widget
Author-email: Bonan Zhu <zhubonan@outlook.com>
License-Expression: MIT
License-File: LICENSE.txt
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.8
Requires-Dist: ase>=3.24
Requires-Dist: weas-widget
Description-Content-Type: text/markdown

# ase-weas-widget

[![PyPI - Version](https://img.shields.io/pypi/v/ase-weas-widget.svg)](https://pypi.org/project/ase-weas-widget)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ase-weas-widget.svg)](https://pypi.org/project/ase-weas-widget)

-----

## Table of Contents

- [ase-weas-widget](#ase-weas-widget)
  - [Table of Contents](#table-of-contents)
  - [Installation](#installation)
  - [Usage](#usage)
  - [How it works](#how-it-works)
  - [License](#license)

## Installation

```console
pip install ase-weas-widget
```

This should install `weas-widget` as the dependency if it is not installed. 
Please refer to the [weas-widget repository](https://github.com/superstar54/weas-widget) for examples in order to verifying its correct installation.

## Usage

This plugin allows viewing `ase.Atoms` object using `ase.visualize.view` via the [weas-widget](https://github.com/superstar54/weas-widget) in a notebook environment:

```python
from ase.build import bulk
from ase.visualize import view
atoms = bulk('Si', 'diamond', 5.4)
view(atoms.repeat((2,2,2)), viewer='weas')
```

Output example:

![example output](example.gif)


The appearance of the resulting plot can be customized with a callback function that modifies the underlying `WeasWidget` object:


```python
def apply_vesta(viewer):
    """Callback to customize the WeasWidget object"""
    viewer.avr.model_style = 1
    viewer.avr.show_bonded_atoms = True
    viewer.avr.color_type = "VESTA"
    
atoms = bulk('Si', 'diamond', 5.4)
view(atoms.repeat((2,2,2)), viewer='weas', mods=apply_vesta)
```

Output example:

![example output](example2.gif)

or equivalently using a pre-defined modifier function (callback) (see [here](https://github.com/bonan-group/ase-weas-widget/blob/main/src/ase_weas_widget/viewer.py) for available options):

```python
atoms = bulk('Si', 'diamond', 5.4)
view(atoms.repeat((2,2,2)), viewer='weas', presets='vesta,ball')
```

Please refer to the documentation of [weas-widget](https://github.com/superstar54/weas-widget) for details about how to control and modify the output.

## How it works

This plugin simply interfaces the `WeasWidget` object with the `ase.visualize` module. The `view` function returns the `WeasWidget` which is constructed from the
`ase.Atoms` object as the output. The latter is then displayed by Jupyter.


## License

`ase-weas-widget` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
