# Basic theory¶

## Local fields in MuSR¶

Muon spin rotation and relaxation spectroscopy is mainly used to probe magnetic materials. We briefly describe here the interactions between the magnetic moments of the muon and the electrons in the host system that produce a local magnetic field at the muon site in magnetically ordered samples.

### Dipolar Field¶

The dipolar field is produced by the magnetic dipolar interaction between the spin polarized electronic orbitals and the muon spin. Even though the interaction is best described with quantum mechanics, for the sake of simplicity, here we approximate the spin polarized electronic orbitals with classical dipoles centered at the nuclei of the magnetic atoms. This approximation is also implicit in the code and works rather well in many cases.

The dipolar field is given by

where, from a quantum perspective, \(\mathbf{m}_i = -g_i \mu_\mathrm{B} \mathbf{J}_i\) and \(\mathbf{J}_i\) is the total angular momentum of the i-th atom. Finally, the radius \(\mathbf{r}_i\) is the distance between the muon and the i-th atom of N magnetic ions in the sample.

When the above sum is performed in real space, it is customary to select a spherical portion of the sample (smaller than a magnetic domain) centered at the muon site and subdivide \(\mathbf{B_{\mathrm{dip}}}\) in three terms:

The first term originates from the magnetic moments inside the sphere of radius \(R_\mathrm{sphere}\), i.e.:

The second and the term originate from magnetic moments outside the sphere and are evaluated in the continuum approximation. They are

where \(\mathbf{N}\) is the demagnetization tensor and \(\mathbf{M}_\mathrm{meas}\)
is the **bulk** magnetization of the sample.

Note

`muesr`

only estimates \(\mathbf{B}_\mathrm{dip}\) and
\(\mathbf{B}_\mathrm{Lor}\).
The demagnetisation field depends on both the sample shape and the
experiment conditions and it must be evaluated case by case.

### Contact Hyperfine field¶

A distinct contribution to the local magnetic field at the muon site is referred to as Fermi contact hyperfine field. It accounts for the finite probability for the quantum electron with wavefunction \(\psi_s (\mathbf{r})\) to share the classical muon position \(\mathbf{r}_\mu\) and it amounts to

In `muesr`

, only a scalar coupling between \(\mathbf{B_{\mathrm{cont}}}\) and
\(\mathbf{m}_e\) is allowed, proportional to \(\vert \psi_s (\mathbf{r}_\mu) \vert ^2\).

In principle the quantum nature of the contact hyperfine interaction requires the knowledge of the electronic
distribution around the muon site for an accurate description. Each magnetic atom that is a
muon neighbor may contribute with a different coupling value, while the current version of `muesr`

allows
for just one average value. Furthermore the coupling may produce contributions from one or more neighbor magnetic atoms.
They add up differently, depending to the magnetic structure.

At the moment this is only implemented by varying the number of nearest neighbours considered in the above sum.
It is **very badly** approximated by considerig that each magnetic
atom within a given radius contributes to the total hyperfine field by an amount
inversely proportional to the cube of its distance from the muon. The
total is then scaled by the common factor ACont.

[TODO]

Improve the implementation of an effective contact interaction in muesr!!!!

## Description of Magnetic Structures¶

There are two possibilities to describe a magnetic structure: by using the
color (Shubnikov) group theory or by defining one (or more) propagation vector(s) and using the Fourier
coefficients formalism. `muesr`

opts for the latter, and it is limited to single wavevector (1-k) structures for the time being.

Since local field are linear in the magnetic moment, the local muon field for multiple-k magnetic orders can be obtained by performing independent simulations for each k vector and by summing the results.

In general a magnetic structure is defined as

where \(\nu\) runs over the atoms of the unit cell and \(n\) identifies the n-th cell, with atomic positions \(\mathbf{R}_{n\nu}\) given by

Here \(\mathbf{R}_{n} = n_a \mathbf{a} + n_b \mathbf{b} + n_c \mathbf{c}\) and \(\mathbf{r}_\nu = x_\nu \mathbf{a} + y_\nu \mathbf{b} + z_\nu \mathbf{c}\).

The Fourier coefficients \(\mathbf{S}_{\nu \mathbf{k}}\) are three dimensional complex vectors. They are related to the irreducible representations of the so called “little groups” i.e. the subgroup of the crystallographic space group formed by the operators leaving invariant the propagation vector.

Many collinear magnetic structures may be represented by a single wavevector and require real cofficients: for instance in the standard collinear Néel antiferromagnet with two sublattices the coefficents correspond to the absolute moment and the complex factor alternates the sign at the two sublattices.

[TODO] Discuss the phase!

## Implementation details¶

`muesr`

is a tool to analyze muon sites and local field contributions
generated by a known magnetic structure. It is intended to be used in an
interactive python environment such as IPython or Jupyter notebooks.

Internally, muesr uses Tesla units and Angstrom for lengths if not specified. Magnetic moments are specified in units of Bohr magnetons.