How to use the micromagneticmodel.Data 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 / data.py View on Github external
import os
import glob
import oommfc as oc
import ubermagtable as ut
import discretisedfield as df
import micromagneticmodel as mm


class Data(mm.Data):
    @property
    def effective_field(self):
        _dict = {'Demag': 'Oxs_Demag::Field',
                 'Exchange': 'Oxs_UniformExchange::Field',
                 'UniaxialAnisotropy': 'Oxs_UniaxialAnisotropy::Field',
                 'Zeeman': 'Oxs_FixedZeeman::Field',
                 'Hamiltonian': 'Oxs_RungeKuttaEvolve:evolver:Total field'}

        td = oc.TimeDriver()
        td.drive(self.system, derive=_dict[self.cls])

        dirname = os.path.join(self.system.name,
                               f'drive-{self.system.drive_number-1}')
        ohf_file = max(glob.iglob(os.path.join(dirname, '*.ohf')),
                       key=os.path.getctime)