Skip to content

Building structures

Native builders follow ASE’s names and conventions. The figures are builder geometries; they do not imply relaxation, stability, or an adsorption energy.

from atomli.build import molecule, molecule_names
water = molecule("H2O")
benzene = molecule("C6H6")
ethanol = molecule("CH3CH2OH")

The molecular catalog includes G2/97 structures and ASE’s additional names. molecule_names() returns the available catalog. Check atom ordering before applying a site-indexed operation. vacuum=5.0 centers a molecule in a padded cell.

Molecular builder atom order and geometric measurements

from atomli.build import bulk
primitive = bulk("Si", "diamond", a=5.43) # 2 atoms
conventional = bulk("Si", "diamond", a=5.43, cubic=True) # 8 atoms

Primitive diamond silicon cell

Conventional cubic diamond silicon cell

Both represent diamond silicon at the same lattice parameter. They require consistent reciprocal-space sampling when comparing electronic calculations. bulk defaults to a primitive cell. cubic=True or orthorhombic=True requests the corresponding conventional representation when available.

Supported prototypes include sc, fcc, bcc, hcp, diamond, rocksalt, zincblende, cesiumchloride, fluorite, wurtzite, rutile, and perovskite. Unsupported parameter combinations raise rather than returning another structure.

salt = bulk("NaCl", "rocksalt", a=5.64, cubic=True)
supercell = salt.repeat((2, 2, 1))

Two by two by one conventional NaCl supercell

The 8-atom conventional cell becomes a 32-atom supercell. Repetition changes atom indices, cell vectors, and the appropriate k-point mesh. Verify constraints and per-site arrays after constructing a supercell.

import numpy as np
from atomli import Atoms
from atomli.build import add_adsorbate, fcc111, molecule
from atomli.constraints import FixAtoms
slab = fcc111("Pt", size=(2, 2, 3), a=3.92, vacuum=6.0)
co_bond = molecule("CO").get_distance(0, 1)
co = Atoms("CO", positions=[[0, 0, 0], [0, 0, co_bond]]) # C first
top_xy = slab.get_positions()[np.argmax(slab.get_positions()[:, 2]), :2]
add_adsorbate(slab, co, height=1.8, position=top_xy)
# Select a layer from coordinates or tags after inspecting this builder's order.
z = slab.get_positions()[:12, 2]
bottom = [i for i, zi in enumerate(z) if abs(zi - z.min()) < 1e-6]
slab.set_constraint(FixAtoms(indices=bottom))

CO at an ontop site on a three layer Pt111 slab

This is a 12-Pt-atom input slab plus CO. Confirm which adsorbate atom defines the height, its orientation, lateral cell size, vacuum, and frozen layers before attaching a calculator. The initial 1.8 Å placement is not a relaxed adsorption distance. Partial-PBC calculator support must be checked explicitly.

The LiF–water adsorption workflow provides a complete molecular calculation with converged constrained structures and analytical adsorbate modes. It uses a finite coordination-site model rather than this periodic Pt input.

Python generator · Builder data · Cell and atom API