Ejemplo n.º 1
0
 def setUp(self):
     self.kwargs = {
         "poscar_filename": get_path("CONTCAR.relax1.gz"),
         "locpot_filename": get_path("LOCPOT.gz"),
         "outcar_filename": get_path("OUTCAR.relax1.gz"),
     }
     self.wf_analyzer = WorkFunctionAnalyzer.from_files(**self.kwargs)
Ejemplo n.º 2
0
def wf(directory, plot_potential=False):

    directory = os.path.abspath(directory)

    wf_analyzer = WorkFunctionAnalyzer.from_files(
        poscar_filename=os.path.join(directory, "POSCAR"),
        locpot_filename=os.path.join(directory, "LOCPOT"),
        outcar_filename=os.path.join(directory, "OUTCAR")
    )

    if plot_potential:
        wf_analyzer.get_locpot_along_slab_plot().show()
        pass #TODO Finish this part

    work_function = wf_analyzer.work_function
    print("Work function = " + str(work_function) + " eV")
Ejemplo n.º 3
0
 def test_shift(self):
     wf_analyzer_shift = WorkFunctionAnalyzer.from_files(shift=-0.25, blength=3.7, **self.kwargs)
     self.assertEqual("%.f" % (self.wf_analyzer.ave_bulk_p),
                      "%.f" % (wf_analyzer_shift.ave_bulk_p))
Ejemplo n.º 4
0
 def test_attributes(self):
     wf_analyzer_shift = WorkFunctionAnalyzer.from_files(shift=0.25, **self.kwargs)
     self.assertEqual("%.1f" %(self.wf_analyzer.ave_bulk_p),
                      "%.1f" %(wf_analyzer_shift.ave_bulk_p))
Ejemplo n.º 5
0
    def setUp(self):

        self.kwargs = {"poscar_filename": get_path("CONTCAR.relax1.gz"),
                       "locpot_filename": get_path("LOCPOT.gz"),
                       "outcar_filename": get_path("OUTCAR.relax1.gz")}
        self.wf_analyzer = WorkFunctionAnalyzer.from_files(**self.kwargs)
Ejemplo n.º 6
0
 def test_attributes(self):
     wf_analyzer_shift = WorkFunctionAnalyzer.from_files(shift=0.25, **self.kwargs)
     self.assertEqual("%.1f" %(self.wf_analyzer.ave_bulk_p),
                      "%.1f" %(wf_analyzer_shift.ave_bulk_p))
Ejemplo n.º 7
0
v = Vasprun('vasprun.xml')
cdos = v.complete_dos
element_dos = cdos.get_element_dos()
plotter = DosPlotter()
efermi = v.efermi

if options.verbose:
    from pymatgen.core import Element
    from pymatgen.io.vasp.outputs import Locpot, Poscar
    from pymatgen.analysis.surface_analysis import WorkFunctionAnalyzer

    l = Locpot.from_file('LOCPOT')
    s = Poscar.from_file('CONTCAR')

    wf = WorkFunctionAnalyzer(s.structure,
                              l.get_average_along_axis(1),
                              efermi,
                              shift=0)
    loc_vac = wf.vacuum_locpot

    for i in element_dos:
        element_dos[i].efermi = loc_vac

    plotter.add_dos_dict(element_dos)
    plt = plotter.get_plot(xlim=[-9, 1])
    plt.plot([efermi - loc_vac, efermi - loc_vac],
             plt.ylim(),
             'b--',
             linewidth=2,
             label='EF')

    plt.xlabel('Energies - Vac(eV)')
Ejemplo n.º 8
0
 def test_plt(self):
     wf_analyzer = WorkFunctionAnalyzer.from_files(**self.kwargs)
     plt = wf_analyzer.get_locpot_along_slab_plot()
     self.assertEqual(type(plt).__name__, "module")
Ejemplo n.º 9
0
 def test_plt(self):
     wf_analyzer = WorkFunctionAnalyzer.from_files(**self.kwargs)
     plt = wf_analyzer.get_locpot_along_slab_plot()
     self.assertEqual(type(plt).__name__, "module")
Ejemplo n.º 10
0
 def test_shift(self):
     wf_analyzer_shift = WorkFunctionAnalyzer.from_files(shift=-0.25, blength=3.7, **self.kwargs)
     self.assertAlmostEqual(self.wf_analyzer.ave_bulk_p, wf_analyzer_shift.ave_bulk_p, places=0)
Ejemplo n.º 11
0
 def test_shift(self):
     wf_analyzer_shift = WorkFunctionAnalyzer.from_files(shift=-0.25, blength=3.7, **self.kwargs)
     self.assertEqual("%.f" %(self.wf_analyzer.ave_bulk_p),
                      "%.f" %(wf_analyzer_shift.ave_bulk_p))