Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/ci-python39.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: CI Python 3.9+

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Verify Python version
run: |
python --version
python -c "import sys; assert sys.version_info >= (3, 9), f'Python 3.9+ required, got {sys.version}'"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-v3-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install project and dependencies
run: poetry install --no-interaction --with dev

- name: Verify installation
run: |
poetry run python -c "import numpy; print('numpy version:', numpy.__version__)"
poetry run python -c "import scipy; print('scipy version:', scipy.__version__)"
poetry run python -c "import hwave; print('hwave imported successfully')"

- name: Run tests with unittest
run: |
poetry run python -m unittest discover tests/ -v

- name: Run tests with pytest and coverage
run: |
poetry add pytest pytest-cov coverage
poetry run pytest tests/ -v --cov=src/hwave --cov-report=term-missing --cov-report=xml
continue-on-error: true

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install dependencies
run: poetry install --no-interaction --with dev

- name: Run flake8
run: poetry run flake8 src/ tests/ --count --select=E9,F63,F7,F82 --show-source --statistics

- name: Run black format
run: poetry run black src/ tests/

- name: Run isort format
run: poetry run isort src/ tests/

- name: Run mypy
run: poetry run mypy src/ --ignore-missing-imports
continue-on-error: true
7 changes: 6 additions & 1 deletion .github/workflows/run_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false

steps:
Expand All @@ -22,6 +22,11 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Verify Python version
run: |
python --version
python -c "import sys; assert sys.version_info >= (3, 9), f'Python 3.9+ required, got {sys.version}'"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest']
python-version: ['3.8', '3.9', '3.10', '3.11']
include:
- os: ubuntu-22.04
python-version: '3.7'
python-version: ['3.9', '3.10', '3.11', '3.12']
fail-fast: false

steps:
Expand All @@ -31,6 +28,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Verify Python version
run: |
python --version
python -c "import sys; assert sys.version_info >= (3, 9), f'Python 3.9+ required, got {sys.version}'"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/H-wave.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

161 changes: 145 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,168 @@
# H-wave

H-wave is a program for performing unrestricted Hartree-Fock (UHF) approximation and random phase approximation (RPA) for itinerant electron systems. UHF and RPA correspond to simple approximations that deal with fluctuations up to first order and enable analyses of electron correlation effects in materials at a low computational cost. The input files describing the one-body and two-body interactions are based on the Wannier90 format[1]. This allows smooth connection for the software packages that derive the effective models from first principles calculations, such as RESPACK[2], to the analyses of the effective model with H-wave.
<div align="center">
<img src="docs/figs/Hwave_logo.png" alt="H-wave Logo" width="200">
</div>

[1] G. Pizzi et al, J. Phys.: Condens. Matter 32 165902 (2020).
[![CI](https://github.com/issp-center-dev/H-wave/workflows/CI/badge.svg)](https://github.com/issp-center-dev/H-wave/actions)
[![Python](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

H-wave is a Python package for performing unrestricted Hartree-Fock (UHF) approximation and random phase approximation (RPA) for itinerant electron systems. UHF and RPA correspond to simple approximations that deal with fluctuations up to first order and enable analyses of electron correlation effects in materials at a low computational cost. The input files describing the one-body and two-body interactions are based on the Wannier90 format[1]. This allows smooth connection for the software packages that derive the effective models from first principles calculations, such as RESPACK[2], to the analyses of the effective model with H-wave.

[1] G. Pizzi et al, J. Phys.: Condens. Matter 32 165902 (2020).
[2] K. Nakmura, Y. Yoshimoto, Y. Nomura et al., Comp. Phys. Commun. 261, 107781 (2021).

## Features

- **Unrestricted Hartree-Fock (UHF) approximation** for itinerant electron systems
- **Random Phase Approximation (RPA)** for correlation effects analysis
- **Support for various interaction types**: Coulomb intra/inter, Exchange, Hund, Ising, PairHop, PairLift
- **Wannier90 format compatibility** for seamless integration with first-principles calculations
- **Comprehensive test suite** with automated CI/CD pipeline
- **Multi-orbital Hubbard model support**

## Methods

Hartree-Fock and Random Phase approximation
- **Hartree-Fock approximation**: Ground state energy calculation
- **Random Phase approximation**: Susceptibility and correlation analysis

## Target Models

- Hubbard model
- Multi-orbital Hubbard model
- Extended Hubbard models with various interaction types

## Available Physical Quantities

- Ground-state energy
- Free energy
- Charge and spin susceptibilities
- Green's functions
- Eigenvalues and eigenvectors

## Requirements

- Python 3.9 or higher
- NumPy (^1.14)
- SciPy (^1.7)
- Requests (^2.28.1)
- Tomli (^2.0.1)
Comment on lines +47 to +50
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The version constraints use caret notation (^) which is Poetry-specific syntax. For general documentation clarity, consider using standard version notation like '>=1.14' or specifying that these are Poetry version constraints.

Suggested change
- NumPy (^1.14)
- SciPy (^1.7)
- Requests (^2.28.1)
- Tomli (^2.0.1)
- NumPy (>=1.14)
- SciPy (>=1.7)
- Requests (>=2.28.1)
- Tomli (>=2.0.1)

Copilot uses AI. Check for mistakes.

## Installation

### From PyPI (Recommended)

```bash
pip install hwave
```

### From Source

For development or if you need to modify the program:

```bash
git clone https://github.com/issp-center-dev/H-wave.git
cd H-wave
pip install -e .
```

### Using Poetry (Development)

```bash
git clone https://github.com/issp-center-dev/H-wave.git
cd H-wave
poetry install
```

## Quick Start

### Basic Usage

```python
import hwave.qlms

# Run UHF calculation
hwave.qlms.run(input_dict=params)
```

### Command Line Interface

## Target models
```bash
# Run UHF calculation
hwave input.toml

Hubbard model, multi-orbital Hubbard model
# Calculate DOS
hwave_dos input.toml
```

## Available physical quantities
## Testing

ground-state energy, free energy, charge and spin susceptibilities, etc.
The project includes a comprehensive test suite that covers:

## Requirement
- **UHF calculations** (UHFr and UHFk solvers)
- **RPA calculations** with various interaction types
- **Multi-orbital systems**
- **Spin-orbital coupling**

Python3 with numpy, scipy, and other library packages
### Running Tests

## Install
```bash
# Run all tests
python -m unittest discover tests/ -v

- From PyPI
# Run specific test modules
python -m unittest tests.test_uhf -v
python -m unittest tests.test_rpa_1orb -v

``` bash
python3 -m pip install hwave
# Using pytest (if installed)
pytest tests/ -v
```

- From source (if you modify the program)
### Continuous Integration

The project uses GitHub Actions for automated testing:

- **Multi-version testing**: Python 3.9, 3.10, 3.11, 3.12
- **Code quality checks**: flake8, black, isort, mypy
- **Automated testing**: Runs on every push and pull request to main/develop branches

## Documentation

- [User Manual](https://www.pasums.issp.u-tokyo.ac.jp/h-wave/en/doc/manual)
- [API Documentation](https://www.pasums.issp.u-tokyo.ac.jp/h-wave/en/doc/manual)
- [Tutorial Examples](https://github.com/issp-center-dev/H-wave/tree/main/docs/tutorial)

## Contributing

We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README references a CONTRIBUTING.md file that is not included in this PR. Either include this file or remove the reference to avoid a broken link.

Suggested change
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.
We welcome contributions! Please see our Contributing Guidelines for details.

Copilot uses AI. Check for mistakes.

### Development Setup

1. Fork the repository
2. Create a feature branch: `git checkout -b feature/your-feature-name`
3. Make your changes
4. Run tests: `python -m unittest discover tests/ -v`
5. Commit your changes: `git commit -m "Add your feature"`
6. Push to the branch: `git push origin feature/your-feature-name`
7. Create a Pull Request

### Code Quality

The project enforces code quality through:

- **Black**: Code formatting
- **isort**: Import sorting
- **flake8**: Linting
- **mypy**: Type checking

Run these tools before submitting:

``` bash
python3 -m pip install DIRECTORY_OF_THE_REPOSITORY
```bash
black src/ tests/
isort src/ tests/
flake8 src/ tests/
mypy src/
```

## License
Expand Down
Loading
Loading