{ "cells": [ { "cell_type": "markdown", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "# Energy terms and energy equation\n", "\n", "There are several different energy terms that are implemented in `micromagneticmodel`. Here, we will provide a short list of them, together with some basic properties.\n", "\n", "## Energy terms\n", "\n", "### 1. Exchange energy\n", "\n", "The main parameter required for the exchange energy is the exchange energy constant `A`." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import micromagneticmodel as mm\n", "\n", "exchange = mm.Exchange(A=1e-11)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The values of its arguments are" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1e-11" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "exchange.A" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'exchange'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "exchange.name" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "String and LaTeX representations are" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Exchange(A=1e-11)'" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "repr(exchange)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$- A \\mathbf{m} \\cdot \\nabla^{2} \\mathbf{m}$" ], "text/plain": [ "Exchange(A=1e-11)" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "exchange" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 2. Zeeman energy\n", "\n", "#### Time-independent\n", "\n", "Zeeman energy requires the external magnetic field vector to be provided. Optionally, `name` can be given to the energy term." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "zeeman = mm.Zeeman(H=(0, 0, 1e6))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The values of attributes are" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(0, 0, 1000000.0)" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "zeeman.H" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'zeeman'" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "zeeman.name" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "LaTeX representation is" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Zeeman(H=(0, 0, 1000000.0))'" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "repr(zeeman)" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$-\\mu_{0}M_\\text{s} \\mathbf{m} \\cdot \\mathbf{H}$" ], "text/plain": [ "Zeeman(H=(0, 0, 1000000.0))" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "zeeman" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "ubermagutil.typesystem.descriptors.Subset" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(zeeman.wave)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Time-dependent\n", "\n", "Several different options can be used to specify a time-dependent field:\n", "\n", "- Predefined functions `sin` and `sinc`\n", "- Arbitratry time dependence specified as a function\n", "- Custom `tcl` code for `OOMMF`\n", "\n", "In this notebook, only the predefined functions are shown. For the other options please refer to [this notebook](https://ubermag.github.io/documentation/ipynb/oommfc/timedependent-field-current.html).\n", "\n", "Either sine or sinc wave can be used to multiply `H`. For instance, in order to define a time-dependent external field, which is a sine wave with $1 \\,\\text{GHz}$ frequency and $t_{0} = 2\\,\\text{ps}$ shift." ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "zeeman_sin = mm.Zeeman(H=(0, 0, 1e6), func=\"sin\", f=1e9, t0=2e-12)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "LaTeX representation is:" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"Zeeman(H=(0, 0, 1000000.0), f=1000000000.0, t0=2e-12, func='sin')\"" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "repr(zeeman_sin)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Similarly, we can define a \"sinc\" pulse:" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "zeeman_sinc = mm.Zeeman(H=(0, 0, 1e6), func=\"sinc\", f=1e9, t0=2e-12)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "LaTeX representation is:" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$-\\mu_{0}M_\\text{s} \\mathbf{m} \\cdot \\mathbf{H}$" ], "text/plain": [ "Zeeman(H=(0, 0, 1000000.0), f=1000000000.0, t0=2e-12, func='sinc')" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "zeeman_sinc" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 3. Uniaxial anisotropy\n", "\n", "This energy term requires the anisotropy constant $K_{1}$ and uniaxial anisotropy axis $\\mathbf{u}$ to be passed. As before, `name` is optional as well." ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "uniaxialanisotropy = mm.UniaxialAnisotropy(K=1e5, u=(0, 1, 0))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The attributes are:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "100000.0" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uniaxialanisotropy.K" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(0, 1, 0)" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uniaxialanisotropy.u" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "String and LaTeX representations are" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'UniaxialAnisotropy(K=100000.0, u=(0, 1, 0))'" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "repr(uniaxialanisotropy)" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$-K (\\mathbf{m} \\cdot \\mathbf{u})^{2}$" ], "text/plain": [ "UniaxialAnisotropy(K=100000.0, u=(0, 1, 0))" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uniaxialanisotropy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In order to define higher-order uniaxial anisotropy term, `K1` and `K2` should be passed." ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [], "source": [ "uniaxialanisotropy = mm.UniaxialAnisotropy(K1=1e5, K2=1e3, u=(0, 1, 0))" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$-K_{1} (\\mathbf{m} \\cdot \\mathbf{u})^{2} - K_{2} (\\mathbf{m} \\cdot \\mathbf{u})^{4}$" ], "text/plain": [ "UniaxialAnisotropy(K1=100000.0, K2=1000.0, u=(0, 1, 0))" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "uniaxialanisotropy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4. Demagnetisation energy\n", "\n", "Demagnetisation energy does not require any input parameters. If needed, `name` can be passed." ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "demag = mm.Demag()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The only attribute is" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'demag'" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "demag.name" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "String and LaTeX representations are" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Demag()'" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "repr(demag)" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$-\\frac{1}{2}\\mu_{0}M_\\text{s}\\mathbf{m} \\cdot \\mathbf{H}_\\text{d}$" ], "text/plain": [ "Demag()" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "demag" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 5. Dzyaloshinskii-Moriya energy\n", "\n", "DM energy takes two mandatory input parameters: DM constant $D$ and the crystallographic class `crystalclass`. The allowed crystallographic classes are \n", "1. `Cnv`\n", "2. `T` or `O`\n", "3. `D2d`\n", "\n", "For `Cnv` and `D2d` the normal axis must also be specified. Allowed values for `crystalclass` are:\n", "1. `Cnv_x`, `Cnv_y`, or `Cnv_z`\n", "2. `D2d_x`, `D2d_y`, or `D2d_z`\n", "\n", "As usual, `name` argument is optional." ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "dmi_cnv_x = mm.DMI(D=5e-3, crystalclass=\"Cnv_x\")\n", "dmi_cnv_y = mm.DMI(D=5e-3, crystalclass=\"Cnv_y\")\n", "dmi_cnv_z = mm.DMI(D=5e-3, crystalclass=\"Cnv_z\")\n", "dmi_t = mm.DMI(D=5e-3, crystalclass=\"T\")\n", "dmi_d2d_x = mm.DMI(D=5e-3, crystalclass=\"D2d_x\")\n", "dmi_d2d_y = mm.DMI(D=5e-3, crystalclass=\"D2d_y\")\n", "dmi_d2d_z = mm.DMI(D=5e-3, crystalclass=\"D2d_z\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Attributes are" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dmi_cnv_x.D == dmi_cnv_y.D == dmi_cnv_z.D == dmi_t.D == dmi_d2d_x.D == dmi_d2d_y.D == dmi_d2d_z.D" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Cnv_x'" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dmi_cnv_x.crystalclass" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "LaTeX representations are different for different crystallographic classes." ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$D ( \\mathbf{m} \\cdot \\nabla m_{x} - m_{x} \\nabla \\cdot \\mathbf{m} )$" ], "text/plain": [ "DMI(D=0.005, crystalclass='Cnv_x')" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dmi_cnv_x" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$D ( \\mathbf{m} \\cdot \\nabla m_{y} - m_{y} \\nabla \\cdot \\mathbf{m} )$" ], "text/plain": [ "DMI(D=0.005, crystalclass='Cnv_y')" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dmi_cnv_y" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$D ( \\mathbf{m} \\cdot \\nabla m_{z} - m_{z} \\nabla \\cdot \\mathbf{m} )$" ], "text/plain": [ "DMI(D=0.005, crystalclass='Cnv_z')" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dmi_cnv_z" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$D \\mathbf{m} \\cdot (\\nabla \\times \\mathbf{m})$" ], "text/plain": [ "DMI(D=0.005, crystalclass='T')" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dmi_t" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$D\\mathbf{m} \\cdot \\left( \\frac{\\partial \\mathbf{m}}{\\partial y} \\times \\hat{y} - \\frac{\\partial \\mathbf{m}}{\\partial z} \\times \\hat{z} \\right)$" ], "text/plain": [ "DMI(D=0.005, crystalclass='D2d_x')" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dmi_d2d_x" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$D\\mathbf{m} \\cdot \\left( \\frac{\\partial \\mathbf{m}}{\\partial z} \\times \\hat{z} - \\frac{\\partial \\mathbf{m}}{\\partial x} \\times \\hat{x} \\right)$" ], "text/plain": [ "DMI(D=0.005, crystalclass='D2d_y')" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dmi_d2d_y" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$D\\mathbf{m} \\cdot \\left( \\frac{\\partial \\mathbf{m}}{\\partial x} \\times \\hat{x} - \\frac{\\partial \\mathbf{m}}{\\partial y} \\times \\hat{y} \\right)$" ], "text/plain": [ "DMI(D=0.005, crystalclass='D2d_z')" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dmi_d2d_z" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 6. Cubic anisotropy\n", "\n", "Cubic anisotropy energy term requires the anisotropy constant $K_{1}$ and two mutually perpendicular anisotropy axes $\\mathbf{u}_{1}$ and $\\mathbf{u}_{2}$. Argument `name` is optional." ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [], "source": [ "cubicanisotropy = mm.CubicAnisotropy(K=1e5, u1=(1, 0, 0), u2=(0, 1, 0))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The attributes are:" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "100000.0" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cubicanisotropy.K" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(1, 0, 0)" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cubicanisotropy.u1" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(0, 1, 0)" ] }, "execution_count": 40, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cubicanisotropy.u2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "String and LaTeX representations are:" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'CubicAnisotropy(K=100000.0, u1=(1, 0, 0), u2=(0, 1, 0))'" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "repr(cubicanisotropy)" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$-K [(\\mathbf{m} \\cdot \\mathbf{u}_{1})^{2}(\\mathbf{m} \\cdot \\mathbf{u}_{2})^{2}+(\\mathbf{m} \\cdot \\mathbf{u}_{2})^{2}(\\mathbf{m} \\cdot \\mathbf{u}_{3})^{2}+(\\mathbf{m} \\cdot \\mathbf{u}_{3})^{2}(\\mathbf{m} \\cdot \\mathbf{u}_{1})^{2}]$" ], "text/plain": [ "CubicAnisotropy(K=100000.0, u1=(1, 0, 0), u2=(0, 1, 0))" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cubicanisotropy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 7. RKKY\n", "\n", "RKKY energy term requires the sigma constant $\\sigma$ and optionally $\\sigma_{2}$. In addition, two subregions defined in the mesh must be passed as a list." ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [], "source": [ "rkky = mm.RKKY(sigma=-1e-4, subregions=[\"subregion1\", \"subregion2\"])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The attributes are:" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "-0.0001" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rkky.sigma" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['subregion1', 'subregion2']" ] }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rkky.subregions" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "String and LaTeX representations are:" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"RKKY(sigma=-0.0001, subregions=['subregion1', 'subregion2'])\"" ] }, "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ "repr(rkky)" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\text{RKKY}(\\text{subregion1}, \\text{subregion2})$" ], "text/plain": [ "RKKY(sigma=-0.0001, subregions=['subregion1', 'subregion2'])" ] }, "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rkky" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Energy equation\n", "\n", "The energy equation of the micromagnetic system is the sum of energy terms. For instance, if we sum two energy terms, we get:" ] }, { "cell_type": "code", "execution_count": 48, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "micromagneticmodel.energy.energy.Energy" ] }, "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(exchange + dmi_cnv_z)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If we assign this value to a separate variable, we can explore some of its properties." ] }, { "cell_type": "code", "execution_count": 49, "metadata": {}, "outputs": [], "source": [ "energy = exchange + dmi_cnv_z" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The string representation is:" ] }, { "cell_type": "code", "execution_count": 50, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"Exchange(A=1e-11) + DMI(D=0.005, crystalclass='Cnv_z')\"" ] }, "execution_count": 50, "metadata": {}, "output_type": "execute_result" } ], "source": [ "repr(energy)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Similarly, the LaTeX representation is" ] }, { "cell_type": "code", "execution_count": 51, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$- A \\mathbf{m} \\cdot \\nabla^{2} \\mathbf{m}+ D ( \\mathbf{m} \\cdot \\nabla m_{z} - m_{z} \\nabla \\cdot \\mathbf{m} )$" ], "text/plain": [ "Exchange(A=1e-11) + DMI(D=0.005, crystalclass='Cnv_z')" ] }, "execution_count": 51, "metadata": {}, "output_type": "execute_result" } ], "source": [ "energy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This Hamiltonian consists of two energy term. To add another term to it `+=` operator can be used." ] }, { "cell_type": "code", "execution_count": 52, "metadata": {}, "outputs": [], "source": [ "energy += zeeman" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The Hamiltonian is now" ] }, { "cell_type": "code", "execution_count": 53, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$- A \\mathbf{m} \\cdot \\nabla^{2} \\mathbf{m}+ D ( \\mathbf{m} \\cdot \\nabla m_{z} - m_{z} \\nabla \\cdot \\mathbf{m} )-\\mu_{0}M_\\text{s} \\mathbf{m} \\cdot \\mathbf{H}$" ], "text/plain": [ "Exchange(A=1e-11) + DMI(D=0.005, crystalclass='Cnv_z') + Zeeman(H=(0, 0, 1000000.0))" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "energy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Accesing the individual energy terms from the energy equation\n", "\n", "There are two ways of retrieving an individual energy term from the energy equation. Let us say we want to change the value of the Dzyaloshinkii-Moriya constant $D$.\n", "\n", "If an energy term with name `myenergy` was added to the Hamiltonian, that term can be accessed by typing `energy.myenergy`. In the case of DMI:" ] }, { "cell_type": "code", "execution_count": 54, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$D ( \\mathbf{m} \\cdot \\nabla m_{z} - m_{z} \\nabla \\cdot \\mathbf{m} )$" ], "text/plain": [ "DMI(D=0.005, crystalclass='Cnv_z')" ] }, "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ "energy.dmi" ] }, { "cell_type": "code", "execution_count": 55, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.005" ] }, "execution_count": 55, "metadata": {}, "output_type": "execute_result" } ], "source": [ "energy.dmi.D" ] }, { "cell_type": "code", "execution_count": 56, "metadata": {}, "outputs": [], "source": [ "energy.dmi.D = 5e-3" ] }, { "cell_type": "code", "execution_count": 57, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.005" ] }, "execution_count": 57, "metadata": {}, "output_type": "execute_result" } ], "source": [ "energy.dmi.D" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Similarly, the exchange energy term is" ] }, { "cell_type": "code", "execution_count": 58, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$- A \\mathbf{m} \\cdot \\nabla^{2} \\mathbf{m}$" ], "text/plain": [ "Exchange(A=1e-11)" ] }, "execution_count": 58, "metadata": {}, "output_type": "execute_result" } ], "source": [ "energy.exchange" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "because we used name `'myexchange'` at the time of initialisation." ] }, { "cell_type": "code", "execution_count": 59, "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/plain": [ "'exchange'" ] }, "execution_count": 59, "metadata": {}, "output_type": "execute_result" } ], "source": [ "exchange.name" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 4 }