BornAgain uses numeric values for physical quantities. Unit constants are conversion factors: multiply an input by its unit, or divide a returned value by the desired output unit.
| Constant | Meaning | Value |
|---|---|---|
ba.nm |
Nanometer | 1 |
ba.angstrom |
Angstrom | 0.1 * ba.nm |
ba.micrometer |
Micrometer | 1000 * ba.nm |
ba.millimeter |
Millimeter | 1e6 * ba.nm |
ba.nm2 |
Square nanometer | ba.nm**2 |
ba.nm3 |
Cubic nanometer | ba.nm**3 |
ba.rad |
Radian | 1 |
ba.deg |
Degree | pi / 180 * ba.rad |
ba.tesla |
μ₀M in tesla → M in A/m | 1 / μ₀ |
ba.gauss |
μ₀M in gauss → M in A/m | 1e-4 * ba.tesla |
import bornagain as ba
length = 2*ba.millimeter # 2,000,000 nm
volume = 8*ba.nm3 # 8 cubic nanometers
angle = 30*ba.deg # pi/6 radians
ba.deg2rad(angle_in_degrees) and ba.rad2deg(angle_in_radians) convert
angles explicitly.
For magnetic-unit conversions and examples, see Magnetization.
Check the units of each API argument. Material SLD inputs use Å⁻²; see Material.