I/O and Parsers (dftio.io)#

The dftio.io module is the core of the library’s parsing capabilities. It contains the ParserRegister class, which manages the registration and selection of parsers for different DFT codes, as well as the implementations of the parsers themselves.

ParserRegister#

The ParserRegister class is a singleton that holds a registry of all available parsers. When you run dftio parse from the command line, this class is responsible for selecting the appropriate parser based on the --mode argument.

Key Methods#

  • register(name, parser_cls): Adds a new parser to the registry.

  • get_parser(name): Retrieves a parser class from the registry by name.

Available Parsers#

dftio supports the following DFT codes. Each parser is implemented in its own submodule within dftio.io.

  • ABACUS (abacus): Parses output from the ABACUS DFT code. See dftio.io.abacus.abacus_parser.

  • Gaussian (gaussian): Parses output from the Gaussian quantum chemistry software. See dftio.io.gaussian.gaussian_parser.

  • PYATB (pyatb): Parses output from the PYATB library. See dftio.io.pyatb.pyatb_parser.

  • RESCU (rescu): Parses output from the RESCU DFT code. See dftio.io.rescu.rescu_parser.

  • SIESTA (siesta): Parses output from the SIESTA DFT code. See dftio.io.siesta.siesta_parser.

  • VASP (vasp): Parses output from the Vienna Ab initio Simulation Package (VASP). See dftio.io.vasp.vasp_parser.

Below is a more detailed breakdown of each parser’s functionality.

ABACUS Parser#

The ABACUS parser (dftio.io.abacus.AbacusParser) is designed to handle the output files generated by the ABACUS software.

Key Responsibilities:

  • Parses atomic structures (STRU files).

  • Extracts Hamiltonian and overlap matrices from sparse matrix files (data-HR-sparse_SPIN0.csr, data-SR-sparse_SPIN0.csr).

  • Reads band structure data from BANDS_1.dat.

  • Extracts other information from the main log file (running_scf.log).

Gaussian Parser#

The Gaussian parser (dftio.io.gaussian.GaussianParser) processes .log files from Gaussian calculations.

Key Responsibilities:

  • Extracts atomic structures and coordinates.

  • Parses basis set information.

  • Reads molecular orbital energies (eigenvalues).

VASP Parser#

The VASP parser (dftio.io.vasp.VaspParser) is responsible for parsing the various output files from VASP.

Key Responsibilities:

  • Reads atomic positions from POSCAR or CONTCAR.

  • Parses eigenvalues from EIGENVAL.

  • Extracts k-points and weights from KPOINTS.

  • Gathers additional information from OUTCAR, such as lattice parameters and forces.