zhubonan / castepxbin

Reading binary files generated by CASTEP in Python
MIT License
10 stars 3 forks source link

parsing the main binary output #2

Closed zhubonan closed 2 years ago

zhubonan commented 2 years ago

Support for parsing check and castep_bin files would be very useful. Some properties are not printed in the text .castep output or at least for a high precision (e.g. forces).

We can search through the Fortran records inside the binary files for certain header contains (CHAR of length < 256), record the position of the headers in the first pass and read required properties in a second pass.

This would probably require us to implement a FortranRecord class for handling the record markers and contents.

The immediate use case would be for parsing high-quality forces for external finite-difference phonons using tools such as phonopy and when integrated with AiiDA (for aiida-castep and aiida-phononpy).

Many more quantities can also be extracted and opening up more post-processing opportunities.

Existing binary parsing utilities:

There is a useful Fortran file parsing package implemented for Julia: https://traktofon.github.io/FortranFiles.jl/v0.4/. We can use similar concepts (e.g. similar to the Record type). Sub-record support can be useful but not mandatory as a single record size from CASTEP is not expected to exceed 2GB.

NOTE: castep binary files are big-endian (enforced at compile time).

zhubonan commented 2 years ago

@ml-evs Just sent you an invite. Seems I can only assign those users that have been added to the repository.

ml-evs commented 2 years ago

Accepted!