A Manim-based library for chemistry and biochemistry animations
Project description
Chemanim
A Python library extended from ManimGL 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, space-filling, and wireframe structures.
- Protein Visualization: Cartoon ribbon diagrams with secondary structure coloring.
- Reactions: Animate chemical reactions simply.
Installation
Install from PyPI:
pip install chemanim
Interactive Setup (Recommended)
After installation, run the setup wizard to install optional features:
chemanim-setup
This will show an interactive menu to choose what you need:
- All Features ⭐ - ManimGL + RDKit + ChemPy + Biotite + py3Dmol
- Animations Only - Just ManimGL
- Chemistry Analysis - RDKit + ChemPy + ChemFormula
- Protein Analysis - Just Biotite
- 3D Viewer - Just py3Dmol
Manual Installation
Or install optional dependencies directly:
| Command | What it adds |
|---|---|
pip install chemanim[vis] |
ManimGL for animations |
pip install chemanim[chem] |
RDKit + ChemPy + ChemFormula for molecular analysis |
pip install chemanim[bio] |
Biotite for protein secondary structure analysis |
pip install chemanim[viewer] |
py3Dmol for interactive 3D viewing |
pip install chemanim[all] |
All optional dependencies |
Core Dependencies (installed automatically)
numpy- Numerical operationsrequests- HTTP requests for PubChempubchempy- PubChem API wrapperbiopython- PDB file parsingnetworkx- Molecular graph operations
Development Installation
For local development:
git clone https://github.com/Wachirawut2023/Chemanim.git
cd Chemanim
pip install -e .[all]
Usage
See examples/ folder for demo scripts.
Basic Animation
manimgl examples/demo_reaction.py SimpleReactionScene
3D Molecule Visualization
manimgl examples/demo_3d_molecule.py Molecule3DDemo
Protein Visualization
manimgl examples/demo_protein_styles.py ProteinStylesDemo
Interactive 3D Viewer (py3Dmol)
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)
Examples
| Example | Description |
|---|---|
demo_pubchem.py |
Fetch and display molecules from PubChem |
demo_reaction.py |
Simple chemical reaction animation |
demo_render_styles.py |
Ball-and-stick, space-filling, wireframe |
demo_protein_styles.py |
Protein cartoon, backbone, and atom views |
demo_py3dmol_viewer.py |
Interactive HTML 3D viewer |
License
MIT License - see LICENSE for details.
Author
Wachirawut Raksawat (@Wachirawut2023)
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chemanim-0.1.3.tar.gz.
File metadata
- Download URL: chemanim-0.1.3.tar.gz
- Upload date:
- Size: 74.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58314931ecf64e80b04d59a31d270a554ccb4a473d5ab324ab708fcec341e085
|
|
| MD5 |
7b9aea23d674016f1e7f5f18b31a8d24
|
|
| BLAKE2b-256 |
343f773281d70b3b19f7c25edef9a2ed01ecfdb6c5720ceb4904ac2aeaad4abb
|
File details
Details for the file chemanim-0.1.3-py3-none-any.whl.
File metadata
- Download URL: chemanim-0.1.3-py3-none-any.whl
- Upload date:
- Size: 47.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c225d91d1d22a5a746e9e8905deb948f5245eade61699ac21ae896c7d0fa6c56
|
|
| MD5 |
73fb01556c858285ea46be030779c675
|
|
| BLAKE2b-256 |
4354705636e6ff4f21ca31e12c2f99a5844e72ffb6ce097d55a4877c183a0518
|