Closed kbarros closed 2 weeks ago
One minor question I have is whether its actually vacuum_permeability in the units. Isn't it vacuum permeability times the square of the Bohr magneton?
Yes, that's true. If we wanted to be more complete, we could hypothetically perform the following renamings of the Units energy constants to include the conversion factors:
THz -> h_THz # Planck constant
K -> kB_K # Boltzmann constant
T -> μB_T # Bohr magneton
But that is sort of unnecessarily verbose. So colloquially, a physicist might say "work in units where $h = k_B = μ_B= 1$". Given that units.T
actually means $μ_B T$, I think (within this same context) it's consistent to say that units.vacuum_permeability
(namely $μ_0$) actually means $μ_0 μ_B^2$. However, I realize that it's confusing, so there are various places in the docs that I use the full expression $μ_0 μ_B^2$ without suppressing the $μ_B$ factors.
Sounds good. I have no objections, just wanted to make sure I'm following.
Allow more flexibility in the system of
Units
. Given some specific energy and length scale, e.g.units = Units(:meV, :angstrom)
, the returned object will provide various physical constants. For example,units
providesTHz
,meV
,K
, andT
in multiples of the base energy unit. For kelvin and tesla, conversions are employed using the Botzmann constant and Bohr magneton, respectively. The functionset_external_field!
is deprecated in favor ofset_field!
, which now expects the magnetic field scaled by the Bohr magneton, which has units of energy. The functionenable_dipole_dipole!
now expects a vacuum permeability constant $μ_0 μ_B^2$ with dimensions of length³-energy, and this can be obtained viaunits.vacuum_permeability
.Most existing Sunny scripts should continue to work, but deprecation warnings will guide users toward the new interface.