コード例 #1
0
import joommfutil.typesystem as ts
from .energyterm import EnergyTerm


@ts.typesystem(name=ts.Name(const=True))
class Demag(EnergyTerm):
    _latex = (r'$-\frac{1}{2}\mu_{0}M_\text{s}'
              r'\mathbf{m} \cdot \mathbf{H}_\text{d}$')

    def __init__(self, name='demag'):
        """Abstract demagnetisation energy class."""
        self.name = name

    @property
    def _repr(self):
        """A representation string property.

        Returns:
           A representation string.

        """
        return 'Demag(name=\'{}\')'.format(self.name)
コード例 #2
0
import joommfutil.typesystem as ts
from .dynamicsterm import DynamicsTerm


@ts.typesystem(alpha=ts.Scalar(unsigned=True), name=ts.Name(const=True))
class Damping(DynamicsTerm):
    _latex = (r'$\alpha \mathbf{m} \times'
              r'\frac{\partial \mathbf{m}}{\partial t}$')

    def __init__(self, alpha, name='damping'):
        """A damping dynamics term class.

        Args:
            alpha (Real): Gilbert damping

        """
        self.alpha = alpha
        self.name = name

    @property
    def _repr(self):
        """A representation string property.

        Returns:
           A representation string.

        """
        return 'Damping(alpha={}, name=\'{}\')'.format(self.alpha, self.name)
コード例 #3
0
ファイル: stt.py プロジェクト: talekarpm1/micromagneticmodel
import joommfutil.typesystem as ts
from .dynamicsterm import DynamicsTerm


@ts.typesystem(u=ts.Vector(size=3), beta=ts.Scalar, name=ts.Name(const=True))
class STT(DynamicsTerm):
    _latex = (r'$-(\mathbf{u} \cdot \boldsymbol\nabla)\mathbf{m} + '
              r'\beta\mathbf{m} \times \big[(\mathbf{u} \cdot '
              r'\boldsymbol\nabla)\mathbf{m}\big]$')

    def __init__(self, u, beta, name='stt'):
        """A spin transfer torque term.

        Args:
            u (RealVector): velocity vector
            beta (Real): non-adiabatic parameter

        """
        self.u = u
        self.beta = beta
        self.name = name

    @property
    def _repr(self):
        """A representation string property.

        Returns:
           A representation string.

        """
        return ('STT(u={}, beta={}, '
コード例 #4
0
ファイル: field.py プロジェクト: gamdow/discretisedfield
import pyvtk
import struct
import numpy as np
import joommfutil.typesystem as ts
import discretisedfield as df
import discretisedfield.util as dfu
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable


@ts.typesystem(mesh=ts.Typed(expected_type=df.Mesh),
               dim=ts.Scalar(expected_type=int, unsigned=True, const=True),
               name=ts.Name(const=True))
class Field(dfu.Field):
    """Finite difference field

    This class defines a finite difference field and provides some
    basic operations. The field is defined on a finite difference mesh
    (`discretisedfield.Mesh`).

    Parameters
    ----------
    mesh : discretisedfield.Mesh
        Finite difference rectangular mesh on which the field is defined.
    dim : int, optional
        Dimension of the field value. For instance, if ``dim=3``
        the field is three-dimensional vector field; and for
        ``dim=1`` it is a scalar field.
    value : 0, array_like, callable, optional
        For more details, please refer to the `value` property.
    norm : numbers.Real, callable, optional
コード例 #5
0
import joommfutil.typesystem as ts
from .energyterm import EnergyTerm


@ts.typesystem(H=ts.Vector(size=3), name=ts.Name(const=True))
class Zeeman(EnergyTerm):
    _latex = r'$-\mu_{0}M_\text{s} \mathbf{m} \cdot \mathbf{H}$'

    def __init__(self, H, name='zeeman'):
        """A Zeeman energy class.

        This method internally calls set_H method. Refer to its documentation.

        """
        self.H = H
        self.name = name

    @property
    def _repr(self):
        """A representation string property.

        Returns:
           A representation string.

        """
        return 'Zeeman(H={}, name=\'{}\')'.format(self.H, self.name)