Tutorial

This tutorial will take you through a calculation using aiida-strain. It assumes that you are already familiar with using AiiDA.

Creating strained structures

To create strained structures, you can use the ApplyStrains workflow. It requires an input (unstrained) AiiDA structure, and parameters that indicate which kind of strain should be applied:

  • strain_kind is the name of a strain.structure subclass, that governs how the strain is applied.

  • strain_parameters is the name of a strain.parameter instance, which gives the material-specific strain parameters.

  • strain_strengths is a list of strain values for which the strained structure should be calculated

In the following example, we apply -2%, -1%, 1% and 2% uni-axial (110) strain to unstrained InSb:

#!/usr/bin/env runaiida
# -*- coding: utf-8 -*-

# © 2017-2019, ETH Zurich, Institut für Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
Example applying uniaxial 110 strain to InSb.
"""

import pymatgen

from aiida.orm.nodes.data.str import Str
from aiida.orm.nodes.data.list import List
from aiida.orm import StructureData
from aiida.engine.launch import run

from aiida_strain import ApplyStrains


def get_strain_input(  # pylint: disable=missing-docstring
    strain_kind='three_five.Uniaxial110',
    strain_parameters='InSb',
    strain_strengths=(-0.02, -0.01, 0.01, 0.02)
):
    structure = StructureData()
    structure.set_pymatgen(pymatgen.Structure.from_file('POSCAR'))

    return dict(
        structure=structure,
        strain_kind=Str(strain_kind),
        strain_parameters=Str(strain_parameters),
        strain_strengths=List(list=list(strain_strengths))
    )


if __name__ == '__main__':
    print(run(ApplyStrains, **get_strain_input()))

Filtering symmetries

In addition to creating strained structures, you can also find out which symmetries the strained structure respects. To do that, use the ApplyStrainsWithSymmetry workflow, and add as an additional input a file describing the symmetries in symmetry_representation HDF5 format:

For this example, you also need to have the symmetry-repr command line utility available as an AiiDA code.

Note

The input files and source for the examples can be found on the aiida-strain GitHub.