File: pipe.py

package info (click to toggle)
python-ase 3.21.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,936 kB
  • sloc: python: 122,428; xml: 946; makefile: 111; javascript: 47
file content (32 lines) | stat: -rw-r--r-- 702 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pickle
import sys


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()


if __name__ == '__main__':
    main()