Exemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser(description='''Convenient DOS Plotter for Feff runs.
    Author: Alan Dozier
    Version: 1.0
    Last updated: April, 2013''')

    parser.add_argument('filename', metavar='filename', type=str, nargs=1,
                        help='ldos%% file set to plot')
    parser.add_argument('filename1', metavar='filename1', type=str, nargs=1,
                        help='feff.inp input file ')
    parser.add_argument('-s', '--site', dest='site', action='store_const',
                        const=True, help='plot site projected DOS')
    parser.add_argument('-e', '--element', dest='element', action='store_const',
                        const=True, help='plot element projected DOS')
    parser.add_argument('-o', '--orbital', dest="orbital", action='store_const',
                        const=True, help='plot orbital projected DOS')

    args = parser.parse_args()
    f = FeffLdos.from_file(args.filename1[0], args.filename[0])
    dos = f.complete_dos

    all_dos = OrderedDict()
    all_dos['Total'] = dos

    structure = f.complete_dos.structure

    if args.site:
        for i in xrange(len(structure)):
            site = structure[i]
            all_dos['Site ' + str(i) + " " + site.specie.symbol] = \
                dos.get_site_dos(site)
    if args.element:
        all_dos.update(dos.get_element_dos())
    if args.orbital:
        all_dos.update(dos.get_spd_dos())

    plotter = DosPlotter()
    plotter.add_dos_dict(all_dos)
    plotter.show()
Exemplo n.º 2
0
class FeffLdosTest(unittest.TestCase):

    filepath1 = os.path.join(test_dir, 'feff.inp')
    filepath2 = os.path.join(test_dir, 'ldos')
    l = FeffLdos.from_file(filepath1, filepath2)

    def test_init(self):
        efermi = FeffLdosTest.l.complete_dos.efermi
        self.assertEqual(efermi, -11.430,
                         "Did not read correct Fermi energy from ldos file")

    def test_complete_dos(self):
        complete_dos = FeffLdosTest.l.complete_dos
        self.assertEqual(complete_dos.as_dict()['spd_dos']["s"]['efermi'],
                         -11.430,
                         "Failed to construct complete_dos dict properly")

    def test_as_dict_and_from_dict(self):
        l2 = FeffLdosTest.l.charge_transfer_to_string()
        d = FeffLdosTest.l.as_dict()
        l3 = FeffLdos.from_dict(d).charge_transfer_to_string()
        self.assertEqual(l2, l3, "Feffldos to and from dict does not match")
Exemplo n.º 3
0
Version: 1.0
Last updated: April, 2013''')

parser.add_argument('filename', metavar='filename', type=str, nargs=1,
                    help='ldos%% file set to plot')
parser.add_argument('filename1', metavar='filename1', type=str, nargs=1,
                    help='feff.inp input file ')
parser.add_argument('-s', '--site', dest='site', action='store_const',
                    const=True, help='plot site projected DOS')
parser.add_argument('-e', '--element', dest='element', action='store_const',
                    const=True, help='plot element projected DOS')
parser.add_argument('-o', '--orbital', dest="orbital", action='store_const',
                    const=True, help='plot orbital projected DOS')

args = parser.parse_args()
f = FeffLdos.from_file(args.filename1[0], args.filename[0])
dos = f.complete_dos

all_dos = OrderedDict()
all_dos['Total'] = dos

structure = f.complete_dos.structure

if args.site:
    for i in xrange(len(structure)):
        site = structure[i]
        all_dos['Site ' + str(i) + " " + site.specie.symbol] = \
            dos.get_site_dos(site)
if args.element:
    all_dos.update(dos.get_element_dos())
if args.orbital:
Exemplo n.º 4
0
                    help='plot site projected DOS')
parser.add_argument('-e',
                    '--element',
                    dest='element',
                    action='store_const',
                    const=True,
                    help='plot element projected DOS')
parser.add_argument('-o',
                    '--orbital',
                    dest="orbital",
                    action='store_const',
                    const=True,
                    help='plot orbital projected DOS')

args = parser.parse_args()
f = FeffLdos.from_file(args.filename1[0], args.filename[0])
dos = f.complete_dos

all_dos = OrderedDict()
all_dos['Total'] = dos

structure = f.complete_dos.structure

if args.site:
    for i in xrange(len(structure)):
        site = structure[i]
        all_dos['Site ' + str(i) + " " + site.specie.symbol] = \
            dos.get_site_dos(site)
if args.element:
    all_dos.update(dos.get_element_dos())
if args.orbital: