CLuster Expansion in Atomistic Simulation Environment (clease)
CLEASE (CLuster Expansion in Atomistic Simulation Environment) is a Python package for constructing and handling cluster expansion Hamiltonians for materials simulations, often used in conjunction with ASE. It is currently at version 1.2.0 and receives updates periodically, with the last major release in April 2024.
Common errors
-
NameError: name 'CEConfig' is not defined
cause Using the old class name 'CEConfig' which was renamed in clease v1.1.0.fixReplace `CEConfig` with `CEBulk`. For slab calculations, `CESlab` was renamed to `CEPrism`. -
AttributeError: module 'clease' has no attribute 'sqs'
cause Attempting to use the `clease.sqs` module, which was removed in clease v1.2.0.fixInstall and use the `sqsgenerator` library directly for SQS functionality, as it is no longer integrated into `clease`. -
TypeError: 'float' object is not iterable
cause Providing a single float value to `Settings(max_cluster_dia=...)` instead of a list.fixEnsure `max_cluster_dia` is a list, e.g., `Settings(max_cluster_dia=[3.0, 4.0, 5.0])`.
Warnings
- breaking The main classes `CEConfig` and `CESlab` were renamed to `CEBulk` and `CEPrism` respectively.
- breaking The `clease.sqs` module, which provided functionality for generating Special Quasirandom Structures, has been removed.
- gotcha The `max_cluster_dia` parameter in `clease.Settings` expects a list of floats (one for each cluster order), not a single float.
Install
-
pip install clease
Imports
- CEBulk
from clease import CEConfig
from clease import CEBulk
- CEPrism
from clease import CESlab
from clease import CEPrism
- Settings
from clease import Settings
- Concentration
from clease import Concentration
Quickstart
from ase.build import bulk
from clease import CEBulk, Concentration, Settings
# 1. Define primitive cell using ASE
prim = bulk("Cu", "fcc", a=3.61)
# 2. Define concentration for a binary system (e.g., Cu-Au)
conc = Concentration(basis_elements=[["Cu", "Au"]])
# 3. Define settings for the cluster expansion
settings = Settings(
primitive_structure=prim,
supercell=[2, 2, 2], # Supercell dimensions for mapping
concentrations=[conc],
max_cluster_dia=[3.0, 4.0, 5.0] # Max diameter for 2-body, 3-body, 4-body clusters
)
# 4. Initialize the Cluster Expansion Bulk object
ce_bulk = CEBulk(settings, verbose=False)
print(f"CEBulk object initialized for {ce_bulk.name}")
# Further steps involve fitting and predicting properties.