Skip to content

Write a Custom Transformation

1. Introduction

Write a transformation of materials in Python and apply it. The notebook is the starting point: it takes the materials, runs the transformation written in it and passes the result back to Materials Designer.

2. Open the notebook

In JupyterLite, the notebook is made/custom_transformation.ipynb, entry 6.3.1 "Custom Transformation" of made/Introduction.ipynb.

3. Set the parameters

The notebook takes the input materials or, when there are none, graphene from Standata.

Cell 3 holds the transformation:

1
new_material = materials[0]

The default transformation passes the first material through unchanged; the Python code of the transformation replaces it.

4. Run and read the result

Run the notebook with Run > Run All. The notebook shows the result, names it Custom Transformed Material and passes it back with set_materials, as in Structure Notebooks.

5. Interactive JupyterLite notebook

The interactive JupyterLite notebook for custom transformations can be accessed below.