|
| 1 | +# Create an Interface with Python Transformation |
| 2 | + |
| 3 | +In this tutorial, we create an interface between two materials using the Python Transformation feature. Specifically, we will explore the creation of an interface between Graphene and Ni(111). |
| 4 | + |
| 5 | +## Step 0: Open Materials Designer |
| 6 | + |
| 7 | +We start with [opening](../../entities-general/actions/create.md) an instance of the [Materials Designer Interface](../../materials-designer/overview.md) for creating and designing new [Materials structures](../../materials/overview.md) on our platform. |
| 8 | + |
| 9 | +## Step 1: Import Materials |
| 10 | + |
| 11 | +In order to use Graphene and Ni, the user should first [import](../../materials-designer/header-menu/input-output/import.md) sample crystalline structures of the two respective materials into the current Materials Designer session, from the account-owned [collection](../../accounts/collections.md) of materials. |
| 12 | + |
| 13 | +In this example, we will import Graphene and Ni from Standata. |
| 14 | + |
| 15 | +- Open the 'Import from Standata' dialog by going to `Input/Output` > `Import from Standata`. |
| 16 | +<img src="/images/tutorials/interface_with_python/open_standata.png" alt="Open Import from Standata Dialog"/> |
| 17 | +- Select 'Graphene' and 'Ni' from the materials list. |
| 18 | +<img src="/images/tutorials/interface_with_python/import_from_standata.png" alt="Import Gr and Ni from Standata"/> |
| 19 | +- Click 'Submit' to import these materials into the Materials Designer session. |
| 20 | +- Default Material Silicon should be removed from the session. |
| 21 | +<img src="/images/tutorials/interface_with_python/remove_silicon.png" alt="Remove Silicon"/> |
| 22 | +- Graphene and Ni should now be available in the materials list. |
| 23 | +<img src="/images/tutorials/interface_with_python/graphene_and_ni_imported.png" alt="Gr and Ni available in materials list"/> |
| 24 | + |
| 25 | +## Step 2: Use Python Transformation Dialog |
| 26 | + |
| 27 | +Navigate to `Advanced` > `Python Transformation` from the main interface. |
| 28 | +<img src="/images/tutorials/interface_with_python/open_python_transformation.png" alt="Open Python Transformation Dialog"/> |
| 29 | + |
| 30 | +- Choose the transformation titled “Place a 2D materials Layer on a Surface”. |
| 31 | +<img src="/images/tutorials/interface_with_python/select_transformation.png" alt="Select Transformation"/> |
| 32 | +- Select Ni and Graphene from the materials list. The order of selection can be easily accounted for later, but the default expected order is substrate first and then the layer. |
| 33 | +<img src="/images/tutorials/interface_with_python/select_materials.png" alt="Select Materials"/> |
| 34 | + |
| 35 | +!!!warning "Key Considerations" |
| 36 | + The user is responsible for calculating the appropriate superlattice matrices to ensure realistic interfaces. |
| 37 | + Excessive straining during the scaling of the layer can result in unrealistic deformations, so use **`scale_layer_to_fit`** cautiously. |
| 38 | + |
| 39 | +In the Python code area: |
| 40 | + |
| 41 | +- Set the substrate index and layer index corresponding to the Selected Materials. In this example, the substrate (Ni) should be at index 0 and the layer (Graphene) at index 1. |
| 42 | +- Customize the **`SETTINGS`** for your specific use case, including: |
| 43 | + - Miller indices for the substrate and layer, the default value is (1,1,1) for substrate and (0,0,1) for 2D layer. |
| 44 | + - Vacuum space and number of layers, we can leave it at default values. |
| 45 | + - The distance between the substrate and the layer in Angstroms. |
| 46 | + - Superlattice matrices which should be precalculated for a good lattice match. For Graphene on Ni(111) matrix [[1,0], [0,1]] for both materials already provides a good match since lattices are of the same type (hexagonal) and have similar vectors. |
| 47 | + - Flag **`scale_layer_to_fit`** scales 2D layer superlattice and basis to fit the superlattice of substrate. This is useful when the layer is not a perfect match to the substrate. In this example, we will leave it at default value of `False`. |
| 48 | + |
| 49 | +<details> |
| 50 | +<summary>Click to view the Python code</summary> |
| 51 | + |
| 52 | +```python |
| 53 | +# Indices identify the substrate and layer from the list of input materials under `materials_in` in globals(). |
| 54 | +SUBSTRATE_INDEX = 0 |
| 55 | +LAYER_INDEX = 1 |
| 56 | + |
| 57 | +SETTINGS = { |
| 58 | + "substrate_surface": { |
| 59 | + # Set Miller indices as a tuple for the resulting substrate surface. |
| 60 | + "miller_indices": (1, 1, 1), |
| 61 | + # The vacuum space (in Ångströms) added to the surface in the direction perpendicular to the surface. |
| 62 | + "vacuum": 5, |
| 63 | + # The number of atomic layers in the resulting substrate. |
| 64 | + "number_of_layers": 3, |
| 65 | + # The transformation matrix for the surface. Format is: [[v1x, v1y], [v2x, v2y]]. |
| 66 | + # fmt: off |
| 67 | + "superlattice_matrix": [ |
| 68 | + [1, 0], |
| 69 | + [0, 1] |
| 70 | + ], |
| 71 | + # fmt: on |
| 72 | + }, |
| 73 | + "layer_surface": { |
| 74 | + # Set Miller indices as a tuple for the resulting layer surface: (0,0,1) for 2D material |
| 75 | + "miller_indices": (0, 0, 1), |
| 76 | + # The vacuum space (in Ångströms) added to the surface in the direction perpendicular to the surface. |
| 77 | + "vacuum": 5, |
| 78 | + # The number of atomic layers in the resulting substrate: 1 for 2D material |
| 79 | + "number_of_layers": 1, |
| 80 | + # The transformation matrix for the surface. Format is: [[v1x, v1y], [v2x, v2y]]. |
| 81 | + # fmt: off |
| 82 | + "superlattice_matrix": [ |
| 83 | + [1, 0], |
| 84 | + [0, 1] |
| 85 | + ], |
| 86 | + # fmt: on |
| 87 | + }, |
| 88 | + "interface": { |
| 89 | + "distance": 3.0, |
| 90 | + }, |
| 91 | + # If True the layer cell and basis vectors will be scaled to fit the substrate cell. |
| 92 | + # Mind the strain that is introduced by this operation. |
| 93 | + "scale_layer_to_fit": False, |
| 94 | +} |
| 95 | +``` |
| 96 | +</details> |
| 97 | + |
| 98 | +- Click `Run All` to process the transformation. |
| 99 | +- The strain matrix will appear in the output, providing insight into the lattice deformation. |
| 100 | +- `Output Materials` will update with the newly created structure. |
| 101 | +<img src="/images/tutorials/interface_with_python/after_run.png" alt="Results of code execution: strain matrix and output materials"/> |
| 102 | + |
| 103 | +- Review the resulting strain matrix, if satisfied, submit the form to add the interface to your materials collection. |
| 104 | +- Verify the final structure using the Orthographic camera in the 3D Viewer to ensure proper alignment and centrality of the layer over the substrate. |
| 105 | + |
| 106 | +- Resulting Material with unit cell repeated 3 times in A and B directions: |
| 107 | +<img src="/images/tutorials/interface_with_python/resulting_material.png" alt="Graphene on Ni interface"/> |
0 commit comments