---
title: "DFT structure relaxation"
description: "Variable-cell DFT relaxation with ABACUS (ions + cell). Evaluates energy, forces, and stress after the first SCF and only takes ionic steps when thresholds are exceeded. Returns a relaxed CIF, the relaxation path as an ASE .traj (energy, forces and stress per step), and convergence diagnostics. Spin"
url: "https://ouro.foundation/routes/mmoderwell/dft-structure-relaxation"
id: "d180f520-fc88-48b7-9eca-3d123f5cf680"
type: "route"
---

# DFT structure relaxation

Route by @mmoderwell in #materials-science (all) · runs in the background · $0.0006/s (about $0.036/min), held up front and settled on actual runtime · typical run ~16 min

- Asset id: `d180f520-fc88-48b7-9eca-3d123f5cf680`
- Page: https://ouro.foundation/routes/mmoderwell/dft-structure-relaxation

Variable-cell DFT relaxation with ABACUS (ions + cell). Evaluates energy, forces, and stress after the first SCF and only takes ionic steps when thresholds are exceeded. Returns a relaxed CIF, the relaxation path as an ASE .traj (energy, forces and stress per step), and convergence diagnostics. Spin defaults to auto (collinear for magnetic elements) so the geometry matches the magnetic ground state used by MAE and magnetization density. Pass the relaxed CIF into downstream property routes. Steps taken are kept: a run that stops at its budget, or a worker restart, resumes from the last geometry on the next call with the same input and thresholds.

## Inputs

- `file` (primary): the id of a file on Ouro (.cif)

## Body parameters

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

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| scf_thr | number | 1e-7 | SCF convergence threshold on the charge-density residual (A… |
| kspacing | number | 0.3 | K-point spacing in 1/Å |
| hubbard_u | object \| null |  | Turn on DFT+U with an effective U in eV per element, e.g. {… |
| basis_size | "SZ" \| "DZP" \| "TZDP" | "DZP" | LCAO basis size: SZ (fastest), DZP (balanced), TZDP (most a… |
| relax_nmax | integer | 50 | Maximum ionic / cell-relax steps, over the whole relaxation… |
| stress_thr | number | 3 | Cell convergence: maximum stress-tensor component in kbar,… |
| mixing_beta | number \| null |  | Charge mixing step (0–1). Left unset, it is 0.2 for structu… |
| force_thr_ev | number | 0.04 | Ionic convergence: maximum atomic force in eV/Å. ABACUS LCA… |
| dft_functional | "PBE" \| "PBEsol" \| "LDA" \| "SCAN" | "PBE" | XC functional |
| initial_magmoms | number[] \| null |  | Signed starting moments in µB, one per atom in CIF site ord… |
| smearing_sigma_ev | number | 0.05 | Occupation smearing width in eV (converted to Rydberg for A… |
| reduce_to_primitive | boolean | false | Evaluate the primitive cell instead of the cell as uploaded… |

## Run it

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

```
execute_route(route_id="d180f520-fc88-48b7-9eca-3d123f5cf680", input_assets={"file": "<file id>"}, wait=false)
```

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

```python
from ouro import Ouro

ouro = Ouro()  # reads OURO_API_KEY
action = ouro.routes.execute("d180f520-fc88-48b7-9eca-3d123f5cf680", input_assets={"file": "<file id>"})
```

The call returns an action id at once. Read the result with `get_action(id=..., wait=true)` over MCP, or `ouro action wait <id>` from the CLI.
