How to use the oommfc.SpinXferEvolver function in oommfc

To help you get started, we’ve selected a few oommfc 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 += 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:
            driver.evolver.do_precess = 0
        if mm.Damping() in system.dynamics:
            driver.evolver.alpha = system.dynamics.damping.alpha
github ubermag / oommfc / oommfc / scripts / evolver.py View on Github external
eps_primemif, eps_primename = oc.scripts.setup_scalar_parameter(
            evolver.eps_prime, 'sl_eps_prime')
        evolver.eps_prime = eps_primename
        mif += eps_primemif

    # Scripts for a specific evolver.
    if isinstance(evolver, oc.EulerEvolver):
        mif += '# EulerEvolver\n'
        mif += 'Specify Oxs_EulerEvolve:evolver {\n'
    elif isinstance(evolver, oc.RungeKuttaEvolver):
        mif += '# RungeKuttaEvolver\n'
        mif += 'Specify Oxs_RungeKuttaEvolve:evolver {\n'
    elif isinstance(evolver, oc.SpinTEvolver):
        mif += '# Zhang-Li evolver\n'
        mif += 'Specify Anv_SpinTEvolve:evolver {\n'
    elif isinstance(evolver, oc.SpinXferEvolver):
        mif += '# Slonczewski evolver\n'
        mif += 'Specify Oxs_SpinXferEvolve:evolver {\n'
    elif isinstance(evolver, oc.CGEvolver):
        mif += '# CGEvolver\n'
        mif += 'Specify Oxs_CGEvolve:evolver {\n'

    # Define all other parameters.
    for attr, value in evolver:
        mif += f'  {attr} {value}\n'
    mif += '}\n\n'

    return mif