vossjo / ase-espresso

ase interface for Quantum Espresso
GNU General Public License v3.0
65 stars 55 forks source link

Error in espresso.read_espresso_out() #33

Closed yCobanoglu closed 3 years ago

yCobanoglu commented 4 years ago
espresso.read_espresso_out(file)

causes

 File "/venv/lib/python3.8/site-packages/ase/io/espresso.py", line 170, in read_espresso_out
    for image_index in image_indexes:
TypeError: 'int' object is not iterable

Line 170:


    # slice from the subset
        image_indexes = results_config_indexes[index]
    else:
        image_indexes = all_config_indexes[index]

    # Extract initialisation information each time PWSCF starts
    # to add to subsequent configurations. Use None so slices know
    # when to fill in the blanks.
    pwscf_start_info = dict((idx, None) for idx in indexes[_PW_START])

    for image_index in image_indexes:  #<-- BUG can't iterate over int !!!
        ...

The error is obvious but the fix isn't (for sb who didn't write the parser at least).

vossjo commented 3 years ago

This is a (potential) issue with the ASE io module to read and write espresso files. It's not related to ase-espresso. ASE's io module and ase-espresso are two separate, unrelated projects.

SiLiKhon commented 1 year ago

@yCobanoglu this is probably way to late, but I'll leave a comment for the case someone else faces this problem as well.

I just stumbled upon this gh issue when googling this problem (which is still there, 3 years later...) The solution is to use a slice rather than the default integer index:

espresso.read_espresso_out(file, index=slice(None))

They even mention in the docs, that this parameter should be a slice - yet an integer -1 is set as the default value.