Running calculations on generated structures

For this tutorial, we use EMT calculator to demonstrate how one can run calculations on the structures generated using CLEAES and update database with the calculation results for further evaluation of the CE model. Here is a simple example script that runs the calculations for all structures that are not yet converged

>>> from ase.calculators.emt import EMT
>>> from ase.db import connect
>>> from clease.tools import update_db
>>> calc = EMT()
>>> db_name = "aucu.db"
>>> db = connect(db_name)
>>>
>>> # Run calculations for all structures that are not converged.
>>> for row in db.select(converged=False):
...   atoms = row.toatoms()
...   atoms.calc = calc
...   atoms.get_potential_energy()
...   update_db(uid_initial=row.id, final_struct=atoms, db_name=db_name)

CLEASE has update_db() function to update the database entry with the calculation results. It automatically updates the intial structure entry and generates a new entry for the final structure. The key-value pairs of the initial structure entry are updated as:

key

description

converged

True

started

empty

queued

empty

final_struct_id

ID of the DB entry containing the final converged structure

clease.tools.update_db(uid_initial=None, final_struct=None, db_name=None, custom_kvp_init: dict | None = None, custom_kvp_final: dict | None = None)[source]

Update the database.

Parameters:

uid_initial: int

entry ID of the initial structure in the database

final_struct: Atoms

Atoms object with the final structure with a physical quantity that needs to be modeled (e.g., DFT energy)

db_name: str

Database name

custom_kvp_init: dict (optional)

If desired, one can pass additional key-value-pairs for the entry containing the initial structure

custom_kvp_final: dict (optional)

If desired, one can pass additional key-value-pairs for the entry containing the final structure