Exemple #1
0
def recompute_alpha(sph_start, sph_end, t_start, t_end, mag_params):
    """
    From a change in energy we can calculate what the effective damping
    was. For more details see [Albuquerque2001,
    http://dx.doi.org/10.1063/1.1355322].

    alpha' = - (1/(M**2))  *( dE/dt  /  spaceintegral( (dm/dt**2  )))

    No space integral is needed because we are working with 0D LLG.
    """

    Ms = mag_params.Ms
    dt = t_end - t_start

    # Estimate dEnergy / dTime
    dE = llg_state_energy(sph_end, mag_params) \
        - llg_state_energy(sph_start, mag_params)
    dEdt = dE / dt

    # Estimate dMagentisation / dTime then take sum of squares
    dm = [
        m2 - m1
        for m1, m2 in zip(utils.sph2cart(sph_start), utils.sph2cart(sph_end))
    ]
    dmdt_sq_sum = sum([(dm_i / dt)**2 for dm_i in dm])

    # dE should be negative so the result should be positive.
    return -(1 / (Ms**2)) * (dEdt / dmdt_sq_sum)
def recompute_alpha(sph_start, sph_end, t_start, t_end, mag_params):
    """
    From a change in energy we can calculate what the effective damping
    was. For more details see [Albuquerque2001,
    http://dx.doi.org/10.1063/1.1355322].

    alpha' = - (1/(M**2))  *( dE/dt  /  spaceintegral( (dm/dt**2  )))

    No space integral is needed because we are working with 0D LLG.
    """

    Ms = mag_params.Ms
    dt = t_end - t_start

    # Estimate dEnergy / dTime
    dE = llg_state_energy(sph_end, mag_params) \
        - llg_state_energy(sph_start, mag_params)
    dEdt = dE / dt

    # Estimate dMagentisation / dTime then take sum of squares
    dm = [m2 - m1 for m1, m2 in
          zip(utils.sph2cart(sph_start), utils.sph2cart(sph_end))]
    dmdt_sq_sum = sum([(dm_i / dt)**2 for dm_i in dm])

    # dE should be negative so the result should be positive.
    return - (1/(Ms**2)) * (dEdt / dmdt_sq_sum)
def test_dfdm():

    ms = [utils.sph2cart([1.0, 0.0, pi/18]),
          utils.sph2cart([1.0, 0.0, 0.0001*pi]),
          utils.sph2cart([1.0, 0.0, 0.999*pi]),
          utils.sph2cart([1.0, 0.3*2*pi, 0.5*pi]),
          utils.sph2cart([1.0, 2*pi, pi/18]),
          ]

    for m in ms:
        yield check_dfdm, m
Exemple #4
0
def test_dfdm():

    ms = [
        utils.sph2cart([1.0, 0.0, pi / 18]),
        utils.sph2cart([1.0, 0.0, 0.0001 * pi]),
        utils.sph2cart([1.0, 0.0, 0.999 * pi]),
        utils.sph2cart([1.0, 0.3 * 2 * pi, 0.5 * pi]),
        utils.sph2cart([1.0, 2 * pi, pi / 18]),
    ]

    for m in ms:
        yield check_dfdm, m
Exemple #5
0
def zeeman_energy(sph, mag_params):
    """ Ez = - mu0 * (M.Happ)
    """
    Ms = mag_params.Ms
    Happ = mag_params.Hvec
    mu0 = mag_params.mu0

    m = utils.sph2cart(sph)
    return -1 * mu0 * Ms * sp.dot(m, Happ)
def zeeman_energy(sph, mag_params):
    """ Ez = - mu0 * (M.Happ)
    """
    Ms = mag_params.Ms
    Happ = mag_params.Hvec
    mu0 = mag_params.mu0

    m = utils.sph2cart(sph)
    return -1 * mu0 * Ms * sp.dot(m, Happ)
def test_llg_residuals():
    m0_sph = [0.0, pi/18]
    m0_cart = utils.sph2cart(tuple([1.0] + m0_sph))
    # m0_constrained = list(m0_cart) + [None]  # ??ds

    residuals = [(llg_cartesian_residual, m0_cart),
                 #(llg_spherical_residual, m0_sph),
                 # (llg_constrained_cartesian_residual, m0_constrained),
                 ]

    for r, i in residuals:
        yield check_residual, r, i
Exemple #8
0
def test_llg_residuals():
    m0_sph = [0.0, pi / 18]
    m0_cart = utils.sph2cart(tuple([1.0] + m0_sph))
    # m0_constrained = list(m0_cart) + [None]  # ??ds

    residuals = [
        (llg_cartesian_residual, m0_cart),
        #(llg_spherical_residual, m0_sph),
        # (llg_constrained_cartesian_residual, m0_constrained),
    ]

    for r, i in residuals:
        yield check_residual, r, i
Exemple #9
0
def magnetocrystalline_anisotropy_energy(sph, mag_params):
    """ Eca = K1 (m.e)^2"""
    K1 = mag_params.K1
    m_cart = utils.sph2cart(sph)
    return K1 * (1 - sp.dot(m_cart, mag_params.easy_axis)**2)
def magnetocrystalline_anisotropy_energy(sph, mag_params):
    """ Eca = K1 (m.e)^2"""
    K1 = mag_params.K1
    m_cart = utils.sph2cart(sph)
    return K1 * (1 - sp.dot(m_cart, mag_params.easy_axis)**2)