Metadata-Version: 2.5
Name: atomeye-widget
Version: 3.1.0
Summary: AtomEye, the atomistic configuration viewer by Ju Li, as a WebAssembly notebook widget for marimo and Jupyter
Project-URL: Homepage, https://github.com/jameskermode/AtomEye
Project-URL: Issues, https://github.com/jameskermode/AtomEye/issues
Project-URL: Demo, https://jameskermode.github.io/AtomEye/
Author: Ju Li, Futoshi Shimizu, James Kermode
Maintainer: James Kermode
License-Expression: MIT
License-File: LICENSE
Keywords: ASE,anywidget,atomistic,extxyz,jupyter,marimo,visualisation
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: WebAssembly :: Emscripten
Classifier: Framework :: Jupyter
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Chemistry
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.9
Requires-Dist: anywidget>=0.9
Requires-Dist: traitlets
Provides-Extra: ase
Requires-Dist: ase; extra == 'ase'
Requires-Dist: numpy; extra == 'ase'
Provides-Extra: test
Requires-Dist: ase; extra == 'test'
Requires-Dist: numpy; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

# atomeye-widget

[AtomEye](https://github.com/jameskermode/AtomEye), the atomistic
configuration viewer, as a notebook widget. The viewer itself runs in the
browser as WebAssembly, so the widget needs no compiled extension, no
display and no server-side rendering: it works in
[marimo](https://marimo.io) (including WASM notebooks), Jupyter and
anywhere else [anywidget](https://anywidget.dev) does.

    pip install atomeye-widget

It is a pure Python package, so in a notebook that runs in the browser
(marimo WASM, JupyterLite, Pyodide) `micropip.install("atomeye-widget")`
installs it too.

```python
from ase.build import bulk
from atomeye_widget import AtomEyeWidget

w = AtomEyeWidget(bulk("Si", cubic=True) * (3, 3, 3))
w                                   # in marimo: mo.ui.anywidget(w)
```

`AtomEyeWidget` takes an `ase.Atoms`, a list of them (a trajectory) or
Extended XYZ text. The package also registers itself as an ASE viewer:
`ase.visualize.view(atoms, viewer="atomeye_widget")` returns the widget.

- `w.frame = 5` shows another frame of a trajectory; `w.show(atoms)` shows
  something new, keeping the view.
- `w.run_command("toggle_bond_mode")` runs any AtomEye command;
  `w.run_script(text)` several. Per-atom arrays of the `Atoms` are
  available for colouring: `w.aux_property_coloring("charge")`.
- A new view shows the atoms at a third of their usual size, with bonds,
  so that the structure is visible. `AtomEyeWidget(atoms, startup="")`
  gives AtomEye's own defaults (full-size atoms, no bonds), and `startup`
  can be any AtomEye commands to run first, one per line.
- `w.capture()` asks the browser for a PNG, which arrives in `w.png`.

Press `?` on the view (or the "? shortcuts" button) for a list of the
keyboard and mouse controls. The mouse and keyboard work as in AtomEye on the desktop: drag to rotate,
Shift-drag to translate, wheel or right-drag to move in and out,
right-click an atom for information about it (shown under "AtomEye
output"); on a touch screen, one finger rotates, two
fingers translate, pinching moves in and out and holding a finger still
on an atom gives the information, and, after clicking on the view to give it the keyboard, the
usual keys (`b` bonds, `k` coordination colouring, `Delete`/`Insert` next
and previous frame, ...).

`examples/marimo_demo.py` in the source tree is a small marimo app; it
runs in your browser at <https://jameskermode.github.io/AtomEye/>.

The JavaScript bundle `atomeye_widget/static/widget.js` is built from the
C sources with Emscripten: see `wasm/README.md` in the source tree.

## Credits and licence

AtomEye was written by Ju Li, with the scripting interface of AtomEye 3
by Futoshi Shimizu. If you use it in published work, please cite
J. Li, "AtomEye: an efficient atomistic configuration viewer",
Modelling Simul. Mater. Sci. Eng. 11 (2003) 173,
[doi:10.1088/0965-0393/11/2/305](https://doi.org/10.1088/0965-0393/11/2/305).
The port to the browser and this widget are by James Kermode.

MIT licence, with the permission of the original authors: see `LICENSE`.
