How to use the micromagneticmodel.ZhangLi function in micromagneticmodel

To help you get started, we’ve selected a few micromagneticmodel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ubermag / oommfc / oommfc / scripts / driver.py View on Github external
mif += '  m0 :m0\n'
        for attr, value in driver:
            if attr != 'evolver':
                mif += f'  {attr} {value}\n'
        mif += '}\n\n'

        # Saving results.
        mif += 'Destination table mmArchive\n'
        mif += 'Destination mags mmArchive\n\n'
        mif += 'Schedule DataTable table Stage 1\n'
        mif += 'Schedule Oxs_MinDriver::Magnetization mags Stage 1'

    if isinstance(driver, oc.TimeDriver):
        # Check evolver and set default if not passed.
        if not hasattr(driver, 'evolver'):
            if mm.ZhangLi() in system.dynamics:
                driver.evolver = oc.SpinTEvolver()
            elif mm.Slonczewski() in system.dynamics:
                driver.evolver = oc.SpinXferEvolver()
            else:
                driver.evolver = oc.RungeKuttaEvolver()
        elif not isinstance(driver.evolver, (oc.EulerEvolver,
                                             oc.RungeKuttaEvolver,
                                             oc.SpinTEvolver,
                                             oc.SpinXferEvolver)):
            msg = f'Cannot use {type(driver.evolver)} for evolver.'
            raise TypeError(msg)

        # Extract dynamics equation parameters.
        if mm.Precession() in system.dynamics:
            driver.evolver.gamma_G = system.dynamics.precession.gamma0
        else:
github ubermag / oommfc / oommfc / dynamics / zhangli.py View on Github external
import micromagneticmodel as mm


class ZhangLi(mm.ZhangLi):
    """Zhang-Li spin-transfer torque dynamics term.

    This dynamics term models the Zhang-Li spin-transfer-torque term
    in the Landau-Lifshitz-Gilbert equation. It is defined by the
    velocity in the x-direction `u` and the non-adiabatic constant
    `beta`.

    .. math::

           \\frac{\\text{d}\\mathbf{m}}{\\text{d}t} = -(\\mathbf{u}
           \\cdot \\boldsymbol\\nabla)\\mathbf{m} + \\beta\\mathbf{m}
           \\times \\big[(\\mathbf{u} \\cdot
           \\boldsymbol\\nabla)\\mathbf{m}\\big]

    `u` can be either contant in space or spatially varying, whereas
    `beta` can be only constant in space. If `u` is constant, a single