Adsorption workflow
A reproducible adsorption calculation retains the host/adsorbate definition, constraints, electronic state, energy references, and vibrational subspace. The example uses water at a finite (LiF)₂ coordination site with PBE/def2-SVP.
Reproduce the calculation
Section titled “Reproduce the calculation”python visual-tutorials.py --output adsorption-studyDownload the script. It generates the electronic fields, nine constraint variants, and analytical fixed-host adsorbate modes. All electronic calculations use CPU. The outputs include trajectories, force histories, absolute energies, a wavefunction, and portable viewer snapshots.
Define the model and constraints
Section titled “Define the model and constraints”from atomli import Atomsfrom atomli.calculators import QCfrom atomli.constraints import FixAtomsfrom atomli.optimize import BFGS
atoms = Atoms("LiFLiFOH2", positions=[ [0, 0, 0], [1.7, 0, 0], [1.7, 1.7, 0], [0, 1.7, 0], [-0.3, -0.25, 2.15], [-0.3, 0.513, 2.746], [-0.3, -1.013, 2.746],])host_indices = [0, 1, 2, 3]adsorbate_indices = [4, 5, 6]atoms.set_constraint(FixAtoms(indices=host_indices))atoms.calc = QC(xc="PBE", basis="def2-svp", device="cpu", scf={"energy_tolerance": 1e-8})if not BFGS(atoms, maxstep=0.12).run(fmax=0.003, steps=160): raise RuntimeError("Adsorption geometry did not converge")Converged water adsorption on a finite frozen LiF host
The host coordinates remain fixed while all water coordinates relax. The raw force on the host can remain nonzero. The reported optimization criterion is the largest projected atomic force norm.
Preserve energy references
Section titled “Preserve energy references”For the fixed-host model,
The host reference uses the same frozen coordinates; isolated water is relaxed with the same method and basis. Retain all three absolute energies, charges, spin states, and geometries.
energy_ads = energy_complex - energy_frozen_host - energy_relaxed_waterAbsolute energy terms and reference convention. This is an electronic energy difference without counterpoise, thermal, standard-state, dielectric, or coverage corrections. The small finite host and double-zeta basis require convergence studies before quantitative surface inference.
Inspect the retained density
Section titled “Inspect the retained density”from atomli.visualize import view_field
field = atoms.calc.get_field(atoms=atoms, kind="electron_density", shape=[45, 45, 45], margin=2.5)view_field(atoms, field, isovalue=0.05).write_html("adsorption-density.html")Retained electron density of the optimized LiF water adsorption complex
The contour is total electron density. Charge-transfer analysis requires a specified population scheme or a matched-grid density difference.
Calculate the fixed-host adsorbate Hessian
Section titled “Calculate the fixed-host adsorbate Hessian”from atomli.vibrations import Vibrations
vib = Vibrations(atoms, indices=adsorbate_indices, method="analytical").run()frequencies = vib.get_frequencies()Analytical O H stretching dominated mode of the adsorbed water
The nine-coordinate block includes frustrated translation and rotation. Host response is excluded. Its eigenvectors must not be interpreted as the full cluster modes. Additional bond/line/plane constraints require their own independent-coordinate treatment.
Output record
Section titled “Output record”| Output | Contents |
|---|---|
adsorption-fixed-host.extxyz | Accepted optimization frames |
adsorption-fixed-host.json | Geometry, constraints, distances, raw/projected force residuals |
adsorption-energy.json | Absolute energies and subtraction convention |
adsorbate-hessian.json | Analytical Hessian, eigenvectors, and frequencies |
adsorption-density.snapshot.json | Registered density grid and isosurface settings |
adsorption.h5 | Electronic wavefunction payload |
Electronic wavefunction payloads do not serialize the native constraints. Retain the constraint definition and atom ordering separately. The HTML files open independently of a notebook kernel.