-
Notifications
You must be signed in to change notification settings - Fork 5
Feature/sof-7948 FE diagram #340
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
base: main
Are you sure you want to change the base?
Changes from all commits
7418af3
9582383
10bb19c
48cd1fb
c41b488
00d345e
033114c
3f79866
eb9c95c
095559d
6edbf54
7603776
03d6f48
37b302e
3805ac9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,201 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cells": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "markdown", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "0", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "# Create Solid Solution (Mixed Stoichiometry)\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "Create a solid solution by partially substituting one element with another\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "(e.g., Hf₁₋ₓZrₓO₂). Automatically determines optimal supercell size to achieve\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "the target concentration.\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "<h2 style=\"color:green\">Usage</h2>\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "1. Make sure to select Input Materials (in the outer runtime) before running the notebook.\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "1. Set parameters in cell 1.1. below.\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "1. Click \"Run\" > \"Run All\" to run all cells.\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "1. Scroll down to view results.\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "## Notes\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "1. For more information, see [Introduction](Introduction.ipynb)" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "markdown", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "1", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "## 1. Prepare the Environment\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "### 1.1. Set solid solution parameters" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "code", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "execution_count": null, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "2", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "outputs": [], | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "SOURCE_ELEMENT = \"Ni\" # Element to partially replace\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "TARGET_ELEMENT = \"Co\" # Replacement element\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "CONCENTRATION = 0.5 # Fraction of SOURCE_ELEMENT sites to replace (0–1)\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "# Site selection: \"random\" or \"uniform\" (Farthest Point Sampling for even spacing)\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "SITE_SELECTION_METHOD = \"uniform\"\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "# Random seed for reproducible site selection\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "SEED = 0\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "# Tolerance for matching target concentration (smaller = larger supercell)\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "TOLERANCE = 0.01" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "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\")" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "markdown", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "5", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "### 1.3. Get input materials" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "code", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "execution_count": null, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "6", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "outputs": [], | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "from mat3ra.notebooks_utils.material import get_materials\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "materials = get_materials(globals())" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+92
to
+96
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Guard against empty/missing input materials before indexing.
🛡️ Proposed fix from mat3ra.made.tools.helpers import create_solid_solution
-unit_cell = materials[0]
+if not materials:
+ raise ValueError("No input materials found. Select a material before running this notebook.")
+if len(materials) > 1:
+ print(f"Warning: {len(materials)} materials selected; only the first one will be used.")
+unit_cell = materials[0]
solid_solution = create_solid_solution(Also applies to: 111-136 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "markdown", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "7", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "## 2. Create Solid Solution" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "code", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "execution_count": null, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "8", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "outputs": [], | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "from mat3ra.made.tools.helpers import create_solid_solution\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "unit_cell = materials[0]\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "solid_solution = create_solid_solution(\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| " material=unit_cell,\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| " source_element=SOURCE_ELEMENT,\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| " target_element=TARGET_ELEMENT,\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| " concentration=CONCENTRATION,\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| " seed=SEED,\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| " tolerance=TOLERANCE,\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| " site_selection_method=SITE_SELECTION_METHOD,\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| ")\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "from collections import Counter\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "composition = Counter(solid_solution.basis.elements.values)\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "n_cation = composition.get(SOURCE_ELEMENT, 0) + composition.get(TARGET_ELEMENT, 0)\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "actual_fraction = composition.get(TARGET_ELEMENT, 0) / n_cation if n_cation else 0\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "print(f\"Unit cell: {unit_cell.name}\")\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "print(f\"Composition: {dict(composition)}\")\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "print(f\"Total atoms: {sum(composition.values())}\")\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "print(f\"Requested concentration: {CONCENTRATION}\")\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "print(f\"Actual concentration: {actual_fraction:.4f}\")\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "print(f\"Site selection method: {SITE_SELECTION_METHOD}\")" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "markdown", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "9", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "## 3. Visualize Result(s)" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "code", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "execution_count": null, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "10", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "outputs": [], | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "from mat3ra.notebooks_utils.ipython.entity.material.visualize import visualize_materials as visualize\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "visualize(\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| " {\"material\": solid_solution, \"title\": f\"Solid Solution: {dict(composition)}\"}, viewer=\"wave\")" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "markdown", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "11", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "## 4. Pass data to the outside runtime" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "cell_type": "code", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "execution_count": null, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "id": "12", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": {}, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "outputs": [], | ||||||||||||||||||||||||||||||||||||||||||||||||
| "source": [ | ||||||||||||||||||||||||||||||||||||||||||||||||
| "from mat3ra.notebooks_utils.material import set_materials\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "\n", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "set_materials([solid_solution])" | ||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||||
| "metadata": { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "kernelspec": { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "display_name": "Python 3", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "language": "python", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "name": "python3" | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "language_info": { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "codemirror_mode": { | ||||||||||||||||||||||||||||||||||||||||||||||||
| "name": "ipython", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "version": 3 | ||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "file_extension": ".py", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "mimetype": "text/x-python", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "name": "python", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "nbformat_minor": 5, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "pygments_lexer": "ipython3", | ||||||||||||||||||||||||||||||||||||||||||||||||
| "version": "3.11.2" | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+186
to
+197
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win Remove stray
🧹 Proposed fix "file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
- "nbformat_minor": 5,
"pygments_lexer": "ipython3",
"version": "3.11.2"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "nbformat": 4, | ||||||||||||||||||||||||||||||||||||||||||||||||
| "nbformat_minor": 5 | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
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.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: mat3ra/api-examples
Length of output: 20125
Add
plotlytoanalyze_convex_hull's Pyodide packages.other/materials_designer/workflows/analyze_convex_hull.ipynbcallsplot_convex_hull, and that helper imports Plotly.config.yml:56-59only installstqdmandpalettablefor this notebook; theplotly==5.24.1pin undermadewon’t apply here, anddefault.packages_pyodidedoesn’t include Plotly.Proposed fix
- name: analyze_convex_hull packages_pyodide: - tqdm - palettable + - plotly==5.24.1📝 Committable suggestion
🤖 Prompt for AI Agents