Dimensionality analysis¶
This is a example of analysis of the dimensionality of a structure using
the ase.geometry.dimensionality.analyze_dimensionality()
function. This is
useful for finding lowdimensional materials, such as 1D chainlike
structures, 2D layered structures, or structures with multiple dimensionality
types, such as 1D+3D.
The example below creates a layered MoS_{2} structure and analyzes its dimensionality.
import ase.build
from ase.visualize import view
from ase.geometry.dimensionality import analyze_dimensionality
atoms = ase.build.mx2(formula='MoS2', kind='2H', a=3.18, thickness=3.19)
atoms.cell[2, 2] = 7.0
atoms.set_pbc((1, 1, 1))
atoms *= 3
intervals = analyze_dimensionality(atoms, method='RDA')
m = intervals[0]
print(sum([e.score for e in intervals]))
print(m.dimtype, m.h, m.score, m.a, m.b)
atoms.set_tags(m.components)
view(atoms)
Coloring the atoms by their tags shows the distinct bonded clusters, which in this case are separate layers.
Each component in the material can be extracted, or “isolated”,
using the ase.geometry.dimensionality.isolate_components()
function as
the example below demonstrates.
import numpy as np
import ase.build
from ase import Atoms
from ase.visualize import view
from ase.geometry.dimensionality import isolate_components
# build two slabs of different types of MoS2
rep = [4, 4, 1]
a = ase.build.mx2(formula='MoS2', kind='2H', a=3.18, thickness=3.19) * rep
b = ase.build.mx2(formula='MoS2', kind='1T', a=3.18, thickness=3.19) * rep
positions = np.concatenate([a.get_positions(), b.get_positions() + [0, 0, 7]])
numbers = np.concatenate([a.numbers, b.numbers])
cell = a.cell
atoms = Atoms(numbers=numbers, positions=positions, cell=cell, pbc=[1, 1, 1])
atoms.cell[2, 2] = 14.0
# isolate each component in the whole material
result = isolate_components(atoms)
print("counts:", [(k, len(v)) for k, v in sorted(result.items())])
for dim, components in result.items():
for atoms in components:
print(dim)
view(atoms, block=True)
The method is described in the article:
P.M. Larsen, M. Pandey, M. Strange, and K. W. JacobsenPhys. Rev. Materials 3 034003, 2019
See also
More examples here: Dimensionality analysis of ICSD and COD databases.

ase.geometry.dimensionality.
analyze_dimensionality
(atoms, method='RDA', merge=True)¶ Performs a kinterval analysis.
In each kinterval the components (connected clusters) are identified. The intervals are sorted according to the scoring parameter, from high to low.
Parameters:
 atoms: ASE atoms object
The system to analyze. The periodic boundary conditions determine the maximum achievable component dimensionality, i.e. pbc=[1,1,0] sets a maximum dimensionality of 2.
 method: string
Analysis method to use, either ‘RDA’ (default option) or ‘TSA’. These correspond to the Rank Determination Algorithm of Mounet et al. and the Topological Scaling Algorithm (TSA) of Ashton et al.
 merge: boolean
Decides if kintervals of the same type (e.g. 01D or 3D) should be merged. Default: true
Returns:
 intervals: list
List of KIntervals for each interval identified. A KInterval is a namedtuple with the following field names:
 score: float
Dimensionality score in the range [0, 1]
 a: float
The start of the kinterval
 b: float
The end of the kinterval
 dimtype: str
The dimensionality type
 h: tuple
The histogram of the number of components of each dimensionality. For example, (8, 0, 3, 0) means eight 0D and three 2D components.
 components: array
The component ID of each atom.
 cdim: dict
The component dimensionalities