|
| 1 | +# GEMINI.md: AI-Assisted Development Guide for `dftio` |
| 2 | + |
| 3 | +This document provides context and instructions for an AI assistant to effectively contribute to the `dftio` project. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +`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. |
| 8 | + |
| 9 | +The project provides a command-line interface (CLI) for parsing operations and for plotting derived data like electronic band structures. |
| 10 | + |
| 11 | +**Key Technologies:** |
| 12 | +- **Language:** Python 3.9+ |
| 13 | +- **Core Libraries:** NumPy, SciPy, PyTorch, ASE (Atomic Simulation Environment), sisl |
| 14 | +- **Package Management:** `uv` |
| 15 | +- **Testing:** `pytest` |
| 16 | + |
| 17 | +## Building and Running |
| 18 | + |
| 19 | +### Installation |
| 20 | + |
| 21 | +The project uses `uv` for dependency management. To set up a development environment, including testing dependencies, run: |
| 22 | + |
| 23 | +```bash |
| 24 | +# Install all dependencies, including development tools |
| 25 | +uv sync --group dev |
| 26 | +``` |
| 27 | +This command installs packages defined in `pyproject.toml`. |
| 28 | + |
| 29 | +### Running the CLI |
| 30 | + |
| 31 | +The main entry point is the `dftio` command. It has several subcommands, with `parse` being the most central one. |
| 32 | + |
| 33 | +**Example for parsing ABACUS output:** |
| 34 | +```bash |
| 35 | +dftio parse --mode abacus --root /path/to/abacus/output --hamiltonian --overlap -o /path/to/save |
| 36 | +``` |
| 37 | + |
| 38 | +For a full list of commands and options, use the help flag: |
| 39 | +```bash |
| 40 | +dftio --help |
| 41 | +dftio parse --help |
| 42 | +``` |
| 43 | + |
| 44 | +### Running Tests |
| 45 | + |
| 46 | +The project uses `pytest` for testing. The standard test suite can be run with the following command, which excludes slower "integration" tests: |
| 47 | + |
| 48 | +```bash |
| 49 | +uv run pytest -v -m "not integration" |
| 50 | +``` |
| 51 | + |
| 52 | +To run the full suite including code coverage analysis (as done in CI): |
| 53 | +```bash |
| 54 | +uv run pytest -v -m "not integration" --cov=dftio |
| 55 | +``` |
| 56 | + |
| 57 | +## Development Conventions |
| 58 | + |
| 59 | +### Project Structure |
| 60 | + |
| 61 | +- **`dftio/`**: Main source code for the library. |
| 62 | + - **`io/`**: Contains the parsing logic for different DFT packages. Each package (e.g., `abacus`, `siesta`) has its own submodule. |
| 63 | + - **`data/`**: Data structures for handling atomic configurations and computational results. |
| 64 | + - **`__main__.py`**: Defines the CLI entry point and its arguments. |
| 65 | +- **`test/`**: Contains all `pytest` tests. The structure mirrors the main `dftio/` directory. |
| 66 | +- **`docs/`**: Project documentation, built with Jupyter Book. |
| 67 | +- **`pyproject.toml`**: Defines project metadata, dependencies, and tool configurations (including `pytest`). |
| 68 | + |
| 69 | +### Coding Style |
| 70 | + |
| 71 | +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. |
| 72 | + |
| 73 | +### Adding a New Parser |
| 74 | + |
| 75 | +To add support for a new DFT package, you would typically: |
| 76 | +1. Create a new module under `dftio/io/`, e.g., `dftio/io/new_package/`. |
| 77 | +2. Implement a parser class within that module. |
| 78 | +3. Register the new parser in `dftio/io/parse.py`'s `ParserRegister` to make it available via the CLI. |
| 79 | +4. Add corresponding tests in the `test/` directory to validate the parser's correctness. |
0 commit comments