Skip to content

Commit

Permalink
Merge branch 'main' into fix/number_of_supercells
Browse files Browse the repository at this point in the history
  • Loading branch information
mikibonacci committed Sep 23, 2024
2 parents 58a6d9c + 9881c23 commit cb42238
Show file tree
Hide file tree
Showing 41 changed files with 1,040 additions and 1,205 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on: [push, pull_request]

jobs:

pre-commit:
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

# Set up Python environment
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

# Install pre-commit
- name: Install pre-commit
run: pip install pre-commit

# Run pre-commit on all files
- name: Run pre-commit
run: pre-commit run --all-files
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 24.4.2

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
hooks:
- id: black
- id: ruff
types_or: [python, pyi, jupyter]
args: [--fix]
- id: ruff-format
types_or: [python, pyi, jupyter]
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Plugin to compute vibrational properties of materials via the aiida-vibroscopy A
Once cloned the repository, `cd` into it and:

```shell
pip install -e
pip install --user .
```

If you want to easily set up phonopy, use the CLI of this package (inspect it via `aiidalab-qe-vibroscopy --help`):
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ dependencies = [
"kaleido",
]

[tool.ruff.lint]
ignore = ["E501", "E402", "TRY003", "RUF012", "N806"]

[project.urls]
Source = "https://github.com/mikibonacci/aiidalab-qe-vibroscopy"

Expand All @@ -37,4 +40,4 @@ Source = "https://github.com/mikibonacci/aiidalab-qe-vibroscopy"
"vibronic" = "aiidalab_qe_vibroscopy.app:property"

[project.scripts]
"aiidalab-qe-vibroscopy" = "aiidalab_qe_vibroscopy.__main__:cli"
"aiidalab-qe-vibroscopy" = "aiidalab_qe_vibroscopy.__main__:cli"
2 changes: 1 addition & 1 deletion src/aiidalab_qe_vibroscopy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""AiiDAlab Qe plugin for vibrational spectoscopy."""
"""AiiDAlab Qe plugin for vibrational spectoscopy."""
15 changes: 9 additions & 6 deletions src/aiidalab_qe_vibroscopy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
So we only setup in AiiDA.
"""


@click.group()
def cli():
pass

@cli.command(
help="Setup phonopy@localhost in the current AiiDA database."
)

@cli.command(help="Setup phonopy@localhost in the current AiiDA database.")
def setup_phonopy():
load_profile()
try:
Expand All @@ -27,10 +27,12 @@ def setup_phonopy():
# Use shutil.which to find the path of the phonopy executable
phonopy_path = shutil.which("phonopy")
if not phonopy_path:
raise FileNotFoundError("Phonopy code is not found in PATH. \
raise FileNotFoundError(
"Phonopy code is not found in PATH. \
You should update your PATH. If you have not phonopy in , \
your environment, install the code via \
`pip install phonopy --user`.")
`pip install phonopy --user`."
)
# Construct the command as a list of arguments
command = [
"verdi",
Expand All @@ -53,5 +55,6 @@ def setup_phonopy():
else:
print("Code phonopy@localhost is already installed! Nothing to do here.")


if __name__ == "__main__":
cli()
cli()
26 changes: 22 additions & 4 deletions src/aiidalab_qe_vibroscopy/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,40 @@
from aiidalab_qe_vibroscopy.app.result import Result
from aiidalab_qe.common.panel import OutlinePanel

from aiidalab_qe.common.widgets import QEAppComputationalResourcesWidget
from aiidalab_qe.common.widgets import (
QEAppComputationalResourcesWidget,
PwCodeResourceSetupWidget,
)


class Outline(OutlinePanel):
title = "Vibrational properties"
# description = "IR and Raman spectra; you may also select phononic and dielectric properties"


phonopy_code = QEAppComputationalResourcesWidget(
description="phonopy",
PhononWorkChainPwCode = PwCodeResourceSetupWidget(
description="pw.x for phonons", # code for the PhononWorkChain workflow",
default_calc_job_plugin="quantumespresso.pw",
)

# The finite electric field does not support npools (does not work with npools>1), so we just set it as QEAppComputationalResourcesWidget
DielectricWorkChainPwCode = QEAppComputationalResourcesWidget(
description="pw.x for dielectric", # code for the DielectricWorChain workflow",
default_calc_job_plugin="quantumespresso.pw",
)

PhonopyCalculationCode = QEAppComputationalResourcesWidget(
description="phonopy", # code for the PhonopyCalculation calcjob",
default_calc_job_plugin="phonopy.phonopy",
)

property = {
"outline": Outline,
"code": {"phonopy": phonopy_code},
"code": {
"phonon": PhononWorkChainPwCode,
"dielectric": DielectricWorkChainPwCode,
"phonopy": PhonopyCalculationCode,
},
"setting": Setting,
"workchain": workchain_and_builder,
"result": Result,
Expand Down
Loading

0 comments on commit cb42238

Please sign in to comment.