Skip to content

Commit

Permalink
Merge branch 'release/0.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
piskunow committed Nov 25, 2023
2 parents c289cf0 + 683dff2 commit fc270cf
Show file tree
Hide file tree
Showing 19 changed files with 2,107 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fetch-depth: 2

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

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/checkout@v4

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

Expand All @@ -44,18 +44,18 @@ jobs:
poetry --version
- name: Install System Dependencies (Ubuntu)
if: startsWith(matrix.os, 'ubuntu') && (matrix.session 'tests' | matrix.session == 'pre-commit')
if: startsWith(matrix.os, 'ubuntu') && (matrix.session == 'no')
run: |
sudo apt-get update
sudo apt-get install -y python3-dev python3-setuptools python3-scipy python3-matplotlib python3-pytest python3-sympy g++ build-essential gfortran libopenblas-dev liblapack-dev libmumps-scotch-dev
- name: Install Python dependencies (Ubuntu)
if: startsWith(matrix.os, 'ubuntu') && (matrix.session 'tests' | matrix.session == 'pre-commit')
if: startsWith(matrix.os, 'ubuntu') && (matrix.session == 'no')
run: |
python -m pip install cython tinyarray
- name: Clone and Install kwant (Ubuntu)
if: startsWith(matrix.os, 'ubuntu') && (matrix.session 'tests' | matrix.session == 'pre-commit')
if: startsWith(matrix.os, 'ubuntu') && (matrix.session == 'no')
run: |
git clone https://github.com/kwant-project/kwant.git
cd kwant
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
uses: actions/checkout@v4

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

Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@

## Features

- TODO
- KPM expansion of typical spectal functions
- Density of states
- Green's functions
- Kubo conductivity
- Chern marker
- Time evolution
- Tools for system with periodic boundaries
- KPM vector factories that produces tiles
- Velocity operators adapted to periodic boundaries
- Distance operators adapted to periodic boundaries

## Requirements

- TODO
- Python >=3.9

## Installation

Expand All @@ -41,9 +50,9 @@ You can install _KPM Tools_ via [pip] from [PyPI]:
$ pip install kpm-tools
```

## Usage
## Python API

Please see the [Command-line Reference] for details.
Please see the [Python API reference] for details.

## Contributing

Expand Down Expand Up @@ -74,4 +83,4 @@ This project was generated from [@cjolowicz]'s [Hypermodern Python Cookiecutter]

[license]: https://github.com/piskunow/kpm-tools/blob/main/LICENSE
[contributor guide]: https://github.com/piskunow/kpm-tools/blob/main/CONTRIBUTING.md
[command-line reference]: https://kpm-tools.readthedocs.io/en/latest/usage.html
[python api reference]: https://kpm-tools.readthedocs.io/en/latest/api.html
81 changes: 81 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Python API

```{eval-rst}
.. click:: kpm_tools.__main__:main
:prog: kpm-tools
:nested: full
```

Each of the following sections describes the usage of different modules in the `kpm_tools` package.

## Bloch Module

```{eval-rst}
.. automodule:: kpm_tools.bloch
:members:
:undoc-members:
:show-inheritance:
```

## Common Module

```{eval-rst}
.. automodule:: kpm_tools.common
:members:
:undoc-members:
:show-inheritance:
```

## Evolution Module

```{eval-rst}
.. automodule:: kpm_tools.evolution
:members:
:undoc-members:
:show-inheritance:
```

## Hamiltonians Module

```{eval-rst}
.. automodule:: kpm_tools.hamiltonians
:members:
:undoc-members:
:show-inheritance:
```

## KPM Functions Module

```{eval-rst}
.. automodule:: kpm_tools.kpm_funcs
:members:
:undoc-members:
:show-inheritance:
```

## KPM Generator Module

```{eval-rst}
.. automodule:: kpm_tools.kpm_generator
:members:
:undoc-members:
:show-inheritance:
```

## Plotting Module

```{eval-rst}
.. automodule:: kpm_tools.plotting
:members:
:undoc-members:
:show-inheritance:
```

## Tiles Module

```{eval-rst}
.. automodule:: kpm_tools.tiles
:members:
:undoc-members:
:show-inheritance:
```
47 changes: 47 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
"""Sphinx configuration."""

import inspect
import os
import sys


project = "KPM Tools"
author = "Pablo Piskunow"
copyright = "2023, Pablo Piskunow"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx.ext.linkcode",
"sphinx_click",
"myst_parser",
"nbsphinx",
Expand Down Expand Up @@ -36,3 +43,43 @@
""" # noqa: B950


def linkcode_resolve(domain, info):
"""Resolve links to source."""
if domain != "py":
return None
if not info["module"]:
return None

# Replace with your project's GitHub repository URL
github_repo = "https://github.com/piskunow/kpm-tools"

# Get the module object
module = sys.modules.get(info["module"])
if module is None:
return None

# Get the source file path of the module
filename = inspect.getsourcefile(module)
if filename is None:
return None

# Trim the filename to a path relative to the project root
rel_fn = os.path.relpath(filename, start=os.path.dirname(__file__))

# Get the line number of the object within the module
obj = module
for part in info["fullname"].split("."):
obj = getattr(obj, part, None)

if obj is None:
return None

try:
lines, _ = inspect.getsourcelines(obj)
except Exception:
return None

line = inspect.getsourcelines(obj)[1]
return f"{github_repo}/blob/main/{rel_fn}#L{line}"
5 changes: 2 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ end-before: <!-- github-only -->

[license]: license
[contributor guide]: contributing
[command-line reference]: usage
[python api]: api

```{toctree}
---
Expand All @@ -15,8 +15,7 @@ maxdepth: 1
---
Tutorials <tutorials>
usage
reference
api
contributing
Code of Conduct <codeofconduct>
License <license>
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ maxdepth: 1
---
tutorials/tutorial_bloch
tutorials/tutorial_time_evolution
tutorials/tutorial_evolution_performance
```
589 changes: 589 additions & 0 deletions docs/tutorials/tutorial_evolution_performance.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit fc270cf

Please sign in to comment.