def __init__(self, moment, saxis=(0, 0, 1)):
        """
        :param moment: magnetic moment, supplied as float or list/np.ndarray
        :param saxis: spin axis, supplied as list/np.ndarray, parameter will
        be converted to unit vector (default is [0, 0, 1])
        :return: Magmom object
        """
        # to init from another Magmom instance
        if isinstance(moment, Magmom):
            saxis = moment.saxis
            moment = moment.moment

        moment = np.array(moment, dtype='d')
        if moment.ndim == 0:
            moment = moment * [0, 0, 1]

        self.moment = moment

        saxis = np.array(saxis, dtype='d')

        self.saxis = saxis / np.linalg.norm(saxis)
def __init__ ( self , moment , saxis = ( 0 , 0 , 1 ) ) : if isinstance ( moment , Magmom ) : saxis = moment . saxis moment = moment . moment moment = np . array ( moment , dtype = 'd' ) if moment . ndim == 0 : moment = moment * [ 0 , 0 , 1 ] self . moment = moment saxis = np . array ( saxis , dtype = 'd' ) self . saxis = saxis / np . linalg . norm ( saxis )
:param moment: magnetic moment, supplied as float or list/np.ndarray
        :param saxis: spin axis, supplied as list/np.ndarray, parameter will
        be converted to unit vector (default is [0, 0, 1])
        :return: Magmom object