Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AiiDA 2 #5

Merged
merged 54 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
bd40543
WIP
addman2 Feb 26, 2024
1b83918
Add parser 'create'
addman2 Feb 26, 2024
c477c1c
update setup.json
addman2 Feb 26, 2024
174094a
WIP
addman2 Feb 26, 2024
5ed9a91
Add frist test
addman2 Feb 26, 2024
937b96c
WIP
addman2 Feb 26, 2024
b52f1a3
Update git ignore, Sort
addman2 Feb 27, 2024
bad31a2
Update git ignore, Sort
addman2 Feb 27, 2024
9f07420
clean up pk_decorator
addman2 Feb 27, 2024
1486724
WIP
addman2 Feb 27, 2024
0755a3d
WIP
addman2 Feb 28, 2024
06329c3
WIP
addman2 Feb 28, 2024
f997a98
WIP
addman2 Feb 28, 2024
905cc00
Add dry-run no-save-wf options to run
addman2 Feb 28, 2024
8cf98f9
Add anthor gitignore
addman2 Feb 29, 2024
d571da7
QMC=Chem now works
addman2 Feb 29, 2024
dd1e33e
Merge pull request #1 from addman2/add_qmcchem
addman2 Feb 29, 2024
3af54e0
WIP
addman2 Mar 1, 2024
7d6e238
Merge pull request #2 from addman2/add_qmcchem
addman2 Mar 1, 2024
62157c4
Add dump command
addman2 Mar 1, 2024
f95be7c
Merge branch 'add_qmcchem' into aiida2
addman2 Mar 1, 2024
a87501a
WIP
addman2 Mar 1, 2024
57555f2
Fix strange name of cli function
addman2 Mar 1, 2024
93cb00e
Add extract option
addman2 Mar 1, 2024
3f2e477
Add output command
addman2 Mar 1, 2024
adb5db9
Add # WFs in list
addman2 Mar 2, 2024
e45f05a
Move dumping command to new dump group
addman2 Mar 2, 2024
866692a
Add console script
addman2 Mar 2, 2024
1eaf962
Fix proglem with aqp and loading profile
addman2 Mar 3, 2024
9cc161d
Fix number of wf in list command
addman2 Mar 3, 2024
a26d923
Add sotrage of blocks
addman2 Mar 3, 2024
a855524
Clean up cli client
addman2 Mar 3, 2024
8e38add
Add interactive editor
addman2 Mar 3, 2024
5c4efe8
Add Edditing from file
addman2 Mar 3, 2024
dad5459
Typos
addman2 Mar 5, 2024
8c606db
Refactoring
addman2 Mar 5, 2024
bf66cf1
Add info about code completion
addman2 Mar 5, 2024
b53bcfa
ammend
addman2 Mar 5, 2024
3779f87
Features in show
addman2 Mar 5, 2024
8a7f94b
Add info about dcoer images
addman2 Mar 5, 2024
4c40192
Add highliting of most recent wf
addman2 Mar 5, 2024
959043b
Promting to activate project
addman2 Mar 5, 2024
0fe3df1
Make output nicer
addman2 Mar 5, 2024
0a2b323
Add jast_opt example
addman2 Mar 5, 2024
b9069d1
Add workflow command
addman2 Mar 5, 2024
95e374c
Fix minor bug
addman2 Mar 5, 2024
0e0fe11
README
scemama Mar 5, 2024
330f46e
Add gprah show
addman2 Mar 18, 2024
8d48d95
Minor changes
scemama Mar 19, 2024
d7296c4
Merge branch 'aiida2' of github.com:addman2/aiida-qp2 into aiida2
scemama Mar 19, 2024
26178e2
Merge pull request #3 from scemama/aiida2
addman2 Mar 19, 2024
2078012
Remove reentry scan
addman2 May 28, 2024
c448780
Remove docs from CI (temporary)
addman2 May 28, 2024
d2921d0
FIx precommit
addman2 May 28, 2024
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
49 changes: 23 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ jobs:
# run: |
# pip install --upgrade pip
# pip install -e .[testing]
# reentry scan -r aiida
#
# - name: Run test suite
# env:
Expand All @@ -54,30 +53,29 @@ jobs:
#
# run: py.test --cov qp2 --cov-append .

docs:
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 --force-reinstall MarkupSafe==2.0.1
pip install -e .[docs]
reentry scan -r aiida
- name: Build docs
run: cd docs && make
- name: Add nojekyll file
run: touch docs/build/html/.nojekyll
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
# docs:
# 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 --force-reinstall MarkupSafe==2.0.1
# pip install -e .[docs]
# - name: Build docs
# run: cd docs && make
# - name: Add nojekyll file
# run: touch docs/build/html/.nojekyll
# - name: Deploy
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./docs/build/html

pre-commit:
runs-on: ubuntu-latest
Expand All @@ -92,7 +90,6 @@ jobs:
run: |
pip install --upgrade pip
pip install -e .[pre-commit,docs,testing]
reentry scan -r aiida
- name: Run pre-commit
run: |
pre-commit install
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
*.swp
~*
*~
.project
*.egg*
.DS_Store
.coverage
.DS_Store
.project
.pytest_cache
.vscode
build/
configs/
dist/
pip-wheel-metadata/
examples/*.pdf
pip-wheel-metadata/
170 changes: 115 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,82 +1,142 @@
[![Build Status](https://github.com/TREX-CoE/aiida-qp2/workflows/ci/badge.svg?branch=master)](https://github.com/TREX-CoE/aiida-qp2/actions)
[![PyPI version](https://badge.fury.io/py/aiida-qp2.svg)](https://badge.fury.io/py/aiida-qp2)

# aiida-qp2
# AiiDA-qp2

AiiDA plugin for [Quantum Package 2.0](https://github.com/QuantumPackage/qp2) (QP2).
## Installation

This is a brief installation guide fo aiida-qp2. First one needs to setup properly `aiida` it should be installed when package is installed. Also RabbitMQ is importat to run `aiida`.

This plugin is the modified output of the
[AiiDA plugin cutter](https://github.com/aiidateam/aiida-plugin-cutter),
intended to help developers get started with their AiiDA plugins.
```
# It is better to run it in some kind of virtual environment.

$ pip install aiida-qp2
```

## Repository contents
Command line code completion with `TAB` is very usefull, dont hesitate to activate it and use it:

* [`aiida_qp2/`](aiida_qp2/): The main source code of the plugin package
* [`calculations.py`](aiida_qp2/calculations.py): A new `QP2Calculation` `CalcJob` class
* [`parsers.py`](aiida_qp2/parsers.py): A new `Parser` for the `QP2Calculation`
* [`docs/`](docs/): A documentation template. The [ReadTheDocs documentation](https://trex-coe.github.io/aiida-qp2/) is built and deployed on the `gh-pages` branch.
* [`examples/`](examples/): Examples of how to submit a calculation using this plugin
* [`LICENSE`](LICENSE): License for your plugin
* [`MANIFEST.in`](MANIFEST.in): Configure non-Python files to be included for publication on [PyPI](https://pypi.org/)
* [`README.md`](README.md): This file
* [`setup.json`](setup.json): Plugin metadata for registration on [PyPI](https://pypi.org/) and the [AiiDA plugin registry](https://aiidateam.github.io/aiida-registry/) (including entry points)
* [`setup.py`](setup.py): Installation script for pip / [PyPI](https://pypi.org/)
* [`.pre-commit-config.yaml`](.pre-commit-config.yaml): Configuration of [pre-commit hooks](https://pre-commit.com/) that sanitize coding style and check for syntax errors. Enable via `pip install -e .[pre-commit] && pre-commit install`
* [`.github/`](.github/): [Github Actions](https://github.com/features/actions) configuration
* [`ci.yml`](.github/workflows/ci.yml): runs tests and builds documentation at every new commit
* [`publish-on-pypi.yml`](.github/workflows/publish-on-pypi.yml): automatically deploy git tags to PyPI
```
eval "$(_VERDI_COMPLETE=bash_source verdi)"
```

### AiiDA profile

## Features
First we need to setup profile. One can use `postgreSQL` as a db backend but for simplicity we will show you SQLite setup:

* Initialize a wave function file (EZFIO) based on `StructureData` instance and `qp_create_ezfio` dictionary.
This step can optionally use `BasisSet` and/or `Pseudopotential` nodes produced by the
[`aiida-gaussian-datatypes`](https://github.com/addman2/aiida-gaussian-datatypes/tree/development_trvb) plugin.
* Run calculations (e.g. HF, CIPSI) in a given order according to the `qp_commands` list. Some pre- or post-processing (e.g. `shell` scripting) is also possible by providing a list of commands in `qp_prepend` or `qp_append` keys of the `parameters` Dict, respectively.
* Export TREXIO file from the QP-native EZFIO format.
```
$ verdi profile setup core.sqlite_dos
```

You will be promted some questions but answering them is very easy. Setting up PostgreSQL more challenging, however, it is recomended for larger projects.

## Installation
### AiiDA computer

```shell
pip install aiida-qp2
verdi quicksetup # better to set up a new profile
verdi plugin list aiida.calculations # should now show your calclulation plugins
Now you need to specify computer where you want to run your calculations. Here is the setup for your local computer. First setup a `yaml` file with setting called `localhost.yaml` and then setup the code.

```
$ cat > localhost.yaml
---
label: "localhost"
hostname: "localhost"
transport: "core.local"
scheduler: "core.direct"
work_dir: "/var/tmp/aiida"
use_double_quotes: true
mpirun_command: "mpirun -np {tot_num_mpiprocs}"
mpiprocs_per_machine: "8"
prepend_text: " "
append_text: " "

$ verdi computer setup --config localhost.yaml
```

## Usage
One can test the computer via `verdi computer test <label>`.

### AiiDA code

Lastly we need to setup the code. Again to do the most simple setup one can pull docker image from docker hub.

```
$ docker pull docker://addman151/qp2-aiida:tagname

See [`Demo-aiida-qp.md`](examples/Demo-aiida-qp.md) and `.py` files in the [`examples/`](examples/) directory.
# you can use tagname:latest - for serial qmcchem
# or you can use tagname:intel - for parallel
```

For instance, the `example_trexio_from_xyz.py` is the 3-step workflow using the plugin.
Unfortunatelly, the image is litle bit large, something what has to be fix in the future. When the image is downloaded we can continue by creating new code node inside AiiDA. Again we will use an yaml file.

```shell
verdi daemon start # make sure the daemon is running
cd examples
python example_trexio_from_xyz.py # prepare and submit the calculation
verdi process list -a # check record of calculation
```
$ cat > qp.yaml
engine_command: "docker run -v $(pwd):/data {image_name}"
wrap_cmdline_params: false
use_double_quotes: false
image_name: 'qp2-aiida'
label: 'qp2-docker'
description: 'quantum package 2'
default_calc_job_plugin:
- 'qp2.create'
- 'qp2.run'
filepath_executable: '/bin/entrypoint.sh'
computer: 'localhost'
prepend_text: ' '
append_text: ' '

$ verdi code create core.code.containerized --config qp.yaml
```

1. Create the EZFIO wave function file from the `hcn.xyz` file using a given basis set.
2. Run SCF calculation using the previously created wave function and parse the output file looking for the Hartree-Fock energy.
3. Export TREXIO wave function file by converting EZFIO format using `TREXIO_TEXT` back end.
Now run `verdi status` and you should not see any error messages:
```
✔ version: AiiDA v2.5.1
✔ config: /home/.../.aiida
✔ profile: profile
✔ storage: SqliteDosStorage[...]: open,
✔ rabbitmq: Connected to RabbitMQ v3.8.9 as amqp://guest:guest@...
```

## Running AiiDA qp2

## Development
N.B.: One can execute console script either through `verdi data qp2.cli` command or with a shortcut `aqp`

```shell
git clone https://github.com/TREX-CoE/aiida-qp2 .
cd aiida-qp2
pip install -e .[pre-commit] # install extra dependencies
pre-commit install # install pre-commit hooks
```
echo "2

## License
H 0.0 0.0 0.0
H 0.7 0.0 0.0" > H2.xyz

MIT
verdi data qp2.cli create Hydrogen2 --code qp2-docker@localhost --structure H2.xyz
# Or equivalent with:
# aqp create --code qp2-docker@localhost --structure H2.xyz

## Contact
verdi data qp2.cli list # Find pk of your project

[email protected]
verdi data qp2.cli activate <pk> # preplace by pk

[email protected]
verdi data qp2.cli run scf # Finally running HF calculation

verdi data qp2.cli show # Look at the results

```

I wrote these command from head hopefully there are no mistakes.

## Running QMC=Chem

Pull `QMC=Chem` docker image

```
docker pull docker://addman151/qmcchem-aiida
```

You can install this code in the same way how the qp code was installed. In fact this image contain also `qp` so you can you this image also for previous calculations.

Recomended workflow follows:

```
aqp run save_for_qmcchem --trexio-bug-fix
```

The option `--trexio-bug-fix` is there because there is a bug where one has to manually put absolute path to the trexio file. This flag will fix it.

Now run `QMC=Chem`:

```
aqp run qmcchem -p "-t 1800" -p "-l 20"
```
82 changes: 82 additions & 0 deletions README.md.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[![Build Status](https://github.com/TREX-CoE/aiida-qp2/workflows/ci/badge.svg?branch=master)](https://github.com/TREX-CoE/aiida-qp2/actions)
[![PyPI version](https://badge.fury.io/py/aiida-qp2.svg)](https://badge.fury.io/py/aiida-qp2)

# aiida-qp2

AiiDA plugin for [Quantum Package 2.0](https://github.com/QuantumPackage/qp2) (QP2).

This plugin is the modified output of the
[AiiDA plugin cutter](https://github.com/aiidateam/aiida-plugin-cutter),
intended to help developers get started with their AiiDA plugins.

## Repository contents

* [`aiida_qp2/`](aiida_qp2/): The main source code of the plugin package
* [`calculations.py`](aiida_qp2/calculations.py): A new `QP2Calculation` `CalcJob` class
* [`parsers.py`](aiida_qp2/parsers.py): A new `Parser` for the `QP2Calculation`
* [`docs/`](docs/): A documentation template. The [ReadTheDocs documentation](https://trex-coe.github.io/aiida-qp2/) is built and deployed on the `gh-pages` branch.
* [`examples/`](examples/): Examples of how to submit a calculation using this plugin
* [`LICENSE`](LICENSE): License for your plugin
* [`MANIFEST.in`](MANIFEST.in): Configure non-Python files to be included for publication on [PyPI](https://pypi.org/)
* [`README.md`](README.md): This file
* [`setup.json`](setup.json): Plugin metadata for registration on [PyPI](https://pypi.org/) and the [AiiDA plugin registry](https://aiidateam.github.io/aiida-registry/) (including entry points)
* [`setup.py`](setup.py): Installation script for pip / [PyPI](https://pypi.org/)
* [`.pre-commit-config.yaml`](.pre-commit-config.yaml): Configuration of [pre-commit hooks](https://pre-commit.com/) that sanitize coding style and check for syntax errors. Enable via `pip install -e .[pre-commit] && pre-commit install`
* [`.github/`](.github/): [Github Actions](https://github.com/features/actions) configuration
* [`ci.yml`](.github/workflows/ci.yml): runs tests and builds documentation at every new commit
* [`publish-on-pypi.yml`](.github/workflows/publish-on-pypi.yml): automatically deploy git tags to PyPI


## Features

* Initialize a wave function file (EZFIO) based on `StructureData` instance and `qp_create_ezfio` dictionary.
This step can optionally use `BasisSet` and/or `Pseudopotential` nodes produced by the
[`aiida-gaussian-datatypes`](https://github.com/addman2/aiida-gaussian-datatypes/tree/development_trvb) plugin.
* Run calculations (e.g. HF, CIPSI) in a given order according to the `qp_commands` list. Some pre- or post-processing (e.g. `shell` scripting) is also possible by providing a list of commands in `qp_prepend` or `qp_append` keys of the `parameters` Dict, respectively.
* Export TREXIO file from the QP-native EZFIO format.


## Installation

```shell
pip install aiida-qp2
verdi quicksetup # better to set up a new profile
verdi plugin list aiida.calculations # should now show your calclulation plugins
```

## Usage

See [`Demo-aiida-qp.md`](examples/Demo-aiida-qp.md) and `.py` files in the [`examples/`](examples/) directory.

For instance, the `example_trexio_from_xyz.py` is the 3-step workflow using the plugin.

```shell
verdi daemon start # make sure the daemon is running
cd examples
python example_trexio_from_xyz.py # prepare and submit the calculation
verdi process list -a # check record of calculation
```

1. Create the EZFIO wave function file from the `hcn.xyz` file using a given basis set.
2. Run SCF calculation using the previously created wave function and parse the output file looking for the Hartree-Fock energy.
3. Export TREXIO wave function file by converting EZFIO format using `TREXIO_TEXT` back end.


## Development

```shell
git clone https://github.com/TREX-CoE/aiida-qp2 .
cd aiida-qp2
pip install -e .[pre-commit] # install extra dependencies
pre-commit install # install pre-commit hooks
```

## License

MIT

## Contact

[email protected]

[email protected]
Loading
Loading