A natural language interface for VMD (Visual Molecular Dynamics). Upload a PDB file, describe a visualization in plain English, and get a rendered image — no Tcl scripting required.
- User uploads a PDB file and enters a natural language prompt
- An LLM (GPT-4o via OpenRouter) converts the prompt into a VMD Tcl script
- VMD runs headlessly to render the scene using TachyonInternal
- A PNG is returned and displayed in the UI
The Streamlit frontend also exposes the generated Tcl script in an editable text area, so users can tweak and re-render without re-prompting.
Prompt: Color chain A red in ribbon representation, hide everything else
Generated Tcl:
delrep 0 top
color Display Background white
axes location Off
display depthcue off
mol addrep top
mol modstyle 0 top NewRibbons
mol modcolor 0 top ColorID 1
mol modselect 0 top "chain A"Requirements:
Install dependencies:
pip install fastapi uvicorn anthropic pillow streamlit requests python-multipartSet environment variable:
cp .env.example .env
# edit .env and add your Anthropic key
export ANTHROPIC_API_KEY=sk-ant-...Start the FastAPI backend:
uvicorn main:app --reloadStart the Streamlit frontend (separate terminal):
streamlit run streamlit_app.pyThen open http://localhost:8501 and upload a PDB file.
Test the backend directly:
curl -X POST "http://127.0.0.1:8000/vmd/run" \
-F "prompt=Color chain A red in ribbon representation and hide everything else" \
-F "pdb_file=@A1B1.pdb"| Endpoint | Description |
|---|---|
POST /vmd/run |
Natural language prompt + PDB → rendered PNG URL |
POST /vmd/run-tcl |
Raw Tcl script + PDB → rendered PNG URL |
GET /static/<filename> |
Serve rendered images |