Atomate2 Materials Science Workflows
Atomate2 is a Python library providing a comprehensive collection of materials science workflows built on top of the AiiDA infrastructure. It allows researchers to automate complex computational materials design tasks, from structural relaxations and property calculations using various density functional theory (DFT) codes (like VASP, Quantum ESPRESSO, FLEUR) to advanced analyses. It is a complete rewrite of the original atomate library, moving from FireWorks to AiiDA for workflow management. The current version is 0.1.1 and it follows a release cadence tied to feature development and bug fixes.
Common errors
-
No profile specified. Please set a default profile using 'aiida-profile setdefault <name>' or specify it explicitly.
cause AiiDA profile has not been set up or loaded before attempting to submit an atomate2 workflow.fixRun `aiida-profile setup` to create a new profile, then ensure `aiida.load_profile()` is called in your script, or set a default profile with `aiida-profile setdefault <profile_name>`. -
ModuleNotFoundError: No module named 'aiida_vasp'
cause The AiiDA plugin for VASP calculations is not installed, but a VASP-related workflow was attempted.fixInstall the required AiiDA calculator plugin: `pip install aiida-vasp` (or for other calculators, e.g., `aiida-quantumespresso`). -
aiida.common.exceptions.NotExistent: Code with label 'vasp-std@cluster' (or similar) does not exist.
cause The specific computational code (e.g., VASP) required by the atomate2 workflow has not been configured in AiiDA.fixConfigure the code using the AiiDA CLI: `aiida-code setup` and follow the prompts to register your computational executable. -
RuntimeError: No valid codes for entry point 'vasp.vasp' found in database for computer 'local_computer'.
cause Even if the `aiida-vasp` plugin is installed, no VASP code is configured on the target computer within AiiDA.fixRun `aiida-code setup` to configure a VASP code on your AiiDA computer. Make sure the code is associated with the correct computer and is set up to use the `vasp.vasp` entry point.
Warnings
- breaking Atomate2 is a complete rewrite of the original `atomate` library. It uses AiiDA as its workflow engine instead of FireWorks. There is no direct upgrade path or backward compatibility; code written for `atomate` will not run with `atomate2`.
- gotcha Atomate2 strictly depends on AiiDA for workflow management. Users must have AiiDA installed and a profile configured (`aiida-profile setup`) before atomate2 can be used. Furthermore, computational codes (e.g., VASP, Quantum ESPRESSO) must also be configured within AiiDA.
- gotcha To run workflows for specific calculators (e.g., VASP, Quantum ESPRESSO), the corresponding AiiDA plugin (e.g., `aiida-vasp`, `aiida-quantumespresso`) must be explicitly installed, in addition to atomate2 itself.
- gotcha Atomate2 requires Python 3.11 or higher. Using older Python versions will lead to installation or runtime errors.
Install
-
pip install atomate2 -
pip install 'atomate2[vasp]' # For VASP workflows -
pip install 'atomate2[quantum_espresso]' # For Quantum ESPRESSO workflows
Imports
- DoubleRelaxFlow
from atomate.vasp.flows.double_relax import DoubleRelaxFlow
from atomate2.vasp.flows.double_relax import DoubleRelaxFlow
- EnergyMaker
from atomate2.common.jobs.energy import EnergyMaker
- Structure
from pymatgen.core import Structure
Quickstart
from pymatgen.core import Structure
from pymatgen.core.lattice import Lattice
from atomate2.vasp.flows.double_relax import DoubleRelaxFlow
from aiida import load_profile
from aiida.engine import submit
import os
# --- AiiDA Profile Setup (Crucial Pre-requisite) ---
# Before running, ensure you have an AiiDA profile configured:
# 1. Install aiida-core: `pip install aiida-core[psql]`
# 2. Setup a profile: `aiida-profile setup` and follow prompts.
# 3. Setup VASP code: `aiida-code setup vasp.vasp` (assuming 'vasp.vasp' is the plugin name)
# and configure path to your VASP executable on a local or remote machine.
# Load the AiiDA profile
try:
load_profile()
except Exception as e:
print(f"Could not load AiiDA profile. Please run 'aiida-profile setup' and try again. Error: {e}")
exit(1)
# Define a simple Silicon structure
lattice = Lattice.cubic(5.43)
structure = Structure(lattice, ["Si", "Si"], [[0, 0, 0], [0.25, 0.25, 0.25]])
# Create and submit a VASP DoubleRelaxFlow
try:
flow = DoubleRelaxFlow.from_structure(structure)
submitted_flow = submit(flow)
print(f"Submitted DoubleRelaxFlow with PK: {submitted_flow.pk}")
print("\nNote: This only submits the workflow to AiiDA. To execute it,")
print("you need the AiiDA daemon running (`verdi daemon start`) ")
print("and VASP (or other chosen calculator) properly configured as an AiiDA code.")
print(f"You can monitor the workflow with: verdi process show {submitted_flow.pk}")
except Exception as e:
print(f"Error submitting flow: {e}")
print("Ensure 'aiida-vasp' is installed (`pip install aiida-vasp`) ")
print("and VASP is configured as an AiiDA code (`aiida-code setup`).")