Пример #1
0
def test_axs_is_list_when_single_dos_passed():
    single_dos = [[DosBySpinEnergy("", [total_up, total_down])]]
    dos_info = DosPlotData(relative_energies=relative_energies,
                           doses=single_dos, names=["total"], energy_range=xlim,
                           dos_ranges=ylim_set, energy_lines=[0.0, 1.0])
    plotter = DosPlotter(dos_plot_data=dos_info)
    assert isinstance(plotter._axs, list)
    assert len(plotter._axs) == 1
Пример #2
0
def test_scissor_energy(pdos_list):
    dos_data = DosData(energies=[0.0, 0.5, 1.0],
                       total=np.array([[4, 0, 5], [4, 0, 5]]),
                       pdos=pdos_list,
                       base_energy=0.0,
                       vertical_lines=[0.0, 1.0])
    actual = scissor_energy(
        dos_data.dos_plot_data(grouped_atom_indices={"H": [0]}),
        energy_shift=1.0)
    assert actual.relative_energies == [0.0, 1.5, 2.0]
    assert actual.doses[0][0] == DosBySpinEnergy(name="",
                                                 dos=[[4, 0, 5], [4, 0, 5]])
    assert actual.energy_lines == [0.0, 2.0]
Пример #3
0
relative_energies = [i for i in range(-5, 6)]

total_up = [0.0] * 2 + [2] * 2 + [4] * 4 + [2] * 2 + [0]
total_down = [0.0] * 4 + [6] * 6 + [0]
h_s_up = [0.0] * 2 + [2] * 8 + [0]
h_s_down = [0.0] * 4 + [1] * 6 + [0]
h_p_up = [0.0] * 2 + [3] * 8 + [0]
h_p_down = [0.0] * 3 + [2] * 7 + [0]

xlim = [-6, 6]
ylim_set = [[-10, 10], [-5, 5]]
colors = DosMplSettings().colors


doses = [[DosBySpinEnergy("", [total_up, total_down])],
         [DosBySpinEnergy("s", np.array([h_s_up, h_s_down])),
          DosBySpinEnergy("p", np.array([h_p_up, h_p_down]))]]

dos_plot_data = DosPlotData(relative_energies=relative_energies,
                            doses=doses,
                            names=["total", "H"],
                            energy_range=xlim,
                            dos_ranges=ylim_set,
                            energy_lines=[0.0, 1.0])
dos_data_len = len(dos_plot_data.doses)


def test_dos_plot_data_msonable():
    assert_msonable(dos_plot_data)
Пример #4
0
def test_dos_by_spin_energy():
    dos = DosBySpinEnergy(name="test", dos=[[-3, -2, -1, 0], [1, 2, 3, 4]])
    mask = [True, False, False, True]
    assert dos.max_dos(mask) == 3.0
Пример #5
0
def test_orbital_dos():
    total_up = [0, 1]
    total_down = [2, 3]
    total_array = [total_up, total_down]
    orbital_dos = DosBySpinEnergy("total", total_array)
    assert orbital_dos.max_dos() == max([max(total_up), max(total_down)])