[QE-users] run qe nscf calculation using ase

Impact Group impactgroup at proton.me
Wed Jan 4 04:55:07 CET 2023


Dear all,
I am trying to run the QE using ase. A mwe is:
#!/usr/bin/env python

import ase.io as aio
import ase.io.espresso as aie
from ase.calculators.espresso import Espresso
from ase.constraints import ExpCellFilter
from ase.dft.dos import DOS
from ase.optimize import BFGS

structure = aio.read("Fe_mp-13_symmetrized.cif")
pseudolst = {"Fe": "Fe.pbe-spn-kjpaw_psl.1.0.0.UPF"}
for atoms in structure:
atoms.magmom = "3"
input_data = {
"nspin": 2,
"degauss": 0.04,
'occupations': 'smearing',
'smearing': 'gaussian',
}
input_dos = {
"calculation": "nscf",
"occupations": "tetrahedra",
}
kpts_dos = (3, 3, 3)
structure.magmom = '3.0'
calc = Espresso(
pseudopotentials=pseudolst,
tstress=True,
tprnfor=True,
input_data=input_data,
crystal_coordinates=True,
)
structure.calc = calc
ucf = ExpCellFilter(structure)
opt = BFGS(ucf, trajectory="structure.traj", restart="structure.restart")
opt.run(fmax=0.25)
structure.get_potential_energy()
input_data.update(input_dos)
del input_data["smearing"]
del input_data["degauss"]
op = aio.read("structure.traj")
input_data.update(input_dos)
dos_cal = Espresso(pseudopotentials=pseudolst,
input_data=input_data,
kpts=kpts_dos)
op.dos_cal = dos_cal
dos = DOS(dos_cal)
# with open("trial_in", "w") as k:
# aie.write_espresso_in(
# k,
# op,
# pseudopotentials=pseudolst,
# input_data=input_data,
# crystal_coordinates=True,
# kpts=kpts_dos,
# )

# dos = DOS(calc)

While, the relax+scf is working properly, I am getting error in nscf, as:

python mwe.py
/home/rudra/.local/lib/python3.11/site-packages/ase/calculators/espresso.py:170: FutureWarning: Espresso calculator is being restructured. Please use e.g. Espresso(profile=EspressoProfile(argv=['mpiexec', 'pw.x'])) to customize command-line arguments.
warnings.warn(compatibility_msg, FutureWarning)
Step Time Energy fmax
BFGS: 0 09:19:25 -8965.723058 4.521557
BFGS: 1 09:19:38 -8965.984876 0.086497
/home/rudra/.local/lib/python3.11/site-packages/ase/calculators/espresso.py:170: FutureWarning: Espresso calculator is being restructured. Please use e.g. Espresso(profile=EspressoProfile(argv=['mpiexec', 'pw.x'])) to customize command-line arguments.
warnings.warn(compatibility_msg, FutureWarning)
Traceback (most recent call last):
File "/home/rudra/.local/lib/python3.11/site-packages/ase/calculators/abc.py", line 77, in _get
return dct[name]
~~~^^^^^^
KeyError: 'kpoint_weights'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/rudra/Projects/ASE/QE/mwe.py", line 47, in <module>
dos = DOS(dos_cal)
^^^^^^^^^^^^
File "/home/rudra/.local/lib/python3.11/site-packages/ase/dft/dos.py", line 32, in __init__
self.w_k = calc.get_k_point_weights()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rudra/.local/lib/python3.11/site-packages/ase/calculators/abc.py", line 88, in get_k_point_weights
return self._get('kpoint_weights')
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rudra/.local/lib/python3.11/site-packages/ase/calculators/abc.py", line 79, in _get
raise PropertyNotPresent(name)
ase.calculators.calculator.PropertyNotPresent: kpoint_weights
I agree that its more of ASE question rather than QE. But, as my last hope, I am expecting some peoplemust be using ase+qe and may help.

Regards,

Sent with [Proton Mail](https://proton.me/) secure email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20230104/581796f5/attachment.html>


More information about the users mailing list