# Native clusters¶

The purpose of this example is to demonstrate how to extract native clusters.

## Import modules¶

In the present case it is necessary to import two icet classes, namely ClusterSpace and Structure. The respective objects are used to store information regarding a specific cluster space and structure. Additionally, the ASE function ase.build.bulk() will be used to generate the structures.

## Generate prototype Si cell¶

The next step is to build a prototype, here a unit cell of bulk silicon. It is furthermore decided that the cluster vectors will be created by populating the sites with either silicon or germanium. Also the cutoff for pairs is set to 10 Å.

## Initiate the cluster space¶

The cluster space is created by initiating a ClusterSpace object and providing the prototype structure, cutoffs and list of elements that were defined above as arguments.

## Structure from Si/Ge supercell¶

First, a $$2\times2\times1$$ supercell is built, after which the sites are randomly populated with Si and Ge atoms. Thereafter, an icet Structure object structure is created by providing an ASE Atoms object as input to the Structure.from_atoms() method.

## Extract the native clusters¶

The native clusters are extracted with help of the ClusterSpace.get_native_clusters method, with the structure defined in the previous section as input argument. Afterwards the structure itself and the native clusters are printed in tabular format, in the latter case by using the print() method.

The (partial) output produced by this script should similar to the following:

Cell:
[[ 0.     5.43   5.43 ]
[ 5.43   0.     5.43 ]
[ 2.715  2.715  0.   ]]

Element and positions:
Si  [ 0.  0.  0.]
Ge  [ 1.3575  1.3575  1.3575]
Si  [ 2.715  0.     2.715]
Si  [ 4.0725  1.3575  4.0725]
Si  [ 0.     2.715  2.715]
Ge  [ 1.3575  4.0725  4.0725]
Ge  [ 2.715  2.715  5.43 ]
Si  [ 4.0725  4.0725  6.7875]

Native cluster counts:
5.91721  :: 0 0 2.9586
==============
Si Si 3
Si Ge 1
Total: 4
...
:: 0 0
==============
Si 5
Ge 3
Total: 8


## Source code¶

The complete source code is available in examples/get_native_clusters.py