{ "cells": [ { "cell_type": "markdown", "id": "b9f94041-4e9b-4cb8-b327-8c95223dca01", "metadata": {}, "source": [ "# Material" ] }, { "cell_type": "code", "execution_count": 1, "id": "f724f6ae", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Material\n", " .id: my material\n", " .composition: Fe 2.0 O 3.0\n", " .density (g/cm^3) Var.value = 5.3, .min = 0.0, .max = 23.0, .fit: False, .id: \n", " .isotope: none\n", " .abundance Var.value = 0.0, .min = 0.0, .max = 1.0, .fit: False, .id: \n", " .lamb_moessbauer Var.value = 0.0, .min = 0.0, .max = 1.0, .fit: False, .id: \n", " derived parameters:\n", " .total_number_density (1/m^3) = 9.993720850163132e+28\n", " .average_mole_mass (g/mole) = 31.9374\n", " .isotope_number_density (1/m^3) = 0.0\n", " number of hyperfine sites 0\n", "\n" ] } ], "source": [ "import nexus as nx\n", "\n", "mat_iron_oxide = nx.Material(id = \"my material\",\n", " composition = [[\"Fe\", 2], [\"O\", 3]],\n", " density = 5.3)\n", "\n", "print(mat_iron_oxide)" ] }, { "cell_type": "code", "execution_count": 2, "id": "f707cbd2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[['Ni', 0.7919215353166942], ['Fe', 0.20807846468330582]]\n" ] } ], "source": [ "permalloy_wt_composition = [[\"Ni\", 80], [\"Fe\", 20]]\n", "\n", "permalloy_at_composition = nx.conversions.WtToAt([[\"Ni\", 80], [\"Fe\", 20]])\n", "\n", "print(permalloy_at_composition)" ] }, { "cell_type": "code", "execution_count": 3, "id": "00ac029a-0eff-4a4f-98a5-37628a2394d5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(['Fe', 0.6994307614270416], ['O', 0.3005692385729583])\n" ] } ], "source": [ "Fe2O3_at = (['Fe', 2], ['O', 3]) # or (['Fe', 0.4], ['O', 0.6])\n", "\n", "Fe2O3_wt = nx.conversions.AtToWt(Fe2O3_at)\n", "\n", "print(Fe2O3_wt)" ] }, { "cell_type": "code", "execution_count": 4, "id": "9c0403df-4a7c-4b9e-b076-288ad70f83c3", "metadata": {}, "outputs": [], "source": [ "mat_iron_oxide = nx.Material.Template(nx.lib.material.Fe2O3)" ] }, { "cell_type": "code", "execution_count": 5, "id": "fe50bbc3-76cf-4d75-8aa7-d9ffec0dbe99", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Material\n", " .id: my material\n", " .composition: Fe 2.0 O 3.0\n", " .density (g/cm^3) Var.value = 5.3, .min = 0.0, .max = 23.0, .fit: False, .id: \n", " .isotope: 57-Fe\n", " .abundance Var.value = 0.95, .min = 0.0, .max = 1.0, .fit: False, .id: \n", " .lamb_moessbauer Var.value = 0.793, .min = 0.0, .max = 1.0, .fit: False, .id: \n", " derived parameters:\n", " .total_number_density (1/m^3) = 9.865724904114486e+28\n", " .average_mole_mass (g/mole) = 32.351749454\n", " .isotope_number_density (1/m^3) = 3.748975463563505e+28\n", " number of hyperfine sites 0\n", "\n" ] } ], "source": [ "mat = nx.Material(id = \"my material\",\n", " composition = [[\"Fe\", 2],[\"O\", 3]],\n", " density = 5.3,\n", " isotope = nx.lib.moessbauer.Fe57, # load isotope from library\n", " abundance = 0.95, # \"Fe\" in composition is made out of 95% of 57-Fe,\n", " lamb_moessbauer = 0.793,\n", " #hyperfine_sites = [] # list Hyperfine objects acting on the isotope\n", " )\n", "\n", "print(mat)" ] }, { "cell_type": "code", "execution_count": 6, "id": "de28dd74-88d6-41f6-91d5-1bcc32a79de5", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Material\n", " .id: my material\n", " .composition: Fe 2.0 O 3.0\n", " .density (g/cm^3) Var.value = 5.3, .min = 0.0, .max = 23.0, .fit: False, .id: \n", " .isotope: 57-Fe\n", " .abundance Var.value = 0.95, .min = 0.0, .max = 1.0, .fit: False, .id: \n", " .lamb_moessbauer Var.value = 0.793, .min = 0.0, .max = 1.0, .fit: False, .id: \n", " derived parameters:\n", " .total_number_density (1/m^3) = 9.865724904114486e+28\n", " .average_mole_mass (g/mole) = 32.351749454\n", " .isotope_number_density (1/m^3) = 3.748975463563505e+28\n", " number of hyperfine sites 1\n", "\n" ] } ], "source": [ "# do not pass any values. In this case there is no isomer shift, no magnetic field and no quadrupole splitting.\n", "# it will results in an unsplit line\n", "site = nx.Hyperfine()\n", "\n", "# apply to the material\n", "mat.hyperfine_sites = [site]\n", "\n", "print(mat)" ] } ], "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.12.0" } }, "nbformat": 4, "nbformat_minor": 5 }