• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

materialsproject / pymatgen / 3970359380

pending completion
3970359380

push

github

GitHub
Unittest2pytest (#2810)

6488 of 6488 new or added lines in 136 files covered. (100.0%)

80578 of 102201 relevant lines covered (78.84%)

0.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pymatgen/cli/feff_plot_dos.py
1
#!/usr/bin/env python
2
# Copyright (c) Pymatgen Development Team.
3
# Distributed under the terms of the MIT License.
4

5
"""
6
Script for plotting cross sections generated by FEFF found in xmu.dat files.
7
"""
8

9
from __future__ import annotations
10

11
import argparse
12

13
from pymatgen.io.feff.outputs import Xmu
14
from pymatgen.util.plotting import pretty_plot
15

16
__author__ = "Alan Dozier"
17
__credits__ = "Anubhav Jain, Shyue Ping Ong"
18
__copyright__ = "Copyright 2012, The Materials Project"
19
__version__ = "1.0.2"
20
__maintainer__ = "Alan Dozier"
21
__email__ = "adozier@uky.edu"
22
__date__ = "April 7, 2013"
23

24

25
def main():
26
    """
27
    Main function.
28
    """
29
    parser = argparse.ArgumentParser(
30
        description="""
31
    Convenient DOS Plotter for Feff runs.
32
    Author: Alan Dozier
33
    Version: 1.0
34
    Last updated: April, 2013"""
35
    )
36

37
    parser.add_argument("filename", metavar="filename", type=str, nargs=1, help="xmu file to plot")
38
    parser.add_argument(
39
        "filename1",
40
        metavar="filename1",
41
        type=str,
42
        nargs=1,
43
        help="feff.inp filename to import",
44
    )
45

46
    plt = pretty_plot(12, 8)
47
    color_order = ["r", "b", "g", "c", "k", "m", "y"]
48

49
    args = parser.parse_args()
50
    xmu = Xmu.from_file(args.filename[0], args.filename1[0])
51

52
    data = xmu.as_dict()
53

54
    plt.title(data["calc"] + " Feff9.6 Calculation for " + data["atom"] + " in " + data["formula"] + " unit cell")
55
    plt.xlabel("Energies (eV)")
56
    plt.ylabel("Absorption Cross-section")
57

58
    x = data["energies"]
59
    y = data["scross"]
60
    tle = "Single " + data["atom"] + " " + data["edge"] + " edge"
61
    plt.plot(x, y, color_order[1 % 7], label=tle)
62

63
    y = data["across"]
64
    tle = data["atom"] + " " + data["edge"] + " edge in " + data["formula"]
65
    plt.plot(x, y, color_order[2 % 7], label=tle)
66

67
    plt.legend()
68
    leg = plt.gca().get_legend()
69
    ltext = leg.get_texts()  # all the text.Text instance in the legend
70
    plt.setp(ltext, fontsize=15)
71
    plt.tight_layout()
72
    plt.show()
73

74

75
if __name__ == "__main__":
76
    main()
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc