Skip to content

Dislocation simplification & generalisation #193

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

Merged
merged 57 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
6b9718c
ENH: Generic interface for generating disloc unit_cells
thomas-rocke Oct 17, 2023
721823b
TST: Unittesting for _validate_disloc_inputs
thomas-rocke Oct 17, 2023
f0d24ee
ENH: Add test of dislocs from bulk configs
thomas-rocke Oct 20, 2023
0150204
ENH: Convert all dislocs to simpler attribute-based solution
thomas-rocke Oct 23, 2023
24d56ce
BUG: Fix incorrect disloc parameterisations
thomas-rocke Oct 23, 2023
ddb2075
MAINT: Formatting & Structure of dislocation.py
thomas-rocke Oct 23, 2023
a69ea8e
DOC: Dislocation docs
thomas-rocke Oct 23, 2023
c368bb6
DOC: Example of dislocations in disordered systems
thomas-rocke Oct 24, 2023
87c7d53
BUG: Fix disloc classes sharing vector objects
thomas-rocke Oct 25, 2023
0c0c01b
DOC: Fix typo, remove empty cell in dislocs docs
thomas-rocke Oct 25, 2023
adfd8c6
ENH: Account for larger supercells in disloc generation
thomas-rocke Oct 25, 2023
b7ec4bf
BUG: Remove erroneous float.copy()
thomas-rocke Oct 25, 2023
21abad5
DOC: Fix heading weights in disloc docs
thomas-rocke Oct 25, 2023
14662d3
ENH: Create utils.py, shift cubic bulk validation there
thomas-rocke Nov 2, 2023
7a969e6
BUG: BCCEdge100110Dislocation unit_cell_core_position -> unit_cell_co…
thomas-rocke Nov 2, 2023
e7e4821
MAINT: CUbicCrystalDissociatedDislocation takes all params from left_…
thomas-rocke Nov 2, 2023
b39e596
MAINT: Minor PEP8 changes to dislocation.py
thomas-rocke Nov 2, 2023
02e45d2
MAINT: Change bad function import name Bulk -> ase_bulk
thomas-rocke Nov 2, 2023
935fe0a
ENH: Make CubicCrystalDislocation and CubicCrystalDissociatedDislocat…
thomas-rocke Nov 2, 2023
d61ff89
MAINT: Remove random print, minor formatting
thomas-rocke Nov 3, 2023
af39167
DOC: Shift multispecies dislocations docs to new notebook
thomas-rocke Nov 5, 2023
4287a0d
DOC: Add "interactive_view" from cylinder_configurations.ipynb to mat…
thomas-rocke Nov 5, 2023
6bcd021
DOC: Updates to Multispecies Dislocations
thomas-rocke Nov 5, 2023
667a7ff
DOC: alpha- and beta-dislocations in mutispecies systems
thomas-rocke Nov 5, 2023
a8d62aa
Merge remote-tracking branch 'pgrigorev_matscipy/docs_plasticity' int…
thomas-rocke Nov 5, 2023
6c29cc8
DOC: Add live list of available dislocation systems to cylinder_confi…
thomas-rocke Nov 5, 2023
bc531fe
DOC: Shift interactive_view to visualisation.py
thomas-rocke Nov 5, 2023
53a52f9
DOC: Add multispecies disloc dics to plasticity.rst
thomas-rocke Nov 5, 2023
76378ce
DOC: Non-equivalent dislocations in multispecies
thomas-rocke Nov 6, 2023
f01d3ec
DOC: dislocation.py formatting for numpydoc
thomas-rocke Nov 6, 2023
a7651d9
Merge remote-tracking branch 'upstream/master' into DislocRefactor
thomas-rocke Nov 6, 2023
22b2d65
Merge branch 'libAtoms:master' into DislocRefactor
thomas-rocke Nov 6, 2023
903d1a7
Merge remote-tracking branch 'upstream/disable-arm-linux' into Disloc…
thomas-rocke Nov 6, 2023
5245d48
DOC: Inclusion of multispecies dislocations in paper
thomas-rocke Nov 6, 2023
6ce70bf
Merge branch 'DislocRefactor' of https://github.com/thomas-rocke/mats…
thomas-rocke Nov 6, 2023
5f5805a
Delete dd_test.png
thomas-rocke Nov 6, 2023
3cdbdcf
DOC: Minor formatting changes to multispecies dislocs
thomas-rocke Nov 6, 2023
8efdafa
DOC: Adjust multispecies plots atom size
thomas-rocke Nov 6, 2023
16a5e5d
DOC: Change display(Latex()) to Markdown cell
thomas-rocke Nov 6, 2023
c30ae72
DOC: Apply new docs to fresh cylinder_configurations.ipynb
thomas-rocke Nov 7, 2023
5215e99
Merge branch 'libAtoms:master' into DislocDocFixing
thomas-rocke Nov 7, 2023
cb7c3c4
DOC: Remove empty cell at end
thomas-rocke Nov 7, 2023
8b26c05
Merge remote-tracking branch 'upstream/master' into DislocRefactor
thomas-rocke Nov 7, 2023
0f569ed
Merge remote-tracking branch 'origin/DislocDocFixing' into DislocRefa…
thomas-rocke Nov 7, 2023
154ffc1
DOC: Revert cylinder_configurations.ipynb back to matscipy master ver…
thomas-rocke Nov 7, 2023
ef9182f
DOC: Re-apply changes to cylinder_configurations.ipynb
thomas-rocke Nov 7, 2023
c67be2d
DOC: Change multispecies docs to use show_dislocation
thomas-rocke Nov 7, 2023
dc6cf6e
DOC: Add d_name tooltips to multispecies dislocs
thomas-rocke Nov 7, 2023
fcd8f02
DOC: Add nglview import so dislocation plots are drawn
thomas-rocke Nov 7, 2023
bd41566
DOC: Merge pgrigorev changes to visualisation.py
thomas-rocke Nov 7, 2023
10ba582
DOC: Add new show_dislocation features
thomas-rocke Nov 7, 2023
443f9d6
DOC: Disloc line tooltips formatting
thomas-rocke Nov 8, 2023
b0c47af
DOC: Change default zoom level for alpha and beta forms of dislocs
thomas-rocke Nov 8, 2023
0eb21ff
DOC: Change to using GaAs as multispecies example
thomas-rocke Nov 8, 2023
0b6e4ad
MAINT: Remove duplicate import
thomas-rocke Nov 8, 2023
8fb6c83
DOC: Minor docs fixes
thomas-rocke Nov 8, 2023
481bdf8
MAINT: Remove dict from slots in CubicCrystalDislocation
thomas-rocke Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions docs/applications/cylinder_configurations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,58 @@
"from visualisation import show_dislocation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Accessing Key Dislocation Properties\n",
"As defined in a dimensionless (alat=1) frame, each kind of dislocation has several key properties which describe the geometric layout of the atomic cell, and also the position and orientation of the dislocation. Such properties are stored in matscipy as attributes of each dislocation class, such that they can be accessed without actually needing to construct a dislocation.\n",
"\n",
"As an example:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from matscipy.dislocation import BCCMixed111Dislocation\n",
"\n",
"print(\"For a BCC 1/2<111>{110} Mixed Dislocation\")\n",
"print()\n",
"\n",
"print(\"The dislocation is oriented in a cell described by the miller indices: \")\n",
"print(BCCMixed111Dislocation.axes)\n",
"\n",
"print(\"Dimensionless burgers vector is: \", BCCMixed111Dislocation.burgers_dimensionless)\n",
"\n",
"print(\"Dislocation core will be at fractional coords \", BCCMixed111Dislocation.unit_cell_core_position_dimensionless, \" within a unit cell\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Available Dislocation Systems\n",
"The available dislocation systems are:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matscipy.dislocation as disloc_mod\n",
"import inspect\n",
"# Find all classes in matscipy.dislocation which inherit from the Abstact Base Class CubicCrystalDislocation\n",
"for name, attr in disloc_mod.__dict__.items():\n",
" if inspect.isclass(attr):\n",
" if issubclass(attr, disloc_mod.CubicCrystalDislocation) and attr not in [disloc_mod.CubicCrystalDislocation, disloc_mod.CubicCrystalDissociatedDislocation]:\n",
" print(name)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
251 changes: 251 additions & 0 deletions docs/applications/multispecies_dislocations.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Multi-species Dislocation Systems\n",
"The previous section discussed constructing cylindrical dislocation cells, using single-species systems as case studies. The dislocation classes in `matscipy.dislocation` can also be applied to systems which have much more chemical complexity. However, the following restrictions apply:\n",
"1. The desired system can be expressed in a cubic lattice\n",
"2. The desired system shares on-lattice geometry with an existing \"base\" crystal structure\n",
"\n",
"As an example, let's take Zincblende GaAs and compare with a diamond lattice:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from ase.build import bulk\n",
"from ase.lattice.cubic import Diamond\n",
"import numpy as np\n",
"import nglview # this import is necessary for rendering of the 3D view\n",
"from visualisation import show_dislocation, interactive_view\n",
"from ase.visualize import view\n",
"\n",
"# Data from https://doi.org/10.1080/08927022.2011.602975\n",
"alat = 11.306/2\n",
"C11 = 98.47\n",
"C12 = 15.25\n",
"C44 = 57.89\n",
"\n",
"GaAs = bulk(\"GaAs\", crystalstructure=\"zincblende\", cubic=True, a=alat)\n",
"\n",
"diamond = Diamond(\"C\", latticeconstant=alat)\n",
"\n",
"gaas_pos = GaAs.get_scaled_positions()\n",
"dia_pos = diamond.get_scaled_positions()\n",
"\n",
"# Sort the coords, as bulk uses a different atom order\n",
"gaas_idxs = np.lexsort((gaas_pos[:, 0], gaas_pos[:, 1], gaas_pos[:, 2]))\n",
"dia_idxs = np.lexsort((dia_pos[:, 0], dia_pos[:, 1], dia_pos[:, 2]))\n",
"print(\"GaAs Fractional Coordinates\")\n",
"print(gaas_pos[gaas_idxs, :])\n",
"print()\n",
"print(\"Diamond Fractional Coordinates\")\n",
"print(dia_pos[dia_idxs, :])\n",
"\n",
"interactive_view(GaAs, name=\"GaAs Bulk\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can see that the fractional coordinates of the Zincblende GaAs are the same as the Diamond structure we generated. We can therefore say that Zincblende shares geometry with Diamond. The displacement field used to generate dislocation structures is agnostic to atomic chemistry, and so we can model Zincblende dislocations as if they were dislocations in a Diamond crystal with the lattice constant and elastic properties of the Zincblende crystal.\n",
"\n",
"To build a dislocation with this GaAs bulk, we can simply pass it as an argument in place of the lattice constant:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from matscipy.dislocation import DiamondGlide90degreePartial\n",
"\n",
"disloc = DiamondGlide90degreePartial(GaAs, C11, C12, C44)\n",
"\n",
"GaAs_bulk, GaAs_dislocation = disloc.build_cylinder(radius=3 * alat)\n",
"\n",
"show_dislocation(GaAs_dislocation, scale=0.35, d_name=\"GaAs 1/6<112> 90 degree partial\", \n",
" diamond_structure=True, CNA_color=False, add_bonds=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Additional Dislocations in Multispecies Systems\n",
"Dislocations in multispecies systems have additiional complexity over those in single-species crystals, due to the breaking of some symmetries caused by the added chemical complexity. For our Zincblende GaAs example, this means that we can have two different forms of some of our dislocations: $\\alpha$ (As-terminated), and $\\beta$ (Ga-terminated).\n",
"\n",
"$\\alpha$-$90^\\circ$ Partial Dislocation in GaAs:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# alpha-90 degree dislocation\n",
"GaAs = bulk(\"GaAs\", crystalstructure=\"zincblende\", cubic=True, a=alat)\n",
"symbols = np.array(GaAs.get_chemical_symbols())\n",
"# Swap Ga <-> As to get other alpha dislocation\n",
"new_symbols = symbols.copy()\n",
"new_symbols[symbols == \"Ga\"] = \"As\"\n",
"new_symbols[symbols == \"As\"] = \"Ga\"\n",
"GaAs.set_chemical_symbols(new_symbols)\n",
"disloc = DiamondGlide90degreePartial(GaAs, C11, C12, C44)\n",
"\n",
"GaAs_bulk, GaAs_dislocation = disloc.build_cylinder(radius=3 * alat)\n",
"view = show_dislocation(GaAs_dislocation, scale=0.35, d_name=\"GaAs 1/6<112> Alpha-90 degree partial\", \n",
" diamond_structure=True, CNA_color=False, add_bonds=True)\n",
"\n",
"view.control.zoom(0.8)\n",
"view"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$\\beta$-$90^\\circ$ Partial Dislocation in GaAs:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"GaAs = bulk(\"GaAs\", crystalstructure=\"zincblende\", cubic=True, a=alat)\n",
"# beta dislocation is the one done by default, for the bulk built by ase.build.bulk\n",
"disloc = DiamondGlide90degreePartial(GaAs, C11, C12, C44)\n",
"\n",
"GaAs_bulk, GaAs_dislocation = disloc.build_cylinder(radius=3 * alat)\n",
"view = show_dislocation(GaAs_dislocation, scale=0.35, d_name=\"GaAs 1/6<112> Beta-90 degree partial\", \n",
" diamond_structure=True, CNA_color=False, add_bonds=True)\n",
"\n",
"view.control.zoom(0.8)\n",
"view"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Dislocations in Disordered Systems\n",
"Generating dislocation structures for systems which have some chemical disorder is also possible, with some caveats:\n",
"1. The generation routines will only work reliably when given on-lattice bulk structures with cubic cells\n",
"2. The generated structure is based on a periodic replication of the base unit_cell, thus won't have true disorder\n",
"3. The displacement field applied to the bulk structure does not depend on atomic species - known lattice distortions caused by the disorder will not be captured\n",
"4. The current code only allows $C_{11}$, $C_{12}$, and $C_{44}$ to be specified, so more complex elastic effects (e.g. $C_{11} \\neq C_{22}$) cannot currently be captured\n",
"\n",
"With these in mind, a recommended workflow would be to start by generating the dislocation system for an ordered system, but using the elastic constants of the disordered system. From there, the disorder can be applied by simply changing the chemcical symbols of the atoms to match the target composition.\n",
"\n",
"To show a worked example of this, consider the alloy $\\text{In}_{0.5} \\text{Ga}_{0.5} \\text{As}$. This should form in a Zincblende structure, where the Ga sites from the previous GaAs bulk are now 50% occupied by In.\n",
"\n",
"In order to model this, we can generate a dislocation for GaAs, using the lattice constant and elastic properties of $\\text{In}_{0.5} \\text{Ga}_{0.5} \\text{As}$.\n",
"\n",
"NOTE: Whilst disordered systems like this $\\text{In}_{0.5} \\text{Ga}_{0.5} \\text{As}$ example should have off-lattice distortions in the bulk state, it is heavily recommended that the dislocation structures are generated using an on-lattice crystal. This is because the off-lattice structure will interact differently with the continuum displacement field, which could lead to overlapping/extremely close atoms, or generally incorrect core structures. The off-lattice distortions should ideally be found by relaxing the dislocation structure."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from ase.build import bulk\n",
"from matscipy.dislocation import DiamondGlide90degreePartial\n",
"\n",
"# Data from https://doi.org/10.1080/08927022.2011.602975\n",
"alat = 11.2402/2\n",
"C11 = 120.31\n",
"C12 = 55.87\n",
"C44 = 58.26\n",
"\n",
"GaAs = bulk(\"GaAs\", crystalstructure=\"zincblende\", cubic=True, a=alat)\n",
"\n",
"\n",
"disloc = DiamondGlide90degreePartial(GaAs, C11, C12, C44)\n",
"\n",
"GaAs_bulk, GaAs_dislocation = disloc.build_cylinder(radius=3 * alat)\n",
"\n",
"show_dislocation(GaAs_dislocation, scale=0.35, d_name=\"GaAs 1/6<112> Beta-90 degree partial\", \n",
" diamond_structure=True, CNA_color=False, add_bonds=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"From this GaAs structure, we then do Monte Carlo sampling to introduce 50% Indium to the structure:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"np.random.seed(1)\n",
"\n",
"species = np.array(GaAs_dislocation.get_chemical_symbols())\n",
"\n",
"Ga_idxs = np.argwhere(species == \"Ga\")[:, 0]\n",
"\n",
"# Choose random half of the idxs to be In\n",
"In_idxs = sorted(np.random.choice(Ga_idxs, size=int(Ga_idxs.shape[0]/2), replace=False))\n",
"\n",
"# Introduce the chemical disorder in In-Ga sites\n",
"species[In_idxs] = \"In\"\n",
"\n",
"InGaAs_bulk = GaAs_bulk.copy()\n",
"InGaAs_bulk.set_chemical_symbols(species)\n",
"\n",
"InGaAs_dislocation = GaAs_dislocation.copy()\n",
"InGaAs_dislocation.set_chemical_symbols(species)\n",
"\n",
"view = show_dislocation(InGaAs_dislocation, scale=0.35, d_name=\"InGaAs 1/6<112> Beta-90 degree partial\", \n",
" diamond_structure=True, CNA_color=False, add_bonds=True)\n",
"\n",
"# In and Ga have almost the same default colors in nglview\n",
"# so we add another component with the In atoms in red to\n",
"# see the chemical disorder better\n",
"In_ats = InGaAs_dislocation[In_idxs]\n",
"c = view.add_component(nglview.ASEStructure(In_ats),\n",
" default_representation=False)\n",
"c.add_spacefill(radius=1.0, color=\"red\")\n",
"view"
]
}
],
"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",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
3 changes: 2 additions & 1 deletion docs/applications/plasticity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ Tutorials:

.. toctree::

cylinder_configurations.ipynb
cylinder_configurations.ipynb
multispecies_dislocations.ipynb
Loading