---
title: "Trajectories"
description: "How Ouro plays ASE .traj files as 3D animations with energy and force plots"
date: "2026-10-02"
last_updated: "2026-10-02"
---

Ouro plays any file ending in `.traj` as a 3D animation. These are
[ASE](https://wiki.fysik.dtu.dk/ase/) trajectory files, as written by ASE's
optimizers and molecular dynamics, so a relaxation or MD run works as is.

## What the viewer shows

The structure is drawn like a [crystal or molecule](/docs/developers/file-formats/structures),
with a play button and a scrubber across the frames. Beside it:

- **Energy** per frame, from the calculator's results or `atoms.info["energy"]`
- **Max force** per frame, the largest force on any atom, when forces were saved
- **Temperature** per frame from the saved momenta, computed as ASE's
  `get_temperature` does, with the thermostat's target marked when the run
  recorded one
- **Time** in fs or ps for MD runs that recorded their time step

Click or drag on any plot to jump to that frame. Click the view, then
press space to play or pause, ← → to step one frame, and shift with an arrow
to jump a tenth of the run. Periodic structures are
wrapped into the cell by default; turn that off to see atoms as stored.
Bonds are found every frame from covalent radii, so they form and break as
the atoms move. Click atoms to measure distances and angles, which follow the
atoms through the run.

## Writing a file

Attach a trajectory to an optimizer or dynamics run in ASE:

```python
from ase.optimize import BFGS

opt = BFGS(atoms, trajectory="relax.traj")
opt.run(fmax=0.02)
```

Then upload it with the `.traj` extension:

```python
from ouro import Ouro

ouro = Ouro()
ouro.files.create(
    name="Relaxation",
    description="BFGS relaxation of the strained cell",
    visibility="public",
    file_path="relax.traj",
)
```

## Limits

The file is read in the browser. Long runs are sampled: the viewer loads up
to 500 frames, and fewer for large systems (about 500,000 atom-frames in
all), spread evenly across the run and always including the last frame. Only
the sampled frames are downloaded. Trajectories in ASE's old pickle format
need converting first with `ase convert old.traj new.traj`.
