Atomic Simulation Environment
The Atomic Simulation Environment or ASE is a Python library for atomistic simulations. It provides algorithms for structure optimization, molecular dynamics and other common operations. While ASE does not implement any electronic structure method, it contains interfaces that can be used to call a large range of different codes. It contains methods to generate, read, write and visualize structures.
In order to use the ASE interface with a particular code, that code has to be installed separately.
ASE is typically used by writing a Python script. In the below example, the BFGS optimizer is used to calculate the structure of a water molecule from a hand-written initial guess for the atomic positions.
from ase import Atoms from ase.optimize import BFGS from gpaw import GPAW # Requires GPAW calculator to be installed from ase.io import write system = Atoms('H2O', positions=[[-1, 0, 0], [1, 0, 0], [0, 0, 1]]) system.center(vacuum=3.0) calc = GPAW(xc='PBE', h=0.18, txt='gpaw.txt') system.set_calculator(calc) opt = BFGS(system, trajectory='opt.traj', logfile='opt.log') opt.run(fmax=0.05) # tolerance 0.05 eV/Ang write('output.xyz', system)
The final structure is written in the xyz format while the intermediate geometries are saved in ASE's own traj format. The graphical interace for ASE, ase-gui, can be used to visualize these geometries, including animations of the optimization procedure. The above example uses the GPAW calculator. This can be replaced by any other code that implements the ASE calculator interface.
ASE relies on external "calculators" to implement the calculation of energies, forces and other quantities. ASE contains interfaces to many different calculators. Any calculator appropriately implementing the Python ASE interface can be used together with ASE and thus benefit from the implemented algorithms described below.
The structure module of ASE contains the G2 molecule database plus simple interfaces to generate bulk structures, nanotubes and nanoribbons. Advanced modules to set up lattices, surfaces and space groups are also available.
A number of structure optimization algorithms are available for local (BFGS, MDMin etc.) as well as global structure optimization (basin hopping, minima hopping). The optimization can be subject to constraints.
ASE implements NVE, NVT, and NPT molecular dynamics for use with any force calculator implementing the ASE interface.