Atomic Simulation Environment (ASE)
The Atomic Simulation Environment (ASE) is a comprehensive Python library designed for setting up, manipulating, running, visualizing, and analyzing atomistic simulations. It offers a flexible framework that integrates with various external simulation codes through its Calculator interface, supporting methods ranging from Density Functional Theory (DFT) to semi-empirical and classical interatomic potentials. ASE is actively maintained with frequent feature and bugfix releases; the current stable version is 3.28.0.
Warnings
- breaking ASE now requires Python 3.10 or newer, starting with version 3.27.0. Ensure your Python environment meets this requirement.
- breaking The `ase.ga` (genetic algorithm) module has moved to a standalone project, `ase-ga`, in version 3.27.0. It is no longer part of the main `ase` package.
- breaking The Optimizable interface (used by Optimizers) changed in version 3.26.0 to work with arbitrary degrees of freedom instead of Cartesian (Nx3) ones. This can break code that uses internal Optimizer features like `converged()`.
- breaking The `ase.io.orca.read_orca_output` function now returns an `Atoms` object with attached properties, instead of just a results dictionary. The previous behavior is available via `ase.io.orca.read_orca_outputs()`.
- deprecated The `master` parameter to Optimizers is now keyword-only. The `force_consistent` option has been removed from `Optimizer`.
Install
-
pip install ase
Imports
- Atoms
from ase import Atoms
- EMT
from ase.calculators.emt import EMT
- BFGS
from ase.optimize import BFGS
Quickstart
from ase import Atoms
from ase.calculators.emt import EMT
from ase.optimize import BFGS
from ase.io import write
# Create a molecule (H2)
h2 = Atoms('H2', positions=[[0, 0, 0], [0, 0, 0.7]])
# Attach a calculator (Empirical Potential)
h2.calc = EMT()
# Optimize the geometry
optimizer = BFGS(h2, trajectory='h2.traj')
optimizer.run(fmax=0.02)
# Print final energy and write structure
print(f'Final potential energy: {h2.get_potential_energy():.3f} eV')
write('H2.xyz', h2)