semvec/pypi-packages huggingface dataset:
chemanim 0.1.6
A Manim-based library for chemistry and biochemistry animations
License: MIT
Requires Python: >=3.9
Keywords: animation, biochemistry, chemistry, manim, molecules, protein, visualization

# Chemanim

A Python library extended from [Manim](https://github.com/3b1b/manim) for creating chemistry and biochemistry animations.

## Features

- **Core Chemistry**: Visualize Atoms, Bonds, and Molecules.
- **Trusted Data**: Fetch molecular structures directly from PubChem.
- **Biochemistry**: Parse and visualize PDB structures (Proteins/DNA).
- **3D Molecules**: Render ball-and-stick structures with PubChem or RDKit conformers.
- **Reactions**: Animate chemical reactions simply.

## Installation

### 1. Basic (Logic & Data only)
Use this if you don't need animations or cannot install Manim dependencies.
```bash
pip install -e .
```

### 2. Full (With Animations)
First, ensure you have [Manim's system dependencies](https://docs.manim.community/en/stable/installation.html) installed (FFmpeg, etc.).
```bash
pip install -e .[vis]
```

## Usage

See `examples/` folder for demo scripts.

```bash
manim -pql examples/demo_reaction.py SimpleReactionScene
```

### 3D quickstart

Install with Manim and RDKit (optional) and run the sample:

```bash
manim -pql examples/demo_3d_molecule.py Molecule3DDemo
```

### External 3D viewers (py3Dmol / XYZ)

Optional dependency: `pip install py3Dmol`

- Generate interactive HTML and XYZ: `python examples/demo_py3dmol_viewer.py`
- Styles supported: ball, stick, ball-and-stick (default). Files land in `media/py3dmol/`.

Programmatic use:

```python
from chemanim.connect import fetch_molecule_data
from chemanim.viewer_3d import show_py3dmol, write_xyz

data = fetch_molecule_data("benzene")
view = show_py3dmol(data, style="ball_and_stick")
view.write_html("benzene.html")
write_xyz("benzene.xyz", data)
```