This guide describes the integration of the AI structure generation module with InterfaceML. The integration adds fullerene generation and evaluation to the web interface and exposes new API endpoints for batch workflows.
- AI-based fullerene generation for C60, C70, C80, C84, C100, and custom sizes
- Batch generation with metadata export (XYZ and JSON)
- Web UI integration with status checks and validation
- Unified REST API endpoints for traditional and AI features
Traditional features:
/api/upload- File uploads/api/build-interface- Interface builder/api/fix-layers- Layer management/api/compute-density- Density analysis/api/plot-dos- DOS visualization
AI features:
/api/ai/generate- Structure generation/api/ai/evaluate- Quality metrics/api/ai/info- Model information
- Python 3.8 or higher
- InterfaceML dependencies
- PyTorch 2.0 or higher
- PyTorch Geometric 2.0 or higher
- Ensure the AI module is present:
cd /path/to/InterfaceML
ls fullerene_e3gen/checkpoints/best_model.pt- Optional environment overrides:
# Override the AI module location
export INTERFACEML_FULLERENE_PATH=/path/to/fullerene_e3gen
# Override the checkpoint path
export INTERFACEML_FULLERENE_CHECKPOINT=/path/to/best_model.pt- Start the integrated server:
cd interfaceml/web
python app.py --port 5000Expected output includes the upload folder, module availability, and server URL.
- Open a browser at
http://localhost:5000and select the AI Structure Generation tab.
- Select "C60 (Buckminsterfullerene)" from the dropdown
- Set the number of samples
- Click "Generate Structures"
- Download results
curl -X POST http://localhost:5000/api/ai/generate \
-H "Content-Type: application/json" \
-d '{
"num_atoms": 60,
"num_samples": 5,
"output_format": "xyz"
}'curl -X POST http://localhost:5000/api/ai/evaluate \
-H "Content-Type: application/json" \
-d '{
"generated_dir": "ai_generated_abc123"
}'- Select multiple carbon counts
- Set samples per size
- Click "Batch Generate"
- Select "Custom" from the dropdown
- Enter an even atom count between 20 and 240
- Generate
Key files:
interfaceml/web/app.py- app factory and blueprint registrationinterfaceml/web/routes/- Flask blueprints by domaininterfaceml/web/ai.py- AI module discovery and loadinginterfaceml/web/core.py- core module availabilityinterfaceml/web/dos.py- DOS and PDOS helpersinterfaceml/web/utils.py- shared utilities
from interfaceml.web.ai import load_fullerene_api
ai_status = load_fullerene_api()
app.register_blueprint(common_bp)
app.register_blueprint(interface_bp)
app.register_blueprint(dos_bp)
app.register_blueprint(ai_bp)Key files:
templates/index.html- AI tab UIstatic/css/style.css- AI stylesstatic/js/app.js- AI interactions
The AI module loads from the following layout:
fullerene_e3gen/
|-- checkpoints/
| `-- best_model.pt # Main checkpoint (required)
|-- api.py # Python API
`-- config.yaml # Model config