@staticmethod
def get_magnetization(filename='OUTCAR', lines=None):
    '\n        Gets the magnetization\n\n        Args:\n            filename (str): Filename of the OUTCAR file to parse\n            lines (list/None): lines read from the file\n\n        Returns:\n            list: A list with the mgnetization values\n        '
    ionic_trigger = 'FREE ENERGIE OF THE ION-ELECTRON SYSTEM (eV)'
    electronic_trigger = 'eigenvalue-minimisations'
    nion_trigger = 'NIONS ='
    mag_lst = list()
    local_spin_trigger = False
    n_atoms = None
    mag_dict = dict()
    mag_dict['x'] = list()
    mag_dict['y'] = list()
    mag_dict['z'] = list()
    lines = _get_lines_from_file(filename=filename, lines=lines)
    istep_energies = list()
    final_magmom_lst = list()
    for (i, line) in enumerate(lines):
        line = line.strip()
        if (ionic_trigger in line):
            mag_lst.append(np.array(istep_energies))
            istep_energies = list()
        if ('Atomic Wigner-Seitz radii' in line):
            local_spin_trigger = True
        if (electronic_trigger in line):
            try:
                line = lines[(i + 2)].split('magnetization')[(- 1)]
                if (line != ' \n'):
                    spin_str_lst = line.split()
                    spin_str_len = len(spin_str_lst)
                    if (spin_str_len == 1):
                        ene = float(line)
                    elif (spin_str_len == 3):
                        ene = [float(spin_str_lst[0]), float(spin_str_lst[1]), float(spin_str_lst[2])]
                    else:
                        warnings.warn('Unrecognized spin configuration.')
                        return (mag_lst, final_magmom_lst)
                    istep_energies.append(ene)
            except ValueError:
                warnings.warn('Something went wrong in parsing the magnetization')
        if (n_atoms is None):
            if (nion_trigger in line):
                n_atoms = int(line.split(nion_trigger)[(- 1)])
        if local_spin_trigger:
            try:
                for (ind_dir, direc) in enumerate(['x', 'y', 'z']):
                    if ('magnetization ({})'.format(direc) in line):
                        mag_dict[direc].append([float(lines[((i + 4) + atom_index)].split()[(- 1)]) for atom_index in range(n_atoms)])
            except ValueError:
                warnings.warn('Something went wrong in parsing the magnetic moments')
    if (len(mag_dict['x']) > 0):
        if (len(mag_dict['y']) == 0):
            final_mag = np.array(mag_dict['x'])
        else:
            n_ionic_steps = np.array(mag_dict['x']).shape[0]
            final_mag = np.abs(np.zeros((n_ionic_steps, n_atoms, 3)))
            final_mag[:, :, 0] = np.array(mag_dict['x'])
            final_mag[:, :, 1] = np.array(mag_dict['y'])
            final_mag[:, :, 2] = np.array(mag_dict['z'])
        final_magmom_lst = final_mag.tolist()
    return (mag_lst, final_magmom_lst)
Gets the magnetization

Args:
    filename (str): Filename of the OUTCAR file to parse
    lines (list/None): lines read from the file

Returns:
    list: A list with the mgnetization values
@staticmethod
def get_magnetization(filename='OUTCAR', lines=None):
    '\n        Gets the magnetization\n\n        Args:\n            filename (str): Filename of the OUTCAR file to parse\n            lines (list/None): lines read from the file\n\n        Returns:\n            list: A list with the mgnetization values\n        '
    ionic_trigger = 'FREE ENERGIE OF THE ION-ELECTRON SYSTEM (eV)'
    electronic_trigger = 'eigenvalue-minimisations'
    nion_trigger = 'NIONS ='
    mag_lst = list()
    local_spin_trigger = False
    n_atoms = None
    mag_dict = dict()
    mag_dict['x'] = list()
    mag_dict['y'] = list()
    mag_dict['z'] = list()
    lines = _get_lines_from_file(filename=filename, lines=lines)
    istep_energies = list()
    final_magmom_lst = list()
    for (i, line) in enumerate(lines):
        line = line.strip()
        if (ionic_trigger in line):
            mag_lst.append(np.array(istep_energies))
            istep_energies = list()
        if ('Atomic Wigner-Seitz radii' in line):
            local_spin_trigger = True
        if (electronic_trigger in line):
            try:
                line = lines[(i + 2)].split('magnetization')[(- 1)]
                if (line != ' \n'):
                    spin_str_lst = line.split()
                    spin_str_len = len(spin_str_lst)
                    if (spin_str_len == 1):
                        ene = float(line)
                    elif (spin_str_len == 3):
                        ene = [float(spin_str_lst[0]), float(spin_str_lst[1]), float(spin_str_lst[2])]
                    else:
                        warnings.warn('Unrecognized spin configuration.')
                        return (mag_lst, final_magmom_lst)
                    istep_energies.append(ene)
            except ValueError:
                warnings.warn('Something went wrong in parsing the magnetization')
        if (n_atoms is None):
            if (nion_trigger in line):
                n_atoms = int(line.split(nion_trigger)[(- 1)])
        if local_spin_trigger:
            try:
                for (ind_dir, direc) in enumerate(['x', 'y', 'z']):
                    if ('magnetization ({})'.format(direc) in line):
                        mag_dict[direc].append([float(lines[((i + 4) + atom_index)].split()[(- 1)]) for atom_index in range(n_atoms)])
            except ValueError:
                warnings.warn('Something went wrong in parsing the magnetic moments')
    if (len(mag_dict['x']) > 0):
        if (len(mag_dict['y']) == 0):
            final_mag = np.array(mag_dict['x'])
        else:
            n_ionic_steps = np.array(mag_dict['x']).shape[0]
            final_mag = np.abs(np.zeros((n_ionic_steps, n_atoms, 3)))
            final_mag[:, :, 0] = np.array(mag_dict['x'])
            final_mag[:, :, 1] = np.array(mag_dict['y'])
            final_mag[:, :, 2] = np.array(mag_dict['z'])
        final_magmom_lst = final_mag.tolist()
    return (mag_lst, final_magmom_lst)