Calculators
For ASE, a calculator is a black box that can take atomic numbers and
atomic positions from an Atoms
object and calculate the
energy and forces and sometimes also stresses.
In order to calculate forces and energies, you need to attach a calculator object to your atoms object:
>>> atoms = read('molecule.xyz')
>>> e = atoms.get_potential_energy()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jjmo/ase/atoms/ase.py", line 399, in get_potential_energy
raise RuntimeError('Atoms object has no calculator.')
RuntimeError: Atoms object has no calculator.
>>> from ase.calculators.abinit import Abinit
>>> calc = Abinit(...)
>>> atoms.calc = calc
>>> e = atoms.get_potential_energy()
>>> print(e)
-42.0
Here we attached
an instance of the ase.calculators.abinit
class and then
we asked for the energy.
Supported calculators
The calculators can be divided in four groups:
Abacus, ALIGNN, AMS, Asap, BigDFT, CHGNet, DeePMD-kit, DFTD3, DFTD4, DFTK, FLEUR, GPAW, Hotbit, M3GNet, MACE, TBLite, and XTB have their own native or external ASE interfaces.
ABINIT, AMBER, CP2K, CASTEP, deMon2k, DFTB+, ELK, EXCITING, FHI-aims, GAUSSIAN, Gromacs, LAMMPS, MOPAC, NWChem, Octopus, ONETEP, PLUMED, psi4, Q-Chem, Quantum ESPRESSO, SIESTA, TURBOMOLE and VASP, have Python wrappers in the ASE package, but the actual FORTRAN/C/C++ codes are not part of ASE.
Pure python implementations included in the ASE package: EMT, EAM, Lennard-Jones, Morse and HarmonicCalculator.
Calculators that wrap others, included in the ASE package:
ase.calculators.checkpoint.CheckpointCalculator
, thease.calculators.loggingcalc.LoggingCalculator
, thease.calculators.mixing.LinearCombinationCalculator
, thease.calculators.mixing.MixedCalculator
, thease.calculators.mixing.SumCalculator
, thease.calculators.mixing.AverageCalculator
, thease.calculators.socketio.SocketIOCalculator
, the Grimme-D3 potential, and the qmmm calculatorsEIQMMM
, andSimpleQMMM
.
name |
description |
---|---|
DFT supporting both pw and lcao basis |
|
Atomistic Line Graph Neural Network force field |
|
Amsterdam Modeling Suite |
|
Highly efficient EMT code |
|
Wavelet based code for DFT |
|
Universal neural network potential for charge-informed atomistics |
|
A deep learning package for many-body potential energy representation |
|
London-dispersion correction |
|
Charge-dependent London-dispersion correction |
|
Plane-wave code for DFT and related models |
|
Full Potential LAPW code |
|
Real-space/plane-wave/LCAO PAW code |
|
DFT based tight binding |
|
Materials 3-body Graph Network universal potential |
|
Many-body potential using higher-order equivariant message passing |
|
Light-weight tight-binding framework |
|
Semiemprical extended tight-binding program package |
|
Plane-wave pseudopotential code |
|
Classical molecular dynamics code |
|
Plane-wave pseudopotential code |
|
DFT and classical potentials |
|
Gaussian based DFT code |
|
DFT based tight binding code |
|
DFT based tight binding |
|
Atomic orbital DFT code |
|
Embedded Atom Method |
|
elk |
Full Potential LAPW code |
Plane-wave pseudopotential code |
|
Full Potential LAPW code |
|
Numeric atomic orbital, full potential code |
|
Gaussian based electronic structure code |
|
Gaussian based electronic structure code |
|
Classical molecular dynamics code |
|
Interatomic potential code |
|
Hessian based harmonic force-field code |
|
Classical MD with standardized models |
|
Classical molecular dynamics code |
|
Combination of multiple calculators |
|
Semiempirical molecular orbital code |
|
Gaussian based electronic structure code |
|
Real-space pseudopotential code |
|
Linear-scaling pseudopotential code |
|
LCAO pseudopotential code |
|
Gaussian based electronic structure code |
|
Enhanced sampling method library |
|
Gaussian based electronic structure code |
|
Gaussian based electronic structure code |
|
LCAO pseudopotential code |
|
Fast atom orbital code |
|
Plane-wave PAW code |
|
Effective Medium Theory calculator |
|
lj |
Lennard-Jones potential |
morse |
Morse potential |
Checkpoint calculator |
|
Socket-based interface to calculators |
|
Logging calculator |
|
DFT-D3 dispersion correction calculator |
|
Explicit Interaction QM/MM |
|
Subtractive (ONIOM style) QM/MM |
Note
A Fortran implemetation of the Grimme-D3 potential, that can be used as an add-on to any ASE calculator, can be found here: https://gitlab.com/ehermes/ased3/tree/master.
The calculators included in ASE are used like this:
>>> from ase.calculators.abc import ABC
>>> calc = ABC(...)
where abc
is the module name and ABC
is the class name.
Calculator configuration
Calculators that depend on external codes or files are generally
configurable. ASE loads the configuration from a configfile located
at ~/.config/ase/config.ini
. The default path can be overriden by
setting the environment variable ASE_CONFIG_PATH
to another path
or paths separated by colon.
To see the full configuration on a given machine, run ase info --calculators.
An example of a config file is as follows:
[abinit]
command = mpiexec /usr/bin/abinit
pp_paths = /usr/share/abinit/pseudopotentials
[espresso]
command = mpiexec pw.x
pseudo_path = /home/ase/upf_pseudos
Calculators build a full command by appending command-line arguments to the configured command. Therefore, the command should normally consist of any parallel arguments followed by the binary, but should not include further flags unless desired for a specific reason. The command is also used to build a full command for e.g. socket I/O calculators.
The Espresso calculator can then invoked in the following way:
>>> from ase.build import bulk
>>> from ase.calculators.espresso import Espresso
>>> espresso = Espresso(
input_data = {
'system': {
'ecutwfc': 60,
}},
pseudopotentials = {'Si': 'si_lda_v1.uspp.F.UPF'},
)
>>> si = bulk('Si')
>>> si.calc = espresso
>>> si.get_potential_energy()
-244.76638508140397
It can be useful for software libraries to override the local
configuration. To do so, the code should supply the configurable
information by instantiating a “profile”, e.g.,
Abinit(profile=AbinitProfile(command=command))
. The profile
encloses the configurable information specific to a particular code,
so this may differ depending on which code. It can also be
useful for software libraries that manage their own configuration
to set the ASE_CONFIG_PATH
to an empty string.
- EAM
- Pure Python EMT calculator
- ABINIT
- Amber
- CASTEP
- CP2K
- CRYSTAL14
- Demon
- deMon-Nano
- DFTB+
- DMol3
- Espresso
- exciting
- FHI-aims
- FLEUR
- GAMESS-US
- Gaussian
- Gromacs
- GULP
- Harmonic calculator
- Communication with calculators over sockets
- Jacapo - ASE python interface for Dacapo
- KIM
- LAMMPS Calculators
- Mopac
- NWChem
- Octopus
- ONETEP
- OpenMX
- ORCA
- PLUMED
- psi4
- Q-Chem
- SIESTA
- Introduction
- Environment variables
- SIESTA Calculator
- Extra FDF parameters
- Example
- Defining Custom Species
- Pseudopotentials
- Restarting from an old Calculation
- Choosing the coordinate format
- Siesta Calculator Class
- Excited states calculations
- Raman Calculations with SIESTA and PyNAO
- Further Examples
- Siesta lrtddft Class
- Siesta RamanCalculatorInterface Calculator Class
- TURBOMOLE
- VASP
- QMMM
- Checkpointing
- Mixing Calculators
- Logging Calculator
- DFT-D3
- Other built-in calculators
- Stuff for testing things
- ACE-Molecule