示例#1
0
文件: pipe.py 项目: wes-amat/ase
def main():
    import matplotlib.pyplot as plt
    stdin = sys.stdin
    if sys.version_info[0] == 3:
        stdin = stdin.buffer
    task, data = pickle.load(stdin)
    if task == 'eos':
        from ase.eos import plot
        plot(*data)
    elif task == 'neb':
        from ase.neb import plot_band_from_fit
        plot_band_from_fit(*data)
    elif task == 'reciprocal':
        from ase.dft.bz import bz_plot
        bz_plot(**data)
    elif task == 'graph':
        from ase.gui.graphs import make_plot
        make_plot(show=False, *data)
    else:
        print('Invalid task {}'.format(task))
        sys.exit(17)

    # Magic string to tell GUI that things went okay:
    print('GUI:OK')
    sys.stdout.close()

    plt.show()
示例#2
0
    def plot(self, dimension=3, **plotkwargs):
        """Visualize this bandpath.

        Plots the irreducible Brillouin zone and this bandpath."""
        import ase.dft.bz as bz

        special_points = self.special_points
        labelseq, coords = resolve_kpt_path_string(self.path,
                                                   special_points)

        paths = []
        points_already_plotted = set()
        for subpath_labels, subpath_coords in zip(labelseq, coords):
            subpath_coords = np.array(subpath_coords)
            points_already_plotted.update(subpath_labels)
            paths.append((subpath_labels, self._scale(subpath_coords)))

        # Add each special point as a single-point subpath if they were
        # not plotted already:
        for label, point in special_points.items():
            if label not in points_already_plotted:
                paths.append(([label], [self._scale(point)]))

        kw = {'vectors': True}
        kw.update(plotkwargs)
        return bz.bz_plot(self.cell, paths=paths,
                          points=self.cartesian_kpts(),
                          pointstyle={'marker': '.'},
                          **kw)
示例#3
0
def main():
    import matplotlib.pyplot as plt
    task, data = pickle.load(sys.stdin.buffer)
    if task == 'eos':
        from ase.eos import plot
        plot(*data)
    elif task == 'neb':
        forcefit = data
        forcefit.plot()
    elif task == 'reciprocal':
        from ase.dft.bz import bz_plot
        bz_plot(**data)
    elif task == 'graph':
        from ase.gui.graphs import make_plot
        make_plot(show=False, *data)
    else:
        print('Invalid task {}'.format(task))
        sys.exit(17)

    # Magic string to tell GUI that things went okay:
    print('GUI:OK')
    sys.stdout.close()

    plt.show()