Cluster counts

A cluster vector is essentially a count of clusters averaged and aggregated in a compact form. Sometimes it may be of interest to study the underlying cluster counts rather than the cluster vector. In a binary alloy with species A and B, for example, one may wonder how many nearest neighbor pairs are A-A, A-B, and B-B, respectively. To facilitate such analyses, icet provides a cluster counts module. This example demonstrates how to use this module.

Import modules

In addition to the ClusterCounts and OrbitList classes, we also use the ASE function bulk() to generate a prototype structure.

from ase.build import bulk
from icet.core.cluster_counts import ClusterCounts
from icet import OrbitList

Generate prototype cell

The next step is to build a prototype supercell. Here, we create a toy structure based on Ti and W decorating a simple cubic \(2\times1\times1\) cell. Moreover, we define a cutoff for pairs at 5 Å. We also keep the primitive cell, i.e., the \(1\times1\times1\) simple cubic cell.

prim_atoms = bulk('Ti', 'sc', a=3.0)
atoms = prim_atoms.repeat([2, 1, 1])
atoms.set_chemical_symbols(['Ti', 'W'])
cutoffs = [5.0]

Create primitive orbit list

Next, we create an orbit list based on the above primitive structure and cutoff. To this end, we use the OrbitList class. The orbit list defines the orbits that are included in the cluster count (every cluster corresponds to an orbit).

prim_orbitlist = OrbitList(prim_atoms, cutoffs)

Count clusters

We are now ready to create a ClusterCounts object based on the orbit list and the above created supercell.

cluster_counts = ClusterCounts(prim_orbitlist, atoms)

Source code

The complete source code is available in examples/get_cluster_counts.py
"""
This example demonstrates how to count the number of clusters for a structure.
"""

# Start import
from ase.build import bulk
from icet.core.cluster_counts import ClusterCounts
from icet import OrbitList
# End import

# Create a titanium, single-layered, sheet and randomly populate some of the
# sites with W atoms.
# Start setup
prim_atoms = bulk('Ti', 'sc', a=3.0)
atoms = prim_atoms.repeat([2, 1, 1])
atoms.set_chemical_symbols(['Ti', 'W'])
cutoffs = [5.0]
# End setup

# Determine the orbit list for the corresponding primitive structure for all
# pair clusters within the cutoff distance
prim_orbitlist = OrbitList(prim_atoms, cutoffs)
# Use the primitive orbit list to count the number of clusters.
cluster_counts = ClusterCounts(prim_orbitlist, atoms)
# Print all of the clusters that were found.
print('Number of atoms: {0}'.format(len(atoms)))
print('Found {} orbits'.format(len(cluster_counts)))
print(cluster_counts)