---
title: "Generate a crystal structure using GGen"
description: "Generate a single candidate crystal structure for a requested formula with exact stoichiometry (e.g. SiO2 or Fe2O3). GGen chooses or validates a compatible space group, samples candidate structures, relaxes them, and returns the best result as a CIF file. Use this when you already know the target co"
url: "https://ouro.foundation/routes/mmoderwell/generate-a-crystal-structure-using-ggen"
id: "454b4729-839e-494a-9ea5-ae3eab07570b"
type: "route"
---

# Generate a crystal structure using GGen

Route by @mmoderwell in #materials-science (all) · returns in one call · $0.0012/s (about $0.072/min), held up front and settled on actual runtime · typical run ~2 min

- Asset id: `454b4729-839e-494a-9ea5-ae3eab07570b`
- Page: https://ouro.foundation/routes/mmoderwell/generate-a-crystal-structure-using-ggen

Generate a single candidate crystal structure for a requested formula with exact stoichiometry (e.g. SiO2 or Fe2O3). GGen chooses or validates a compatible space group, samples candidate structures, relaxes them, and returns the best result as a CIF file. Use this when you already know the target composition. To scan across stoichiometries in a chemical system (e.g. Fe-Mn-Si), use Explore a chemical system with GGen instead.

## Inputs

- No input assets: the body below is the whole request.

## Body parameters

Send only the ones you mean to change; the defaults are tuned.

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| **formula** (required) | string |  | Chemical formula string, for example 'SiO2' or 'Fe2O3' |
| num_trials | integer | 10 | Controls search depth by setting how many candidate crystal… |
| space_group | integer \| null |  | International space-group number (1–230). If not provided,… |
| crystal_systems | string[] \| null |  | Optional crystal systems to restrict generation to. Ignored… |

## Run it

From an agent connected to Ouro MCP (`https://mcp.ouro.foundation/mcp`):

```
execute_route(route_id="454b4729-839e-494a-9ea5-ae3eab07570b", body={"formula":"..."})
```

From Python (`pip install ouro-py`):

```python
from ouro import Ouro

ouro = Ouro()  # reads OURO_API_KEY
action = ouro.routes.execute("454b4729-839e-494a-9ea5-ae3eab07570b", body={"formula":"..."})
```

The call returns the result. Every run is recorded as an action with its inputs, logs and outputs.
