4
$\begingroup$

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') ``` 
$\endgroup$
0

2 Answers 2

0
$\begingroup$

Apparently python got confused about ~ symbol. Putting whole path instead of qe_bin_path = '~/qe-7.3.1/bin' solves the problem

$\endgroup$
1
  • 1
    $\begingroup$ Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. $\endgroup$ Commented Jul 2, 2024 at 16:17
0
$\begingroup$

I guess you are using the latest version of ase, in which the calculator requests an additional input "profile".

$\endgroup$
1
  • 2
    $\begingroup$ Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. $\endgroup$ Commented Jul 5, 2024 at 2:26

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.