Skip to content

Create a Perturbation in a Material

1. Introduction

Perturb a supercell of a material: the atoms are displaced by a smooth function of their coordinates, a sine wave by default.

2. Open the notebook

In JupyterLite, the notebook is made/create_perturbation.ipynb, entry 5.2.1 "Perturbation using sine wave" of made/Introduction.ipynb.

3. Set the parameters

Cell 1.1 holds the parameters:

1
2
3
4
5
6
7
8
# string representation of the perturbation function, function of x, y, z variables
perturbation_function = "0.5 * sin (2 * pi * x) "

USE_CARTESIAN_COORDINATES = False

SUPERCELL_MATRIX = [[30, 0, 0], [0, 30, 0], [0, 0, 1]]

PRESERVE_GEODESIC_DISTANCE = False

perturbation_function is the displacement, a string expression of x, y and z, in the coordinates that USE_CARTESIAN_COORDINATES selects.

SUPERCELL_MATRIX builds the supercell of the first of the input materials that is perturbed.

PRESERVE_GEODESIC_DISTANCE = True keeps the distances between the atoms along the perturbed surface and scales the cell to match the periodic boundary conditions.

4. Run and read the result

Run the notebook with Run > Run All. The notebook shows the supercell, then the perturbed material from the top and from the side, and passes it back with set_materials, as in Structure Notebooks.

5. Interactive JupyterLite notebook

The interactive JupyterLite notebook for creating a perturbation can be accessed below.