|
5 | 5 | "source": [ |
6 | 6 | "# Create a Perturbation in a Material\n", |
7 | 7 | "\n", |
8 | | - "Create a perturbation in a material with a specified smooth function. \n", |
| 8 | + "Create a perturbation in a material with a specified smooth function or a custom function described with [SymPy](https://docs.sympy.org/latest/tutorials/intro-tutorial/intro.html) expressions. \n", |
9 | 9 | "\n", |
10 | 10 | "<h2 style=\"color:green\">Usage</h2>\n", |
11 | 11 | "\n", |
|
34 | 34 | "cell_type": "markdown", |
35 | 35 | "source": [ |
36 | 36 | "## 1. Prepare the Environment\n", |
37 | | - "### 1.1. Set up defect parameters " |
| 37 | + "### 1.1. Set up supercell parameters " |
38 | 38 | ], |
39 | 39 | "metadata": { |
40 | 40 | "collapsed": false |
|
127 | 127 | "from utils.visualize import visualize_materials as visualize\n", |
128 | 128 | "from mat3ra.made.tools.build.supercell import create_supercell\n", |
129 | 129 | "\n", |
130 | | - "unit_cell = materials[1]\n", |
| 130 | + "unit_cell = materials[0]\n", |
131 | 131 | "supercell = create_supercell(unit_cell, supercell_matrix=SUPERCELL_MATRIX)\n", |
132 | 132 | "visualize(supercell, repetitions=[1, 1, 1], rotation=\"0x\")" |
133 | 133 | ], |
|
248 | 248 | "from mat3ra.made.tools.build.perturbation import CellMatchingDistancePreservingSlabPerturbationBuilder\n", |
249 | 249 | "from mat3ra.made.tools.utils.perturbation import PerturbationFunctionHolder\n", |
250 | 250 | "\n", |
251 | | - "x = sp.Symbol(\"x\")\n", |
252 | | - "y = sp.Symbol(\"y\")\n", |
| 251 | + "x,y = sp.symbols('x y')\n", |
253 | 252 | "function = amplitude * sp.sin(2 * sp.pi * x / wavelength + phase) * sp.sin(2 * sp.pi * y / wavelength)\n", |
254 | 253 | "\n", |
255 | 254 | "custom_perturbation_function = PerturbationFunctionHolder(function=function, variables=[\"x\", \"y\"])\n", |
|
0 commit comments