コード例 #1
0
ファイル: plot_band.py プロジェクト: toyamanya/vise
    def make_band_plot_info(self):
        bs_plotter = BSPlotter(self.bs)
        plot_data = bs_plotter.bs_plot_data(zero_to_efermi=False)
        distances = [list(d) for d in plot_data["distances"]]
        self._composition = self.vasprun.final_structure.composition

        band_info = [BandInfo(band_energies=self._remove_spin_key(plot_data),
                              band_edge=self._band_edge(self.bs, plot_data),
                              fermi_level=self.bs.efermi)]

        if self.vasprun2:
            bs2 = self.vasprun2.get_band_structure(self.kpoints_filename,
                                                   line_mode=True)
            plot_data2 = BSPlotter(bs2).bs_plot_data(zero_to_efermi=False)
            band_info.append(
                BandInfo(band_energies=self._remove_spin_key(plot_data2),
                         band_edge=self._band_edge(bs2, plot_data2),
                         fermi_level=self.bs.efermi))

        x = bs_plotter.get_ticks_old()
        x_ticks = XTicks(_sanitize_labels(x["label"]), x["distance"])

        return BandPlotInfo(band_info_set=band_info,
                            distances_by_branch=distances,
                            x_ticks=x_ticks,
                            title=self._title)
コード例 #2
0
ファイル: test_plot_band.py プロジェクト: toyamanya/vise
def mock_two_bands_plt_axis(two_band_set, mocker):
    mock_plt = mocker.patch("vise.analyzer.plot_band.plt", auto_spec=True)
    mock_axis = MagicMock()
    mock_plt.gca.return_value = mock_axis
    band_plot_info = BandPlotInfo(two_band_set, distances, x_ticks, title)
    plotter = BandPlotter(band_plot_info, y_range)
    plotter.construct_plot()
    return mock_plt, mock_axis
コード例 #3
0
def test_band_plot_info_add(band_plot_info, band_info_set):
    band_plot_info_2 = BandPlotInfo(band_info_set, distances, x_ticks, "a")
    added = band_plot_info + band_plot_info_2
    assert added.band_info_set[0] == band_info_set[0]
    assert added.band_info_set[1] == band_info_set[0]
    assert added.distances_by_branch == distances
    assert added.x_ticks == x_ticks
    assert added.title == title  # title is set to the original one.
コード例 #4
0
ファイル: test_plot_band.py プロジェクト: toyamanya/vise
def band_plot_info(band_info_set):
    return BandPlotInfo(band_info_set, distances, x_ticks, title)
コード例 #5
0
ファイル: test_plot_band.py プロジェクト: toyamanya/vise
def test_draw_two_bands(two_band_set):
    band_plot_info = BandPlotInfo(two_band_set, distances, x_ticks, title)
    band_plotter = BandPlotter(band_plot_info, y_range)
    band_plotter.construct_plot()
    band_plotter.plt.show()