GeminiSim / README.md
SKekana's picture
Update README.md
7a64295 verified

A newer version of the Gradio SDK is available: 5.44.1

Upgrade
metadata
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), 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


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

Install dependencies with:

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):

    # In app.py
    genai.configure(api_key="YOUR_GEMINI_API_KEY")
    

    Or, set the key as an environment variable and update the script accordingly:

    export GEMINI_API_KEY="your-key-here"
    
  2. Run the Application

    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 for details.


Acknowledgments