Skip to content

rate

" Module with classes for calculating the rate

SingleRateCalc(m_chi, v_e, material, model, numerics)

Bases: ABC

An abstract class for calculating rates at a given mass and earth velocity

Source code in darkmagic/rate.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def __init__(
    self,
    m_chi: float,
    v_e: ArrayLike,
    material: Material,
    model: Model,
    numerics: Numerics,
):
    self.m_chi = m_chi
    self.v_e = v_e
    self.material = material
    self.model = model
    self.numerics = numerics
    self._grid = None
    self._dwf_grid = None

calculate_rate()

Computes the differential rate

Source code in darkmagic/rate.py
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
def calculate_rate(
    self,
):
    """
    Computes the differential rate
    """

    # (nq, nmodes) and (nq, nmodes, natoms, 3)
    omegas, epsilons = self.material.get_eig(self.grid)

    # Compute \Sigma_{\nu}(q)
    sigma_q_nu = self.calculate_sigma_q_nu(omegas, epsilons)

    # Integrate to get deltaR
    deltaR = (
        (1 / self.material.m_cell)
        * (const.rho_chi / self.m_chi)
        * self.grid.vol_element[:, None]
        * self.model.F_med_prop(self.grid)[:, None] ** 2
        * sigma_q_nu
    )

    # TODO: the names here aren't great
    max_bin_num = math.ceil(self.material.max_dE / self.numerics.bin_width)
    bin_num = np.floor(omegas / self.numerics.bin_width).astype(int)
    # Each bin has the rate from processes of energies within that bin
    diff_rate = np.zeros(max_bin_num)
    np.add.at(diff_rate, bin_num, deltaR)
    # Integrate over q to get rate from different modes
    binned_rate = np.sum(deltaR, axis=0)
    # Sum over modes to get total rate
    total_rate = np.sum(diff_rate)

    return [diff_rate, binned_rate, total_rate]

MagnonScatterRate(m_chi, v_e, material, model, numerics)

Bases: SingleRateCalc

Class for calculating the differential rate for magnon scattering

Source code in darkmagic/rate.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def __init__(
    self,
    m_chi: float,
    v_e: ArrayLike,
    material: Material,
    model: Model,
    numerics: Numerics,
):
    self.m_chi = m_chi
    self.v_e = v_e
    self.material = material
    self.model = model
    self.numerics = numerics
    self._grid = None
    self._dwf_grid = None

PhononScatterRate(m_chi, v_e, material, model, numerics)

Bases: SingleRateCalc

Class for calculating the differential rate for phonon scattering

Source code in darkmagic/rate.py
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def __init__(
    self,
    m_chi: float,
    v_e: ArrayLike,
    material: Material,
    model: Model,
    numerics: Numerics,
):
    self.m_chi = m_chi
    self.v_e = v_e
    self.material = material
    self.model = model
    self.numerics = numerics
    self._grid = None
    self._dwf_grid = None