Skip to content

Commit

Permalink
add band example
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Jul 15, 2023
1 parent aeb35de commit dbc6bbe
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
43 changes: 43 additions & 0 deletions examples/ex05-band-al.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from ase.build import bulk, fcc111
from ase.visualize import view
from xespresso import Espresso
import matplotlib.pyplot as plt


atoms = fcc111("Al", size=(1, 1, 2), vacuum=4.0)
pseudopotentials = {
"Al": "Al.pbe-n-rrkjus_psl.1.0.0.UPF",
}
calc = Espresso(
pseudopotentials=pseudopotentials,
label="scf/al",
ecutwfc=40,
occupations="smearing",
degauss=0.01,
kpts=(4, 4, 1),
debug=True,
)
atoms.calc = calc
e = atoms.get_potential_energy()
calc.read_results()
e = calc.results["energy"]
fermi_energy = calc.get_fermi_level()
print("Energy: {0:1.3f}".format(e))
# ===============================================================================
bandpath = atoms.cell.bandpath()
calc = Espresso(
calculation="bands",
label="scf/al",
pseudopotentials=pseudopotentials,
ecutwfc=40,
occupations="smearing",
degauss=0.01,
kpts=bandpath,
debug=True,
)
atoms.calc = calc
calc.run(atoms)
# =================================================
bs = calc.band_structure()
bs.reference = fermi_energy
bs.plot()
1 change: 1 addition & 0 deletions xespresso/xespresso.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ def read_results(self):
except Exception as e:
logger.debug("Read output: %s, failed! %s" % (pwo, e))
self.results["convergence"] = convergence
self.results["label"] = self.label
# logger.debug('Read result failed!')
# pwos = [file for file in os.listdir(self.directory) if pwo in file]
# output = None
Expand Down

0 comments on commit dbc6bbe

Please sign in to comment.