deepmodeling / abacus-develop

An electronic structure package based on either plane wave basis or numerical atomic orbitals.
http://abacus.ustc.edu.cn
GNU Lesser General Public License v3.0
169 stars 129 forks source link

ASE-ABACUS can't read from v3.7.1 #5200

Open MoseyQAQ opened 2 weeks ago

MoseyQAQ commented 2 weeks ago

Describe the bug

I am trying to read the results obtained from ABACUS-3.7.1 using the latest ASE-ABACUS interface:

from ase.io import read, write
atoms = read("running_relax.log", format='abacus-out')

It seems that the new version of the ASE-ABACUS interface doesn't support reading output files from the older version of ABACUS. This leads to an IndexError during the reading process.

   atoms = read("running_relax.log", format='abacus-out')
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\io\formats.py", line 806, in read
    return next(_iread(filename, slice(index, None), format, io,
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\parallel.py", line 302, in new_generator
    for result in generator(*args, **kwargs):
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\io\formats.py", line 872, in _iread
    for dct in io.read(fd, *args, **kwargs):
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\io\formats.py", line 630, in wrap_read_function
    yield from read(filename, index, **kwargs)
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\utils\__init__.py", line 577, in iofunc
    obj = func(fd, *args, **kwargs)
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\io\abacus.py", line 2040, in read_abacus_out
    chunks = _get_abacus_chunks(fd, index, non_convergence_ok)
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\utils\__init__.py", line 577, in iofunc
    obj = func(fd, *args, **kwargs)
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\io\abacus.py", line 2025, in _get_abacus_chunks
    final_chunk = AbacusOutCalcChunk(calc_contents, header_chunk, -1)
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\io\abacus.py", line 1263, in __init__
    self._header = header.header_summary
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\utils\__init__.py", line 678, in getter
    cache[name] = meth(self)
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\io\abacus.py", line 1230, in header_summary
    "initial_atoms": self.initial_atoms,
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\utils\__init__.py", line 678, in getter
    cache[name] = meth(self)
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\io\abacus.py", line 1095, in initial_atoms
    labels, positions, mag, vel = self.initial_site
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\utils\__init__.py", line 678, in getter
    cache[name] = meth(self)
  File "D:\Softwares\Anaconda3\lib\site-packages\ase\io\abacus.py", line 1089, in initial_site
    return parse_block(self._parse_site()[0])
IndexError: list index out of range

Is there any fast method to fix this? Or I can just use a newer version of ABACUS to perform SCF calculation, or use an older version of ASE-ABACUS.

I believe it would be more robust if ASE-ABACUS could read from a JSON file generated by RapidJSON.

Expected behavior

No response

To Reproduce

No response

Environment

No response

Additional Context

No response

Task list for Issue attackers (only for developers)

WHUweiqingzhou commented 5 days ago

Please Try v3.7.3 or later version.

WHUweiqingzhou commented 5 days ago

We should polish our interface tests @pxlxingliang