This document provides context and instructions for an AI assistant to effectively contribute to the dftio project.
dftio is a Python library designed to parse and process output files from various Density Functional Theory (DFT) software packages. Its primary goal is to convert complex DFT outputs into standardized, machine-learning-ready formats. The library supports packages such as ABACUS, VASP, SIESTA, Gaussian, RESCU, and PYATB.
The project provides a command-line interface (CLI) for parsing operations and for plotting derived data like electronic band structures.
Key Technologies:
- Language: Python 3.9+
- Core Libraries: NumPy, SciPy, PyTorch, ASE (Atomic Simulation Environment), sisl
- Package Management:
uv - Testing:
pytest
The project uses uv for dependency management. To set up a development environment, including testing dependencies, run:
# Install all dependencies, including development tools
uv sync --group devThis command installs packages defined in pyproject.toml.
The main entry point is the dftio command. It has several subcommands, with parse being the most central one.
Example for parsing ABACUS output:
dftio parse --mode abacus --root /path/to/abacus/output --hamiltonian --overlap -o /path/to/saveFor a full list of commands and options, use the help flag:
dftio --help
dftio parse --helpThe project uses pytest for testing. The standard test suite can be run with the following command, which excludes slower "integration" tests:
uv run pytest -v -m "not integration"To run the full suite including code coverage analysis (as done in CI):
uv run pytest -v -m "not integration" --cov=dftiodftio/: Main source code for the library.io/: Contains the parsing logic for different DFT packages. Each package (e.g.,abacus,siesta) has its own submodule.data/: Data structures for handling atomic configurations and computational results.__main__.py: Defines the CLI entry point and its arguments.
test/: Contains allpytesttests. The structure mirrors the maindftio/directory.docs/: Project documentation, built with Jupyter Book.pyproject.toml: Defines project metadata, dependencies, and tool configurations (includingpytest).
Follow the existing coding style in the file you are editing. While no specific linter is enforced in the project configuration, adhere to standard PEP 8 conventions.
To add support for a new DFT package, you would typically:
- Create a new module under
dftio/io/, e.g.,dftio/io/new_package/. - Implement a parser class within that module.
- Register the new parser in
dftio/io/parse.py'sParserRegisterto make it available via the CLI. - Add corresponding tests in the
test/directory to validate the parser's correctness.