Skip to content
Merged
Changes from all commits
Commits
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
48 changes: 24 additions & 24 deletions getting-started/unit-converter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"metadata": {},
"source": [
"## CGS to SI\n",
"`Ubermag` uses SI units for all of the system parameters. Experimentally, material parameters are can often be measured in CGS units SI units, or a mixture of the two. Firstly, we show a convinent way of converting from CGS to SI units and other useful quantities.\n",
"`Ubermag` uses SI units for all of the system parameters. Experimentally, material parameters can often be measured in CGS units, SI units, or a mixture of the two. Firstly, we show a convenient way of converting from CGS to SI units and other useful quantities.\n",
"\n",
"To do this, we make use of `astropy.units`, a package aimed at the astrophysics community for its unit converting functionality. `astropy` is not installed by default. We can install it (e.g. with `pip`) directly from the notebook. Generally, you will not install `astropy` from inside the notebook (using either `pip` or `conda`) but for the sake of demonstration we run the command in here."
]
Expand All @@ -44,11 +44,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: astropy in /home/mlang/miniconda3/envs/ubermagdev310/lib/python3.10/site-packages (5.3.4)\n",
"Requirement already satisfied: numpy<2,>=1.21 in /home/mlang/miniconda3/envs/ubermagdev310/lib/python3.10/site-packages (from astropy) (1.26.0)\n",
"Requirement already satisfied: pyerfa>=2.0 in /home/mlang/miniconda3/envs/ubermagdev310/lib/python3.10/site-packages (from astropy) (2.0.1)\n",
"Requirement already satisfied: PyYAML>=3.13 in /home/mlang/miniconda3/envs/ubermagdev310/lib/python3.10/site-packages (from astropy) (6.0.1)\n",
"Requirement already satisfied: packaging>=19.0 in /home/mlang/miniconda3/envs/ubermagdev310/lib/python3.10/site-packages (from astropy) (23.1)\n"
"Requirement already satisfied: astropy in /home/zulfigak/anaconda3/envs/ubermagdev3/lib/python3.8/site-packages (5.2.2)\n",
"Requirement already satisfied: numpy>=1.20 in /home/zulfigak/anaconda3/envs/ubermagdev3/lib/python3.8/site-packages (from astropy) (1.24.3)\n",
"Requirement already satisfied: pyerfa>=2.0 in /home/zulfigak/anaconda3/envs/ubermagdev3/lib/python3.8/site-packages (from astropy) (2.0.0.3)\n",
"Requirement already satisfied: PyYAML>=3.13 in /home/zulfigak/anaconda3/envs/ubermagdev3/lib/python3.8/site-packages (from astropy) (6.0.1)\n",
"Requirement already satisfied: packaging>=19.0 in /home/zulfigak/anaconda3/envs/ubermagdev3/lib/python3.8/site-packages (from astropy) (23.2)\n"
]
}
],
Expand Down Expand Up @@ -230,7 +230,7 @@
"$0.001 \\; \\mathrm{m^{2}\\,A}$"
],
"text/plain": [
"<Quantity 0.001 m2 A>"
"<Quantity 0.001 A m2>"
]
},
"execution_count": 7,
Expand All @@ -247,7 +247,7 @@
"id": "e6ac0a10",
"metadata": {},
"source": [
"If we wish to detach the numervical value for its units, we can do this using `.value`"
"If we wish to detach the numerical value for its units, we can do this using `.value`"
]
},
{
Expand Down Expand Up @@ -278,7 +278,7 @@
"source": [
"### Equivalencies\n",
"\n",
"The `astropy.units` also enables conversions of units with different equivalencies i.e. temperature and energy. To use this we can create a variable with the relevant units of temperature and use the `to` function to convert to the relevant units with the relevant equivalency.\n",
"`astropy.units` also enables conversions of units with different equivalencies such as temperature and energy. To use this we can create a variable with the relevant units of temperature and use the `to` function to convert to the relevant units with the relevant equivalency.\n",
"\n",
"For example, if an exchange interaction has a temperature of 4.15 K we can calculate the equivalent energy in J."
]
Expand Down Expand Up @@ -313,7 +313,7 @@
"id": "3b9b4a7a",
"metadata": {},
"source": [
"While `astropy` handles a variety of units and conversions, it does not currently have an equivalency for magnetic induction and magnetic field strength i.e. B to H . As this is a very useful for the magnetism community, we have provided the conversion here."
"While `astropy` handles a variety of units and conversions, it does not currently have an equivalency for magnetic induction and magnetic field strength i.e. B to H . As this is very useful for the magnetism community, we have provided the conversion here."
]
},
{
Expand Down Expand Up @@ -380,7 +380,7 @@
"J = \\frac{3k_\\text{B}T_\\text{C}}{\\epsilon z},\n",
"\\end{equation}\n",
"where $k_\\text{B}$ is the Boltzmann constant, $z$ is the number of nearest neighbours, and $\\epsilon$ is\n",
"a structural depended correction factor. The values of this correction factor has been calculated in Table I of [Garanin 1996](https://doi.org/10.1103/PhysRevB.53.11593)."
"a structurally dependent correction factor. The values of this correction factor have been calculated in Table I of [Garanin 1996](https://doi.org/10.1103/PhysRevB.53.11593)."
]
},
{
Expand Down Expand Up @@ -440,7 +440,7 @@
"\\begin{equation}\n",
"A = \\frac{zJl^2}{12V},\n",
"\\end{equation}\n",
"where $J$ is the Heisenberg exchange, $z$ is the number of nearest neighbour atoms, and $l$ is the distance between neighbor atoms and $V$ is the crystal volume per magnetic atom."
"where $J$ is the Heisenberg exchange, $z$ is the number of nearest neighbour atoms, and $l$ is the distance between neighbouring atoms, and $V$ is the crystal volume per magnetic atom."
]
},
{
Expand Down Expand Up @@ -547,7 +547,7 @@
"\\begin{equation}\n",
"D = \\frac{zdl}{12V},\n",
"\\end{equation}\n",
"where $d$ is the atomistic DMI, $z$ is the number of nearest neighbour atoms, and $l$ is the distance between neighbor atoms and $V$ is the crystal volume per magnetic atom."
"where $d$ is the atomistic DMI, $z$ is the number of nearest neighbour atoms, and $l$ is the distance between neighbouring atoms, and $V$ is the crystal volume per magnetic atom."
]
},
{
Expand Down Expand Up @@ -616,7 +616,7 @@
"id": "5709f726",
"metadata": {},
"source": [
"For a system with a micromagentic exchange of $6\\times 10^{-14}$ Jm$^{-1}$ and a helical period of 20 nm"
"For a system with a micromagentic exchange of $6\\times 10^{-14}$ Jm$^{-1}$ and a helical period of 20 nm."
]
},
{
Expand Down Expand Up @@ -651,7 +651,7 @@
"\\begin{equation}\n",
"P = \\frac{4\\pi J l}{|d|},\n",
"\\end{equation}\n",
"where $J$ is the Heisenberg exchange, $d$ is the atomistic DMI, and $l$ is the distance between neighbor atoms."
"where $J$ is the Heisenberg exchange, $d$ is the atomistic DMI, and $l$ is the distance between neighbouring atoms."
]
},
{
Expand All @@ -661,11 +661,11 @@
"source": [
"### Saturation Magnetisation\n",
"#### Micromagnetics\n",
"The saturation magnetisation is often measured in $\\mu_\\text{B}/f.u.$ but is needed in A/m in micromagnetics. A simple converstion can be used\n",
"The saturation magnetisation is often measured in $\\mu_\\text{B}/f.u.$ but is needed in A/m in micromagnetics. A simple conversion can be used\n",
"\\begin{equation}\n",
"M_s [ \\text{A}/ \\text{m}]= \\frac{\\mu_\\text{B} M_s[\\mu_\\text{B}/f.u.]}{V},\n",
"\\end{equation}\n",
"where $M_s[\\mu_\\text{B}/f.u.]$ is the saturation magnetisation in $\\mu_B$ per formula unit, $\\mu_B$ is the Bohr magneton in J/m, and $V$ is the volume of the formula unit in m$^3$."
"where $M_s[\\mu_\\text{B}/f.u.]$ is the saturation magnetisation in $\\mu_B$ per formula unit, $\\mu_B$ is the Bohr magneton in J/T, and $V$ is the volume of the formula unit in m$^3$."
]
},
{
Expand Down Expand Up @@ -704,7 +704,7 @@
"metadata": {},
"source": [
"#### Atomistic\n",
"In atomistic simulations the saturation magnetisation $M_s$ in micromagnetic simulations can be related to the magnetic moment $\\mu$ simply by\n",
"In atomistic simulations, the saturation magnetisation $M_s$ in micromagnetic simulations can be related to the magnetic moment $\\mu$ simply by\n",
"\\begin{equation}\n",
"\\mu = M_s V,\n",
"\\end{equation}\n",
Expand Down Expand Up @@ -752,7 +752,7 @@
"source": [
"### Anisotropy\n",
"#### Micromagnetic\n",
"Anisotropy can can be measured experimentally in a variety of different ways. The results torque magnetometry, for example, can give correct value for the anisotropy in units of Jm$^{-3}$."
"Anisotropy can be measured experimentally in a variety of different ways. The results torque magnetometry, for example, can give correct value for the anisotropy in units of Jm$^{-3}$."
]
},
{
Expand All @@ -761,12 +761,12 @@
"metadata": {},
"source": [
"#### Atomistic\n",
"Similarly to the saturation magnetisation the conversion between micromagnetic $K$ and atomistic anisotropy $k$ is simply volume weighted\n",
"Similarly to the saturation magnetisation, the conversion between micromagnetic $K$ and atomistic anisotropy $k$ is simply volume weighted\n",
"\\begin{equation}\n",
"k = K V,\n",
"\\end{equation}\n",
"where $V$ is the crystal volume per magnetic atom.\n",
"This atomistic anisotropy $k$ can also be calculated from the difference in energy of $J$ in different directions. i.e. $J_{\\perp} = 6\\times 10^{-23}$ J and $J_{\\parallel} = 5 \\times 10^{-23}$ J gives an atomistic anisotropy $k=1\\times 10^{-23}$ J."
"This atomistic anisotropy $k$ can also be calculated from the difference in energy between $J$ in different directions, i.e. $J_{\\perp} = 6\\times 10^{-23}$ J and $J_{\\parallel} = 5 \\times 10^{-23}$ J, gives an atomistic anisotropy $k=1\\times 10^{-23}$ J."
]
},
{
Expand Down Expand Up @@ -816,8 +816,8 @@
"id": "2da69916",
"metadata": {},
"source": [
"Here FeGe will be used as example for how to obtain micromagnetic parameters. FeGe has a cubic crystal structure with four Ge and four Fe atoms per unit cell with a lattice constant of $a=\t\n",
"4.6995$ Å and the distance between Fe atoms is 2.881 Å \\[[Wilhelm 2007](http://doi.org/10.1016/j.stam.2007.04.004)\\]. The saturation magnetisation is $1.07 \\mu_\\text{B}/f.u.$ \\[[Yamada 2003](https://doi.org/10.1016%2FS0921-4526%2802%2902471-7)\\] and magnetic ordering temperature is 278 K \\[[Lebech 1989](https://iopscience.iop.org/article/10.1088/0953-8984/1/35/010/meta)\\]. The helical period of FeGe is $\\sim 70$ nm \\[[Yu 2011](https://doi.org/10.1038/nmat2916)\\]."
"Here, FeGe will be used as example for how to obtain micromagnetic parameters. FeGe has a cubic crystal structure with four Ge and four Fe atoms per unit cell with a lattice constant of $a=\t\n",
"4.6995$ Å, and the distance between Fe atoms is 2.881 Å \\[[Wilhelm 2007](http://doi.org/10.1016/j.stam.2007.04.004)\\]. The saturation magnetisation is $1.07 \\mu_\\text{B}/f.u.$ \\[[Yamada 2003](https://doi.org/10.1016%2FS0921-4526%2802%2902471-7)\\], and magnetic ordering temperature is 278 K \\[[Lebech 1989](https://iopscience.iop.org/article/10.1088/0953-8984/1/35/010/meta)\\]. The helical period of FeGe is $\\sim 70$ nm \\[[Yu 2011](https://doi.org/10.1038/nmat2916)\\]."
]
},
{
Expand Down Expand Up @@ -978,7 +978,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.8.19"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down