On my Windows Subsystem for Linux I compiled QE and I can execute simple test script from terminal. However, if I try to run QE using ASE I get the following error:
Traceback (most recent call last): File "/mnt/d/PhD/DFT/ASE_test/Untitled.py", line 60, in <module> energy_h2 = run_espresso(h2, 'H2') ^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/d/PhD/DFT/ASE_test/Untitled.py", line 41, in run_espresso calc = Espresso(pseudopotentials=pseudopotentials, tstress=True, tprnfor=True, input_data=input_parameters, kpts=(1, 1, 1)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/mateja/.local/lib/python3.11/site-packages/ase/calculators/espresso.py", line 165, in __init__ super().__init__( File "/home/mateja/.local/lib/python3.11/site-packages/ase/calculators/genericfileio.py", line 274, in __init__ raise BadConfiguration(f'No configuration of {template.name}') ase.calculators.calculator.BadConfiguration: No configuration of espresso Here is the python code:
from ase import Atoms from ase.build import molecule from ase.calculators.espresso import Espresso import subprocess qe_bin_path = '~/qe-7.3.1/bin' pseudo_dir = '/mnt/d/PhD/DFT/SSSP_1.3.0_PBE_efficiency' input_parameters = { 'control': { 'calculation': 'scf', 'prefix': 'H2', 'pseudo_dir': pseudo_dir, 'outdir': './out', }, 'system': { 'ecutwfc': 30, 'ecutrho': 240, }, 'electrons': { 'conv_thr': 1e-8, } } pseudopotentials = { 'H': 'H.pbe-rrkjus_psl.1.0.0.UPF' # Ensure this file is in the pseudo_dir } def run_espresso(atoms, prefix): input_parameters['control']['prefix'] = prefix calc = Espresso(pseudopotentials=pseudopotentials, tstress=True, tprnfor=True, input_data=input_parameters, kpts=(1, 1, 1)) input_file = f'{prefix}.in' output_file = f'{prefix}.out' calc.write_input(atoms, inputfile=input_file) mpirun_command = f'mpirun -np 2 pw.x -in {input_file} > {output_file}' subprocess.run(mpirun_command, shell=True, check=True) calc.read_results() return atoms.get_potential_energy() h2 = molecule('H2') energy_h2 = run_espresso(h2, 'H2') ```