Get started

The quickest way to use MLatom is to run it online on the Aitomistic Hub or Aitomistic Lab@XMU — nothing to install. To run locally, just install MLatom — it pulls in the required dependencies automatically (including the PyTorch/TorchANI and geometry-optimization backends the AIQM2 example below uses). AIQM2 additionally needs the DFT-D4 program (via conda):

pip install -U mlatom
conda install -c conda-forge dftd4
export dftd4bin=$(which dftd4)   # point MLatom at the dftd4 executable

See the installation guide for the full dependency list and other methods.

Quick start

Optimize the geometry of a water molecule with AIQM2 — an AI-enhanced quantum-mechanical method (native to MLatom, CHNO elements) that reaches beyond-DFT accuracy at semi-empirical cost.

Python API

import mlatom as ml

mol = ml.data.molecule.from_xyz_string('''3

O    0.00000    0.00000    0.11779
H    0.00000    0.75545   -0.47116
H    0.00000   -0.75545   -0.47116
''')
aiqm2 = ml.methods(method='AIQM2')
opt = ml.optimize_geometry(model=aiqm2, initial_molecule=mol).optimized_molecule
print(opt.energy)          # optimized energy in hartree

To check your setup worked, the printed energy should be approximately:

-76.3838

Command line (input file)

The same calculation from the command line. Save the geometry as init.xyz:

3

O    0.00000    0.00000    0.11779
H    0.00000    0.75545   -0.47116
H    0.00000   -0.75545   -0.47116

and the input as geomopt.inp:

AIQM2               # method
geomopt             # task: geometry optimization
xyzfile=init.xyz    # input geometry
optxyz=opt.xyz      # output geometry

then run:

mlatom geomopt.inp

The optimized geometry is written to opt.xyz, and the output reports the optimized energy (≈ -76.3838 hartree). You can also download geomopt.inp and init.xyz.

Note

Prefer zero setup? Run these online on the Aitomistic Hub or Aitomistic Lab@XMU (both powered by Protomia) — no installation needed.