BUG: Espresso: band structure fails (only Gamma)
Checklist
- I use ASE 3.24 and Python 3.13 on a Debian 13 Trixie system
- I previously used ASE 3.22 and Python 3.11 on Debian 3.11
Summary
I have widely used electronic band structure calculations with the Espresso calculator, with ASE 3.22.
All went smoothly with kpts given as grid sampling tuple, band path and HKL lists.
I can't seem to find a way to produce the same with ASE 3.24.
Script is given below, as well as error message.
Details
Espresso does not anymore support the set method for setting kpts, so I create an immutable calculator with kpts=(11,11,11).
Then I launch the band_structure method, but the Espresso calculator does not support this method (ends with error message).
So I switch to ase.spectrum.band_structure.get_band_structure.
PropertyNotPresent: ibz_kpoints
Many thanks, Emmanuel.
The full script ase_qe I use for this example is:
from ase.build import bulk
from ase.calculators.espresso import Espresso, EspressoProfile
pseudopotentials = {"Na": "na_pbe_v1.5.uspp.F.UPF", "Cl": "cl_pbe_v1.4.uspp.F.UPF"}
atoms = bulk('NaCl', crystalstructure='rocksalt', a=6.0)
profile = EspressoProfile(command='/usr/bin/pw.x', pseudo_dir='/usr/share/espresso/pseudo/')
# add bandpath
kpts={'path': 'GXWLGK', 'npoints': 200}
input_data = {
'system': {'ecutwfc': 60, 'ecutrho': 480},
'disk_io': 'low', # Automatically put into the 'control' section
'kpts': kpts,
}
calc = Espresso(
profile=profile,
pseudopotentials=pseudopotentials,
tstress=True, # deprecated, put in input_data
tprnfor=True, # deprecated, put in input_data
input_data=input_data,
)
atoms.calc = calc
# bs = atoms.calc.band_structure() fails...
from ase.spectrum.band_structure import get_band_structure
bs = get_band_structure(calc=atoms.calc)
bs.plot(emin=0, emax=20, filename='bs.png')
The error message:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/ase/calculators/abc.py", line 77, in _get
return dct[name]
~~~^^^^^^
KeyError: 'ibz_kpoints'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/farhi/./ase_qe.py", line 52, in <module>
bs = get_band_structure(calc=atoms.calc)
File "/usr/lib/python3/dist-packages/ase/spectrum/band_structure.py", line 101, in get_band_structure
kpts = calc.get_ibz_k_points()
File "/usr/lib/python3/dist-packages/ase/calculators/abc.py", line 85, in get_ibz_k_points
return self._get('ibz_kpoints')
~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/ase/calculators/abc.py", line 79, in _get
raise PropertyNotPresent(name)
ase.calculators.calculator.PropertyNotPresent: ibz_kpoints