code: def get_moment_relative_to_crystal_axes(self, lattice):
          
          # get matrix representing unit lattice vectors
          unit_m = lattice.matrix / np.linalg.norm(lattice.matrix, axis=1)[:, None]
          # note np.matmul() requires numpy version >= 1.10
          moment = np.matmul(self.global_moment, np.linalg.inv(unit_m))
          # round small values to zero
          moment[np.abs(moment) < 1e-8] = 0
          return moment
docs: If scalar magmoms, moments will be given arbitrarily along z.
          Used for writing moments to magCIF file.
  
          :param magmom: Magmom
          :param lattice: Lattice
          :return: vector as list of floats