Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import oommfc as oc
from .driver import Driver
class HysteresisDriver(Driver):
def _script(self, system, **kwargs):
# Save initial magnetisation.
m0filename = 'initial_magnetisation.omf'
system.m.write(m0filename)
meshname = system.m.mesh.name
systemname = system.name
Hmin = kwargs["Hmin"]
Hmax = kwargs["Hmax"]
n = kwargs["n"]
mif = oc.util.mif_file_vector_field(m0filename,
'initial_magnetisation',
'main_atlas')
mif += oc.util.mif_vec_mag_scalar_field('initial_magnetisation',
'initial_magnetisation_norm')
from .driver import Driver
class TimeDriver(Driver):
"""Time driver.
Only attributes in ``_allowed_attributes`` can be defined. For details on
possible values for individual attributes and their default values, please
refer to ``Oxs_TimeDriver`` documentation (https://math.nist.gov/oommf/).
Examples
--------
1. Defining driver with a keyword argument.
>>> import oommfc as oc
...
>>> td = oc.TimeDriver(total_iteration_limit=5)
2. Passing an argument which is not allowed.
from .driver import Driver
class MinDriver(Driver):
"""Energy minimisation driver.
Only attributes in ``_allowed_attributes`` can be defined. For details on
possible values for individual attributes and their default values, please
refer to ``Oxs_MinDriver`` documentation (https://math.nist.gov/oommf/).
Examples
--------
1. Defining driver with a keyword argument.
>>> import oommfc as oc
...
>>> md = oc.MinDriver(stopping_mxHxm=0.01)
2. Passing an argument which is not allowed.