@staticmethod
def get_band_properties(filename='OUTCAR', lines=None):
    fermi_trigger = 'E-fermi'
    (fermi_trigger_indices, lines) = _get_trigger(lines=lines, filename=filename, trigger=fermi_trigger)
    fermi_level_list = list()
    vbm_level_dict = OrderedDict()
    cbm_level_dict = OrderedDict()
    for ind in fermi_trigger_indices:
        fermi_level_list.append(float(lines[ind].strip().split()[2]))
    band_trigger = 'band No.  band energies     occupation'
    is_spin_polarized = False
    for (n, ind) in enumerate(fermi_trigger_indices):
        if (n == (len(fermi_trigger_indices) - 1)):
            (trigger_indices, lines_new) = _get_trigger(lines=lines[ind:(- 1)], filename=filename, trigger=band_trigger)
        else:
            (trigger_indices, lines_new) = _get_trigger(lines=lines[ind:fermi_trigger_indices[(n + 1)]], filename=filename, trigger=band_trigger)
        band_data = list()
        for ind in trigger_indices:
            if ('spin component' in lines_new[(ind - 3)]):
                is_spin_polarized = True
            for line in lines_new[(ind + 1):]:
                data = line.strip().split()
                if (len(data) != 3):
                    break
                band_data.append([float(d) for d in data[1:]])
        if is_spin_polarized:
            band_data_per_spin = [np.array(band_data[0:int((len(band_data) / 2))]).tolist(), np.array(band_data[int((len(band_data) / 2)):]).tolist()]
        else:
            band_data_per_spin = [band_data]
        for (spin, band_data) in enumerate(band_data_per_spin):
            if (spin in cbm_level_dict.keys()):
                pass
            else:
                cbm_level_dict[spin] = list()
            if (spin in vbm_level_dict.keys()):
                pass
            else:
                vbm_level_dict[spin] = list()
            if (len(band_data) > 0):
                (band_energy, band_occ) = [np.array(band_data)[:, i] for i in range(2)]
                args = np.argsort(band_energy)
                band_occ = band_occ[args]
                band_energy = band_energy[args]
                cbm_bool = (np.abs(band_occ) < 1e-06)
                if any(cbm_bool):
                    cbm_level_dict[spin].append(band_energy[(np.abs(band_occ) < 1e-06)][0])
                else:
                    cbm_level_dict[spin].append(band_energy[(- 1)])
                if all(cbm_bool):
                    vbm_level_dict[spin].append(cbm_level_dict[spin][(- 1)])
                else:
                    vbm_level_dict[spin].append(band_energy[(~ cbm_bool)][(- 1)])
    return (np.array(fermi_level_list), np.array([val for val in vbm_level_dict.values()]), np.array([val for val in cbm_level_dict.values()]))
@staticmethod
def get_band_properties(filename='OUTCAR', lines=None):
    fermi_trigger = 'E-fermi'
    (fermi_trigger_indices, lines) = _get_trigger(lines=lines, filename=filename, trigger=fermi_trigger)
    fermi_level_list = list()
    vbm_level_dict = OrderedDict()
    cbm_level_dict = OrderedDict()
    for ind in fermi_trigger_indices:
        fermi_level_list.append(float(lines[ind].strip().split()[2]))
    band_trigger = 'band No.  band energies     occupation'
    is_spin_polarized = False
    for (n, ind) in enumerate(fermi_trigger_indices):
        if (n == (len(fermi_trigger_indices) - 1)):
            (trigger_indices, lines_new) = _get_trigger(lines=lines[ind:(- 1)], filename=filename, trigger=band_trigger)
        else:
            (trigger_indices, lines_new) = _get_trigger(lines=lines[ind:fermi_trigger_indices[(n + 1)]], filename=filename, trigger=band_trigger)
        band_data = list()
        for ind in trigger_indices:
            if ('spin component' in lines_new[(ind - 3)]):
                is_spin_polarized = True
            for line in lines_new[(ind + 1):]:
                data = line.strip().split()
                if (len(data) != 3):
                    break
                band_data.append([float(d) for d in data[1:]])
        if is_spin_polarized:
            band_data_per_spin = [np.array(band_data[0:int((len(band_data) / 2))]).tolist(), np.array(band_data[int((len(band_data) / 2)):]).tolist()]
        else:
            band_data_per_spin = [band_data]
        for (spin, band_data) in enumerate(band_data_per_spin):
            if (spin in cbm_level_dict.keys()):
                pass
            else:
                cbm_level_dict[spin] = list()
            if (spin in vbm_level_dict.keys()):
                pass
            else:
                vbm_level_dict[spin] = list()
            if (len(band_data) > 0):
                (band_energy, band_occ) = [np.array(band_data)[:, i] for i in range(2)]
                args = np.argsort(band_energy)
                band_occ = band_occ[args]
                band_energy = band_energy[args]
                cbm_bool = (np.abs(band_occ) < 1e-06)
                if any(cbm_bool):
                    cbm_level_dict[spin].append(band_energy[(np.abs(band_occ) < 1e-06)][0])
                else:
                    cbm_level_dict[spin].append(band_energy[(- 1)])
                if all(cbm_bool):
                    vbm_level_dict[spin].append(cbm_level_dict[spin][(- 1)])
                else:
                    vbm_level_dict[spin].append(band_energy[(~ cbm_bool)][(- 1)])
    return (np.array(fermi_level_list), np.array([val for val in vbm_level_dict.values()]), np.array([val for val in cbm_level_dict.values()]))