Skip to content

Commit

Permalink
update: import standata in speciic exmaples
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Nov 14, 2024
1 parent f77847b commit 0844748
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
4 changes: 3 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ default:
- pandas==1.5.3
- ase==3.22.1
- ipywidgets
- mat3ra-standata
packages_python:
- pymatgen==2024.4.13
packages_pyodide:
Expand Down Expand Up @@ -65,3 +64,6 @@ notebooks:
packages_pyodide:
- mat3ra-esse
- mat3ra-made
- name: specific_examples
packages_common:
- mat3ra-standata
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
"DEFECT_TYPE = \"adatom\"\n",
"PLACEMENT_METHOD = \"coordinate\"\n",
"# Using crystal coordinates for the defect placement\n",
"USE_CARTESIAN_COORDINATES = False \n",
"HOLLOW_SITE_COORDINATE = [1/2, 1/2] # in crystal coordinates\n",
"BRIDGE_SITE_COORDINATE = [3/8, 1/2] # in crystal coordinates\n",
"TOP_SITE_COORDINATE = [7/12, 5/12] # in crystal coordinates\n",
"USE_CARTESIAN_COORDINATES = False\n",
"HOLLOW_SITE_COORDINATE = [1 / 2, 1 / 2] # in crystal coordinates\n",
"BRIDGE_SITE_COORDINATE = [3 / 8, 1 / 2] # in crystal coordinates\n",
"TOP_SITE_COORDINATE = [7 / 12, 5 / 12] # in crystal coordinates\n",
"\n",
"# Setting data according to Table 1 in the manuscript, distance_z is the `h` from the table.\n",
"# Uncomment the lines to create the defect for the desired adatom.\n",
Expand Down Expand Up @@ -100,7 +100,8 @@
" await micropip.install('mat3ra-api-examples', deps=False)\n",
" from utils.jupyterlite import install_packages\n",
"\n",
" await install_packages(\"create_point_defect.ipynb\", \"../../../config.yml\")"
" await install_packages(\"create_point_defect.ipynb\", \"../../../config.yml\")\n",
" await install_packages(\"specific_examples\", \"../../../config.yml\")"
],
"metadata": {
"collapsed": false
Expand Down Expand Up @@ -174,7 +175,7 @@
"cell_type": "code",
"outputs": [],
"source": [
"from mat3ra.made.tools.build.defect import AdatomSlabPointDefectConfiguration\n",
"from mat3ra.made.tools.build.defect import AdatomSlabPointDefectConfiguration\n",
"from mat3ra.made.tools.build.defect.builders import PointDefectBuilderParameters\n",
"\n",
"configurations = [AdatomSlabPointDefectConfiguration(crystal=supercell,\n",
Expand Down Expand Up @@ -236,7 +237,8 @@
"\n",
"for material_with_defect in materials_with_adatom:\n",
" title = f\"{material_with_defect.metadata['build']['configuration']['chemical_element']} adatom\"\n",
" visualize([{\"material\": material_with_defect, \"title\": title}, {\"material\": material_with_defect, \"title\":title, \"rotation\": \"-90x\"}])"
" visualize([{\"material\": material_with_defect, \"title\": title},\n",
" {\"material\": material_with_defect, \"title\": title, \"rotation\": \"-90x\"}])"
],
"metadata": {
"collapsed": false
Expand All @@ -261,7 +263,8 @@
"from utils.jupyterlite import download_content_to_file\n",
"\n",
"for material_with_defect in materials_with_adatom:\n",
" download_content_to_file(material_with_defect.to_json(), f\"{material_with_defect.metadata['build']['configuration']['chemical_element']}_adatom.json\")"
" download_content_to_file(material_with_defect.to_json(),\n",
" f\"{material_with_defect.metadata['build']['configuration']['chemical_element']}_adatom.json\")"
],
"metadata": {
"collapsed": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"\n",
"# Create slab with default parameters if imported material is not a slab\n",
"DEFAULT_SLAB_PARAMETERS = {\n",
" \"miller_indices\": (0,0,1),\n",
" \"miller_indices\": (0, 0, 1),\n",
" \"thickness\": 3,\n",
" \"vacuum\": 0.0,\n",
" \"use_orthogonal_z\": True,\n",
Expand Down Expand Up @@ -82,10 +82,12 @@
"\n",
"if sys.platform == \"emscripten\":\n",
" import micropip\n",
"\n",
" await micropip.install('mat3ra-api-examples', deps=False)\n",
" await micropip.install('mat3ra-standata')\n",
" from utils.jupyterlite import install_packages\n",
" await install_packages(\"\", \"../../../config.yml\")"
"\n",
" await install_packages(\"\", \"../../../config.yml\")\n",
" await install_packages(\"specific_examples\", \"../../../config.yml\")"
],
"metadata": {
"collapsed": false
Expand All @@ -110,6 +112,7 @@
"source": [
"from mat3ra.made.material import Material\n",
"from mat3ra.standata.materials import Materials\n",
"\n",
"material = Material(Materials.get_by_name_first_match(\"TiN\"))"
],
"metadata": {
Expand Down Expand Up @@ -142,7 +145,7 @@
" bulk=material,\n",
" miller_indices=DEFAULT_SLAB_PARAMETERS[\"miller_indices\"],\n",
" thickness=DEFAULT_SLAB_PARAMETERS[\"thickness\"],\n",
" vacuum= DEFAULT_SLAB_PARAMETERS[\"vacuum\"],\n",
" vacuum=DEFAULT_SLAB_PARAMETERS[\"vacuum\"],\n",
" use_orthogonal_z=DEFAULT_SLAB_PARAMETERS[\"use_orthogonal_z\"],\n",
" xy_supercell_matrix=DEFAULT_SLAB_PARAMETERS[\"xy_supercell_matrix\"]\n",
" )\n",
Expand Down Expand Up @@ -179,12 +182,11 @@
")\n",
"from mat3ra.made.tools.build.defect import IslandSlabDefectConfiguration\n",
"\n",
"coordinate_condition= BoxCoordinateCondition(\n",
"coordinate_condition = BoxCoordinateCondition(\n",
" min_coordinate=SHAPE_PARAMETERS['min_coordinate'],\n",
" max_coordinate=SHAPE_PARAMETERS['max_coordinate']\n",
")\n",
"\n",
"\n",
"island_config = IslandSlabDefectConfiguration(\n",
" crystal=slab,\n",
" condition=coordinate_condition,\n",
Expand All @@ -193,6 +195,7 @@
")\n",
"\n",
"from mat3ra.made.tools.build.defect import IslandSlabDefectBuilder, SlabDefectBuilderParameters\n",
"\n",
"params = SlabDefectBuilderParameters(\n",
" auto_add_vacuum=AUTO_ADD_VACUUM,\n",
" vacuum_thickness=VACUUM_THICKNESS,\n",
Expand Down Expand Up @@ -243,7 +246,7 @@
"source": [
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": slab_with_island, \"title\": f\"Material with Island Defect ({SHAPE_PARAMETERS['shape']})\"}],\n",
"rotation=\"-90x\")\n",
" rotation=\"-90x\")\n",
"\n",
"visualize([{\"material\": slab, \"title\": \"Original material\"},\n",
" {\"material\": slab_with_island, \"title\": f\"Material with Island Defect ({SHAPE_PARAMETERS['shape']})\"}])"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
" import micropip\n",
"\n",
" await micropip.install('mat3ra-api-examples', deps=False)\n",
" await micropip.install('mat3ra-standata')\n",
" from utils.jupyterlite import install_packages\n",
" await install_packages(\"\", \"../../../config.yml\")"
"\n",
" await install_packages(\"specific_examples\", \"../../../config.yml\")"
],
"metadata": {
"collapsed": false
Expand Down Expand Up @@ -150,7 +150,7 @@
" CommensurateLatticeTwistedInterfaceBuilder\n",
"from mat3ra.made.tools.build.interface.configuration import TwistedInterfaceConfiguration\n",
"\n",
"configs = [ TwistedInterfaceConfiguration(\n",
"configs = [TwistedInterfaceConfiguration(\n",
" film=material,\n",
" substrate=material,\n",
" twist_angle=parameters[\"angle\"],\n",
Expand Down Expand Up @@ -186,7 +186,7 @@
"cell_type": "code",
"outputs": [],
"source": [
"interfaces= [ builder.get_material(config) for config in configs]"
"interfaces = [builder.get_material(config) for config in configs]"
],
"metadata": {
"collapsed": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"INTERFACE_DISTANCE = 3.23 # Distance between layers in Angstroms\n",
"INTERFACE_VACUUM = 20.0 # Vacuum layer thickness in Angstroms\n",
"\n",
"\n",
"# Visualization settings\n",
"SHOW_INTERMEDIATE_STEPS = True\n",
"VISUALIZE_REPETITIONS = [1, 1, 1]"
Expand Down Expand Up @@ -88,9 +87,9 @@
" import micropip\n",
"\n",
" await micropip.install('mat3ra-api-examples', deps=False)\n",
" await micropip.install('mat3ra-standata')\n",
" from utils.jupyterlite import install_packages\n",
" await install_packages(\"\", \"../../../config.yml\")\n"
"\n",
" await install_packages(\"specific_examples\", \"../../../config.yml\")"
],
"metadata": {
"collapsed": false
Expand Down

0 comments on commit 0844748

Please sign in to comment.