Skip to content
Materials Science

materials-science-ai999x

Crystal structures and diffraction, defects and diffusion, mechanical properties, phase diagrams, polymers, ceramics and composites, and electronic and thermal properties.

87capabilities
13topics
87formulas typeset
8worked examples below
1.0.0version
About this model

What Materials Science does

Materials Science (materials-science-ai999x) is an offline Python package for materials science. It covers crystal structures and diffraction, defects and diffusion, mechanical properties, phase diagrams, polymers, ceramics and composites, and electronic and thermal properties.

It has 87 capabilities — 87 computational procedures — in 13 topics, the largest being Crystal structures, Mechanical properties, Diffraction, Polymers, Diffusion and Fracture. Ask a question in words with ask(), or call a capability by name with typed inputs with solve(). Every answer carries its value and unit, the steps that produced it and the formula in LaTeX.

When a question is not determined — a value is missing, an input is out of range, or the request is outside the package — it says so and names what it needs, instead of guessing. It runs on an ordinary CPU without a network connection (Python >=3.10), and the same question always gets the same answer.

Install

pip install materials-science-ai999x
hf download AI999X/materials-science-ai999x --local-dir materials-science-ai999x

What it covers

Ceramics2Coordination number from the cation-anion radius ratio · Lattice parameter and density of an ionic crystalComposites2Critical fibre length · Elastic moduli of a continuous-fibre composite (rule of mixtures)Crystal structures16Angle between two directions in a cubic crystal · Angle between two lattice directions in any crystal · Angle between two lattice planes in any crystal …Defects4Burgers vector of a perfect dislocation · Equilibrium vacancy concentration · Largest atom that fits an interstitial site …Diffraction11Bragg angle of a reflection · Diffraction angle of a cubic (h k l) reflection · First allowed reflections of a cubic crystal …Diffusion6Activation energy and pre-exponential factor of diffusion · Concentration in a semi-infinite solid (Fick's second law) · Depth at which a concentration is reached (Fick's second law) …Electronic properties5Band gap from intrinsic conductivities at several temperatures · Built-in potential of a p-n junction · Electron and hole concentrations of a doped semiconductor …Fracture6Critical crack length from the fracture toughness · Design stress for a target failure probability (Weibull) · Fracture stress from the fracture toughness …Mechanical properties140.2 % offset yield strength from a stress-strain curve · Elastic elongation and diameter change of a rod in tension · Hall-Petch grain-size strengthening …Phase diagrams6Atomic percent to weight percent (binary alloy) · Degrees of freedom by Gibbs' phase rule · Phase fractions by the lever rule …Phase transformations2Avrami (JMAK) transformation kinetics · Critical nucleus radius and activation energy (homogeneous nucleation)Polymers8Average repeat-unit weight and degree of polymerization of a copolymer · Creep strain of a Kelvin-Voigt viscoelastic solid · End-to-end distance of a freely rotating chain …Thermal properties5Electronic thermal conductivity of a metal (Wiedemann-Franz law) · Linear thermal expansion · Molar heat capacity of a solid (Debye model) …
Try it

Worked examples

Each question below was put to materials-science-ai999x and the answer shown is the one it returned, with the steps it took.

Crystal structuresm.ask(…)

Theoretical density: structure = FCC, A = 63.55 g/mol, R = 0.128 nm

rho = 8895.28269 kg/m^3
rho_gcc = 8.89528269
a_nm = 0.362038672
Show the steps
  1. Theoretical density of a metal
    \rho = \frac{n A}{V_{\mathrm{cell}} N_A}
    with structure = FCC, A = 63.55 g/mol, R = 0.128 nm
    → rho = 8895.28269 kg/m^3, rho_gcc = 8.89528269, a_nm = 0.362038672
Diffractionm.ask(…)

Bragg angle: d = 0.2087 nm, lambda = 0.1542 nm

theta_deg = 21.68045609
two_theta_deg = 43.36091219
Show the steps
  1. Bragg angle of a reflection
    n\lambda = 2d\sin\theta
    with d = 0.2087 nm, lam = 0.1542 nm
    → theta_deg = 21.68045609, two_theta_deg = 43.36091219
Diffusionm.ask(…)

Fick's second law: C0 = 0.25 wt%, Cs = 1.2 wt%, x = 0.5 mm, D = 1.6e-11 m^2/s, t = 7 h

Cx = 0.7987846097
z = 0.3937129927
ratio = 0.5776680102
Show the steps
  1. Concentration in a semi-infinite solid (Fick's second law)
    \frac{C_x - C_0}{C_s - C_0} = 1 - \operatorname{erf}\!\left(\frac{x}{2\sqrt{Dt}}\right)
    with C0 = 0.25, Cs = 1.2, x = 0.5 mm, D = 1.6e-11 m^2/s, t = 7 h
    → Cx = 0.7987846097, z = 0.3937129927, ratio = 0.5776680102
Phase diagramsm.ask(…)

Iron-carbon microconstituents: C0 = 0.35 wt%

W_proeutectoid = 0.5555555556
W_pearlite = 0.4444444444
W_ferrite_total = 0.9508834981
W_cementite_total = 0.04911650195
proeutectoid_phase = ferrite
Show the steps
  1. Proeutectoid phase and pearlite in a plain-carbon steel
    W_p = \frac{C_0 - 0.022}{0.76 - 0.022}\ (\text{hypo}),\quad W_p = \frac{6.70 - C_0}{6.70 - 0.76}\ (\text{hyper})
    with C0 = 0.35
    → W_proeutectoid = 0.5555555556, W_pearlite = 0.4444444444, W_ferrite_total = 0.9508834981, W_cementite_total = 0.04911650195, proeutectoid_phase = ferrite
Crystal structuresm.solve(…)
m.solve("planar_density", structure="BCC", h=1, k=1, l=0, a="0.2866 nm")
PD_per_nm2 = 17.21720402
PD = 1.721720402e+19 1/m^2
PPF = 0.8330405509
Show the steps
  1. Planar density of a crystal plane
    \mathrm{PD} = n_V\,d_{\mathrm{planes}},\quad \mathrm{PPF} = \mathrm{PD}\,\pi R^2
    with structure = BCC, h = 1, k = 1, l = 0, a = 0.2866 nm
    → PD_per_nm2 = 17.21720402, PD = 1.721720402e+19 1/m^2, PPF = 0.8330405509
Ceramicsm.ask(…)

Ceramic density: prototype = rocksalt, rc = 0.102 nm, ra = 0.181 nm, Ac = 22.99 g/mol, Aa = 35.45 g/mol

a = 5.66e-10 m
a_nm = 0.566
rho = 2140.769963 kg/m^3
rho_gcc = 2.140769963
Show the steps
  1. Lattice parameter and density of an ionic crystal
    \rho = \frac{n'\left(\sum A_C + \sum A_A\right)}{V_C N_A}
    with prototype = rocksalt, rc = 0.102 nm, ra = 0.181 nm, Ac = 22.99 g/mol, Aa = 35.45 g/mol
    → a = 5.66e-10 m, a_nm = 0.566, rho = 2140.769963 kg/m^3, rho_gcc = 2.140769963
Compositesm.ask(…)

Rule of mixtures: Ef = 69 GPa, Em = 3.4 GPa, Vf = 0.4

E_long_GPa = 29.64
E_trans_GPa = 5.486435921
fiber_load_fraction = 0.9311740891
E_long = 2.964e+10 Pa
E_trans = 5486435921 Pa
Show the steps
  1. Elastic moduli of a continuous-fibre composite (rule of mixtures)
    E_{cl} = E_mV_m + E_fV_f,\quad \frac{1}{E_{ct}} = \frac{V_m}{E_m}+\frac{V_f}{E_f}
    with Ef = 69 GPa, Em = 3.4 GPa, Vf = 0.4
    → E_long_GPa = 29.64, E_trans_GPa = 5.486435921, fiber_load_fraction = 0.9311740891, E_long = 2.964e+10 Pa, E_trans = 5486435921 Pa
Defectsm.ask(…)

Burgers vector: structure = FCC, a = 0.3615 nm

b = 2.556191014e-10 m
b_nm = 0.2556191014
direction = a/2<110>
Show the steps
  1. Burgers vector of a perfect dislocation
    b_{\mathrm{FCC}} = \frac{a}{\sqrt2},\ b_{\mathrm{BCC}} = \frac{a\sqrt3}{2},\ b_{\mathrm{SC}} = a
    with structure = FCC, a = 0.3615 nm
    → b = 2.556191014e-10 m, b_nm = 0.2556191014, direction = a/2<110>
Use it

From Python or the command line

Every snippet was run as shown; the output under it is what it printed.

import materials_science_ai999x as m

a = m.ask("Theoretical density: structure = FCC, A = 63.55 g/mol, R = 0.128 nm")
print(a.outcome)
print(a.values)
for step in a.steps:
    print(step["name"])
Output
SOLVED
{'rho': 8895.2826897, 'rho_gcc': 8.8952826897, 'a_nm': 0.362038671968}
Theoretical density of a metal
Figures

Computed, not drawn by hand

Every value in these figures was computed by the package, each point a run of solve(); in a notebook, plot() and plot_relation() draw a capability's curves the same way.

Diffusion into a solid: concentration profiles over time

\frac{C_x - C_0}{C_s - C_0} = 1 - \operatorname{erf}\!\left(\frac{x}{2\sqrt{Dt}}\right)
Diffusion into a solid: concentration profiles over timeConcentration profiles of a species diffusing into a solid from a surface held at Cs = 1.2 wt% (initial C0 = 0.25 wt%, D = 1.6000e-11 m²/s) after 1, 7 and 24 hours, each computed by the package at 51 depths to 2.5 mm. Marked: x = 0.5 mm, t = 7 h, C = 0.798785 wt%.01200.51initial C0 = 0.250.798785t = 1 ht = 7 ht = 24 hx — depth below the surface [mm]C — concentration [wt%]
Concentration profiles of a species diffusing into a solid from a surface held at Cs = 1.2 wt% (initial C0 = 0.25 wt%, D = 1.6000e-11 m²/s) after 1, 7 and 24 hours, each computed by the package at 51 depths to 2.5 mm. Marked: x = 0.5 mm, t = 7 h, C = 0.798785 wt%.

X-ray diffraction pattern of an FCC crystal

\sin\theta = \frac{\lambda\sqrt{h^2+k^2+l^2}}{2a}
X-ray diffraction pattern of an FCC crystalDiffraction stick pattern of an FCC crystal with a = 3.615 Å under λ = 1.542 Å: every (hkl) up to 4 is placed at the 2θ the package returns and given the structure factor it computes (|F|²/f² = 16 for the 8 allowed reflections, 0 for the 14 absent ones, shown as short grey stems). First line: (111) at 2θ = 43.3583°.5010015005101520111200220311222400331420absent (F = 0)FCC reflection2θ — diffraction angle [°]|F|² / f²
Diffraction stick pattern of an FCC crystal with a = 3.615 Å under λ = 1.542 Å: every (hkl) up to 4 is placed at the 2θ the package returns and given the structure factor it computes (|F|²/f² = 16 for the 8 allowed reflections, 0 for the 14 absent ones, shown as short grey stems). First line: (111) at 2θ = 43.3583°.

Stress–strain curve and the 0.2 % offset yield strength

\sigma(\varepsilon_y) = E(\varepsilon_y - 0.002)
Stress–strain curve and the 0.2 % offset yield strengthAn engineering stress–strain curve (the stated test points) and the line of slope E = 200 GPa offset by 0.2 % strain; the package finds their intersection, the offset yield strength. Marked: ε = 0.466667 %, σy = 533.333 MPa.00.20.40.60.80200400600σy = 533.333 MPameasured curveelastic line offset by 0.2 %ε — engineering strain [%]σ — engineering stress [MPa]
An engineering stress–strain curve (the stated test points) and the line of slope E = 200 GPa offset by 0.2 % strain; the package finds their intersection, the offset yield strength. Marked: ε = 0.466667 %, σy = 533.333 MPa.

Steel microconstituents across the eutectoid (lever rule)

W_p = \frac{C_0 - 0.022}{0.76 - 0.022}\ (\text{hypo}),\quad W_p = \frac{6.70 - C_0}{6.70 - 0.76}\ (\text{hyper})
Steel microconstituents across the eutectoid (lever rule)Microconstituents of slowly cooled plain-carbon steel just below the eutectoid temperature, from the lever rule as computed by the package, as stacked bars at 10 carbon contents: pearlite at the bottom, the proeutectoid constituent on top (ferrite below the eutectoid composition, cementite above it). Marked: C0 = 0.35 wt%, pearlite fraction 0.444444 (proeutectoid ferrite 0.555556).0.511.5200.250.50.7510.444444pearliteproeutectoid ferriteproeutectoid cementiteC0 — carbon content [wt%]mass fraction
Microconstituents of slowly cooled plain-carbon steel just below the eutectoid temperature, from the lever rule as computed by the package, as stacked bars at 10 carbon contents: pearlite at the bottom, the proeutectoid constituent on top (ferrite below the eutectoid composition, cementite above it). Marked: C0 = 0.35 wt%, pearlite fraction 0.444444 (proeutectoid ferrite 0.555556).

Coordination number from the cation-anion radius ratio

\frac{r_c}{r_a}:\ 0.155\ (3),\ 0.225\ (4),\ 0.414\ (6),\ 0.732\ (8)
CN against rc: Coordination number from the cation-anion radius ratioCN (coordination number) against rc (cation radius), with ra = 1.81e-10 m. 31 points computed by materials-science-ai999x; marked: rc = 1.02e-10, CN = 6.1.00e-101.50e-10456786 rc — cation radius [m]CN
CN (coordination number) against rc (cation radius), with ra = 1.81e-10 m. 31 points computed by materials-science-ai999x; marked: rc = 1.02e-10, CN = 6.
Formulas

The mathematics inside

12 of its 87 formulas; every one is in the capability browser below.

Theoretical density of a metal
\rho = \frac{n A}{V_{\mathrm{cell}} N_A}
Bragg angle of a reflection
n\lambda = 2d\sin\theta
Concentration in a semi-infinite solid (Fick's second law)
\frac{C_x - C_0}{C_s - C_0} = 1 - \operatorname{erf}\!\left(\frac{x}{2\sqrt{Dt}}\right)
Proeutectoid phase and pearlite in a plain-carbon steel
W_p = \frac{C_0 - 0.022}{0.76 - 0.022}\ (\text{hypo}),\quad W_p = \frac{6.70 - C_0}{6.70 - 0.76}\ (\text{hyper})
Planar density of a crystal plane
\mathrm{PD} = n_V\,d_{\mathrm{planes}},\quad \mathrm{PPF} = \mathrm{PD}\,\pi R^2
Lattice parameter and density of an ionic crystal
\rho = \frac{n'\left(\sum A_C + \sum A_A\right)}{V_C N_A}
Elastic moduli of a continuous-fibre composite (rule of mixtures)
E_{cl} = E_mV_m + E_fV_f,\quad \frac{1}{E_{ct}} = \frac{V_m}{E_m}+\frac{V_f}{E_f}
Burgers vector of a perfect dislocation
b_{\mathrm{FCC}} = \frac{a}{\sqrt2},\ b_{\mathrm{BCC}} = \frac{a\sqrt3}{2},\ b_{\mathrm{SC}} = a
Coordination number from the cation-anion radius ratio
\frac{r_c}{r_a}:\ 0.155\ (3),\ 0.225\ (4),\ 0.414\ (6),\ 0.732\ (8)
Critical fibre length
l_c = \frac{\sigma_f^* d}{2\tau_c}
Angle between two directions in a cubic crystal
\cos\varphi = \frac{u_1u_2+v_1v_2+w_1w_2}{\sqrt{u_1^2+v_1^2+w_1^2}\sqrt{u_2^2+v_2^2+w_2^2}}
Equilibrium vacancy concentration
N_v = N\exp\!\left(-\frac{Q_v}{kT}\right),\quad N = \frac{N_A\rho}{A}
Capabilities

Every capability, with an example

Search by name, formula, input or topic. Each capability opens to show what it takes, what it returns, when it applies, and a question it answered.

87 capabilities

Ceramics 2

Coordination number from the cation-anion radius ratioradius_ratio_coordination

The expected coordination number and polyhedron of a cation from the ratio of the cation and anion radii (Pauling's radius-ratio rule).

\frac{r_c}{r_a}:\ 0.155\ (3),\ 0.225\ (4),\ 0.414\ (6),\ 0.732\ (8)

Inputs

  • rc cation radius [m]
  • ra anion radius [m]

Returns

  • ratio rc/ra
  • CN coordination number
  • geometry coordination polyhedron

Applies when

  • 0 < rc < ra

Example

m.ask("Radius ratio: rc = 0.102 nm, ra = 0.181 nm")
→ ratio = 0.563536, CN = 6, geometry = octahedral
Lattice parameter and density of an ionic crystalceramic_density

The cubic lattice parameter and theoretical density of a rock-salt, cesium-chloride, zinc-blende or fluorite crystal from its ionic radii and molar masses.

\rho = \frac{n'\left(\sum A_C + \sum A_A\right)}{V_C N_A}

Inputs

  • prototype crystal structure (rocksalt, CsCl, zincblende, fluorite) choice
  • rc cation radius [m]
  • ra anion radius [m]
  • Ac molar mass of the cation element [kg/mol]
  • Aa molar mass of the anion element [kg/mol]

Returns

  • a lattice parameter [m]
  • a_nm lattice parameter in nm
  • rho density [kg/m^3]
  • rho_gcc density in g/cm^3

Applies when

  • radii and molar masses > 0
  • cations and anions touch (the anions need not)

Example

m.ask("Ceramic density: prototype = rocksalt, rc = 0.102 nm, ra = 0.181 nm, Ac = 22.99 g/mol, Aa = 35.45 g/mol")
→ a = 5.66e-10 m, a_nm = 0.566, rho = 2140.77 kg/m^3, rho_gcc = 2.14077

Composites 2

Critical fibre lengthcritical_fiber_length

The critical length l_c = sigma_f d / (2 tau_c) a fibre needs to be loaded to its strength through the fibre-matrix interface.

l_c = \frac{\sigma_f^* d}{2\tau_c}

Inputs

  • sigma_f fibre tensile strength [Pa]
  • d fibre diameter [m]
  • tau_c fibre-matrix bond strength (or matrix shear yield strength) [Pa]

Returns

  • lc critical fibre length [m]
  • lc_mm critical length in mm
  • aspect_ratio l_c/d

Applies when

  • all inputs > 0

Example

m.ask("Critical fiber length: sigma_f = 3.5 GPa, d = 10 um, tau_c = 20 MPa")
→ lc = 0.000875 m, lc_mm = 0.875, aspect_ratio = 87.5
Elastic moduli of a continuous-fibre composite (rule of mixtures)composite_rule_of_mixtures

The longitudinal (isostrain) and transverse (isostress) moduli of an aligned continuous-fibre composite and the fraction of the load carried by the fibres.

E_{cl} = E_mV_m + E_fV_f,\quad \frac{1}{E_{ct}} = \frac{V_m}{E_m}+\frac{V_f}{E_f}

Inputs

  • Ef fibre modulus [Pa]
  • Em matrix modulus [Pa]
  • Vf fibre volume fraction (0 to 1)

Returns

  • E_long_GPa longitudinal modulus in GPa
  • E_trans_GPa transverse modulus in GPa
  • fiber_load_fraction fraction of a longitudinal load carried by the fibres
  • E_long longitudinal modulus [Pa]
  • E_trans transverse modulus [Pa]

Applies when

  • moduli > 0
  • 0 < Vf < 1
  • perfect bonding

Example

m.ask("Rule of mixtures: Ef = 69 GPa, Em = 3.4 GPa, Vf = 0.4")
→ E_long_GPa = 29.64, E_trans_GPa = 5.48644, fiber_load_fraction = 0.931174, E_long = 2.964e+10 Pa, E_trans = 5.48644e+09 Pa

Crystal structures 16

Angle between two directions in a cubic crystalangle_between_directions_cubic

The angle between the directions [u1 v1 w1] and [u2 v2 w2] of a cubic crystal (also the angle between the planes with those indices).

\cos\varphi = \frac{u_1u_2+v_1v_2+w_1w_2}{\sqrt{u_1^2+v_1^2+w_1^2}\sqrt{u_2^2+v_2^2+w_2^2}}

Inputs

  • u1 index u of direction 1 integer
  • v1 index v of direction 1 integer
  • w1 index w of direction 1 integer
  • u2 index u of direction 2 integer
  • v2 index v of direction 2 integer
  • w2 index w of direction 2 integer

Returns

  • angle_deg angle in degrees

Applies when

  • integer indices, neither direction zero

Example

m.ask("Angle between cubic directions: u1 = 1, v1 = 0, w1 = 0, u2 = 1, v2 = 1, w2 = 1")
→ angle_deg = 54.7356
Angle between two lattice directions in any crystalangle_between_directions

The angle between the directions [u1 v1 w1] and [u2 v2 w2] of a crystal with any cell (a, b, c, alpha, beta, gamma).

\cos\varphi = \frac{\mathbf d_1^{\mathsf T}G\,\mathbf d_2}{\sqrt{\mathbf d_1^{\mathsf T}G\,\mathbf d_1}\sqrt{\mathbf d_2^{\mathsf T}G\,\mathbf d_2}}

Inputs

  • a cell edge a [m]
  • b cell edge b [m]
  • c cell edge c [m]
  • alpha cell angle alpha in degrees (between b and c)
  • beta cell angle beta in degrees (between a and c)
  • gamma cell angle gamma in degrees (between a and b)
  • u1 index u of direction 1 integer
  • v1 index v of direction 1 integer
  • w1 index w of direction 1 integer
  • u2 index u of direction 2 integer
  • v2 index v of direction 2 integer
  • w2 index w of direction 2 integer

Returns

  • angle_deg angle in degrees

Applies when

  • a valid cell
  • neither direction zero

Example

m.ask("Angle between lattice directions: a = 0.3 nm, b = 0.3 nm, c = 0.5 nm, alpha = 90, beta = 90, gamma = 120, u1 = 1, v1 = 0, w1 = 0, u2 = 0, v2 = 1, w2 = 0")
→ angle_deg = 120
Angle between two lattice planes in any crystalangle_between_planes

The angle between the normals of the planes (h1 k1 l1) and (h2 k2 l2) of a crystal with any cell.

\cos\varphi = \frac{\mathbf h_1^{\mathsf T}G^{-1}\mathbf h_2}{\sqrt{\mathbf h_1^{\mathsf T}G^{-1}\mathbf h_1}\sqrt{\mathbf h_2^{\mathsf T}G^{-1}\mathbf h_2}}

Inputs

  • a cell edge a [m]
  • b cell edge b [m]
  • c cell edge c [m]
  • alpha cell angle alpha in degrees (between b and c)
  • beta cell angle beta in degrees (between a and c)
  • gamma cell angle gamma in degrees (between a and b)
  • h1 Miller index h of plane 1 integer
  • k1 Miller index k of plane 1 integer
  • l1 Miller index l of plane 1 integer
  • h2 Miller index h of plane 2 integer
  • k2 Miller index k of plane 2 integer
  • l2 Miller index l of plane 2 integer

Returns

  • angle_deg angle between the plane normals in degrees

Applies when

  • a valid cell
  • neither plane (0 0 0)

Example

m.ask("Angle between planes: a = 0.4 nm, b = 0.4 nm, c = 0.4 nm, alpha = 90, beta = 90, gamma = 90, h1 = 1, k1 = 1, l1 = 1, h2 = 1, k2 = 1, l2 = -1")
→ angle_deg = 70.5288
Atomic packing factor and coordination numberatomic_packing_factor

The fraction of a crystal's volume filled by hard-sphere atoms, the coordination number and the atoms per conventional cell of SC, BCC, FCC, HCP or diamond cubic.

\mathrm{APF} = \frac{n\,\tfrac43\pi R^3}{V_{\mathrm{cell}}}

Inputs

  • structure crystal structure (SC, BCC, FCC, HCP, diamond) choice

Returns

  • apf atomic packing factor
  • coordination coordination number
  • atoms_per_cell atoms per conventional cell (HCP: the hexagonal prism)

Applies when

  • hard spheres touching along the close-packed direction; ideal c/a for HCP

Example

m.ask("Atomic packing factor: structure = FCC")
→ apf = 0.74048, coordination = 12, atoms_per_cell = 4
Four-index (Miller-Bravais) to three-index directionmiller_bravais_to_three_index

Convert a Miller-Bravais direction [u v t w] of a hexagonal crystal to the three-index form [U V W].

U = u - t,\ V = v - t,\ W = w

Inputs

  • u index along a1 integer
  • v index along a2 integer
  • t index along a3 (= -(u + v)) integer
  • w index along c integer

Returns

  • U three-index component U
  • V three-index component V
  • W three-index component W
  • indices [U V W]

Applies when

  • integer indices
  • t = -(u + v)

Example

m.ask("Four to three index direction: u = 2, v = -1, t = -1, w = 0")
→ U = 1, V = 0, W = 0, indices = [1 0 0]
Lattice parameter and atomic radius from the densitylattice_parameter_from_density

The lattice parameter a and hard-sphere atomic radius R of a crystal of known structure, density and molar mass.

a = \left(\frac{nA}{\rho N_A}\right)^{1/3}

Inputs

  • structure crystal structure (SC, BCC, FCC, HCP, diamond) choice
  • rho measured density [kg/m^3]
  • A molar mass [kg/mol]

Returns

  • a lattice parameter a [m]
  • a_nm lattice parameter a in nm
  • R_nm atomic radius in nm

Applies when

  • rho > 0
  • A > 0

Example

m.ask("Lattice parameter from density: structure = FCC, rho = 8.96 g/cm^3, A = 63.55 g/mol")
→ a = 3.61165e-10 m, a_nm = 0.361165, R_nm = 0.127691
Lattice parameter from the atomic radiuscubic_lattice_parameter

The cubic lattice parameter a of an SC, BCC, FCC or diamond-cubic crystal of hard-sphere atoms of radius R.

a_{\mathrm{SC}} = 2R,\ a_{\mathrm{BCC}} = \frac{4R}{\sqrt3},\ a_{\mathrm{FCC}} = 2\sqrt2\,R,\ a_{\mathrm{dia}} = \frac{8R}{\sqrt3}

Inputs

  • structure crystal structure (SC, BCC, FCC, diamond) choice
  • R atomic radius [m]

Returns

  • a lattice parameter [m]
  • a_nm lattice parameter in nm
  • nearest_neighbour_nm nearest-neighbour distance 2R in nm

Applies when

  • R > 0

Example

m.ask("Lattice parameter from atomic radius: structure = FCC, R = 0.1278 nm")
→ a = 3.61473e-10 m, a_nm = 0.361473, nearest_neighbour_nm = 0.2556
Linear density along a crystal directionlinear_density

The number of atoms per unit length along the [u v w] direction of an SC, BCC or FCC crystal, and the linear packing fraction.

\mathrm{LD} = \frac{\text{atoms centred on the line}}{\text{length of the line}}

Inputs

  • structure crystal structure (SC, BCC, FCC) choice
  • u direction index u integer
  • v direction index v integer
  • w direction index w integer
  • a lattice parameter [m]

Returns

  • LD_per_nm atoms per nm along [uvw]
  • LD atoms per metre along [uvw] [1/m]
  • repeat_nm repeat distance along [uvw] in nm
  • LPF linear packing fraction (hard spheres)

Applies when

  • a > 0
  • integer indices between -4 and 4, not all zero

Example

m.ask("Linear density: structure = FCC, u = 1, v = 1, w = 0, a = 0.3615 nm")
→ LD_per_nm = 3.91207, LD = 3.91207e+09 1/m, repeat_nm = 0.255619, LPF = 1
Miller indices of a plane from its interceptsmiller_indices_from_intercepts

The Miller indices (h k l) of a plane cutting the axes at x, y, z (in units of the cell edges; inf for a plane parallel to an axis).

(hkl) \propto \left(\tfrac1x, \tfrac1y, \tfrac1z\right)

Inputs

  • x intercept on the a axis (number, fraction or inf) text
  • y intercept on the b axis text
  • z intercept on the c axis text

Returns

  • h Miller index h
  • k Miller index k
  • l Miller index l
  • indices (h k l)

Applies when

  • no intercept 0 (move the origin)
  • at least one finite intercept

Example

m.ask("Miller indices from intercepts: x = 1, y = 1/2, z = inf")
→ h = 1, k = 2, l = 0, indices = (1 2 0)
Planar density of a crystal planeplanar_density

The number of atoms per unit area on the (h k l) plane of an SC, BCC or FCC crystal, and the planar packing fraction.

\mathrm{PD} = n_V\,d_{\mathrm{planes}},\quad \mathrm{PPF} = \mathrm{PD}\,\pi R^2

Inputs

  • structure crystal structure (SC, BCC, FCC) choice
  • h Miller index h integer
  • k Miller index k integer
  • l Miller index l integer
  • a lattice parameter [m]

Returns

  • PD_per_nm2 atoms per nm^2 on the plane
  • PD atoms per m^2 on the plane [1/m^2]
  • PPF planar packing fraction (hard spheres)

Applies when

  • a > 0
  • integer indices between -3 and 3, not all zero

Example

m.ask("Planar density: structure = FCC, h = 1, k = 1, l = 1, a = 0.4 nm")
→ PD_per_nm2 = 14.4338, PD = 1.44338e+19 1/m^2, PPF = 0.9069
Space group of a common crystal structurespace_group

The space-group number, Hermann-Mauguin symbol and crystal system of a common metallic or ionic structure.

\text{e.g. FCC: } Fm\bar{3}m\ (225)

Inputs

  • structure structure (SC, BCC, FCC, HCP, diamond, rocksalt, CsCl, zincblende, fluorite) choice

Returns

  • number space-group number (International Tables)
  • symbol Hermann-Mauguin symbol
  • crystal_system crystal system

Example

m.ask("Space group: structure = BCC")
→ number = 229, symbol = Im-3m, crystal_system = cubic
Theoretical density of a metaltheoretical_density

The density of a crystal from its structure, the atomic radius and the molar mass: rho = n A / (V_cell N_A).

\rho = \frac{n A}{V_{\mathrm{cell}} N_A}

Inputs

  • structure crystal structure (SC, BCC, FCC, HCP, diamond) choice
  • A molar mass (atomic weight) [kg/mol]
  • R atomic radius [m]

Returns

  • rho theoretical density [kg/m^3]
  • rho_gcc density in g/cm^3
  • a_nm lattice parameter a in nm

Applies when

  • A > 0
  • R > 0

Example

m.ask("Theoretical density: structure = FCC, A = 63.55 g/mol, R = 0.128 nm")
→ rho = 8895.28 kg/m^3, rho_gcc = 8.89528, a_nm = 0.362039
Three-index to four-index (Miller-Bravais) directionmiller_bravais_direction

Convert a hexagonal direction [U V W] (axes a1, a2, c) to the Miller-Bravais form [u v t w] (axes a1, a2, a3, c).

u = \tfrac13(2U-V),\ v = \tfrac13(2V-U),\ t = -(u+v),\ w = W

Inputs

  • U index along a1 integer
  • V index along a2 integer
  • W index along c integer

Returns

  • u Miller-Bravais index u
  • v Miller-Bravais index v
  • t Miller-Bravais index t
  • w Miller-Bravais index w
  • indices [u v t w]

Applies when

  • integer indices, not all zero

Example

m.ask("Miller-Bravais direction: U = 1, V = 0, W = 0")
→ u = 2, v = -1, t = -1, w = 0, indices = [2 -1 -1 0]
Volume and density of a hexagonal close-packed cellhcp_cell_density

The volume of the HCP hexagonal prism (6 atoms), the density and the c/a ratio from a, c and the molar mass.

V = \frac{3\sqrt3}{2}a^2c,\quad \rho = \frac{6A}{V N_A}

Inputs

  • a lattice parameter a [m]
  • c lattice parameter c [m]
  • A molar mass [kg/mol]

Returns

  • V volume of the hexagonal prism (6 atoms) [m^3]
  • V_nm3 prism volume in nm^3
  • rho density [kg/m^3]
  • rho_gcc density in g/cm^3
  • c_over_a c/a ratio

Applies when

  • a > 0
  • c > 0
  • A > 0

Example

m.ask("HCP cell: a = 0.3209 nm, c = 0.5211 nm, A = 24.31 g/mol")
→ V = 1.39416e-28 m^3, V_nm3 = 0.139416, rho = 1737.29 kg/m^3, rho_gcc = 1.73729, c_over_a = 1.62387
Volume change of a BCC to FCC transformationpolymorphic_volume_change

The percentage volume change when a metal transforms from BCC to FCC (as iron at 912 C), from the atomic radius in each structure.

\frac{\Delta V}{V} = \frac{a_F^3/4 - a_B^3/2}{a_B^3/2}

Inputs

  • R_bcc atomic radius in the BCC form [m]
  • R_fcc atomic radius in the FCC form [m]

Returns

  • volume_change_percent volume change BCC -> FCC in percent (negative = contraction)
  • V_atom_bcc_nm3 volume per atom in BCC, nm^3
  • V_atom_fcc_nm3 volume per atom in FCC, nm^3

Applies when

  • radii > 0

Example

m.ask("BCC to FCC volume change: R_bcc = 0.1258 nm, R_fcc = 0.1292 nm")
→ volume_change_percent = -0.493257, V_atom_bcc_nm3 = 0.0122606, V_atom_fcc_nm3 = 0.0122001
Volume of a general (triclinic) unit cellunit_cell_volume

The volume of a unit cell from its six lattice parameters a, b, c, alpha, beta, gamma.

V = abc\sqrt{1-\cos^2\alpha-\cos^2\beta-\cos^2\gamma+2\cos\alpha\cos\beta\cos\gamma}

Inputs

  • a cell edge a [m]
  • b cell edge b [m]
  • c cell edge c [m]
  • alpha cell angle alpha in degrees (between b and c)
  • beta cell angle beta in degrees (between a and c)
  • gamma cell angle gamma in degrees (between a and b)

Returns

  • V cell volume [m^3]
  • V_nm3 cell volume in nm^3

Applies when

  • 0 < angles < 180
  • 1 - cos^2(alpha) - cos^2(beta) - cos^2(gamma) + 2 cos(alpha) cos(beta) cos(gamma) > 0

Example

m.ask("Unit cell volume: a = 0.5 nm, b = 0.6 nm, c = 0.7 nm, alpha = 90, beta = 100, gamma = 90")
→ V = 2.0681e-28 m^3, V_nm3 = 0.20681

Defects 4

Burgers vector of a perfect dislocationburgers_vector

The magnitude of the shortest lattice translation (the Burgers vector of a perfect dislocation) in an SC, BCC or FCC metal.

b_{\mathrm{FCC}} = \frac{a}{\sqrt2},\ b_{\mathrm{BCC}} = \frac{a\sqrt3}{2},\ b_{\mathrm{SC}} = a

Inputs

  • structure crystal structure (SC, BCC, FCC) choice
  • a lattice parameter [m]

Returns

  • b Burgers vector magnitude [m]
  • b_nm Burgers vector in nm
  • direction Burgers vector family

Applies when

  • a > 0

Example

m.ask("Burgers vector: structure = FCC, a = 0.3615 nm")
→ b = 2.55619e-10 m, b_nm = 0.255619, direction = a/2<110>
Equilibrium vacancy concentrationvacancy_concentration

The number of atomic sites per volume and the equilibrium number of vacancies N_v = N exp(-Q_v/kT) of a metal.

N_v = N\exp\!\left(-\frac{Q_v}{kT}\right),\quad N = \frac{N_A\rho}{A}

Inputs

  • rho density [kg/m^3]
  • A molar mass [kg/mol]
  • Qv vacancy formation energy (per vacancy, e.g. eV) [J]
  • T temperature [K]

Returns

  • N atomic sites per volume [1/m^3]
  • Nv vacancies per volume [1/m^3]
  • fraction vacancy fraction Nv/N
  • log10_Nv log10 of Nv in m^-3
  • N_per_cm3 atomic sites per cm^3

Applies when

  • all inputs > 0

Example

m.ask("Vacancy concentration: rho = 8.4 g/cm^3, A = 63.5 g/mol, Qv = 0.9 eV, T = 1000 K")
→ N = 7.9663e+28 1/m^3, Nv = 2.31983e+24 1/m^3, fraction = 2.91206e-05, log10_Nv = 24.3655, N_per_cm3 = 7.9663e+22
Largest atom that fits an interstitial siteinterstitial_site_size

The radius of the largest sphere that fits the octahedral or tetrahedral interstitial site of an FCC or BCC lattice of host atoms of radius R.

r = d_{\mathrm{site}\to\mathrm{atom}} - R

Inputs

  • structure crystal structure (FCC, BCC) choice
  • site interstitial site (octahedral, tetrahedral) choice
  • R radius of the host atoms [m]

Returns

  • r radius of the interstitial sphere [m]
  • r_nm interstitial radius in nm
  • ratio r/R

Applies when

  • R > 0

Example

m.ask("Interstitial site size: structure = FCC, site = octahedral, R = 0.129 nm")
→ r = 5.34335e-11 m, r_nm = 0.0534335, ratio = 0.414214
Vacancy formation energy from vacancy fractionsvacancy_formation_energy_fit

The vacancy formation energy Q_v and prefactor from vacancy fractions measured at two or more temperatures (least-squares Arrhenius line).

\ln\frac{N_v}{N} = \ln C - \frac{Q_v}{k}\frac1T

Inputs

  • T temperatures in kelvin vector
  • fraction vacancy fractions N_v/N at those temperatures vector

Returns

  • Qv_eV vacancy formation energy in eV
  • Qv vacancy formation energy [J]
  • prefactor prefactor C of N_v/N = C exp(-Q_v/kT)
  • r_squared r^2 of the fit

Applies when

  • equal lengths, at least two distinct temperatures
  • 0 < fraction < 1
  • fraction rising with T

Example

m.ask("Vacancy formation energy: T = [800, 1000], fraction = [1.2e-6, 3.4e-5]")
→ Qv_eV = 1.15267, Qv = 1.84678e-19 J, prefactor = 21.9114, r_squared = 1

Diffraction 11

Bragg angle of a reflectionbragg_angle

The diffraction angle theta (and 2-theta) of planes of spacing d for X-rays of wavelength lambda: n lambda = 2 d sin(theta).

n\lambda = 2d\sin\theta

Inputs

  • d interplanar spacing [m]
  • lam X-ray wavelength [m]
  • n order of the reflection (default 1) integer optional

Returns

  • theta_deg Bragg angle theta in degrees
  • two_theta_deg diffraction angle 2-theta in degrees

Applies when

  • d, lambda > 0
  • n lambda < 2 d

Example

m.ask("Bragg angle: d = 0.2087 nm, lambda = 0.1542 nm")
→ theta_deg = 21.6805, two_theta_deg = 43.3609
Diffraction angle of a cubic (h k l) reflectioncubic_reflection_angle

The interplanar spacing and the diffraction angle 2-theta of the (h k l) reflection of a cubic crystal of lattice parameter a at wavelength lambda.

\sin\theta = \frac{\lambda\sqrt{h^2+k^2+l^2}}{2a}

Inputs

  • a lattice parameter [m]
  • h Miller index h integer
  • k Miller index k integer
  • l Miller index l integer
  • lam X-ray wavelength [m]

Returns

  • d_nm interplanar spacing in nm
  • theta_deg Bragg angle in degrees
  • two_theta_deg diffraction angle 2-theta in degrees

Applies when

  • a, lambda > 0
  • lambda < 2 d

Example

m.ask("Cubic reflection angle: a = 0.3615 nm, h = 1, k = 1, l = 1, lambda = 0.1542 nm")
→ d_nm = 0.208712, theta_deg = 21.6791, two_theta_deg = 43.3583
First allowed reflections of a cubic crystalallowed_reflections_cubic

The values of h^2 + k^2 + l^2 of the first allowed X-ray reflections of a monatomic SC, BCC, FCC or diamond-cubic crystal, in order of increasing angle.

N = h^2+k^2+l^2,\quad \sin^2\theta = \frac{\lambda^2}{4a^2}N

Inputs

  • structure crystal structure (SC, BCC, FCC, diamond) choice
  • count how many reflections (1 to 15, default 6) integer optional

Returns

  • N_values h^2 + k^2 + l^2 of the allowed reflections, ascending
  • N_last the last of them
  • N_first the first allowed reflection

Applies when

  • 1 <= count <= 15

Example

m.ask("Allowed reflections: structure = FCC, count = 6")
→ N_values = [3, 4, 8, 11, 12, 16], N_last = 16, N_first = 3
Interplanar spacing from a Bragg reflectionbragg_spacing

The interplanar spacing d of planes that reflect X-rays of wavelength lambda at the Bragg angle theta in order n.

d = \frac{n\lambda}{2\sin\theta}

Inputs

  • lam X-ray wavelength [m]
  • theta Bragg angle theta in degrees (half of 2-theta)
  • n order of the reflection (default 1) integer optional

Returns

  • d interplanar spacing [m]
  • d_nm interplanar spacing in nm

Applies when

  • lambda > 0
  • 0 < theta < 90 degrees

Example

m.ask("Bragg spacing: lambda = 0.1542 nm, theta = 30 deg")
→ d = 1.542e-10 m, d_nm = 0.1542
Interplanar spacing in a cubic crystald_spacing_cubic

The spacing of the (h k l) planes of a cubic lattice: d = a / sqrt(h^2 + k^2 + l^2).

d_{hkl} = \frac{a}{\sqrt{h^2+k^2+l^2}}

Inputs

  • a lattice parameter [m]
  • h Miller index h integer
  • k Miller index k integer
  • l Miller index l integer

Returns

  • d interplanar spacing [m]
  • d_nm interplanar spacing in nm

Applies when

  • a > 0
  • integer indices, not all zero

Example

m.ask("Cubic interplanar spacing: a = 0.3615 nm, h = 1, k = 1, l = 1")
→ d = 2.08712e-10 m, d_nm = 0.208712
Interplanar spacing in a general (triclinic) latticed_spacing_triclinic

The spacing of the (h k l) planes of any lattice from its six cell parameters, through the reciprocal metric tensor.

\frac{1}{d_{hkl}^2} = \mathbf{h}^{\mathsf T} G^{-1}\mathbf{h}

Inputs

  • a cell edge a [m]
  • b cell edge b [m]
  • c cell edge c [m]
  • alpha cell angle alpha in degrees (between b and c)
  • beta cell angle beta in degrees (between a and c)
  • gamma cell angle gamma in degrees (between a and b)
  • h Miller index h integer
  • k Miller index k integer
  • l Miller index l integer

Returns

  • d interplanar spacing [m]
  • d_nm interplanar spacing in nm

Applies when

  • a valid cell
  • integer indices, not all zero

Example

m.ask("Triclinic interplanar spacing: a = 0.5 nm, b = 0.5 nm, c = 0.7 nm, alpha = 90, beta = 90, gamma = 120, h = 1, k = 0, l = 0")
→ d = 4.33013e-10 m, d_nm = 0.433013
Interplanar spacing in a hexagonal crystald_spacing_hexagonal

The spacing of the (h k l) planes of a hexagonal lattice: 1/d^2 = 4(h^2 + hk + k^2)/(3a^2) + l^2/c^2.

\frac{1}{d^2} = \frac{4}{3}\frac{h^2+hk+k^2}{a^2}+\frac{l^2}{c^2}

Inputs

  • a lattice parameter a [m]
  • c lattice parameter c [m]
  • h Miller index h integer
  • k Miller index k integer
  • l Miller index l integer
  • i Miller-Bravais index i = -(h + k) (optional, checked) integer optional

Returns

  • d interplanar spacing [m]
  • d_nm interplanar spacing in nm

Applies when

  • a, c > 0
  • integer indices, not all zero
  • i = -(h + k) when given

Example

m.ask("Hexagonal interplanar spacing: a = 0.3209 nm, c = 0.5211 nm, h = 1, k = 0, l = 1")
→ d = 2.45215e-10 m, d_nm = 0.245215
Interplanar spacing in a tetragonal crystald_spacing_tetragonal

The spacing of the (h k l) planes of a tetragonal lattice: 1/d^2 = (h^2 + k^2)/a^2 + l^2/c^2.

\frac{1}{d^2} = \frac{h^2+k^2}{a^2}+\frac{l^2}{c^2}

Inputs

  • a lattice parameter a [m]
  • c lattice parameter c [m]
  • h Miller index h integer
  • k Miller index k integer
  • l Miller index l integer

Returns

  • d interplanar spacing [m]
  • d_nm interplanar spacing in nm

Applies when

  • a, c > 0
  • integer indices, not all zero

Example

m.ask("Tetragonal interplanar spacing: a = 0.3 nm, c = 0.5 nm, h = 1, k = 0, l = 1")
→ d = 2.57248e-10 m, d_nm = 0.257248
Interplanar spacing in an orthorhombic crystald_spacing_orthorhombic

The spacing of the (h k l) planes of an orthorhombic lattice: 1/d^2 = h^2/a^2 + k^2/b^2 + l^2/c^2.

\frac{1}{d^2} = \frac{h^2}{a^2}+\frac{k^2}{b^2}+\frac{l^2}{c^2}

Inputs

  • a lattice parameter a [m]
  • b lattice parameter b [m]
  • c lattice parameter c [m]
  • h Miller index h integer
  • k Miller index k integer
  • l Miller index l integer

Returns

  • d interplanar spacing [m]
  • d_nm interplanar spacing in nm

Applies when

  • a, b, c > 0
  • integer indices, not all zero

Example

m.ask("Orthorhombic interplanar spacing: a = 0.4 nm, b = 0.5 nm, c = 0.6 nm, h = 1, k = 1, l = 0")
→ d = 3.12348e-10 m, d_nm = 0.312348
Structure factor and extinction of a cubic reflectionstructure_factor_cubic

The structure factor |F|/f of the (h k l) reflection of a monatomic SC, BCC, FCC or diamond-cubic crystal, and whether the reflection is allowed.

F_{hkl} = f\sum_j e^{2\pi i(hx_j+ky_j+lz_j)}

Inputs

  • structure crystal structure (SC, BCC, FCC, diamond) choice
  • h Miller index h integer
  • k Miller index k integer
  • l Miller index l integer

Returns

  • F_over_f |F| in units of the atomic scattering factor f
  • F2_over_f2 |F|^2 / f^2 (proportional to intensity)
  • allowed whether the reflection appears

Applies when

  • integer indices, not all zero

Example

m.ask("Structure factor: structure = FCC, h = 2, k = 0, l = 0")
→ F_over_f = 4, F2_over_f2 = 16, allowed = True
X-ray wavelength from a Bragg reflectionbragg_wavelength

The wavelength that reflects from planes of spacing d at the Bragg angle theta in order n.

\lambda = \frac{2d\sin\theta}{n}

Inputs

  • d interplanar spacing [m]
  • theta Bragg angle theta in degrees (half of 2-theta)
  • n order of the reflection (default 1) integer optional

Returns

  • lam wavelength [m]
  • lam_nm wavelength in nm

Applies when

  • d > 0
  • 0 < theta < 90 degrees

Example

m.ask("Bragg wavelength: d = 0.2 nm, theta = 30 deg")
→ lam = 2e-10 m, lam_nm = 0.2

Diffusion 6

Activation energy and pre-exponential factor of diffusiondiffusion_arrhenius_fit

Q_d and D_0 of D = D_0 exp(-Q_d/RT) from diffusion coefficients at two or more temperatures, and D at another temperature.

\ln D = \ln D_0 - \frac{Q_d}{R}\frac{1}{T}

Inputs

  • T temperatures in kelvin vector
  • D diffusion coefficients in m^2/s at those temperatures vector
  • T_target temperature at which D is wanted (optional) [K] optional

Returns

  • Q activation energy [J/mol]
  • Q_kJmol activation energy in kJ/mol
  • D0 pre-exponential factor [m^2/s]
  • log10_D0 log10 of D0 in m^2/s
  • r_squared r^2 of the fit
  • D_target D at T_target [m^2/s]
  • log10_D_target log10 of D at T_target

Applies when

  • equal lengths, at least two distinct temperatures
  • D rising with T

Example

m.ask("Diffusion arrhenius fit: T = [773, 873], D = [5.8e-13, 5.3e-12]")
→ Q = 124136 J/mol, Q_kJmol = 124.136, D0 = 0.000141785 m^2/s, log10_D0 = -3.84837, r_squared = 1
Concentration in a semi-infinite solid (Fick's second law)fick_second_law_concentration

The concentration at depth x after time t in a semi-infinite solid with a constant surface concentration (carburizing, doping): C_x = C_s - (C_s - C_0) erf(x / 2 sqrt(Dt)).

\frac{C_x - C_0}{C_s - C_0} = 1 - \operatorname{erf}\!\left(\frac{x}{2\sqrt{Dt}}\right)

Inputs

  • C0 initial (bulk) concentration (wt%, at% or any one unit)
  • Cs surface concentration (same unit)
  • x depth below the surface [m]
  • D diffusion coefficient [m^2/s]
  • t diffusion time [s]

Returns

  • Cx concentration at depth x (unit of C0, Cs)
  • z erf argument x / (2 sqrt(D t))
  • ratio (Cx - C0)/(Cs - C0)

Applies when

  • x, D, t > 0
  • Cs != C0
  • constant D, surface concentration held constant

Example

m.ask("Fick's second law: C0 = 0.25 wt%, Cs = 1.2 wt%, x = 0.5 mm, D = 1.6e-11 m^2/s, t = 7 h")
→ Cx = 0.798785, z = 0.393713, ratio = 0.577668
Depth at which a concentration is reached (Fick's second law)diffusion_depth_of_concentration

The depth at which the concentration equals C_x after diffusion time t in a semi-infinite solid with constant surface concentration (case depth).

x = 2z\sqrt{Dt}

Inputs

  • C0 initial concentration
  • Cs surface concentration
  • Cx target concentration
  • D diffusion coefficient [m^2/s]
  • t diffusion time [s]

Returns

  • x depth [m]
  • x_mm depth in mm
  • z erf argument

Applies when

  • D, t > 0
  • Cx strictly between C0 and Cs

Example

m.ask("Diffusion depth: C0 = 0.2 wt%, Cs = 1.0 wt%, Cx = 0.6 wt%, D = 2e-11 m^2/s, t = 10 h")
→ x = 0.000809388 m, x_mm = 0.809388, z = 0.476936
Diffusion coefficient at a temperature (Arrhenius)arrhenius_diffusivity

The diffusion coefficient D = D0 exp(-Q_d/RT) at temperature T from the pre-exponential factor and the activation energy.

D = D_0\exp\!\left(-\frac{Q_d}{RT}\right)

Inputs

  • D0 pre-exponential factor [m^2/s]
  • Q activation energy per mole [J/mol]
  • T absolute temperature [K]

Returns

  • D diffusion coefficient [m^2/s]
  • log10_D log10 of D in m^2/s
  • Q_over_RT Q_d/(R T)

Applies when

  • D0, Q, T > 0

Example

m.ask("Arrhenius diffusivity: D0 = 2.3e-5 m^2/s, Q = 148 kJ/mol, T = 773 K")
→ D = 2.29606e-15 m^2/s, log10_D = -14.639, Q_over_RT = 23.0276
Steady-state diffusion flux (Fick's first law)fick_first_law_flux

The steady-state diffusion flux between two positions with known concentrations: J = -D (C2 - C1)/(x2 - x1).

J = -D\frac{dC}{dx} = -D\frac{C_2-C_1}{x_2-x_1}

Inputs

  • D diffusion coefficient [m^2/s]
  • C1 concentration at x1 [kg/m^3]
  • C2 concentration at x2 [kg/m^3]
  • x1 first position [m]
  • x2 second position [m]

Returns

  • J diffusion flux (positive towards increasing x) [kg/(m^2*s)]
  • J_per_hour flux in kg/(m^2 h)

Applies when

  • D > 0
  • x1 != x2

Example

m.ask("Fick's first law: D = 3e-11 m^2/s, C1 = 1.2 kg/m^3, C2 = 0.8 kg/m^3, x1 = 5 mm, x2 = 10 mm")
→ J = 2.4e-09 kg/(m^2*s), J_per_hour = 8.64e-06
Time to reach a concentration at a depth (Fick's second law)diffusion_time_to_concentration

The diffusion time for the concentration at depth x to reach C_x in a semi-infinite solid with constant surface concentration (carburizing time).

t = \frac{x^2}{4Dz^2},\quad \operatorname{erf}z = \frac{C_s-C_x}{C_s-C_0}

Inputs

  • C0 initial concentration
  • Cs surface concentration
  • Cx target concentration at depth x
  • x depth [m]
  • D diffusion coefficient [m^2/s]

Returns

  • t diffusion time [s]
  • t_hours diffusion time in hours
  • z erf argument

Applies when

  • x, D > 0
  • Cx strictly between C0 and Cs

Example

m.ask("Diffusion time: C0 = 0, Cs = 1, Cx = 0.4795001221869535, x = 1 mm, D = 1e-10 m^2/s")
→ t = 10000 s, t_hours = 2.77778, z = 0.5

Electronic properties 5

Band gap from intrinsic conductivities at several temperaturesband_gap_from_conductivity

The band gap of an intrinsic semiconductor from its conductivity at two or more temperatures, with sigma = C exp(-Eg/2kT) (the weak temperature dependence of the prefactor neglected).

\ln\sigma = \ln C - \frac{E_g}{2k}\frac{1}{T}

Inputs

  • T temperatures in kelvin vector
  • sigma conductivities (any one unit) at those temperatures vector

Returns

  • Eg_eV band gap in eV
  • prefactor prefactor C (unit of sigma)
  • r_squared r^2 of the fit

Applies when

  • equal lengths, at least two distinct temperatures
  • sigma rising with T

Example

m.ask("Band gap from conductivity: T = [300, 400], sigma = [2.2, 63]")
→ Eg_eV = 0.693801, prefactor = 1.47943e+06, r_squared = 1
Built-in potential of a p-n junctionpn_junction_built_in_potential

The built-in potential V_bi = (kT/q) ln(n_n p_p/ni^2) of an abrupt p-n junction (majority concentrations from charge neutrality; V_bi ~ (kT/q) ln(Na Nd/ni^2) when Na, Nd >> ni), and with a permittivity the zero-bias depletion width.

V_{bi} = \frac{kT}{q}\ln\frac{N_aN_d}{n_i^2},\quad W = \sqrt{\frac{2\varepsilon V_{bi}}{q}\left(\frac{1}{N_a} + \frac{1}{N_d}\right)}

Inputs

  • Na acceptor concentration on the p side [1/m^3]
  • Nd donor concentration on the n side [1/m^3]
  • ni intrinsic carrier concentration [1/m^3]
  • T temperature [K]
  • eps_r relative permittivity of the semiconductor (optional, for the depletion width) optional

Returns

  • V_bi built-in potential [V]
  • V_bi_approx (kT/q) ln(Na Nd/ni^2) [V]
  • thermal_voltage kT/q [V]
  • W zero-bias depletion width [m]
  • W_um depletion width in um
  • x_n_um depletion width on the n side in um
  • x_p_um depletion width on the p side in um

Applies when

  • Na, Nd, ni, T > 0
  • abrupt junction, complete ionisation, non-degenerate
  • depletion approximation for W

Example

m.ask("Built-in potential: Na = 1e23 m^-3, Nd = 1e22 m^-3, ni = 1e16 m^-3, T = 300 K")
→ V_bi = 0.773844 V, V_bi_approx = 0.773844 V, thermal_voltage = 0.025852 V
Electron and hole concentrations of a doped semiconductorextrinsic_carrier_concentration

The electron and hole concentrations of a semiconductor with donor and acceptor concentrations Nd and Na (complete ionisation), from charge neutrality and n p = ni^2, and the Fermi level relative to the intrinsic level.

n = \frac{N_d - N_a}{2} + \sqrt{\left(\frac{N_d - N_a}{2}\right)^2 + n_i^2},\quad p = \frac{n_i^2}{n}

Inputs

  • Nd donor concentration [1/m^3]
  • Na acceptor concentration [1/m^3]
  • ni intrinsic carrier concentration [1/m^3]
  • T temperature (optional, for the Fermi level) [K] optional

Returns

  • n electron concentration [1/m^3]
  • p hole concentration [1/m^3]
  • log10_n log10 of n in m^-3
  • log10_p log10 of p in m^-3
  • carrier_type n-type, p-type or intrinsic
  • EF_minus_Ei_eV Fermi level above the intrinsic level in eV (when T is given)

Applies when

  • Nd, Na >= 0
  • ni > 0
  • complete ionisation, non-degenerate statistics

Example

m.ask("Extrinsic carrier concentration: Nd = 1e22 m^-3, Na = 2e21 m^-3, ni = 1e16 m^-3")
→ n = 8e+21 1/m^3, p = 1.25e+10 1/m^3, log10_n = 21.9031, log10_p = 10.0969, carrier_type = n-type
Fermi energy of a free-electron metalfermi_energy_free_electron

The conduction-electron density, Fermi energy, Fermi temperature and Fermi velocity of a metal from its density, molar mass and number of valence electrons per atom.

E_F = \frac{\hbar^2}{2m}\left(3\pi^2n\right)^{2/3}

Inputs

  • rho density [kg/m^3]
  • A molar mass [kg/mol]
  • valence valence electrons per atom

Returns

  • n conduction-electron density [1/m^3]
  • log10_n log10 of n in m^-3
  • EF Fermi energy [J]
  • EF_eV Fermi energy in eV
  • TF Fermi temperature [K]
  • vF Fermi velocity [m/s]

Applies when

  • all inputs > 0
  • free-electron model

Example

m.ask("Fermi energy: rho = 8.96 g/cm^3, A = 63.55 g/mol, valence = 1")
→ n = 8.4907e+28 1/m^3, log10_n = 28.9289, EF = 1.12861e-18 J, EF_eV = 7.04421, TF = 81744.7 K, vF = 1.57413e+06 m/s
Intrinsic carrier concentration of a semiconductorintrinsic_carrier_concentration

The effective densities of states Nc and Nv and the intrinsic carrier concentration ni = sqrt(Nc Nv) exp(-Eg/2kT) from the band gap, temperature and effective masses.

n_i = \sqrt{N_cN_v}\,e^{-E_g/2kT},\quad N_c = 2\left(\frac{2\pi m_e^*kT}{h^2}\right)^{3/2}

Inputs

  • Eg band gap [J]
  • T temperature [K]
  • me electron density-of-states effective mass / m0 (default 1) optional
  • mh hole density-of-states effective mass / m0 (default 1) optional

Returns

  • Nc effective density of states, conduction band [1/m^3]
  • Nv effective density of states, valence band [1/m^3]
  • ni intrinsic carrier concentration [1/m^3]
  • log10_ni log10 of ni in m^-3
  • log10_Nc log10 of Nc in m^-3
  • Ei_offset_meV intrinsic Fermi level above midgap in meV

Applies when

  • all inputs > 0
  • non-degenerate (Boltzmann) statistics, parabolic bands

Example

m.ask("Intrinsic carrier concentration: Eg = 1.12 eV, T = 300 K, me = 1.08, mh = 0.81")
→ Nc = 2.81649e+25 1/m^3, Nv = 1.82936e+25 1/m^3, ni = 8.8801e+15 1/m^3, log10_ni = 15.9484, log10_Nc = 25.4497, Ei_offset_meV = -5.57787

Fracture 6

Critical crack length from the fracture toughnesscritical_crack_length

The largest crack a part can carry at stress sigma without fracture: a_c = (K_IC / (Y sigma))^2 / pi.

a_c = \frac{1}{\pi}\left(\frac{K_{Ic}}{Y\sigma}\right)^2

Inputs

  • K_IC plane-strain fracture toughness [Pa*m^0.5]
  • sigma applied stress [Pa]
  • Y geometry factor Y (default 1) optional

Returns

  • a_c critical crack length [m]
  • a_c_mm critical crack length in mm

Applies when

  • all inputs > 0
  • linear-elastic fracture mechanics

Example

m.ask("Critical crack length: K_IC = 55 MPa*m^0.5, sigma = 1000 MPa")
→ a_c = 0.000962887 m, a_c_mm = 0.962887
Design stress for a target failure probability (Weibull)weibull_design_stress

The stress at which a brittle part reaches a given failure probability, from the Weibull modulus and characteristic strength (and V/V0).

\sigma = \sigma_0\left[-\frac{V_0}{V}\ln(1-P_f)\right]^{1/m}

Inputs

  • P_failure allowed probability of failure (0 to 1)
  • sigma0 characteristic strength [Pa]
  • m Weibull modulus
  • V_ratio V/V0 (default 1) optional

Returns

  • sigma design stress [Pa]
  • sigma_MPa design stress in MPa

Applies when

  • 0 < P_failure < 1
  • sigma0, m, V/V0 > 0

Example

m.ask("Weibull design stress: P_failure = 0.001, sigma0 = 400 MPa, m = 10")
→ sigma = 2.00485e+08 Pa, sigma_MPa = 200.485
Fracture stress from the fracture toughnessfracture_critical_stress

The stress at which a crack of length a fails in a material of plane-strain fracture toughness K_IC: sigma_c = K_IC / (Y sqrt(pi a)).

\sigma_c = \frac{K_{Ic}}{Y\sqrt{\pi a}}

Inputs

  • K_IC plane-strain fracture toughness [Pa*m^0.5]
  • a crack length (surface) or half-length (internal) [m]
  • Y geometry factor Y (default 1) optional

Returns

  • sigma_c critical stress [Pa]
  • sigma_c_MPa critical stress in MPa

Applies when

  • all inputs > 0
  • linear-elastic fracture mechanics

Example

m.ask("Fracture stress: K_IC = 26 MPa*m^0.5, a = 2 mm, Y = 1.2")
→ sigma_c = 2.73339e+08 Pa, sigma_c_MPa = 273.339
Griffith critical stress of a brittle solidgriffith_critical_stress

The stress at which a crack of length 2a (internal) or a (surface) propagates in a brittle solid: sigma_c = sqrt(2 E gamma_s / (pi a)).

\sigma_c = \sqrt{\frac{2E\gamma_s}{\pi a}}

Inputs

  • E Young's modulus [Pa]
  • gamma_s specific surface energy [J/m^2]
  • a half-length of an internal crack (or length of a surface crack) [m]

Returns

  • sigma_c critical stress [Pa]
  • sigma_c_MPa critical stress in MPa

Applies when

  • all inputs > 0
  • ideally brittle (no plastic work), plane stress

Example

m.ask("Griffith critical stress: E = 69 GPa, gamma_s = 0.3 J/m^2, a = 0.5 um")
→ sigma_c = 1.62345e+08 Pa, sigma_c_MPa = 162.345
Weibull modulus from a set of measured strengthsweibull_modulus_fit

The Weibull modulus m and characteristic strength sigma_0 from measured fracture strengths, by median-rank regression (Bernard's ranks).

\ln\ln\frac{1}{1-F_i} = m\ln\sigma_i - m\ln\sigma_0

Inputs

  • strengths fracture strengths (any one unit, e.g. MPa) vector

Returns

  • m Weibull modulus
  • sigma0 characteristic strength (unit of the data)
  • r_squared r^2 of the fit

Applies when

  • at least three strengths, not all equal, all > 0

Example

m.ask("Weibull modulus: strengths = [310, 342, 365, 380, 395, 410, 432]")
→ m = 9.55748, sigma0 = 394.709, r_squared = 0.999566
Weibull probability of failure of a brittle partweibull_failure_probability

The probability that a brittle (ceramic) part fails at stress sigma, from the Weibull modulus m and characteristic strength sigma_0, with an optional volume ratio V/V0.

P_f = 1 - \exp\!\left[-\frac{V}{V_0}\left(\frac{\sigma}{\sigma_0}\right)^m\right]

Inputs

  • sigma applied stress [Pa]
  • sigma0 characteristic strength (63.2 % failure at V0) [Pa]
  • m Weibull modulus
  • V_ratio stressed volume over the reference volume V/V0 (default 1) optional

Returns

  • P_failure probability of failure
  • P_survival probability of survival

Applies when

  • all inputs > 0

Example

m.ask("Weibull failure probability: sigma = 300 MPa, sigma0 = 400 MPa, m = 10")
→ P_failure = 0.0547573, P_survival = 0.945243

Mechanical properties 14

0.2 % offset yield strength from a stress-strain curveoffset_yield_strength

The yield strength where the stress-strain curve (piecewise linear through the data) meets a line of slope E offset by 0.2 % strain (or another offset).

\sigma(\varepsilon_y) = E(\varepsilon_y - 0.002)

Inputs

  • strain engineering strains, increasing vector
  • stress engineering stresses in MPa vector
  • E Young's modulus [Pa]
  • offset strain offset (default 0.002) optional

Returns

  • yield_MPa offset yield strength in MPa
  • yield_strain strain at the intersection

Applies when

  • strains strictly increasing
  • the curve starts above the offset line and crosses it

Example

m.ask("Offset yield strength: strain = [0, 0.002, 0.004, 0.006, 0.008], stress = [0, 400, 520, 560, 580], E = 200 GPa")
→ yield_MPa = 533.333, yield_strain = 0.00466667
Elastic elongation and diameter change of a rod in tensionelastic_deformation_of_a_rod

Stress, axial strain, elongation, lateral strain and diameter change of a cylindrical rod under an axial force (Hooke's law and Poisson's ratio).

\varepsilon_z = \frac{F}{A_0E},\quad \varepsilon_x = -\nu\varepsilon_z

Inputs

  • F axial force (tension positive) [N]
  • d0 original diameter [m]
  • l0 original length [m]
  • E Young's modulus [Pa]
  • nu Poisson's ratio

Returns

  • stress_MPa axial stress in MPa
  • axial_strain axial strain
  • elongation_mm elongation in mm
  • lateral_strain lateral strain
  • diameter_change_um change of diameter in micrometres (negative = contraction)

Applies when

  • F, d0, l0, E > 0
  • -1 < nu < 0.5
  • elastic, isotropic

Example

m.ask("Elastic deformation: F = 15 kN, d0 = 10 mm, l0 = 300 mm, E = 110 GPa, nu = 0.34")
→ stress_MPa = 190.986, axial_strain = 0.00173624, elongation_mm = 0.520871, lateral_strain = -0.00059032, diameter_change_um = -5.9032
Hall-Petch grain-size strengtheninghall_petch

sigma_0 and k of sigma_y = sigma_0 + k d^(-1/2) from yield strengths at two or more grain sizes, and the yield strength at another grain size.

\sigma_y = \sigma_0 + k_y d^{-1/2}

Inputs

  • d_um grain diameters in micrometres vector
  • yield_MPa yield strengths in MPa vector
  • d_target_um grain diameter in micrometres at which the yield strength is wanted (optional) optional

Returns

  • sigma0_MPa friction stress sigma_0 in MPa
  • k_MPa_sqrt_um k in MPa um^0.5
  • k_MPa_sqrt_m k in MPa m^0.5
  • r_squared r^2 of the fit
  • yield_target_MPa yield strength at the target grain size in MPa

Applies when

  • equal lengths, at least two distinct grain sizes

Example

m.ask("Hall-Petch: d_um = [100, 4], yield_MPa = [150, 350], d_target_um = 25")
→ sigma0_MPa = 100, k_MPa_sqrt_um = 500, k_MPa_sqrt_m = 0.5, r_squared = 1, yield_target_MPa = 200
Larson-Miller parameter (creep rupture)larson_miller_parameter

The Larson-Miller parameter LMP = T (C + log10 t_r) from a rupture time at a temperature, and the rupture time at another temperature for the same parameter (same stress).

\mathrm{LMP} = T\left(C + \log_{10} t_r\right)

Inputs

  • T absolute temperature [K]
  • t_r rupture time (hours, h ...) [s]
  • C Larson-Miller constant (default 20, with t_r in hours) optional
  • T2 another temperature at the same stress (optional) [K] optional

Returns

  • LMP Larson-Miller parameter (K, t in hours)
  • LMP_thousands LMP / 1000
  • log10_t_hours log10 of the rupture time in hours
  • t_r2_hours rupture time at T2 in hours
  • log10_t2_hours log10 of the rupture time at T2

Applies when

  • T, t_r > 0
  • 5 <= C <= 50
  • time in hours inside the logarithm

Example

m.ask("Larson-Miller parameter: T = 1073 K, t_r = 1000 h")
→ LMP = 24679, LMP_thousands = 24.679, log10_t_hours = 3
Modulus of resiliencemodulus_of_resilience

The elastic strain energy per unit volume stored up to yielding: U_r = sigma_y^2/(2E).

U_r = \frac{\sigma_y^2}{2E}

Inputs

  • sy yield strength [Pa]
  • E Young's modulus [Pa]

Returns

  • Ur modulus of resilience [J/m^3]
  • Ur_MJ_m3 modulus of resilience in MJ/m^3 (= MPa)
  • yield_strain strain at yield

Applies when

  • sy, E > 0
  • linear elastic up to yield

Example

m.ask("Modulus of resilience: sy = 415 MPa, E = 207 GPa")
→ Ur = 416002 J/m^3, Ur_MJ_m3 = 0.416002, yield_strain = 0.00200483
Most favourable slip system of an FCC or BCC crystalmax_schmid_factor

The largest Schmid factor over the 12 {111}<110> (FCC) or {110}<111> (BCC) slip systems for a tensile load direction, how many systems share it, and the yield stress from the CRSS.

m = \max_{\text{systems}}|\cos\phi\cos\lambda|

Inputs

  • structure crystal structure (FCC, BCC) choice
  • load loading direction [u v w] vector
  • tau_crss critical resolved shear stress (optional) [Pa] optional

Returns

  • max_schmid_factor largest Schmid factor
  • active_systems number of systems with that factor
  • systems slip systems considered
  • yield_MPa tensile yield stress in MPa

Applies when

  • nonzero loading direction

Example

m.ask("Maximum Schmid factor: structure = FCC, load = [0, 0, 1]")
→ max_schmid_factor = 0.408248, active_systems = 8, systems = 12
Resolved shear stress and Schmid factor of a slip systemschmid_factor

The Schmid factor cos(phi) cos(lambda) of a slip system (plane normal and slip direction) for a tensile load along a direction of a cubic crystal, the resolved shear stress and the stress to start slip.

\tau_R = \sigma\cos\phi\cos\lambda,\quad \sigma_y = \frac{\tau_{\mathrm{crss}}}{\cos\phi\cos\lambda}

Inputs

  • load loading direction [u v w] vector
  • plane slip-plane normal (h k l) vector
  • direction slip direction [u v w] vector
  • sigma applied tensile stress (optional) [Pa] optional
  • tau_crss critical resolved shear stress (optional) [Pa] optional

Returns

  • schmid_factor |cos(phi) cos(lambda)|
  • phi_deg angle between load and plane normal
  • lambda_deg angle between load and slip direction
  • tau_R_MPa resolved shear stress in MPa
  • yield_MPa tensile stress at which slip starts, in MPa

Applies when

  • cubic crystal (indices as Cartesian directions)
  • slip direction in the slip plane

Example

m.ask("Schmid factor: load = [0, 1, 0], plane = [1, 1, 0], direction = [-1, 1, 1], sigma = 52 MPa")
→ schmid_factor = 0.408248, phi_deg = 45, lambda_deg = 54.7356, tau_R_MPa = 21.2289
Shear modulus, bulk modulus and Lame constant from E and Poisson's ratioisotropic_elastic_constants

The shear modulus G, bulk modulus K and Lame constant lambda of an isotropic material from Young's modulus E and Poisson's ratio nu.

G = \frac{E}{2(1+\nu)},\quad K = \frac{E}{3(1-2\nu)}

Inputs

  • E Young's modulus [Pa]
  • nu Poisson's ratio

Returns

  • G shear modulus [Pa]
  • G_GPa shear modulus in GPa
  • K bulk modulus [Pa]
  • K_GPa bulk modulus in GPa
  • lame_GPa Lame's first constant in GPa

Applies when

  • E > 0
  • -1 < nu < 0.5

Example

m.ask("Elastic constants: E = 200 GPa, nu = 0.3")
→ G = 7.69231e+10 Pa, G_GPa = 76.9231, K = 1.66667e+11 Pa, K_GPa = 166.667, lame_GPa = 115.385
Strain-hardening exponent and strength coefficient (Hollomon)strain_hardening_exponent

The strain-hardening exponent n and strength coefficient K of sigma_T = K epsilon_T^n from true stress-strain points of the plastic region, and the stress at another strain.

\ln\sigma_T = \ln K + n\ln\varepsilon_T

Inputs

  • true_strain true plastic strains vector
  • true_stress true stresses in MPa vector
  • strain_target true strain at which the stress is wanted (optional) optional

Returns

  • n strain-hardening exponent
  • K_MPa strength coefficient in MPa
  • r_squared r^2 of the log-log fit
  • stress_target_MPa true stress at the target strain in MPa

Applies when

  • equal lengths, at least two distinct strains, all values > 0

Example

m.ask("Strain hardening exponent: true_strain = [0.1, 0.2], true_stress = [415, 470]")
→ n = 0.179549, K_MPa = 627.477, r_squared = 1
Stress exponent and activation energy of steady-state creepcreep_parameters_fit

n and Q_c of the power-law creep model rate = A sigma^n exp(-Q_c/RT) from steady-state creep rates at several stresses and temperatures (least squares).

\dot\varepsilon_s = A\sigma^n e^{-Q_c/RT}

Inputs

  • stress_MPa stresses in MPa vector
  • T temperatures in kelvin vector
  • rate steady-state creep rates in 1/s vector

Returns

  • n stress exponent
  • Q_kJmol creep activation energy in kJ/mol

Applies when

  • equal lengths (at least 3)
  • stress and temperature both vary independently
  • all values > 0

Example

m.ask("Creep parameters: stress_MPa = [100, 200, 100], T = [900, 900, 1000], rate = [1e-7, 1.6e-6, 2.5e-6]")
→ n = 4, Q_kJmol = 240.869
Thermal stress in a constrained bodythermal_stress

The stress from a temperature change in a body held in one direction (rod between walls), two (thin film or plate) or three (fully constrained).

\sigma = -E\alpha\Delta T,\quad -\frac{E\alpha\Delta T}{1-\nu},\quad -\frac{E\alpha\Delta T}{1-2\nu}

Inputs

  • E Young's modulus [Pa]
  • alpha linear thermal expansion coefficient [1/K]
  • dT temperature change (positive = heating) [K]
  • constraint constraint (uniaxial, biaxial, triaxial; default uniaxial) choice optional
  • nu Poisson's ratio (needed for biaxial and triaxial) optional

Returns

  • stress thermal stress (negative = compression) [Pa]
  • stress_MPa thermal stress in MPa

Applies when

  • E, alpha > 0
  • -1 < nu < 0.5 when needed

Example

m.ask("Thermal stress: E = 97 GPa, alpha = 20e-6 1/K, dT = 60 K")
→ stress = -1.164e+08 Pa, stress_MPa = -116.4
Toughness (area under the stress-strain curve)tensile_toughness

The energy absorbed per unit volume up to fracture (trapezoidal area under the stress-strain data), the tensile strength and the fracture strain.

U_T = \int_0^{\varepsilon_f}\sigma\,d\varepsilon

Inputs

  • strain engineering strains, non-decreasing vector
  • stress engineering stresses in MPa vector

Returns

  • toughness_MJ_m3 toughness in MJ/m^3
  • toughness toughness [J/m^3]
  • uts_MPa tensile strength (largest stress) in MPa
  • fracture_strain strain at the last point

Applies when

  • equal lengths
  • strains non-decreasing
  • stress in MPa

Example

m.ask("Tensile toughness: strain = [0, 0.002, 0.05, 0.1, 0.15], stress = [0, 400, 500, 520, 480]")
→ toughness_MJ_m3 = 72.5, toughness = 7.25e+07 J/m^3, uts_MPa = 520, fracture_strain = 0.15
True stress and true strain from engineering valuestrue_stress_and_strain

True stress and true strain from the engineering stress and strain of a tensile test before necking (volume conserved).

\sigma_T = \sigma(1+\varepsilon),\quad \varepsilon_T = \ln(1+\varepsilon)

Inputs

  • stress engineering stress [Pa]
  • strain engineering strain (dimensionless)

Returns

  • true_stress true stress [Pa]
  • true_stress_MPa true stress in MPa
  • true_strain true strain

Applies when

  • strain > -1
  • uniform deformation (before necking)

Example

m.ask("True stress and strain: stress = 400 MPa, strain = 0.2")
→ true_stress = 4.8e+08 Pa, true_stress_MPa = 480, true_strain = 0.182322
Young's modulus from elastic stress-strain datayoungs_modulus_from_data

Young's modulus as the slope of the least-squares line through stress-strain points of the elastic region.

E = \frac{\sum(\varepsilon_i-\bar\varepsilon)(\sigma_i-\bar\sigma)}{\sum(\varepsilon_i-\bar\varepsilon)^2}

Inputs

  • strain engineering strains (dimensionless) vector
  • stress engineering stresses in MPa vector

Returns

  • E_GPa Young's modulus in GPa
  • E Young's modulus [Pa]
  • intercept_MPa intercept of the line in MPa
  • r_squared r^2 of the fit

Applies when

  • equal lengths, at least two distinct strains
  • stress in MPa

Example

m.ask("Young's modulus from data: strain = [0, 0.001, 0.002], stress = [0, 200, 400]")
→ E_GPa = 200, E = 2e+11 Pa, intercept_MPa = 0, r_squared = 1

Phase diagrams 6

Atomic percent to weight percent (binary alloy)atomic_to_weight_percent

Convert the composition of a binary alloy from atomic percent to weight percent.

C_1 = \frac{C_1'A_1}{C_1'A_1 + C_2'A_2}\times100

Inputs

  • element1 symbol of element 1 text
  • element2 symbol of element 2 text
  • at1 atomic percent of element 1

Returns

  • wt1 weight percent of element 1
  • wt2 weight percent of element 2

Applies when

  • known elements, different
  • 0 <= at1 <= 100

Example

m.ask("Atomic percent to weight percent: element1 = Al, element2 = Cu, at1 = 90")
→ wt1 = 79.2591, wt2 = 20.7409
Degrees of freedom by Gibbs' phase rulegibbs_phase_rule

The number of degrees of freedom F = C - P + 2 (or + 1 at fixed pressure) of a system of C components and P phases in equilibrium.

F = C - P + 2

Inputs

  • C number of components integer
  • P number of phases integer
  • pressure pressure variable or held constant (default variable) choice optional

Returns

  • F degrees of freedom

Applies when

  • F >= 0

Example

m.ask("Gibbs phase rule: C = 2, P = 3, pressure = constant")
→ F = 0
Phase fractions by the lever rulelever_rule

The mass fractions (and masses) of the two phases of an alloy of overall composition C0 in a two-phase region whose tie line ends at C1 and C2.

W_1 = \frac{C_2-C_0}{C_2-C_1},\quad W_2 = \frac{C_0-C_1}{C_2-C_1}

Inputs

  • C0 overall composition (wt%)
  • C1 composition of phase 1 (wt%)
  • C2 composition of phase 2 (wt%)
  • mass total mass of the alloy (optional) [kg] optional

Returns

  • W1 mass fraction of phase 1
  • W2 mass fraction of phase 2
  • m1 mass of phase 1 [kg]
  • m2 mass of phase 2 [kg]

Applies when

  • C1 != C2
  • C0 between C1 and C2

Example

m.ask("Lever rule: C0 = 35 wt%, C1 = 31.5 wt%, C2 = 42.5 wt%")
→ W1 = 0.681818, W2 = 0.318182
Primary and eutectic microconstituent fractionseutectic_microconstituents

The fractions of primary phase and eutectic microconstituent, and of total alpha and beta, in a binary eutectic alloy cooled just below the eutectic temperature.

W_{\alpha'} = \frac{C_E-C_0}{C_E-C_\alpha},\quad W_e = \frac{C_0-C_\alpha}{C_E-C_\alpha}

Inputs

  • C0 alloy composition (wt%)
  • C_alpha composition of alpha at the eutectic temperature
  • C_E eutectic composition
  • C_beta composition of beta at the eutectic temperature

Returns

  • W_primary fraction of primary (proeutectic) phase
  • W_eutectic fraction of eutectic microconstituent
  • W_alpha_total total fraction of alpha
  • W_beta_total total fraction of beta
  • primary_phase the primary phase (alpha for hypoeutectic, beta for hypereutectic)

Applies when

  • C_alpha < C_E < C_beta
  • C_alpha < C0 < C_beta

Example

m.ask("Eutectic microconstituents: C0 = 25 wt%, C_alpha = 18.3 wt%, C_E = 61.9 wt%, C_beta = 97.8 wt%")
→ W_primary = 0.84633, W_eutectic = 0.15367, W_alpha_total = 0.915723, W_beta_total = 0.0842767, primary_phase = alpha
Proeutectoid phase and pearlite in a plain-carbon steeliron_carbon_microconstituents

The fractions of proeutectoid ferrite or cementite and of pearlite, and of total ferrite and cementite, in a steel cooled slowly just below the eutectoid temperature.

W_p = \frac{C_0 - 0.022}{0.76 - 0.022}\ (\text{hypo}),\quad W_p = \frac{6.70 - C_0}{6.70 - 0.76}\ (\text{hyper})

Inputs

  • C0 carbon content in wt% (0.022 to 2.14)

Returns

  • W_proeutectoid fraction of proeutectoid ferrite or cementite
  • W_pearlite fraction of pearlite
  • W_ferrite_total total fraction of ferrite
  • W_cementite_total total fraction of cementite
  • proeutectoid_phase ferrite (hypoeutectoid) or cementite (hypereutectoid)

Applies when

  • 0.022 < C0 < 2.14 wt% C

Example

m.ask("Iron-carbon microconstituents: C0 = 0.35 wt%")
→ W_proeutectoid = 0.555556, W_pearlite = 0.444444, W_ferrite_total = 0.950883, W_cementite_total = 0.0491165, proeutectoid_phase = ferrite
Weight percent to atomic percent (binary alloy)weight_to_atomic_percent

Convert the composition of a binary alloy from weight percent to atomic percent.

C_1' = \frac{C_1A_2}{C_1A_2 + C_2A_1}\times100

Inputs

  • element1 symbol of element 1 text
  • element2 symbol of element 2 text
  • wt1 weight percent of element 1

Returns

  • at1 atomic percent of element 1
  • at2 atomic percent of element 2

Applies when

  • known elements, different
  • 0 <= wt1 <= 100

Example

m.ask("Weight percent to atomic percent: element1 = Cu, element2 = Ni, wt1 = 60")
→ at1 = 58.0793, at2 = 41.9207

Phase transformations 2

Avrami (JMAK) transformation kineticsavrami_kinetics

The Avrami exponent n and rate constant k of y = 1 - exp(-k t^n) from transformed fractions at two or more times, the half-transformation time and the time for a target fraction.

y = 1 - e^{-kt^n},\quad \ln\ln\frac{1}{1-y} = \ln k + n\ln t

Inputs

  • t times (any one unit, e.g. s) vector
  • y transformed fractions (0 to 1) vector
  • y_target fraction whose time is wanted (optional) optional

Returns

  • n Avrami exponent
  • k rate constant (time unit^-n)
  • log10_k log10 of k
  • t_half time to 50 % transformation (time unit of t)
  • r_squared r^2 of the fit
  • t_target time to the target fraction

Applies when

  • equal lengths, at least two distinct times
  • 0 < y < 1, rising with t

Example

m.ask("Avrami kinetics: t = [50, 100], y = [0.2, 0.8]")
→ n = 2.85051, k = 3.20367e-06, log10_k = -5.49435, t_half = 74.4141, r_squared = 1
Critical nucleus radius and activation energy (homogeneous nucleation)homogeneous_nucleation

The critical radius r* and the energy barrier dG* for homogeneous nucleation of a solid from its undercooled melt.

r^* = -\frac{2\gamma}{\Delta G_v},\quad \Delta G^* = \frac{16\pi\gamma^3}{3\Delta G_v^2},\quad \Delta G_v = -\frac{\Delta H_f\,\Delta T}{T_m}

Inputs

  • gamma solid-liquid interfacial energy [J/m^2]
  • dHf latent heat of fusion per volume [J/m^3]
  • Tm melting temperature [K]
  • T temperature of the undercooled liquid [K]

Returns

  • undercooling undercooling Tm - T [K]
  • dGv_MJ_m3 volume free-energy change in MJ/m^3
  • r_star critical radius [m]
  • r_star_nm critical radius in nm
  • dG_star activation free energy [J]
  • dG_star_eV activation free energy in eV

Applies when

  • gamma, dHf, Tm > 0
  • 0 < T < Tm

Example

m.ask("Homogeneous nucleation: gamma = 0.132 J/m^2, dHf = 1.16e9 J/m^3, Tm = 1064 degC, T = 834 degC")
→ undercooling = 230 K, dGv_MJ_m3 = -199.529, r_star = 1.32312e-09 m, r_star_nm = 1.32312, dG_star = 9.67964e-19 J, dG_star_eV = 6.04155

Polymers 8

Average repeat-unit weight and degree of polymerization of a copolymercopolymer_degree_of_polymerization

The average repeat-unit molecular weight of a copolymer from the two repeat-unit formulas and the mole fraction of the first, and its degree of polymerization.

\bar m = \sum f_jm_j,\quad \mathrm{DP} = \frac{\bar M_n}{\bar m}

Inputs

  • formula1 formula of repeat unit 1 text
  • formula2 formula of repeat unit 2 text
  • f1 mole fraction of repeat unit 1 (0 to 1)
  • Mn number-average molecular weight [kg/mol]

Returns

  • m_avg_g_mol average repeat-unit molecular weight in g/mol
  • DP degree of polymerization

Applies when

  • valid formulas
  • 0 <= f1 <= 1
  • Mn > 0

Example

m.ask("Copolymer degree of polymerization: formula1 = C4H6, formula2 = C8H8, f1 = 0.75, Mn = 350000 g/mol")
→ m_avg_g_mol = 66.6051, DP = 5254.85
Creep strain of a Kelvin-Voigt viscoelastic solidkelvin_voigt_creep

The strain after time t under constant stress for a Kelvin-Voigt (spring and dashpot in parallel) material: eps(t) = (sigma_0/E)(1 - exp(-t E/eta)).

\varepsilon(t) = \frac{\sigma_0}{E}\left(1-e^{-t/\tau}\right)

Inputs

  • sigma0 applied stress [Pa]
  • E spring modulus [Pa]
  • eta dashpot viscosity [Pa*s]
  • t time under load [s]

Returns

  • strain creep strain at time t
  • fraction_of_elastic strain over the final strain sigma_0/E
  • tau retardation time eta/E [s]

Applies when

  • sigma0, E, eta > 0
  • t >= 0

Example

m.ask("Kelvin-Voigt creep: sigma0 = 5 MPa, E = 500 MPa, eta = 1e11 Pa*s, t = 200 s")
→ strain = 0.00632121, fraction_of_elastic = 0.632121, tau = 200 s
End-to-end distance of a freely rotating chainpolymer_chain_dimensions

The root-mean-square end-to-end distance and characteristic ratio of a polymer chain of n bonds of length l with fixed bond angle and free rotation, and its all-trans contour length.

\langle r^2\rangle = nl^2\left[\frac{1+c}{1-c} - \frac{2c(1-c^n)}{n(1-c)^2}\right],\ c = -\cos\theta

Inputs

  • n number of backbone bonds integer
  • l bond length [m]
  • theta bond angle in degrees (default 109.47, tetrahedral) optional

Returns

  • r_rms rms end-to-end distance [m]
  • r_rms_nm rms end-to-end distance in nm
  • C_n characteristic ratio <r^2>/(n l^2)
  • contour_nm all-trans contour length in nm

Applies when

  • n >= 1
  • l > 0
  • 90 < theta < 180 degrees

Example

m.ask("Polymer chain dimensions: n = 2, l = 0.154 nm, theta = 120")
→ r_rms = 2.66736e-10 m, r_rms_nm = 0.266736, C_n = 1.5, contour_nm = 0.266736
Number- and weight-average molecular weight and dispersitymolecular_weight_averages

Mn, Mw and the dispersity Mw/Mn of a polymer from a molecular-weight distribution given as number fractions or weight fractions per size range.

\bar M_n = \sum x_iM_i,\quad \bar M_w = \sum w_iM_i,\quad \mathrm{PDI} = \bar M_w/\bar M_n

Inputs

  • M mean molecular weight of each size range in g/mol vector
  • fraction number or weight fraction of each range (normalised) vector
  • basis whether the fractions are number (x_i) or weight (w_i) fractions (default number) choice optional

Returns

  • Mn number-average molecular weight in g/mol
  • Mw weight-average molecular weight in g/mol
  • PDI dispersity (polydispersity index) Mw/Mn

Applies when

  • equal lengths
  • M > 0
  • fractions >= 0, not all zero (they are normalised)

Example

m.ask("Molecular weight averages: M = [10000, 20000, 30000], fraction = [0.2, 0.5, 0.3], basis = number")
→ Mn = 21000, Mw = 23333.3, PDI = 1.11111
Percent crystallinity of a polymer from densitiespolymer_crystallinity

The mass percent crystallinity of a semicrystalline polymer from its density and the densities of the fully crystalline and fully amorphous polymer.

\%\,\text{cryst} = \frac{\rho_c(\rho_s-\rho_a)}{\rho_s(\rho_c-\rho_a)}\times100

Inputs

  • rho_s density of the sample [kg/m^3]
  • rho_c density of the totally crystalline polymer [kg/m^3]
  • rho_a density of the totally amorphous polymer [kg/m^3]

Returns

  • crystallinity_percent percent crystallinity (by mass)

Applies when

  • rho_a < rho_s < rho_c

Example

m.ask("Polymer crystallinity: rho_s = 0.925 g/cm^3, rho_c = 1.00 g/cm^3, rho_a = 0.87 g/cm^3")
→ crystallinity_percent = 45.738
Repeat-unit molecular weight and degree of polymerizationdegree_of_polymerization

The molecular weight of a repeat unit from its formula and the number-average degree of polymerization DP = Mn / m.

\mathrm{DP} = \frac{\bar M_n}{m}

Inputs

  • formula repeat-unit formula, e.g. C2H3Cl text
  • Mn number-average molecular weight [kg/mol]

Returns

  • repeat_unit_g_mol repeat-unit molecular weight in g/mol
  • DP degree of polymerization

Applies when

  • a valid formula
  • Mn > 0

Example

m.ask("Degree of polymerization: formula = C2H3Cl, Mn = 106000 g/mol")
→ repeat_unit_g_mol = 62.4982, DP = 1696.05
Stress in a stretched rubber (affine network)rubber_elasticity

The shear modulus G = rho R T / Mc of a crosslinked rubber and its engineering and true stress at a uniaxial stretch ratio lambda.

\sigma = \frac{\rho RT}{M_c}\left(\lambda - \frac{1}{\lambda^2}\right)

Inputs

  • rho density of the rubber [kg/m^3]
  • Mc molecular weight between crosslinks [kg/mol]
  • T temperature [K]
  • stretch stretch ratio lambda = L/L0

Returns

  • G_MPa shear modulus in MPa
  • stress_MPa engineering stress in MPa
  • true_stress_MPa true stress in MPa

Applies when

  • all inputs > 0
  • ideal affine network, incompressible

Example

m.ask("Rubber elasticity: rho = 0.95 g/cm^3, Mc = 5000 g/mol, T = 300 K, stretch = 2")
→ G_MPa = 0.473924, stress_MPa = 0.829368, true_stress_MPa = 1.65874
Stress relaxation of a Maxwell viscoelastic solidmaxwell_stress_relaxation

The stress remaining after time t in a polymer held at constant strain, modelled as a Maxwell element: sigma(t) = sigma_0 exp(-t E/eta).

\sigma(t) = \sigma_0 e^{-t/\tau},\quad \tau = \frac{\eta}{E}

Inputs

  • sigma0 initial stress [Pa]
  • E spring modulus [Pa]
  • eta dashpot viscosity [Pa*s]
  • t time held [s]

Returns

  • sigma_t stress at time t [Pa]
  • sigma_t_MPa stress at time t in MPa
  • tau relaxation time eta/E [s]
  • ratio sigma(t)/sigma_0

Applies when

  • sigma0, E, eta > 0
  • t >= 0

Example

m.ask("Maxwell stress relaxation: sigma0 = 10 MPa, E = 1 GPa, eta = 1e12 Pa*s, t = 1000 s")
→ sigma_t = 3.67879e+06 Pa, sigma_t_MPa = 3.67879, tau = 1000 s, ratio = 0.367879

Thermal properties 5

Electronic thermal conductivity of a metal (Wiedemann-Franz law)wiedemann_franz

The electronic thermal conductivity kappa = L sigma T of a metal from its electrical conductivity (or resistivity) and temperature, with the Sommerfeld value of the Lorenz number.

\kappa = L\sigma T,\quad L = \frac{\pi^2}{3}\left(\frac{k}{e}\right)^2

Inputs

  • T temperature [K]
  • sigma electrical conductivity (or give rho) [1/(ohm*m)] optional
  • rho electrical resistivity (or give sigma) [ohm*m] optional

Returns

  • kappa thermal conductivity [W/(m*K)]
  • lorenz Lorenz number in W ohm/K^2

Applies when

  • T > 0
  • exactly one of sigma, rho, positive
  • degenerate free-electron metal

Example

m.ask("Wiedemann-Franz: T = 300 K, sigma = 5.96e7 S/m")
→ kappa = 436.809 W/(m*K), lorenz = 2.443e-08
Linear thermal expansionlinear_thermal_expansion

The length change dL = alpha L0 dT and the new length of a bar heated or cooled freely by dT.

\Delta L = \alpha L_0\,\Delta T

Inputs

  • alpha linear thermal expansion coefficient [1/K]
  • L0 initial length [m]
  • dT temperature change (positive = heating) [K]

Returns

  • dL length change [m]
  • dL_mm length change in mm
  • L new length [m]
  • strain thermal strain alpha dT

Applies when

  • alpha, L0 > 0
  • alpha constant over the range (linear, small strain)

Example

m.ask("Linear thermal expansion: alpha = 17e-6 1/K, L0 = 0.5 m, dT = 100 K")
→ dL = 0.00085 m, dL_mm = 0.85, L = 0.50085 m, strain = 0.0017
Molar heat capacity of a solid (Debye model)debye_heat_capacity

The constant-volume molar heat capacity of a monatomic solid from the Debye model at temperature T.

C_v = 9R\left(\frac{T}{\Theta_D}\right)^3\int_0^{\Theta_D/T}\frac{x^4e^x}{(e^x-1)^2}\,dx

Inputs

  • theta_D Debye temperature [K]
  • T temperature [K]

Returns

  • Cv molar heat capacity at constant volume [J/(mol*K)]
  • Cv_over_3R Cv / 3R (1 at high T)

Applies when

  • theta_D, T > 0
  • T >= theta_D/300

Example

m.ask("Debye heat capacity: theta_D = 343 K, T = 1000000 K")
→ Cv = 24.9434 J/(mol*K), Cv_over_3R = 1
Molar heat capacity of a solid (Einstein model)einstein_heat_capacity

The constant-volume molar heat capacity of a solid from the Einstein model (all atoms vibrating at one frequency).

C_v = 3R\left(\frac{\Theta_E}{T}\right)^2\frac{e^{\Theta_E/T}}{(e^{\Theta_E/T}-1)^2}

Inputs

  • theta_E Einstein temperature [K]
  • T temperature [K]

Returns

  • Cv molar heat capacity at constant volume [J/(mol*K)]
  • Cv_over_3R Cv / 3R

Applies when

  • theta_E, T > 0

Example

m.ask("Einstein heat capacity: theta_E = 300 K, T = 300 K")
→ Cv = 22.9647 J/(mol*K), Cv_over_3R = 0.920674
Volumetric thermal expansionvolumetric_thermal_expansion

The volume change dV = beta V0 dT of an isotropic solid with beta = 3 alpha (linearised), and the exact change V0((1 + alpha dT)^3 - 1).

\Delta V = \beta V_0\,\Delta T,\quad \beta = 3\alpha

Inputs

  • alpha LINEAR thermal expansion coefficient [1/K]
  • V0 initial volume [m^3]
  • dT temperature change (positive = heating) [K]

Returns

  • beta volumetric coefficient 3 alpha [1/K]
  • dV linearised volume change beta V0 dT [m^3]
  • dV_cm3 linearised volume change in cm^3
  • V new volume (linearised) [m^3]
  • dV_exact exact volume change V0((1 + alpha dT)^3 - 1) [m^3]
  • dV_exact_cm3 exact volume change in cm^3

Applies when

  • alpha, V0 > 0
  • isotropic solid, alpha constant over the range

Example

m.ask("Volumetric thermal expansion: alpha = 17e-6 1/K, V0 = 1000 cm^3, dT = 100 K")
→ beta = 5.1e-05 1/K, dV = 5.1e-06 m^3, dV_cm3 = 5.1, V = 0.0010051 m^3, dV_exact = 5.10867e-06 m^3, dV_exact_cm3 = 5.10867
Questions

Frequently asked

What does materials-science-ai999x do?

Materials Science answers questions in materials science: crystal structures and diffraction, defects and diffusion, mechanical properties, phase diagrams, polymers, ceramics and composites, and electronic and thermal properties. Each answer gives the value with its unit, the steps and the formula in LaTeX.

How do I install materials-science-ai999x?

With pip: pip install materials-science-ai999x. The same files are on Hugging Face (hf download AI999X/materials-science-ai999x --local-dir materials-science-ai999x) and GitHub.

Does it run offline?

Yes. It is a Python package that runs on an ordinary CPU without a network connection (Python >=3.10); no GPU and no API key are needed.

How many capabilities does materials-science-ai999x have?

87 capabilities in 13 topics, including Crystal structures, Mechanical properties, Diffraction, Polymers, Diffusion.

Which field and tasks does it cover?

Field: Physical Sciences. Tasks: Question Answering, Token Classification, Text Classification, Sentence Similarity, Feature Extraction.

What does an answer look like?

Asked "Theoretical density: structure = FCC, A = 63.55 g/mol, R = 0.128 nm", it answers: rho = 8895.28 kg/m^3, rho_gcc = 8.89528, a_nm = 0.362039.

What happens when a question cannot be answered?

It says so and names what is missing or out of range, instead of guessing a number.

More from AI999X

Explore every model.