Spaces:
Sleeping
Sleeping
File size: 3,785 Bytes
e2c4ffa 7a64295 e2c4ffa 75fa629 e2c4ffa 954c37e a2d1bea c2f9174 a2d1bea 36f4a56 a2d1bea 36f4a56 a2d1bea 75fa629 a2d1bea 75fa629 a2d1bea |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
---
title: GeminiSim
emoji: ⚛️
colorFrom: gray
colorTo: yellow
sdk: gradio
sdk_version: 5.33.0
app_file: app.py
pinned: false
short_description: 'Gradio app combining ASE simulations with Gemini AI. '
tags: [agent-demo-track, ASE, Gemini, Gradio]
---
# GeminiSim - An ASE-Gemini Agentic Demo
This project is a Gradio-based Agentic Demo for running atomic and molecular simulations using the [Atomic Simulation Environment (ASE)](https://wiki.fysik.dtu.dk/ase/), with natural language setup and analysis powered by Google's Gemini. Users can describe their simulation tasks in plain English, and the tool will set up, run, and analyze simulations automatically. [Video Presentation](https://mylifeunisaac-my.sharepoint.com/:v:/g/personal/63230615_mylife_unisa_ac_za/ETIgsxm_7x5Erxuub3LqmBYBn511VRGulyimNRm8BGTRow?nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJPbmVEcml2ZUZvckJ1c2luZXNzIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXciLCJyZWZlcnJhbFZpZXciOiJNeUZpbGVzTGlua0NvcHkifX0&e=Nn40pW)
---
## Features
- **Natural Language Interface:** Describe your simulation in everyday language.
- **Automated Setup:** Gemini interprets your request and generates ASE-compatible Python code.
- **Simulation Execution:** Runs the simulation (e.g., geometry optimization) using ASE.
- **Result Analysis:** Gemini summarizes and explains the simulation results.
- **Visual Output:** Gradio displays molecular structures and analysis.
- **Code Transparency:** View the generated Python code for reproducibility.
---
## Requirements
- Python 3.8+
- [ASE](https://wiki.fysik.dtu.dk/ase/)
- [Gradio](https://gradio.app/)
- [matplotlib](https://matplotlib.org/)
- [google-generativeai](https://pypi.org/project/google-generativeai/) (for Gemini API access)
- A Gemini API key
Install dependencies with:
```sh
pip install -r requirements.txt
```
---
## Usage
1. **Set your Gemini API Key**
The application requires access to Gemini. Set your API key (replace with your actual key):
```python
# In app.py
genai.configure(api_key="YOUR_GEMINI_API_KEY")
```
Or, set the key as an environment variable and update the script accordingly:
```sh
export GEMINI_API_KEY="your-key-here"
```
2. **Run the Application**
```sh
python app.py
```
3. **Open the Gradio Interface**
After launching, Gradio will provide a local (and optionally public) web URL.
Enter your simulation instructions, such as:
- "Optimize a water molecule and show the final geometry."
- "Simulate a methane molecule and provide a summary of the bond lengths."
---
## How It Works
1. **Input:**
User provides a natural language description of the simulation task.
2. **LLM Parsing:**
Gemini interprets the description and generates ASE setup code.
3. **Simulation:**
The code is executed using ASE, running the required simulation.
4. **Analysis:**
Gemini analyzes the results and provides a summary.
5. **Output:**
The Gradio interface displays the molecular structure, analysis, and generated code.
---
## Security Note
- The current implementation uses `exec()` to run code generated by the LLM. **This is unsafe for untrusted input.**
- For production or public deployment, you must sandbox code execution (e.g., Docker, restricted Python environment).
---
## Customization
- Easily extend for other calculators, property analysis, or support for file uploads.
- Integrate additional ASE features or other simulation backends as needed.
---
## License
This project is provided under the MIT License. See [LICENSE](LICENSE) for details.
---
## Acknowledgments
- [Atomic Simulation Environment (ASE)](https://wiki.fysik.dtu.dk/ase/)
- [Gradio](https://gradio.app/)
- [Gemini](https://ai.google.dev/) |