openmaterials.ai / codes / ASE
ASE: Python objects and a common calculator interface for atomistic simulation
A Python library whose Atoms object and calculator interface let one script drive many electronic structure and force field codes with the same optimizers, dynamics and analysis.
What it is and how it works
One interface, many codes
A calculator takes atomic numbers and positions and returns energy, forces and stress. About 30 codes, from Abinit and VASP to EMT and Lennard-Jones, plug in by files, pipes or in-process Python (Hjorth Larsen 2017).
Atoms object
Positions, cell, periodic flags, velocities and moments in NumPy arrays, units eV and Angstrom. Structures from ase.build, ase.spacegroup or ase.io (Hjorth Larsen 2017).
Optimizers and dynamics
BFGS, L-BFGS, FIRE and MDMin relax structures. Velocity Verlet, Berendsen, Langevin and Nose-Hoover integrators run MD. Filters relax the cell too (Hjorth Larsen 2017).
Saddle points and global search
Nudged elastic band with climbing image and AutoNEB, the dimer method, basin hopping, minima hopping and a genetic algorithm in ase.ga (Hjorth Larsen 2017).
Vibrations and thermochemistry
ase.vibrations and ase.phonons build the Hessian by finite differences, 6N + 1 force calls. Thermo classes turn the modes into U, S, F and G (Hjorth Larsen 2017).
Database and parallelism
ase.db stores Atoms rows with key-value pairs in JSON, SQLite3 or PostgreSQL. Calculators run in parallel as subprocesses or under mpiexec (Hjorth Larsen 2017).
What people do with it
- about 30atomic-scale codes with an ASE calculatorHjorth Larsen 2017
- 65file formats recognized by ase.ioHjorth Larsen 2017
- 6N + 1force calls for a finite-difference HessianHjorth Larsen 2017
Negative thermal expansion of ScF3
Self-consistent phonon free energies F(V,T) fit to the Birch-Murnaghan equation of state in ASE. The thermal expansion changes sign at 400 to 500 K (SCP) or 600 to 800 K (ISC). Oba 2019
SSCHA driven through ASE calculators
The stochastic self-consistent harmonic approximation code runs in a local automatic mode where ASE supplies energies, forces and stresses from Quantum ESPRESSO, VASP, SIESTA or LAMMPS. Monacelli 2021
How it is used
Build the structure
ase.build.bulk, surface or molecule, ase.spacegroup.crystal, or read() from a file.
Attach a calculator
atoms.calc = NWChem(xc='PBE') or any other code. get_potential_energy() runs it.
Relax or propagate
BFGS(atoms).run() relaxes, ase.md integrators propagate, a Trajectory records frames.
Analyse
Vibrations, Phonons, thermochemistry classes, equation of state fits, band structures.
Store
write() to traj or another format, or ase.db rows queried with the ase db tool.
What ASE is
ASE, the Atomic Simulation Environment, is a Python library for setting up, running and analysing atomistic calculations. It defines the Atoms object and a common calculator interface that many codes implement, so a workflow can swap the engine without rewriting the script. On the map it appears through the quantities it computes directly from a trajectory or a relaxed structure.
WebsiteRepositoryOn the mapAll codesLicense: LGPL-2.1-or-later
In more detail
Atoms, calculators and communication
The Atoms object holds chemical symbols, Cartesian positions, an optional cell with periodic flags, and per-atom arrays of momenta, magnetic moments and other quantities, all backed by NumPy. A calculator is a black box that returns energy, forces and possibly stress for an Atoms object. Most calculators write an input file, launch the code as a subprocess, wait and parse the output. GPAW, EMT and Asap run inside the Python process with zero-copy data exchange. The CP2K calculator talks over pipes, so the process stays alive between calls (Hjorth Larsen 2017).
Algorithms built on the interface
ase.optimize holds BFGS, L-BFGS, MDMin, FIRE and SciPy optimizers, plus a preconditioned L-BFGS that gave speedups of up to an order of magnitude over plain L-BFGS on solid-state tests, growing with system size. Constraints fix atoms, bond lengths or internal coordinates, and filters expose cell strain so lattice vectors relax with the atoms. ase.md provides velocity Verlet, Berendsen, Langevin and Nose-Hoover thermostats and Berendsen or Parrinello-Rahman pressure control. Saddle points come from NEB, climbing-image NEB, AutoNEB and the dimer method, global minima from basin hopping, minima hopping and ase.ga (Hjorth Larsen 2017).
Vibrations, phonons and thermodynamics
ASE assembles the Hessian from finite-difference forces, 6N + 1 evaluations for N displaced atoms, and imposes momentum conservation to average out egg-box noise from real-space grids. ase.phonons repeats the primitive cell into a supercell and builds the dynamical matrix D(k) from the displaced-atom forces. The paper shows fcc Al from a 7 x 7 x 7 EMT supercell. HarmonicThermo, IdealGasThermo and CrystalThermo give U, S, F and G, and ase.phasediagram draws convex hulls and Pourbaix diagrams from about 500 stored dissolution energies. The BEEFEnsemble class estimates exchange-correlation errors from an ensemble of functionals and works with GPAW and VASP (Hjorth Larsen 2017).
License and use by other codes
ASE is free software under LGPLv2.1 or newer, installs with pip install ase and needs only Python and NumPy, with SciPy and matplotlib recommended. Amp, matscipy, quippy and Atomistica build on the calculator interface (Hjorth Larsen 2017). The SSCHA code uses ASE to call Quantum ESPRESSO, VASP, SIESTA, CP2K or LAMMPS for the forces on its stochastic populations (Monacelli 2021). Oba 2019 fit the anharmonic free energy curves of ScF3 to the Birch-Murnaghan equation of state with ASE to get lattice constants and bulk moduli at finite temperature.
What it computes on the map
3 quantities, drawn by tier with the data flow between them. Dashed boxes are intermediate quantities. Select one for its formula and the other codes that compute it.
Embed this submap
<iframe src="https://openmaterials.ai/m/c56731602651/80000000010001?embed=1" title="ASE on the OpenMaterials map" width="100%" height="480" loading="lazy" style="border:1px solid #EBEBEB;border-radius:6px"></iframe>
Each quantity with the interface the representation records.
- Potentialase.Atoms.calc
- Structurease.optimize optimizer (FIRE / BFGS) + ase.filters cell filter (FrechetCellFilter / ExpCellFilter) -> relaxed ase.Atoms / pymatgen Structure
- Trajectoryase.md integrator frames via ase.io.trajectory.TrajectoryWriter (positions, A)
References
The code
The papers that describe the code; cite them when you use it.
- A. Hjorth Larsen, J. Jørgen Mortensen, J. Blomqvist et al., The atomic simulation environment: a Python library for working with atoms, Journal of Physics: Condensed Matter, 2017. doi.org/10.1088/1361-648X/aa680e
Applications
Highly cited studies that cite the code, with a few picked by hand.
- S. Haastrup, M. Strange, M. Pandey et al., The Computational 2D Materials Database: high-throughput modeling and discovery of atomically thin crystals, 2D Materials, 2018. doi.org/10.1088/2053-1583/aacfc1
- Y. Oba, T. Tadano, R. Akashi et al., First-principles study of phonon anharmonicity and negative thermal expansion in ScF 3, Physical Review Materials, 2019. doi.org/10.1103/PhysRevMaterials.3.033601
- L. Monacelli, R. Bianco, M. Cherubini et al., The stochastic self-consistent harmonic approximation: calculating vibrational properties of materials with full quantum and anharmonic effects, Journal of Physics: Condensed Matter, 2021. doi.org/10.1088/1361-648X/ac066b
- S. Batzner, A. Musaelian, L. Sun et al., E(3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials, Nature Communications, 2022. doi.org/10.1038/s41467-022-29939-5
How to cite
A. Hjorth Larsen, J. J. Mortensen, J. Blomqvist, et al., The atomic simulation environment - a Python library for working with atoms, J. Phys. Condens. Matter 29, 273002 (2017)