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
174 stars 136 forks source link

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

Open MoseyQAQ opened 1 month ago

MoseyQAQ commented 1 month 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 1 month ago

Please Try v3.7.3 or later version.

WHUweiqingzhou commented 1 month ago

We should polish our interface tests @pxlxingliang

QuantumMisaka commented 1 month ago

@MoseyQAQ ABACUS newer version like 3.8.0 is recommended

QuantumMisaka commented 3 weeks ago

@pxlxingliang @1041176461 ASE-ABACUS interface need support for JSON format, see #3930

Or, a ASE-supported trajectory file should be output after ABACUS calculation, see #5235

1041176461 commented 3 weeks ago

The current JSON file does not contain enough content to support the ASE data structure, such as energy eigenvalues, etc.

pxlxingliang commented 1 week ago

Hi @MoseyQAQ, would you please upload the results of ABACUS or a test case, and I will try to reproduce and fix it.

MoseyQAQ commented 1 week ago

@pxlxingliang Hi, I found that now ASE-ABACUS can read my log file obtained from v3.7.1 correctly. I'm not sure what happened. The test case is in the attachment. Thank you! ASE-ABACUS-tests.zip