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
34 changes: 7 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.10"]
aiida-version: ["stable"]

python-version: ['3.11', '3.12', '3.13']
services:
postgres:
image: postgres:10
Expand All @@ -25,45 +23,27 @@ jobs:
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
- 5432:5432
rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672
- 5672:5672

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

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

- name: Install python dependencies
run: |
pip install --upgrade pip
pip install -e .[testing]
pip install -e .[run,testing]

- name: Run test suite
env:
# show timings of tests
PYTEST_ADDOPTS: "--durations=0"
PYTEST_ADDOPTS: --durations=0
run: pytest --cov aiida_atomistic --cov-append .

pre-commit:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install python dependencies
run: |
pip install --upgrade pip
pip install -e .[pre-commit,docs,testing]
- name: Run pre-commit
run: |
pre-commit install
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
46 changes: 23 additions & 23 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: aiida-atomistic GitHub Pages Deploy
name: gh-pages-deploy
on:
push:
branches: [main, develop, mkdocs]
Expand All @@ -11,7 +11,7 @@ permissions:

# Allow only one concurrent deployment; do NOT cancel in-progress runs.
concurrency:
group: 'pages'
group: pages
cancel-in-progress: false

jobs:
Expand All @@ -21,24 +21,24 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required by git-revision-date-localized
- name: Setup Pages
uses: actions/configure-pages@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[docs]
- name: Build MkDocs documentation
run: mkdocs build --site-dir ./build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './build'
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required by git-revision-date-localized
- name: Setup Pages
uses: actions/configure-pages@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[docs]
- name: Build MkDocs documentation
run: mkdocs build --site-dir ./build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./build

deploy:
environment:
Expand All @@ -47,6 +47,6 @@ jobs:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
25 changes: 25 additions & 0 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: pre-commit

on: [push, pull_request]

jobs:

pre-commit:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install python dependencies
run: |
pip install --upgrade pip
pip install -e .[pre-commit]
- name: Run pre-commit
run: |
pre-commit clean
git add .pre-commit-config.yaml
pre-commit install
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
6 changes: 3 additions & 3 deletions .github/workflows/publish-on-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Publish on PyPI
name: pypi-publish

on:
push:
tags:
# After vMajor.Minor.Patch _anything_ is allowed (without "/") !
- v[0-9]+.[0-9]+.[0-9]+*
- v[0-9]+.[0-9]+.[0-9]+*

jobs:
publish:
Expand All @@ -30,4 +30,4 @@ jobs:
flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.pypi_token }}
FLIT_PASSWORD: ${{ secrets.pypi_token }}
52 changes: 45 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,46 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: check-added-large-files
exclude: uv.lock
- id: check-yaml
- id: end-of-file-fixer
exclude: &exclude_pre_commit_hooks >
(?x)^(
tests/.*(?<!\.py)$|
docs/source/.+\.aiida/repo/.+|
CHANGELOG.md|
)$
- id: fix-encoding-pragma
args: [--remove]
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
exclude: *exclude_pre_commit_hooks

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.0
hooks:
- id: check-github-workflows

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.4
hooks:
- id: ruff-format
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.16.0
hooks:
- id: pretty-format-toml
args: [--autofix]
- id: pretty-format-yaml
args: [--autofix]
exclude: >-
(?x)^(
tests/.*|
environment.yml|
)$
10 changes: 5 additions & 5 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: 2

python:
version: "3.8"
version: '3.8'
install:
- method: pip
path: .
extra_requirements:
- docs
- method: pip
path: .
extra_requirements:
- docs
1 change: 0 additions & 1 deletion docs/how_to/creation_mutation.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,4 +668,3 @@ Final structure ready for calculations!
Is alloy: False
Total charge: -1.0
```

2 changes: 1 addition & 1 deletion docs/how_to/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ qb.append(
print(f"Structures with charges in ({min_charge}, {max_charge}): {len(qb.all())}")
```

!!! tip
!!! tip
**Using Statistics for Efficient Queries**

Statistical properties enable efficient filtering without loading large arrays:
Expand Down
2 changes: 1 addition & 1 deletion docs/in_depth/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Comprehensive explanations of core concepts and advanced topics in `aiida-atomis

[Storage Backends](storage_backends.md)

</div>
</div>
10 changes: 5 additions & 5 deletions docs/in_depth/properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Each `Site` object can have the following properties:

- Type: `str` for pure elements, `list[str]` for alloys
- Example: `'Cu'` or `['Cu', 'Zn']`

- **`position`**: Atomic coordinates in Cartesian space

- Type: `np.ndarray` (shape: `(3,)`)
Expand Down Expand Up @@ -381,7 +381,7 @@ print(field_info.json_schema_extra) # {'store_in': 'db'}

# Properties with 'singular_form' are site properties
field_info = StructureBaseModel.model_computed_fields['charges']
print(field_info.json_schema_extra)
print(field_info.json_schema_extra)
# {'store_in': 'repository', 'singular_form': 'charge'}
```

Expand All @@ -390,10 +390,10 @@ print(field_info.json_schema_extra)
- **`store_in`**: Where to store the property
- `'db'`: Database attributes (fast queries, size-limited)
- `'repository'`: File repository (large arrays, slower queries)

- **`singular_form`**: Links plural computed property to singular site property
- Example: `charges` (plural) ↔ `charge` (singular)

- **`statistic`**: Statistical aggregation for querying
- `'max'`: Maximum value across all sites
- `'min'`: Minimum value across all sites
Expand Down Expand Up @@ -467,4 +467,4 @@ builder.properties.sites.append({'symbol': 'Cu', 'position': [0, 0, 0]}) # OK
# StructureData: immutable (use for storing in database)
structure = StructureData(cell=[[3, 0, 0], [0, 3, 0], [0, 0, 3]], pbc=[True]*3, sites=[...])
structure.properties.sites.append(...) # Error: immutable
```
```
6 changes: 3 additions & 3 deletions docs/in_depth/storage_backends.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class StructureBaseModel(BaseModel):
cell: ArrayLike3x3 = Field(
json_schema_extra={"store_in": "db"}
)

# This array goes to repository
@computed_field(json_schema_extra={"store_in": "repository", "singular_form": "position"})
@property
Expand Down Expand Up @@ -176,7 +176,7 @@ def my_properties(self) -> np.ndarray:
if all(site.my_property is None for site in self.sites):
return None
return np.array([
site.my_property if site.my_property is not None
site.my_property if site.my_property is not None
else Site.get_default_values()['my_property']
for site in self.sites
])
Expand Down Expand Up @@ -266,4 +266,4 @@ Arrays are cached after first load to avoid repeated file I/O:
structure = orm.load_node(pk)
pos1 = structure.properties.positions # Loads from .npz, caches
pos2 = structure.properties.positions # Returns cached (no I/O)
```
```
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ If you use this plugin for your research, please cite the following work:

## Acknowledgements

We acknowledge support from the [NCCR MARVEL](http://nccr-marvel.ch/) funded by the Swiss National Science Foundation and the EU Centre of Excellence ["MaX – Materials Design at the Exascale"](http://www.max-centre.eu/) (Horizon 2020 EINFRA-5, Grant No. 676598).
We acknowledge support from the [NCCR MARVEL](http://nccr-marvel.ch/) funded by the Swiss National Science Foundation and the EU Centre of Excellence ["MaX – Materials Design at the Exascale"](http://www.max-centre.eu/) (Horizon 2020 EINFRA-5, Grant No. 676598).

![marvel](images/MARVEL.png){ width="250" }
![max](images/MaX.png){ width="300" }
![max](images/MaX.png){ width="300" }

[aiida]: http://aiida.net
[aiida-core documentation]: https://aiida.readthedocs.io/projects/aiida-core/en/latest/intro/get_started.html
Expand Down
2 changes: 1 addition & 1 deletion docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.md-grid {
max-width: 1440px;
}
}
16 changes: 10 additions & 6 deletions docs/tutorials/2_first_qe_calculation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ This guide demonstrates how to use aiida-atomistic structures in computational w

Ensure you have the necessary packages and codes installed, which you can verify by following the corresponding [installation guide](https://aiida-quantumespresso.readthedocs.io/en/stable/get_started/installation.html).

:::{important}
For now, please install these versions of the following packages:
- aiida-core: dev/atomistic branch from https://github.com/mikibonacci/aiida-core.git
- aiida-pseudo: dev/atomistic branch from https://github.com/mikibonacci/aiida-pseudo.git
- aiida-quantumespresso: dev/atomistic branch from https://github.com/mikibonacci/aiida-quantumespresso.git
:::
!!! note "Compatible AiiDA and other plugins version with aiida-atomistic"

For now, please install these versions of the following packages:

- aiida-core: dev/atomistic branch from https://github.com/mikibonacci/aiida-core.git
- aiida-pseudo: dev/atomistic branch from https://github.com/mikibonacci/aiida-pseudo.git
- aiida-quantumespresso: dev/atomistic branch from https://github.com/mikibonacci/aiida-quantumespresso.git

You can install all of them by running `pip install .[run]`.


If not already done, remember to install the `sssp` pseudopotentials:

Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Welcome to the aiida-atomistic tutorials! These step-by-step tutorials will get

---

**Duration**: ~5 minutes
**Duration**: ~5 minutes

**Level**: Beginner

Expand All @@ -21,8 +21,8 @@ Welcome to the aiida-atomistic tutorials! These step-by-step tutorials will get

---

**Duration**: ~10 minutes
**Duration**: ~10 minutes

**Level**: Intermediate

Use your structures in real computational workflows with Quantum ESPRESSO:
Expand Down
Loading