How to use the micromagneticmodel.examples 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 / oommf / oommf.py View on Github external
If ``0``, the OOMMF is found and running. Otherwise, ``1`` is returned.

    Examples
    --------
    1. Checking the OOMMF status.

    >>> import oommfc as oc
    ...
    >>> oc.oommf.status()
    Running OOMMF...
    OOMMF found and running.
    0

    """
    system = mm.examples.macrospin()
    try:
        td = oc.TimeDriver()
        td.drive(system, t=1e-12, n=1)
        print('OOMMF found and running.')
        return 0
    except (EnvironmentError, RuntimeError):
        print('Cannot find OOMMF.')
        return 1
github ubermag / oommfc / oommfc / oommf / oommf.py View on Github external
The time difference (overhead) between running OOMMF though ``oommfc``
      and directly.

    Examples
    --------
    1. Getting the overhead time.

    >>> import oommfc as oc
    ...
    >>> isinstance(oc.oommf.overhead(), float)
    Running OOMMF...
    True

    """
    # Running OOMMF through oommfc.
    system = mm.examples.macrospin()
    td = oc.TimeDriver()
    oommfc_start = time.time()
    td.drive(system, t=1e-12, n=1, save=True, overwrite=True)
    oommfc_stop = time.time()
    oommfc_time = oommfc_stop - oommfc_start

    # Running OOMMF directly.
    oommf_runner = get_oommf_runner()
    mifpath = os.path.realpath(os.path.join(system.name,
                                            'drive-0',
                                            'macrospin.mif'))
    oommf_start = time.time()
    oommf_runner.call(mifpath)
    oommf_stop = time.time()
    oommf_time = oommf_stop - oommf_start
    oc.delete(system)