Skip to content

Commit

Permalink
wip: rough implementation of heterostack (takes toooooo long)
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Dec 25, 2024
1 parent 5213ff1 commit e2a5d0e
Showing 1 changed file with 293 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
{
"cells": [
{
"cell_type": "markdown",
"source": [],
"metadata": {
"collapsed": false
},
"id": "e96bfb09b980e52b"
},
{
"cell_type": "markdown",
"source": [
"# Create High-k Metal Gate Stack Tutorial\n",
"\n",
"This notebook demonstrates how to create a high-k metal gate stack heterostructure with four materials: Si (substrate), SiO2 (gate oxide), HfO2 (high-k dielectric), and TiN (metal gate).\n"
],
"metadata": {
"collapsed": false
},
"id": "3ae4cc7db0846f04"
},
{
"cell_type": "markdown",
"source": [
"## 1. Configuration Parameters\n"
],
"metadata": {
"collapsed": false
},
"id": "f1db6e522c6716dc"
},
{
"cell_type": "code",
"outputs": [],
"source": [
"# Global parameters\n",
"MAX_AREA = 800 # Maximum area for all interfaces\n",
"MAX_AREA_RATIO_TOL = 0.09 # Maximum area ratio tolerance for strain matching\n",
"MAX_ANGLE_TOLERANCE = 0.03 # Maximum angle tolerance for strain matching\n",
"MAX_LENGTH_TOLERANCE = 0.03 # Maximum length tolerance for strain matching\n",
"FINAL_VACUUM = 20.0 # Final vacuum spacing in Angstroms\n",
"\n",
"# Structure parameters for each layer\n",
"STRUCTURE_PARAMS = [\n",
" {\n",
" # Silicon substrate\n",
" \"slab_params\": {\n",
" \"miller_indices\": (1, 0, 0),\n",
" \"thickness\": 3, # atomic layers\n",
" \"vacuum\": 0, # Angstroms\n",
" \"xy_supercell_matrix\": [[1, 0], [0, 1]],\n",
" \"use_orthogonal_z\": True\n",
" },\n",
" \"interface_distance\": None # No interface for substrate\n",
" },\n",
" {\n",
" # SiO2 layer\n",
" \"slab_params\": {\n",
" \"miller_indices\": (1,0,0),\n",
" \"thickness\": 2,\n",
" \"vacuum\": 0,\n",
" \"xy_supercell_matrix\": [[1, 0], [0, 1]],\n",
" \"use_orthogonal_z\": True\n",
" },\n",
" \"interface_distance\": 2.5 # Distance to Si substrate\n",
" },\n",
" {\n",
" # HfO2 layer\n",
" \"slab_params\": {\n",
" \"miller_indices\": (0, 1, 1),\n",
" \"thickness\": 3,\n",
" \"vacuum\": 0,\n",
" \"xy_supercell_matrix\": [[1, 0], [0, 1]],\n",
" \"use_orthogonal_z\": True\n",
" },\n",
" \"interface_distance\": 2.8 # Distance to SiO2\n",
" },\n",
" {\n",
" # TiN layer\n",
" \"slab_params\": {\n",
" \"miller_indices\": (0, 0, 1),\n",
" \"thickness\": 3,\n",
" \"vacuum\": FINAL_VACUUM, # Add vacuum to final layer\n",
" \"xy_supercell_matrix\": [[1, 0], [0, 1]],\n",
" \"use_orthogonal_z\": True\n",
" },\n",
" \"interface_distance\": 2.5 # Distance to HfO2\n",
" }\n",
"]\n",
"\n",
"INTERFACE_INDEX=[4,0,0]\n"
],
"metadata": {
"collapsed": false
},
"id": "813b06d4d77a8507",
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"## 2. Environment Setup and Material Loading\n"
],
"metadata": {
"collapsed": false
},
"id": "b076b018bd5efe10"
},
{
"cell_type": "code",
"outputs": [],
"source": [
"from mat3ra.standata.materials import Materials\n",
"from mat3ra.made.material import Material\n",
"from mat3ra.made.tools.build.slab import SlabConfiguration, get_terminations, create_slab\n",
"from mat3ra.made.tools.build.interface import (\n",
" InterfaceConfiguration,\n",
" ZSLStrainMatchingParameters,\n",
" ZSLStrainMatchingInterfaceBuilder,\n",
" ZSLStrainMatchingInterfaceBuilderParameters\n",
")\n",
"from mat3ra.made.tools.modify import translate_to_z_level\n",
"from utils.visualize import visualize_materials as visualize\n",
"\n",
"# Load materials from Standata\n",
"materials = [\n",
" Material(Materials.get_by_name_first_match(\"Silicon\")), # Si substrate\n",
" Material(Materials.get_by_name_first_match(\"SiO2\")), # SiO2\n",
" Material(Materials.get_by_name_first_match(\"HfO2\")), # HfO2\n",
" Material(Materials.get_by_name_first_match(\"TiN\")) # TiN\n",
"]\n"
],
"metadata": {
"collapsed": false
},
"id": "deaa451cfe2f8dc0",
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"## 3. Build Stack Layer by Layer\n",
"\n",
"Now we'll build the stack sequentially, starting with the substrate and adding each layer one by one.\n"
],
"metadata": {
"collapsed": false
},
"id": "9a6950d3f27d1c8"
},
{
"cell_type": "code",
"outputs": [],
"source": [
"# Start with substrate (first material)\n",
"current_structure = materials[0]\n",
"print(\"Starting with substrate:\", materials[0].name)\n",
"\n",
"# Iterate through remaining materials to build interfaces\n",
"for i in range(1, len(materials)):\n",
" print(f\"\\nBuilding interface {i} of {len(materials)-1}...\")\n",
" print(f\"Adding {materials[i].name} to {materials[i-1].name}\")\n",
" \n",
" # Get parameters for current interface\n",
" film_params = STRUCTURE_PARAMS[i]\n",
" substrate_params = STRUCTURE_PARAMS[i-1]\n",
" \n",
" # Create slab configurations\n",
" film_config = SlabConfiguration(\n",
" bulk=materials[i],\n",
" **film_params[\"slab_params\"]\n",
" )\n",
" \n",
" substrate_config = SlabConfiguration(\n",
" bulk=current_structure,\n",
" **substrate_params[\"slab_params\"]\n",
" )\n",
" \n",
" # Get terminations\n",
" film_terminations = get_terminations(film_config)\n",
" substrate_terminations = get_terminations(substrate_config)\n",
" \n",
" # Use first termination pair for simplicity\n",
" film_termination = film_terminations[0]\n",
" substrate_termination = substrate_terminations[0]\n",
" \n",
" print(f\"Using terminations: {film_termination} (film) and {substrate_termination} (substrate)\")\n",
" \n",
" # Create interface configuration\n",
" interface_config = InterfaceConfiguration(\n",
" film_configuration=film_config,\n",
" substrate_configuration=substrate_config,\n",
" film_termination=film_termination,\n",
" substrate_termination=substrate_termination,\n",
" distance=film_params[\"interface_distance\"],\n",
" vacuum=film_params[\"slab_params\"][\"vacuum\"]\n",
" )\n",
" \n",
" # Set up strain matching and build interface\n",
" strain_params = ZSLStrainMatchingParameters(max_area=MAX_AREA, max_area_ratio_tol=MAX_AREA_RATIO_TOL, max_angle_tol=MAX_ANGLE_TOLERANCE, max_length_tol=MAX_LENGTH_TOLERANCE)\n",
" builder = ZSLStrainMatchingInterfaceBuilder(\n",
" build_parameters=ZSLStrainMatchingInterfaceBuilderParameters(\n",
" strain_matching_parameters=strain_params\n",
" )\n",
" )\n",
" \n",
" # Generate and sort interfaces\n",
" interfaces = builder.get_materials(configuration=interface_config)\n",
" \n",
" # Select the first interface (lowest strain, smallest area)\n",
" current_structure = interfaces[INTERFACE_INDEX[i-1]]\n",
" \n",
" # Translate structure to prepare for next layer\n",
" # current_structure = translate_to_z_level(current_structure, \"top\")\n",
" \n",
" # Visualize current state\n",
" visualize(\n",
" current_structure,\n",
" repetitions=[1, 1, 1],\n",
" title=f\"After adding {materials[i].name}\"\n",
" )\n",
" \n",
" # # Print interface statistics\n",
" # print(f\"\\nLayer {i} Statistics:\")\n",
" # print(f\"Number of atoms: {len(current_structure.atoms)}\")\n",
" print(f\"Height: {current_structure.lattice.c:.2f} Å\")\n",
" print(f\"Surface area: {current_structure.lattice.volume()/current_structure.lattice.c:.2f} Ų\")\n"
],
"metadata": {
"collapsed": false
},
"id": "88208178c30708a1",
"execution_count": null
},
{
"cell_type": "markdown",
"source": [
"## 4. Final Structure Visualization and Analysis\n"
],
"metadata": {
"collapsed": false
},
"id": "ae16540b54491e35"
},
{
"cell_type": "code",
"outputs": [],
"source": [
"# Visualize final structure\n",
"visualize(\n",
" current_structure,\n",
" repetitions=[3, 3, 1],\n",
" title=\"Complete High-k Metal Gate Stack\"\n",
")\n",
"\n",
"# Print final analysis\n",
"print(\"\\nFinal Structure Analysis:\")\n",
"print(f\"Total number of atoms: {len(current_structure.atoms)}\")\n",
"print(f\"Total height: {current_structure.lattice.c:.2f} Å\")\n",
"print(f\"Surface area: {current_structure.lattice.surface_area:.2f} Ų\")\n",
"print(\"\\nLayer composition:\")\n",
"for element, count in current_structure.composition.items():\n",
" print(f\" {element}: {count} atoms\")"
],
"metadata": {
"collapsed": false
},
"id": "14be386aeddd4b"
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit e2a5d0e

Please sign in to comment.