layers¶
nrxrdct.laue.layers ¶
layered_structure_factor.py¶
Model a stack of crystalline layers with known orientation relationships (OR) and compute the total kinematical structure factor \(F(\mathbf{Q})\) and intensity \(|F(\mathbf{Q})|^2\).
Physics
In the kinematical (Born) approximation the total scattered amplitude is the coherent sum of contributions from every unit cell in the stack:
where
- \(\mathbf{Q}\) — scattering vector in the lab frame (Å⁻¹)
- \(\mathbf{Q}^\text{cry}_l = U_l^T\,\mathbf{Q}\) — \(\mathbf{Q}\) expressed in the crystal frame of layer \(l\)
- \(F_l(\mathbf{Q}^\text{cry})\) — unit-cell structure factor of layer \(l\), computed by xrayutilities with energy-dependent Cromer–Mann + Henke anomalous scattering factors
- \(\mathbf{R}_{l,n} = z_{0,l}\,\hat{z} + n\,c_l\,\hat{z}\) — position of the \(n\)-th unit cell of layer \(l\) (1-D stacking along \(\hat{z}\))
- \(z_{0,l}\) — cumulative thickness of all layers below layer \(l\)
The geometric sum \(\sum_n \exp(in\varphi)\) is evaluated analytically:
For a superlattice with \(N_\text{rep}\) bilayer repetitions an additional geometric factor is applied over the full bilayer period \(\Lambda\).
Orientation relationship
The orientation \(U\) of each layer maps crystal-frame vectors to the lab frame:
orientation_along_z builds \(U\) from a real-space zone axis [uvw];
orientation_along_plane builds it from a Miller plane (hkl) instead --
required for any growth surface whose normal is not parallel to the
same-index real-space direction, which is always true away from cubic
crystals and hexagonal c-axis growth (in particular, hexagonal m-plane and
a-plane growth). See that function's docstring and the "Non-c-axis /
m-plane stacking" section of the layered-structures user guide for the
underlying geometry.
The OR between two phases A and B is specified by two direction pairs (primary and secondary), defining a rotation \(R_\text{OR}\) such that \(U_B = R_\text{OR}\,U_A\).
Common ORs implemented as helpers:
or_nishiyama_wassermann(NW) — FCC/BCCor_kurdjumov_sachs(KS) — FCC/BCCor_baker_nutting(BN) — BCC/rock-salt (e.g. Fe/MgO)or_from_directions— generic two-direction specification
Usage
from layered_structure_factor import LayeredCrystal, or_kurdjumov_sachs
import xrayutilities as xu
import numpy as np
Fe = xu.materials.Fe
Cu = xu.materials.Cu
# Orient Fe with [001] along the stacking direction (lab z)
U_Fe = orientation_along_z([0, 0, 1], Fe)
# Derive Cu orientation via Kurdjumov-Sachs OR
U_Cu = or_kurdjumov_sachs(Fe, Cu) @ U_Fe
# Build the stack: 20 Fe unit cells / 20 Cu unit cells, 5 repetitions
stack = LayeredCrystal()
stack.add_layer(Fe, U_Fe, thickness=57.4, label='Fe') # ~20 cells × 2.87 Å
stack.add_layer(Cu, U_Cu, thickness=72.6, label='Cu') # ~20 cells × 3.63 Å
stack.set_repetitions(5)
# Compute |F(Q)|² along a scan
qz = np.linspace(1.0, 6.0, 4000)
Q_scan = np.column_stack([np.zeros_like(qz),
np.zeros_like(qz), qz]) # along lab z
intensity = stack.intensity(Q_scan, energy_eV=17000)
# Or single Q-point
Q = np.array([0., 0., 3.09])
F = stack.structure_factor(Q, energy_eV=17000)
print(f'|F(Q)| = {abs(F):.4f} e.u.')
Layer ¶
One crystalline layer in the stack.
| Parameters: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 | |
thickness
property
¶
Total layer thickness in Å -- exactly the value passed to the constructor.
All geometric bookkeeping (block/buffer z-offsets, period lengths,
total_thickness, absorption-depth placement) uses this exact
value. It generally differs slightly from n_cells * d, since
the requested thickness need not be an integer multiple of the
unit-cell repeat d: the coherent structure-factor sum still
runs over the nearest integer number of cells (n_cells), but
every position/period calculation is anchored to the thickness you
asked for, not to its lattice-quantised approximation.
structure_factor ¶
Kinematical structure factor of this layer at scattering vector Q_lab.
F_layer(Q) = F_uc(Q_crystal) · Σ_{n=0}^{N-1} exp(i (Q·n̂)(z0 + n·d))
The phase uses the projection of Q onto the stacking direction n_hat
(not Q_z), so the result is correct for any sample orientation.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
structure_factor_batch ¶
Vectorised :meth:structure_factor for many Q_lab (and, optionally,
many kf_hat) at once, evaluated against a single reference energy.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
LayeredCrystal ¶
A stack of crystalline layers with specified orientations, optionally repeated as a superlattice.
The stacking direction is a lab-frame unit vector n_hat (default
[0, 0, 1], i.e. lab Z). All phase calculations use the projection
Q · n_hat rather than Q_z, so the structure factor is correct
regardless of how the sample sits on the diffractometer.
| Parameters: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 | |
all_layers
property
¶
All distinct Layer objects: buffer layers, then every repeating
block's layers in order (each listed once, not unrolled by n_rep).
blocks
property
¶
Repeating blocks, bottom to top. Each has .layers (list[Layer])
and .n_rep (int). Built by alternating :meth:add_layer calls
with :meth:set_repetitions.
buffer_thickness
property
¶
Total thickness of all non-repeating buffer layers (Å).
layers
property
¶
All layers belonging to repeating blocks, flattened bottom to top.
For the common case of a single repeating block this is exactly
that block's layer list. For a multi-block stack this concatenates
every block's layers (without unrolling n_rep) -- enough for
callers that just need "some/all layers regardless of block", but
not for period/offset math (use .blocks for that).
total_thickness
property
¶
Total stack thickness: buffer + Σ_blocks (n_rep × block period) (Å).
add_buffer_layer ¶
Append a non-repeating layer at the bottom of the stack (substrate side), below every repeating block.
Buffer layers are always added in order from deepest to shallowest: the first call places the layer closest to the substrate, subsequent calls place layers closer to the surface.
| Parameters: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
add_layer ¶
Append a layer to the currently open repeating block.
Layers are stacked in the order they are added; the first call
(after the stack was created, or after the previous block was
closed by :meth:set_repetitions) starts a new block and places
this layer at its bottom; further calls add layers on top of it,
within the same block.
To build several independently-repeated blocks stacked on top of
each other (e.g. one unit repeated 5×, then a different unit
repeated 8×), call :meth:set_repetitions right after finishing
each block -- that both sets its repeat count and closes it, so the
next add_layer call starts a fresh block::
stack.add_layer(A, U_A, tA, label='A')
stack.add_layer(B, U_B, tB, label='B')
stack.set_repetitions(5) # block 1 = (A, B) × 5
stack.add_layer(C, U_C, tC, label='C')
stack.set_repetitions(8) # block 2 = (C,) × 8
stack.add_layer(D, U_D, tD, label='D') # block 3 = (D,) × 1 (cap)
Blocks are stacked bottom to top in the order they were closed (or,
for the last, still-open block, in the order its layers were added).
If you never call set_repetitions at all, every add_layer call
keeps extending a single block -- the original single-repeating-unit
behaviour is preserved exactly.
| Parameters: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
add_pseudomorphic_layer ¶
add_pseudomorphic_layer(crystal, U, thickness, a_substrate, C13: float, C33: float, growth_dir=(0, 0, 1), label=None)
Append a pseudomorphically strained layer to the repeating unit.
The out-of-plane repeat distance is computed from the biaxial strain state imposed by the in-plane lattice constraint:
$$
d = d_{\text{bulk}}\left(1 - \frac{2C_{13}}{C_{33}}\,
\varepsilon_\parallel\right)
\qquad
\varepsilon_\parallel =
\frac{a_{\text{sub}} - a_{\text{film}}}{a_{\text{film}}}
$$
Equivalent to calling :func:pseudomorphic_d_spacing then
:meth:add_layer with the computed d_spacing.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Note: The strain values are printed on addition so you can verify the mismatch.
Source code in src/nrxrdct/laue/layers.py
add_pseudomorphic_layer_nonpolar ¶
add_pseudomorphic_layer_nonpolar(crystal, U, thickness, a_substrate, c_substrate, C11: float, C12: float, C13: float, growth_hkl=(1, 0, 0), label=None)
Append a pseudomorphically strained layer grown on a non-polar
hexagonal surface (m-plane {1,0,-1,0} or a-plane {1,1,-2,0}) to
the repeating unit.
Equivalent to calling :func:pseudomorphic_d_spacing_nonpolar then
:meth:add_layer with the computed d_spacing -- see that
function's docstring for the full derivation and for why
:meth:add_pseudomorphic_layer (the c-axis version) cannot be
reused here: non-polar growth strains two elastically
inequivalent in-plane directions (c itself, and the remaining
in-plane a-type direction) differently, so it needs both
substrate lattice parameters and three stiffness constants
(C11, C12, C13), not one parameter and two constants
(C13, C33).
| Parameters: |
|
|---|
| Returns: |
|
|---|
Note: The strain values are printed on addition so you can verify the mismatch.
Source code in src/nrxrdct/laue/layers.py
1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 | |
average_structure_factor ¶
Structure factor of the thickness-weighted average unit cell at Q_lab.
Instead of summing layer amplitudes with their relative depth phases
(the coherent model), this method sums F_uc_i × N_eff_i over all
layers without the inter-layer phase factors
exp(i Q_n z_{0,i}). The result is the structural envelope of
the diffraction pattern: the intensity it predicts at any Q is the
maximum each satellite could reach if all unit cells happened to
scatter perfectly in phase.
This approximation is useful to:
- predict which satellite positions carry significant scattering power based on the average composition, before running the slower coherent simulation;
- compare the coherent fringe pattern against its envelope to isolate which features arise from constructive interference vs. from the unit cell structure factor.
All absorption corrections (Beer-Lambert two-beam depth limit,
overlying-layer attenuation) are applied identically to
:meth:structure_factor.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 | |
average_structure_factor_batch ¶
Vectorised :meth:average_structure_factor for many Q_lab (and,
optionally, many kf_hat) at once, evaluated against a single
reference energy — see :meth:structure_factor_batch for the
approximation this implies (exact in Q, approximate in the smooth
f'(E)/f''(E) dispersion terms only).
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 | |
copy ¶
Return an independent deep copy of this stack -- every layer's
material, orientation, thickness, and the block/buffer structure are
duplicated, so mutating the copy (e.g. via :meth:rotate, set_U,
or reassigning layer.U directly) never affects the original, and
vice versa.
Implemented as a dill round-trip (the same mechanism as
:meth:save/:meth:load) rather than copy.deepcopy, since it is
already proven to correctly duplicate the xu.materials.Crystal /
Alloy objects each layer holds.
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
describe ¶
Print a summary of the stack.
Source code in src/nrxrdct/laue/layers.py
intensity ¶
Compute |F(Q)|² for an array of Q-points.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
layer_contributions ¶
Return the individual structure factor contribution of each layer.
Buffer layers are included at their absolute z positions. Layers of every repeating block are included for the first repetition of their own block only (z0 relative to that block's start position), without the superlattice factor.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
load
classmethod
¶
Load a stack previously saved with :meth:save.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
plot_lattice_parameter ¶
Plot a lattice parameter profile through the stack depth.
Draws a step function showing how param ('a', 'b', or
'c') varies with depth, with buffer layers at the bottom and the
surface at the top. Every repeating block is unrolled across all of
its own n_rep repetitions, in stack order.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 | |
plot_strain_profile ¶
Plot the strain profile of a lattice parameter through the stack depth.
Strain is defined as
$$
\varepsilon = \frac{p_{\text{layer}} - p_{\text{ref}}}{p_{\text{ref}}}
$$
where p is the chosen lattice parameter ('a', 'b', or
'c').
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 | |
print_reflections ¶
Print the reflections actually present in a spots list for one
layer (or every layer), grouped and sorted by intensity.
Meant as a quick answer to "does hkl=... exist in my spots list for
this layer?" before calling something like
:func:~nrxrdct.laue.simulation.simulate_spot_image, which raises a
ValueError naming exactly this hkl/layer/satellite_order
combination when it can't find a match — this prints the full
picture up front instead of discovering it one failed call at a
time.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
rotate ¶
Rotate one or more layers' orientation matrices by angle_deg about
axis, in either the lab frame or each layer's own crystal frame.
The two frames compose differently and answer different questions:
frame='lab'(default) --axisis a direction in the lab frame (e.g. vertical[0,0,1], the beam[1,0,0], or any other measured lab-frame direction such as a wire's own long axis). Applied asU_new = R(axis) @ U-- physically, rotating the sample itself on the diffractometer about a fixed external axis. Same convention as :func:~nrxrdct.laue.simulation.rotate_U_about_axis, generalised from'x'/'y'/'z'to an arbitrary vector.frame='crystal'--axisis a direction in each selected layer's own crystal frame (e.g.c = [0,0,1]; for a Miller plane normal rather than a real-space direction, convert first with :func:plane_normal_cartesian). Applied asU_new = U @ R(axis)-- physically, twisting the lattice about its own crystallographic axis, independent of the layer's absolute orientation. Because this composes on the right, applying it to several layers with differentU(e.g. an independently fitted core and shell) twists each one about its ownc, not about a shared lab direction.
A common diagnostic use: probing whether a small residual
misorientation between an independently refined core and shell is
consistent with a genuine c-axis twisting moment (rather than a
fitting artifact) -- e.g. nudging just the shell by a fraction of a
degree about its own c and re-comparing against the measured
pattern, without disturbing the original stack::
trial = stack.rotate(0.05, [0, 0, 1], frame='crystal',
layers='InGaN QW', inplace=False)
# stack is untouched; compare trial's simulated pattern instead.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 | |
save ¶
Save this stack to path via dill, so it can be reloaded later
instead of rebuilt from scratch -- resuming a session where you left
off, or handing a hand-tuned/fitted stack to
:class:~nrxrdct.laue.layered_map.LayeredMap as the starting-point
orientation for a per-pixel map (LayeredMap(stack=..., ...))
without re-running the notebook cells that built it.
Round-trips everything: every layer's material (xu.materials.Crystal
/ Alloy), orientation U, thickness, resolved d-spacing, n_hat,
label, and absorption settings, plus the block/repetition structure
and buffer layers -- the exact same mechanism already used internally
by LayeredMap to ship a stack to local worker processes (see
layered_map._serialize_stack), just to a permanent path instead of
a temp file.
| Parameters: |
|
|---|
Example:
stack.save('gan_mplane_stack.pkl')
...later, or in a different session...¶
stack = LayeredCrystal.load('gan_mplane_stack.pkl') lmap = LayeredMap(ny=21, nx=21, stack=stack, h5_path='scan.h5')
Source code in src/nrxrdct/laue/layers.py
set_U ¶
Replace the orientation matrix of layers in the stack.
Two calling forms:
Global — apply one U to every layer::
stack.set_U(U)
Per-material — supply a dict mapping crystal name to U; only
layers whose crystal.name matches a key are updated::
stack.set_U({'GaN': U_GaN, 'InGaN': U_InGaN})
Layers whose material is not listed in the dict are left unchanged. Useful for modelling domain variants or orientation relationships between different materials in the same stack without rebuilding it.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
set_repetitions ¶
Set the repeat count of the currently open block (the layers
added since the previous set_repetitions call, or since the stack
was created) and close it.
The next :meth:add_layer call starts a brand-new block, so
calling add_layer(...) a few times then set_repetitions(N),
repeated as many times as needed, is how you build a sequence of
independently-repeated blocks -- see :meth:add_layer.
Source code in src/nrxrdct/laue/layers.py
structure_factor ¶
Total kinematical structure factor of the stack at Q_lab.
The stack is divided into two sections:
-
Buffer layers (non-repeating, at the bottom):
F_buf(Q) = Σ_j T_above_j · F_layer_j(Q, z0_j)
where T_above_j is the amplitude attenuation from all layers
above layer j (both the MQW block and the shallower buffer layers).
-
Repeating unit (MQW / bilayer, sitting on top of the buffer):
F_MQW(Q) = exp(i·Qₙ·z_buf) · F_unit(Q) · S_rep(Q)
where z_buf is the total buffer thickness,
F_unit is the single-bilayer structure factor, and
S_rep(Q) = Σ_{m=0}^{N_rep-1} exp(i·m·Qₙ·Λ)
is the superlattice geometric factor.
The total structure factor is F_buf + F_MQW.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 | |
structure_factor_batch ¶
Vectorised :meth:structure_factor for many Q_lab (and,
optionally, many kf_hat) at once.
Identical physics to the scalar method, with one approximation: the
unit-cell structure factor F_uc(Q, E) is evaluated at a single
reference energy for the whole batch (via Layer.structure_factor_batch
→ xu.materials.Crystal.StructureFactorForQ) instead of each row's own
energy. This only affects the smooth f'(E)/f''(E) anomalous-dispersion
terms — safe away from absorption edges — and is what makes the batch
path fast: it turns len(all_layers) × N scalar xrayutilities calls into
len(all_layers) vectorised ones. Everything else (Q-dependence,
geometry, per-voxel absorption via kf_hat_arr) is exact and
per-row.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 | |
combine_stacks ¶
Merge an ordered sequence of LayeredCrystal objects (bottom to top) into one flat LayeredCrystal with every repeating block unrolled (so the result has no blocks of its own, only a single implicit non-repeating one).
Each sub-stack's buffer layers are transferred in order as buffer layers
of the combined stack. Each of the sub-stack's repeating blocks
(whether it has one or several -- see :meth:LayeredCrystal.add_layer)
is unrolled across its own n_rep as individual flat layers, preserving
crystal, orientation matrix, physical thickness, and d-spacing. The
result has a single coherent structure factor that sums over the entire
multi-section sequence with the correct inter-layer phase relationships.
This is also the way to make a multi-block stack usable with
single-block-only consumers (e.g. :func:~nrxrdct.laue.simulate_laue_stack):
flatten it first with combine_stacks([my_multi_block_stack]).
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example
stacks = build_ebl_qw_stacks() # returns dict full = combine_stacks(stacks, name="full LED stack") spots = simulate_laue_stack(full, cam, structure_model='coherent')
Source code in src/nrxrdct/laue/layers.py
crystal_to_cartesian ¶
Convert Miller direction [uvw] to a Cartesian vector using the crystal's reciprocal lattice (for directions, use the direct metric).
For a general crystal with lattice parameters a, b, c, α, β, γ the direct metric tensor G is used: x_cart = A · [uvw] where A is the lattice matrix.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
d_spacing_hkl ¶
Interplanar spacing of the (hkl) family for crystal.
Uses the reciprocal lattice directly, so it is valid for any crystal system (cubic, hexagonal, orthorhombic, triclinic, …):
$$ d_{hkl} = \frac{2\pi}{|\mathbf{G}{hkl}|} \qquad \mathbf{G}{hkl} = h\,\mathbf{b}_1 + k\,\mathbf{b}_2 + l\,\mathbf{b}_3 $$ where \(\mathbf{b}_i\) are the reciprocal-lattice basis vectors in the xrayutilities convention (\(\mathbf{b}_i \cdot \mathbf{a}_j = 2\pi\,\delta_{ij}\)).
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example:
import xrayutilities as xu GaN = xu.materials.GaN d_spacing_hkl(GaN, 0, 0, 2) # GaN 002 reflection 2.593...
Source code in src/nrxrdct/laue/layers.py
nitride_elastic_constants ¶
Elastic stiffness constants for a binary or ternary III-nitride (GPa).
For ternary alloys the constants are linearly interpolated between the two binary end-members (Vegard's law approximation).
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example:
c = nitride_elastic_constants('GaN') c = nitride_elastic_constants('InN', x=0.20, end_material='GaN') d, eps_par, eps_perp = pseudomorphic_d_spacing( ... InGaN, GaN.lattice.a, C13=c['C13'], C33=c['C33'])
Source code in src/nrxrdct/laue/layers.py
or_baker_nutting ¶
Baker-Nutting (BN) OR between BCC metal and rock-salt oxide (e.g. Fe / MgO, Fe / FeO): {100}_BCC ∥ {100}_RS <110>_BCC ∥ <010>_RS
Returns R_OR (BCC->rock-salt). Use: U_RS = U_BCC @ R_OR.T
Source code in src/nrxrdct/laue/layers.py
or_from_directions ¶
Compute the orientation relationship rotation R_OR such that
crystal direction dir1_A in phase A is parallel to dir1_B in B,
and dir2_A is as close as possible to dir2_B.
Usage
R_OR = or_from_directions(Fe, [1,1,1], [1,-1,0], Cu, [1,1,0], [1,-1,-2]) U_Cu = R_OR @ U_Fe
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
or_kurdjumov_sachs ¶
Kurdjumov-Sachs (KS) OR between BCC and FCC phases: {110}_BCC ∥ {111}_FCC <111>_BCC ∥ <110>_FCC
Returns R_OR (rotation from BCC crystal frame to FCC crystal frame). To derive U_FCC from U_BCC use: U_FCC = U_BCC @ R_OR.T
Source code in src/nrxrdct/laue/layers.py
or_nishiyama_wassermann ¶
Nishiyama-Wassermann (NW) OR between BCC and FCC phases: {110}_BCC ∥ {111}_FCC <100>_BCC ∥ <011>_FCC
Returns R_OR (rotation from BCC crystal frame to FCC crystal frame). To derive U_FCC from U_BCC use: U_FCC = U_BCC @ R_OR.T
Source code in src/nrxrdct/laue/layers.py
or_pitsch ¶
Pitsch OR between BCC and FCC
{100}_BCC ∥ {110}_FCC <011>_BCC ∥ <111>_FCC
Returns R_OR (rotation from BCC crystal frame to FCC crystal frame). To derive U_FCC from U_BCC use: U_FCC = U_BCC @ R_OR.T
Source code in src/nrxrdct/laue/layers.py
orientation_along_plane ¶
Build a 3×3 orientation matrix U that places the normal of the (hkl)
lattice-plane family — the physically correct growth/stacking-direction
convention for epitaxial films, since the sample surface is parallel to
those planes — along the lab +z axis.
Unlike :func:orientation_along_z, which aligns a real-space direction
[uvw], this aligns the reciprocal vector \(\mathbf{G}_{hkl}\) (via
:func:plane_normal_cartesian). The two functions agree for cubic
crystals and for hexagonal c-axis ((0001)) growth, but differ for any
other hexagonal growth plane — most notably the non-polar m-plane
{1,0,-1,0} and a-plane {1,1,-2,0} orientations used for
polarization-optimised III-nitride devices, where the plane normal is a
30°-rotated real-space direction relative to the same-index [uvw].
Use this whenever the stacking/growth surface is specified as a Miller
plane rather than a zone axis — in particular, always for non-c-axis
hexagonal stacking. Pass the resulting U (or U @ [0, 0, 1], its own
growth direction in the crystal frame) as stacking_direction /
n_hat when building a :class:LayeredCrystal.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example:
m-plane GaN: (10-10) surface, c-axis in-plane along lab x¶
U_GaN_mplane = orientation_along_plane([1, 0, 0], GaN, up_crystal=[0, 0, 1]) n_hat = U_GaN_mplane @ np.array([1.0, 0.0, 0.0]) # growth dir, crystal frame ∥ lab z
Source code in src/nrxrdct/laue/layers.py
orientation_along_z ¶
Build a 3×3 orientation matrix U that places the crystal direction
zone_axis_crystal (real-space [uvw]) along the lab +z axis (stacking
direction).
Optionally align up_crystal as close as possible to lab +x.
Warning
zone_axis_crystal is a real-space direction, not a plane normal.
For cubic crystals and for c-axis hexagonal growth ([0001]) the
two coincide, but for any other non-orthogonal-lattice growth plane
(e.g. hexagonal m-plane or a-plane) they do not — use
:func:orientation_along_plane instead when the growth surface is
specified by Miller plane indices (hkl).
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
plane_normal_cartesian ¶
Cartesian direction of the reciprocal-lattice vector \(\mathbf{G}_{hkl}\) —
i.e. the normal to the (hkl) lattice-plane family — as opposed to
:func:crystal_to_cartesian, which converts a real-space direction
[uvw].
These two are only parallel for the same index triple in an orthogonal
(e.g. cubic) system. In a non-orthogonal system (hexagonal, monoclinic,
triclinic) they generally differ: for example in a hexagonal lattice the
real-space direction [1,0,0] (an a-axis) is not normal to the
(1,0,0)-type prism ("m") plane — the m-plane normal is instead parallel
to the real-space <11-20>-type ("a") direction, a 30° rotation away in
the basal plane. Use this function (via :func:orientation_along_plane)
whenever the growth/stacking direction is specified as a Miller plane
(hkl) rather than a zone axis [uvw] — in particular for any non-c-axis
hexagonal growth such as m-plane or a-plane GaN.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in src/nrxrdct/laue/layers.py
pseudomorphic_d_spacing ¶
pseudomorphic_d_spacing(crystal_film, a_substrate, C13: float, C33: float, growth_dir=(0, 0, 1)) -> float
Out-of-plane repeat distance for a pseudomorphic (coherently strained) film.
Assuming biaxial in-plane stress with a free surface perpendicular to the growth direction, the out-of-plane strain is:
$$
\varepsilon_\perp = -\frac{2C_{13}}{C_{33}}\,\varepsilon_\parallel
\qquad
\varepsilon_\parallel = \frac{a_{\text{sub}} - a_{\text{film}}}{a_{\text{film}}}
$$
The strained repeat along growth_dir is then
\(d = d_{\text{bulk}}(1 + \varepsilon_\perp)\).
This formula is exact for hexagonal c-axis growth and for cubic [001] growth (substitute \(C_{12}/C_{11}\) for \(C_{13}/C_{33}\)).
Warning
Not valid for non-c-axis hexagonal or off-axis cubic growth.
For semipolar / non-polar orientations (e.g. GaN grown along
[2,-2,0], [1,1,-2,3], etc.) the in-plane strain is anisotropic and
the correct out-of-plane response requires rotating the full
elastic stiffness tensor into the growth frame. Calling this
function with a non-c-axis growth_dir for a hexagonal crystal
will raise ValueError.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example: GaN/InGaN LED — pseudomorphic InGaN well on GaN buffer::
d_InGaN, eps_par, eps_perp = pseudomorphic_d_spacing(
InGaN, GaN.lattice.a, C13=92.0, C33=224.0)
stack.add_layer(InGaN, U_InGaN, thickness=n_InGaN * d_InGaN,
d_spacing=d_InGaN, label="InGaN (strained)")
Source code in src/nrxrdct/laue/layers.py
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | |
pseudomorphic_d_spacing_nonpolar ¶
pseudomorphic_d_spacing_nonpolar(crystal_film, a_substrate, c_substrate, C11: float, C12: float, C13: float, growth_hkl=(1, 0, 0))
Out-of-plane (growth-normal) repeat distance for a pseudomorphic film
grown on a non-polar hexagonal surface -- the m-plane {1,0,-1,0}
or a-plane {1,1,-2,0} family (more generally, any prism-plane growth
direction, i.e. any direction perpendicular to c).
Why pseudomorphic_d_spacing cannot be reused here. That function's
scalar formula \(\varepsilon_\perp = -2(C_{13}/C_{33})\varepsilon_\parallel\)
relies on hexagonal elastic stiffness being transversely isotropic
about c: for c-axis growth both in-plane directions are elastically
identical a-type directions, so a single mismatch strain
\(\varepsilon_\parallel\) (and a single ratio \(C_{13}/C_{33}\)) suffices.
Non-polar growth breaks that symmetry: its two in-plane directions are
not equivalent -- one is c itself (elastic constants \(C_{13}\),
\(C_{33}\)), the other is the remaining in-plane a-type direction
(elastic constants \(C_{11}\), \(C_{12}\), \(C_{13}\)) -- so the mismatch
strain along each is generally different, and each pulls on the free
surface with a different coefficient. Calling pseudomorphic_d_spacing
with a non-c-axis growth_dir for a hexagonal crystal raises
ValueError for exactly this reason; leaving growth_dir at its default
(0,0,1) instead silently computes a c-axis strain answer that has
nothing to do with the actual (non-polar) growth direction -- neither is
usable, hence this separate function.
Derivation. Because hexagonal elastic stiffness is transversely
isotropic about c, any direction in the basal plane is elastically
equivalent to any other -- so the growth normal (an a-type direction)
and the in-plane a-type direction retained in the surface share the
same \((C_{11}, C_{12})\) pair, with \(C_{13}\) coupling each to c.
Writing Hooke's law in this local frame with the free-surface condition
\(\sigma_{\perp} = 0\):
Unlike the c-axis case, both substrate lattice parameters enter
(the surface contains both the a- and c-type in-plane directions),
and no stiffness-tensor rotation is needed -- transverse isotropy makes
this formula valid for any basal-plane-normal growth direction, not
just the specific growth_hkl passed.
The bulk (unstrained) repeat d_bulk along the growth normal is found
via :func:shortest_lattice_vector -- not d_spacing_hkl -- since
for a non-orthogonal lattice the shortest lattice-vector repeat along a
prism-plane normal is generally a multiple of the bare interplanar
spacing (for GaN m-plane, exactly 2×; see that function's docstring).
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example:
d, eps_a, eps_c, eps_perp = pseudomorphic_d_spacing_nonpolar( ... InGaN, a_substrate=GaN.lattice.a, c_substrate=GaN.lattice.c, ... C11=c['C11'], C12=c['C12'], C13=c['C13'], growth_hkl=(0, 1, 0))
Source code in src/nrxrdct/laue/layers.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | |
shortest_lattice_vector ¶
Shortest real-space Bravais lattice vector exactly parallel to direction,
found by an exhaustive search over small integer combinations of the
crystal's primitive direct-lattice vectors.
Why this is needed (and why a per-axis projection is not enough).
:meth:Layer's coherent structure-factor sum treats the whole stack as
N identical copies of the same unit-cell structure factor
F_uc(Q_cry), translated by a scalar step d along the stacking
direction n_hat. That 1-D geometric-series model is only exact when
n_hat is parallel to an actual lattice translation T: only then does
stepping by d = |T| regenerate an identical atomic arrangement each
time, so the same F_uc legitimately applies to every step.
For an orthogonal lattice (cubic, tetragonal, orthorhombic) or for
hexagonal c-axis growth, that translation happens to be one of the
primitive vectors themselves (a1, a2, or a3), which is why simply
projecting each one onto n_hat and keeping the shortest — the original
heuristic used here — worked. It is not true in general: for a
hexagonal m-plane normal ({1,0,-1,0}), for instance, the shortest
lattice vector parallel to it is 2·a1 + a2 (length a√3), a combination
of primitives that the old per-vector heuristic could never find — and its
length is twice the bare interplanar spacing d_spacing_hkl of that plane
family (wurtzite has 2 formula units per cell, so consecutive (10-10)
planes are not identical; only every second one is). Using the bare
d_hkl there would silently impose a spurious extra periodicity — half
the true repeat — corrupting the satellite spacing and systematic
absences. Searching combinations, not just single vectors, is what makes
this general.
Not every direction has such a lattice vector within reach: n_hat may be
genuinely incommensurate with the lattice (e.g. many semipolar planes,
where the real/reciprocal correspondence depends on a/c and need not
close on a short integer vector). This function returns (None, None) in
that case rather than guessing — the caller (:class:Layer) turns that
into a ValueError asking for an explicit d_spacing.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Example:
m-plane GaN: shortest lattice vector along the (10-10) normal¶
U = orientation_along_plane([1, 0, 0], GaN) n_hat_crystal = U.T @ (U @ np.array([1.0, 0.0, 0.0])) # = [1,0,0] here T, d = shortest_lattice_vector(n_hat_crystal, GaN) d, d_spacing_hkl(GaN, 1, 0, 0) # d == 2x the bare (10-10) spacing (5.527..., 2.763...)
Source code in src/nrxrdct/laue/layers.py
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | |