Repository navigation
feature/SOF-8072 Feature: SE for a Ti adatom on a 5×5 TiN island, descent energetics of Fig. 6 (MACE and DFT) #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
VsevolodX
wants to merge
31
commits into
main
Choose a base branch
from
feature/SOF-8072
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
19beb46
Build the paper's 458-atom TiN island cell with the Ti adatom at the …
VsevolodX 194ae2e
Add the MACE notebook for the Ti adatom descent energetics on the TiN…
VsevolodX f589df6
Apply review round 1: native-run instructions, site a and paper sourc…
VsevolodX 4009740
Show the island cell with the Ti adatom at a, c and i in the structur…
VsevolodX 1b3cccb
Restore the TiN island notebook to its main version
VsevolodX 081b157
Add a structure notebook for the Ti adatom on a 5x5 TiN island on TiN…
VsevolodX b35065f
Pair the MACE simulation notebook with the Ti adatom notebook and lis…
VsevolodX b0711c7
Say the site derivation once
VsevolodX 59908ff
Close the adatom notebook with References; name the c and i sites
VsevolodX 9e48ddf
Show the manuscript's Fig. 1(b) in the adatom notebook
VsevolodX a61510e
Expose the adatom sites as parameters
VsevolodX e524a88
Drop the run timing from the notebook
VsevolodX fb6e3da
Show each adatom site as built and relaxed
VsevolodX 268e878
State the browser memory limit
VsevolodX 8a488c9
Add DFT single-point energies on the MACE-relaxed structures
VsevolodX 208d386
Use GBRV ultrasoft pseudopotentials for the DFT energies
VsevolodX 04d9d18
Do not write wavefunctions in the DFT jobs
VsevolodX 8ae1ab1
Run the DFT energies on the OFplus queue
VsevolodX af94c71
Run the DFT energies within 24 hours
VsevolodX 265f79a
Apply review of the DFT section
VsevolodX 8c70d4f
Converge the DFT energies to 1e-4 Ry with local-TF mixing
VsevolodX 3af706a
Choose the cell size, freeze the bottom slab plane and relax with DFT
VsevolodX 40b37a8
Let QE write its data file so the final structure is extracted
VsevolodX 03449ed
Allow five ionic steps per DFT job
VsevolodX 178c1f0
Pin api-client to store the frozen plane with the material
VsevolodX 9a35888
Use the whole node the job is billed for
VsevolodX a375341
Draw the DFT energies beside the MACE ones on the Fig. 6 panel
VsevolodX f0540df
Ship no DFT jobs listed, and say which cell the DFT settings are size…
VsevolodX dfc0718
Run the isolated Ti atom as a total-energy job
VsevolodX ca878ea
Say that the isolated Ti atom gets a total energy, not a relaxation
VsevolodX d9d83a9
Pin api-client to the version that reads constraints back
VsevolodX File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
325 changes: 325 additions & 0 deletions
325
other/materials_designer/specific_examples/defect_point_adatom_island_titanium_nitride.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,325 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "0", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "# Ti Adatom on a 5×5 TiN Island on TiN(001)\n", | ||
| "\n", | ||
| "## 0. Introduction\n", | ||
| "\n", | ||
| "This tutorial builds the cell of the Ti adatom descent study in the publication:\n", | ||
| "\n", | ||
| "> **D. G. Sangiovanni, A. B. Mei, D. Edström, L. Hultman, V. Chirita, I. Petrov, and J. E. Greene**, \"Effects of surface vibrations on interlayer mass transport: Ab initio molecular dynamics investigation of Ti adatom descent pathways and rates from TiN/TiN(001) islands\", Physical Review B 97, 035406 (2018). [DOI: 10.1103/PhysRevB.97.035406](https://doi.org/10.1103/PhysRevB.97.035406)\n", | ||
| "\n", | ||
| "The cell (Sec. II.A, Fig. 1b) is a 5×5-atom TiN island, one plane high with Ti corners, on a 12×12×3-atom\n", | ||
| "TiN(001) slab with 15.3 Å of vacuum: 457 atoms. A Ti adatom is added at each of the sites a, c and i of Fig. 6.\n", | ||
| "\n", | ||
| "" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "1", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## 1. Prepare the Environment\n", | ||
| "### 1.1. Set up defect parameters\n", | ||
| "\n", | ||
| "Each entry of `ADATOM_SITES` places one adatom relative to the N atom with the smaller x in the island's\n", | ||
| "edge row at the largest y, in units of the Ti–N site spacing d = a/2, with Δz = 0 the island plane; to add a\n", | ||
| "site, add an entry under a new letter to both `ADATOM_SITES` and `ADATOM_MATERIAL_NAMES`.\n", | ||
| "\n", | ||
| "`CELL_SIZE` picks the cell: `\"12x12x3\"`, the manuscript's (12×12 sites, 3 slab planes, 457 atoms), or `\"10x10x2\"`\n", | ||
| "(10×10 sites, 2 slab planes, 225 atoms). With the bottom slab plane frozen, MACE gives E(c) − E(a) = 0.315 and 0.311 eV,\n", | ||
| "E(i) − E(a) = −2.247 and −2.109 eV, and E_ads(a) = −3.015 and −3.067 eV on the two." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "2", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "MATERIAL_NAME = \"Titanium Nitride\"\n", | ||
| "MILLER_INDICES = (0, 0, 1)\n", | ||
| "# Thickness counts conventional layers of two (001) planes; bottom planes are removed after the island is added.\n", | ||
| "SLAB_THICKNESS = 2\n", | ||
| "VACUUM = 15.3 # Angstrom\n", | ||
| "NUMBER_OF_ADDED_LAYERS = 0.5\n", | ||
| "\n", | ||
| "# Cell sizes as (xy supercell, island box minimum and maximum in crystal coordinates, bottom planes removed);\n", | ||
| "# x and y minima one site apart put Ti atoms at the island corners\n", | ||
| "CELL_SIZES = {\n", | ||
| " \"12x12x3\": ([[6, 0], [0, 6]], [0.3233, 0.24, 0], [0.7233, 0.64, 1], 1),\n", | ||
| " \"10x10x2\": ([[5, 0], [0, 5]], [0.29, 0.19, 0], [0.75, 0.65, 1], 2),\n", | ||
| "}\n", | ||
| "CELL_SIZE = \"12x12x3\"\n", | ||
| "XY_SUPERCELL_MATRIX, ISLAND_MIN_COORDINATE, ISLAND_MAX_COORDINATE, PLANES_REMOVED = CELL_SIZES[CELL_SIZE]\n", | ||
| "\n", | ||
| "ADATOM_ELEMENT = \"Ti\"\n", | ||
| "# Adatom sites as (Δx, Δy, Δz) from the island's edge N atom, in units of the Ti–N site spacing;\n", | ||
| "# Δz = 0 is the island plane. Fig. 6's b and d–h are NEB images between these sites, not positions.\n", | ||
| "ADATOM_SITES = {\n", | ||
| " \"a\": (0.5, -0.5, 1), # fourfold hollow on the island beside the edge\n", | ||
| " \"c\": (0, 0, 1), # atop the edge N\n", | ||
| " \"i\": (0, 1, 0), # atop the terrace N in front of the edge\n", | ||
| "}\n", | ||
| "\n", | ||
| "ISLAND_MATERIAL_NAME = f\"TiN(001) {CELL_SIZE} island 5x5\"\n", | ||
| "ADATOM_MATERIAL_NAMES = {\n", | ||
| " \"a\": f\"{ISLAND_MATERIAL_NAME} + Ti a (FFH island)\",\n", | ||
| " \"c\": f\"{ISLAND_MATERIAL_NAME} + Ti c (atop-N edge)\",\n", | ||
| " \"i\": f\"{ISLAND_MATERIAL_NAME} + Ti i (atop-N terrace)\",\n", | ||
| "}" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "3", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "### 1.2. Install Packages\n", | ||
| "The step executes only in Pyodide environment. For other environments, the packages should be installed via `pip install` (see [README](../../README.ipynb))." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "4", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from mat3ra.notebooks_utils.packages import install_packages\n", | ||
| "\n", | ||
| "await install_packages(\"made|specific_examples\")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "5", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "### 1.3. Load input material" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "6", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from mat3ra.made.material import Material\n", | ||
| "from mat3ra.standata.materials import Materials\n", | ||
| "\n", | ||
| "material = Material.create(Materials.get_by_name_first_match(MATERIAL_NAME))" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "7", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "### 1.4. Create and preview Slab" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "8", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from mat3ra.made.tools.helpers import create_slab\n", | ||
| "from mat3ra.notebooks_utils.ipython.entity.material.visualize import visualize_materials\n", | ||
| "\n", | ||
| "slab = create_slab(\n", | ||
| " crystal=material,\n", | ||
| " termination_top=None, # Use default termination\n", | ||
| " miller_indices=MILLER_INDICES,\n", | ||
| " number_of_layers=SLAB_THICKNESS,\n", | ||
| " vacuum=VACUUM,\n", | ||
| " use_orthogonal_c=True,\n", | ||
| " xy_supercell_matrix=XY_SUPERCELL_MATRIX\n", | ||
| ")\n", | ||
| "\n", | ||
| "visualize_materials(slab)" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "9", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## 2. Create the Island" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "10", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "import numpy as np\n", | ||
| "from mat3ra.made.tools.analyze.other import get_atom_indices_by_layer\n", | ||
| "from mat3ra.made.tools.convert import to_ase\n", | ||
| "from mat3ra.made.tools.entities.coordinate import BoxCoordinateCondition\n", | ||
| "from mat3ra.made.tools.helpers import create_island\n", | ||
| "from mat3ra.made.tools.modify import filter_by_ids, remove_vacuum\n", | ||
| "\n", | ||
| "coordinate_condition = BoxCoordinateCondition(min_coordinate=ISLAND_MIN_COORDINATE, max_coordinate=ISLAND_MAX_COORDINATE)\n", | ||
| "\n", | ||
| "slab_with_island = create_island(\n", | ||
| " slab=slab,\n", | ||
| " condition=coordinate_condition,\n", | ||
| " number_of_added_layers=NUMBER_OF_ADDED_LAYERS,\n", | ||
| " use_cartesian_coordinates=False,\n", | ||
| ")\n", | ||
| "for _ in range(PLANES_REMOVED):\n", | ||
| " bottom_plane = get_atom_indices_by_layer(slab_with_island)[0]\n", | ||
| " slab_with_island = filter_by_ids(slab_with_island, ids=bottom_plane, invert=True, reset_ids=True)\n", | ||
| "slab_with_island = remove_vacuum(slab_with_island, fixed_padding=VACUUM)\n", | ||
| "slab_with_island.name = ISLAND_MATERIAL_NAME\n", | ||
| "\n", | ||
| "atoms = to_ase(slab_with_island)\n", | ||
| "symbols = np.array(atoms.get_chemical_symbols())\n", | ||
| "planes = get_atom_indices_by_layer(slab_with_island)\n", | ||
| "island = planes[-1]\n", | ||
| "island_x, island_y = atoms.positions[island, 0], atoms.positions[island, 1]\n", | ||
| "is_corner = ((np.isclose(island_x, island_x.min()) | np.isclose(island_x, island_x.max()))\n", | ||
| " & (np.isclose(island_y, island_y.min()) | np.isclose(island_y, island_y.max())))\n", | ||
| "print(f\"{slab_with_island.name}: {len(atoms)} atoms ({sum(symbols == 'Ti')} Ti, {sum(symbols == 'N')} N) \"\n", | ||
| " f\"in {len(planes)} planes, c = {atoms.cell[2, 2]:.3f} Å\")\n", | ||
| "print(f\"Island: {len(island)} atoms, corners {symbols[island][is_corner].tolist()}\")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "11", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## 3. Add the Adatom at the Sites of Fig. 6\n", | ||
| "\n", | ||
| "The paper gives no coordinates for the sites; they follow from the lattice and are measured on the island\n", | ||
| "built above, from the offsets in `ADATOM_SITES`. Measured from the edge N with the smaller x, a lies between\n", | ||
| "that N and the edge-centre Ti, the paper's FFH_edge; i is the epitaxial site that extends the island." | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "12", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from mat3ra.made.tools.helpers import create_defect_point_interstitial\n", | ||
| "\n", | ||
| "site_spacing = material.lattice.a / 2\n", | ||
| "edge_y = island_y.max()\n", | ||
| "edge_nitrogen_x = min(atoms.positions[index, 0] for index in island\n", | ||
| " if symbols[index] == \"N\" and np.isclose(atoms.positions[index, 1], edge_y))\n", | ||
| "island_z = atoms.positions[island, 2].mean()\n", | ||
| "\n", | ||
| "adatom_sites = {\n", | ||
| " site: [edge_nitrogen_x + offset_x * site_spacing, edge_y + offset_y * site_spacing, island_z + offset_z * site_spacing]\n", | ||
| " for site, (offset_x, offset_y, offset_z) in ADATOM_SITES.items()\n", | ||
| "}\n", | ||
| "\n", | ||
| "materials_with_adatom = []\n", | ||
| "for site, coordinate in adatom_sites.items():\n", | ||
| " material_with_adatom = create_defect_point_interstitial(\n", | ||
| " slab_with_island, coordinate, ADATOM_ELEMENT, \"exact_coordinate\", use_cartesian_coordinates=True\n", | ||
| " )\n", | ||
| " material_with_adatom.name = ADATOM_MATERIAL_NAMES[site]\n", | ||
| " materials_with_adatom.append(material_with_adatom)\n", | ||
| "\n", | ||
| " atoms_with_adatom = to_ase(material_with_adatom)\n", | ||
| " adatom = len(atoms_with_adatom) - 1\n", | ||
| " distances = np.sort(atoms_with_adatom.get_distances(adatom, range(adatom), mic=True))[:3]\n", | ||
| " print(f\"{material_with_adatom.name}: {len(atoms_with_adatom)} atoms, \"\n", | ||
| " f\"adatom's three shortest distances {np.round(distances, 3)} Å\")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "13", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## 4. Visualize the Result(s)" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "14", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "visualize_materials([{\"material\": material_to_show, \"title\": material_to_show.name, \"rotation\": \"-45x\"}\n", | ||
| " for material_to_show in [slab_with_island, *materials_with_adatom]])" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "15", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## 5. Pass data to the outside runtime" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "16", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "from mat3ra.notebooks_utils.io import download_content_to_file\n", | ||
| "from mat3ra.notebooks_utils.material import set_materials\n", | ||
| "\n", | ||
| "materials = [slab_with_island, *materials_with_adatom]\n", | ||
| "set_materials(materials)\n", | ||
| "for material_to_save in materials:\n", | ||
| " download_content_to_file(material_to_save.to_json(), f\"{material_to_save.name}.json\")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "17", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "## References\n", | ||
| "\n", | ||
| "[1] D. G. Sangiovanni, A. B. Mei, D. Edström, L. Hultman, V. Chirita, I. Petrov, J. E. Greene, \"Effects of surface\n", | ||
| "vibrations on interlayer mass transport: Ab initio molecular dynamics investigation of Ti adatom descent pathways\n", | ||
| "and rates from TiN/TiN(001) islands\", Phys. Rev. B 97, 035406 (2018).\n", | ||
| "[DOI: 10.1103/PhysRevB.97.035406](https://doi.org/10.1103/PhysRevB.97.035406)" | ||
| ] | ||
| } | ||
| ], | ||
| "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 | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: mat3ra/api-examples
Length of output: 5702
🏁 Script executed:
Repository: mat3ra/api-examples
Length of output: 157
🌐 Web query:
mat3ra.made.tools.helpers create_defect_point_interstitial source💡 Result:
🌐 Web query:
site:github.com/mat3ra/made "create_defect_point_interstitial"💡 Result:
🏁 Script executed:
Repository: mat3ra/api-examples
Length of output: 29015
🏁 Script executed:
Repository: mat3ra/api-examples
Length of output: 11735
🏁 Script executed:
Repository: mat3ra/api-examples
Length of output: 40705
🏁 Script executed:
Repository: mat3ra/api-examples
Length of output: 5100
🏁 Script executed:
Repository: mat3ra/api-examples
Length of output: 6475
Re-trim the cell after inserting the
aandcadatoms.remove_vacuum(..., fixed_padding=VACUUM)runs before insertion. The interstitialADDmerge keeps the host lattice and appends the new coordinate, so theaandcexports have less than 15.3 Å above their highest atom. Siteidoes not raise the island layer and does not need this correction.Suggested fix
material_with_adatom = create_defect_point_interstitial( slab_with_island, coordinate, ADATOM_ELEMENT, "exact_coordinate", use_cartesian_coordinates=True ) + if site in ("a", "c"): + material_with_adatom = remove_vacuum(material_with_adatom, fixed_padding=VACUUM) material_with_adatom.name = ADATOM_MATERIAL_NAMES[site]🤖 Prompt for AI Agents