Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Hello World with UMA

This tutorial takes you from an ASE structure to a UMA prediction. You will load one pretrained model, use it for two chemistry domains, and learn how to substitute your own structure.

The four-step workflow

Every basic calculation follows the same pattern:

  1. Represent the system as an ASE Atoms object.

  2. Load a pretrained UMA model.

  3. Choose the task matching the system and attach a FAIRChemCalculator.

  4. Ask ASE for energies and forces or use an ASE simulation method.

Load UMA once

Warp 1.18.0 initialized:
   CUDA Toolkit 13.4, Driver 13.1
   Devices:
     "cpu"      : "x86_64"
     "cuda:0"   : "Tesla T4" (16 GiB, sm_75, mempool enabled)
   Kernel cache:
     /home/runner/.cache/warp/1.18.0
Loading...
Loading...
Loading...
Loading...

The predictor contains the shared UMA model. The calculator created for each system supplies the domain-specific task.

Example 1: calculate a molecular spin gap

For the omol task, set the molecule’s total charge and spin multiplicity in atoms.info. Here we compare singlet and triplet states of CH₂.

WARNING:root:Model is being compiled this might take a while for the first time
W1007 02:50:32.501000 8074 site-packages/torch/_logging/_internal.py:1345] [0/0] Profiler record function <class 'torch.autograd.profiler.record_function'> will be ignored
W1007 02:50:36.015000 8074 site-packages/torch/_inductor/utils.py:1953] [3/0_1] Not enough SMs to use max_autotune_gemm mode
/home/runner/work/_tool/Python/3.12.15/x64/lib/python3.12/site-packages/torch/_inductor/lowering.py:2352: FutureWarning: `torch._prims_common.check` is deprecated and will be removed in the future. Please use `torch._check*` functions instead.
  check(
WARNING:root:The UMA fast path (merge_mole + compile) is only available for fixed composition, task, charge, and spin. This is optimized for MD applications. Falling back to a less optimized version for subsequent evaluations. Reason: 'Spin differs: tensor([3]) vs tensor([1], device='cuda:0')'.
Use inference_settings='batch' for heterogeneous batched evaluations.
Triplet-singlet energy difference: -0.358 eV

Example 2: relax an inorganic crystal

The omat task predicts stress as well as energy and forces, so ASE can relax both the atoms and the unit cell.

Relaxed energy: -8.270 eV
Relaxed cell (Å):
Cell([[-1.423450445536107, 1.4234505044951635, 1.4234504600673523], [1.4234504533735954, -1.4234505068412615, 1.4234504702509376], [1.4234504379469857, 1.42345049925214, -1.4234504624134499]])

Try your own structure

ASE reads many common chemistry file formats, including XYZ, CIF, POSCAR, and trajectory files. Replace the filename and task below with values appropriate for your system.

Choose the task by scientific domain, not merely by which task accepts the structure:

DomainTaskStart here
Molecules and polymersomolOMol25
Inorganic materialsomatOMat24
Heterogeneous catalysisoc20, oc22, or oc25Catalysis datasets
Molecular crystalsomcOMC25
MOFs and direct air captureodacODAC datasets

Next steps