Skip to content

Commit

Permalink
Merge pull request #91 from aiidateam/release_1.0.0
Browse files Browse the repository at this point in the history
Prepare release 1.0.0
  • Loading branch information
yakutovicha committed Mar 30, 2020
2 parents 863a62f + 3dbbc70 commit 21cab22
Show file tree
Hide file tree
Showing 57 changed files with 1,269 additions and 3,263 deletions.
3 changes: 3 additions & 0 deletions .docker/my_init.d/add-codes.sh
Expand Up @@ -2,3 +2,6 @@
set -em

su -c /opt/add-codes.sh aiida

# Make /opt/aiida-cp2k folder editable for the $SYSTEM_USER.
chown -R aiida:aiida /opt/aiida-cp2k/
5 changes: 1 addition & 4 deletions .docker/opt/add-codes.sh
Expand Up @@ -6,7 +6,4 @@ set -x
# Environment
export SHELL=/bin/bash

# Install the ddec and cp2k codes
CP2K_FOLDER=/home/aiida/code/aiida-cp2k

verdi code show cp2k@localhost || verdi code setup --config ${CP2K_FOLDER}/.docker/cp2k-code.yml --non-interactive
verdi code show cp2k@localhost || verdi code setup --config /opt/aiida-cp2k/.docker/cp2k-code.yml --non-interactive
7 changes: 7 additions & 0 deletions .readthedocs.yml
@@ -0,0 +1,7 @@
build:
image: latest
python:
version: 3.6
pip_install: true
extra_requirements:
- "docs"
14 changes: 8 additions & 6 deletions .travis.yml
Expand Up @@ -4,20 +4,22 @@ services:
- docker

before_install:
- pip install --user coveralls
- python .ci/check_travis_tag.py
- docker build -t aiida_cp2k_test .
- docker run -d aiida_cp2k_test
- export DOCKERID=`docker run -d aiida_cp2k_test`
- sleep 30 # wait until the container is launched

script:
- "export DOCKERID=`docker ps -qf 'ancestor=aiida_cp2k_test'`"
- "echo \"Docker ID: $DOCKERID\""
- "docker exec -it --user aiida \"$DOCKERID\" /bin/bash -l -c 'cd code/aiida-cp2k/ && pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) '"
- "docker exec -it --user aiida \"$DOCKERID\" /bin/bash -l -c 'cd code/aiida-cp2k/ && py.test --cov aiida_cp2k --cov-append .'"
- docker exec -it --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-cp2k/ && pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )'
- docker exec -it --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-cp2k/ && py.test --cov aiida_cp2k --cov-append .'
- docker exec -it --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-cp2k/docs && make'

after_success:
- "docker exec -e TRAVIS=\"$TRAVIS\" -e TRAVIS_JOB_ID=\"$TRAVIS_JOB_ID\" -e TRAVIS_BRANCH=\"$TRAVIS_BRANCH\" -it --user aiida \"$DOCKERID\" /bin/bash -l -c 'cd code/aiida-cp2k/ && coveralls'"
- docker exec -e TRAVIS=$TRAVIS -e TRAVIS_JOB_ID=$TRAVIS_JOB_ID -e TRAVIS_BRANCH=$TRAVIS_BRANCH -it --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-cp2k/ && coveralls'

after_script:
- docker logs $DOCKERID

git:
depth: 3
Expand Down
41 changes: 15 additions & 26 deletions Dockerfile
Expand Up @@ -7,38 +7,27 @@

FROM aiidateam/aiida-docker-stack

# Install cp2k
RUN apt-get update && apt-get install -y --no-install-recommends \
cp2k

# Set HOME variable:
# Set HOME and PATH variables.
ENV HOME="/home/aiida"
ENV PATH="${HOME}/.local/bin:${PATH}"

# Install aiida-cp2k
COPY . ${HOME}/code/aiida-cp2k
RUN chown -R aiida:aiida ${HOME}/code
# To prevent the container to exit prematurely.
ENV KILL_ALL_RPOCESSES_TIMEOUT=50

# Install AiiDA
USER aiida
ENV PATH="${HOME}/.local/bin:${PATH}"
WORKDIR /opt/

# Install aiida-cp2k plugin and coveralls
WORKDIR ${HOME}/code/aiida-cp2k
RUN pip install --user .[pre-commit,test]
RUN pip install --user coveralls
# Install CP2K.
RUN apt-get update && apt-get install -y --no-install-recommends cp2k

# Populate reentry cache for aiida user https://pypi.python.org/pypi/reentry/
RUN reentry scan
# Install aiida-cp2k plugin.
COPY . aiida-cp2k
RUN pip install ./aiida-cp2k[pre-commit,test,docs]

# Install the cp2k code
# Install coverals.
RUN pip install coveralls

# Install the cp2k code.
COPY .docker/opt/add-codes.sh /opt/
COPY .docker/my_init.d/add-codes.sh /etc/my_init.d/40_add-codes.sh

# Change workdir back to $HOME
WORKDIR ${HOME}

# Important to end as user root!
USER root

# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
RUN chown -R aiida:aiida ${HOME}
1 change: 0 additions & 1 deletion MANIFEST.in
@@ -1,2 +1 @@
include setup.json
include aiida_cp2k/workchains/multistage_protocols/*
96 changes: 16 additions & 80 deletions README.md
@@ -1,102 +1,38 @@
[![Build Status](https://travis-ci.org/aiidateam/aiida-cp2k.svg?branch=develop)](https://travis-ci.org/aiidateam/aiida-cp2k)
[![Coverage Status](https://coveralls.io/repos/github/aiidateam/aiida-cp2k/badge.svg?branch=develop)](https://coveralls.io/github/aiidateam/aiida-cp2k?branch=develop)
[![PyPI version](https://badge.fury.io/py/aiida-cp2k.svg)](https://badge.fury.io/py/aiida-cp2k)
[![Documentation Status](https://readthedocs.org/projects/aiida-cp2k/badge/?version=latest)](https://aiida-cp2k.readthedocs.io/en/latest/?badge=latest)

# AiiDA CP2K
**The CP2K plugin for the AiiDA workflow and provenance engine.**
[AiiDA](http://www.aiida.net/) plugin for [CP2K](https://www.cp2k.org/).


![logo](./aiida-cp2k_logo.png)

# Installation
## Installation

If you use `pip`, you can install it as:
```
pip install aiida-cp2k
```


# Features
Following the philosophy to _''enable without getting in the way''_, this plugin provides access to all of CP2K's capabilities through a small set of well-tested features:

- A full [CP2K input](https://manual.cp2k.org) has to be provided as a nested Python dictionary ([example](./test/test_dft.py)):
```
params = {'FORCE_EVAL': {'METHOD': 'Quickstep', 'DFT': { ... }}}
calc.use_parameters(ParameterData(dict=params))
```

- Section parameters are stored as key `_` in the dictionary:
```
xc_section = {'XC_FUNCTIONAL': {'_': 'LDA'}}
```

- Repeated sections are stored as a list:
```
kind_section = [{'_': 'H', 'BASIS_SET': 'DZVP-MOLOPT-GTH', 'POTENTIAL': 'GTH-LDA'},
{'_': 'O', 'BASIS_SET': 'DZVP-MOLOPT-GTH', 'POTENTIAL': 'GTH-LDA'}]
```

- Most data files (basis sets, pseudo potentials, VdW, etc.) are auto-discovered from CP2K's [data directory](https://github.com/cp2k/cp2k/tree/master/cp2k/data).
```
dft_section = {'BASIS_SET_FILE_NAME': 'BASIS_MOLOPT', ...}
```

- Additional data files can be added as AiiDA SinglefileData ([example](test/test_mm.py)):
```
water_pot = SinglefileData(file="/tmp/water.pot")
calc.use_file(water_pot, linkname="water_pot")
```

- The start geometry can be provided as AiiDA StructureData ([example](./test/test_dft.py)):
To install the plugin in an editable mode, run:
```
atoms = ase.build.molecule('H2O', vacuum=2.0)
calc.use_structure(StructureData(ase=atoms))
git clone https://github.com/aiidateam/aiida-cp2k
cd aiida-cp2k
pip install -e . # Also installs aiida, if missing (but not postgres/rabbitmq).
```

- Alternatively the start geometry can be contained in the CP2K input ([example](./test/test_no_struct.py)):
```
coord_section = {' ': ['H 2.0 2.0 2.737166',
'H 2.0 2.0 2.000000']},
```
## Links
* [Documentation](https://aiida-cp2k.readthedocs.io/en/latest/) for the calculation examples and features of the plugin.
* [Make an issue](https://github.com/aiidateam/aiida-cp2k/issues/new) for bug reports, questions and suggestions.
* [AiiDA](http://www.aiida.net/) to learn about AiiDA.
* [Cp2k](https://www.cp2k.org/) to learn about CP2K.

- For restarting a calculation a parent folder can be attached ([example](./test/test_restart.py)):
```
calc2.use_parent_folder(calc1.out.remote_folder)
```

- By default only the output and restart file (if present) are retrieved. Additional files are retrieved upon request ([example](test/test_mm.py)):
```
settings = {'additional_retrieve_list': ["*.cube"]}
calc.use_settings(ParameterData(dict=settings))
```
## License
MIT

- The final geometry is extracted from the restart file (if present) and stored in AiiDA ([example](./test/test_geopt.py)):
```
print(calc.out.output_structure)
```

- From the CP2K output only the #warnings and final energy are parsed ([example](./test/test_mm.py)):
```
print(calc.res.nwarnings, calc.res.energy, calc.res.energy_units)
```

- The calculation is considered failed if #warnings can not be found ([example](./test/test_failure.py)).

- The conversion of geometries between AiiDA and CP2K has a precision of at least 1e-10 Ångström ([example](./test/test_precision.py)).

- The Python code complies with the [Flake8](http://flake8.pycqa.org) coding conventions.


# Testing

Every commit and pull request is automatically tested by [TravisCI](https://travis-ci.org/cp2k/aiida-cp2k/).

To run the tests locally install [Docker](https://docs.docker.com/engine/installation/) and execute the following commands:
```
git clone https://github.com/cp2k/aiida-cp2k
docker build -t aiida_cp2k_test aiida-cp2k
docker run -it --init aiida_cp2k_test
```
## Contact
yakutovicha@gmail.com


## Acknowledgements
Expand Down
Binary file removed aiida-cp2k_logo.png
Binary file not shown.
2 changes: 1 addition & 1 deletion aiida_cp2k/__init__.py
Expand Up @@ -7,6 +7,6 @@
###############################################################################
"""AiiDA-CP2K plugins, parsers, workflows, etc ..."""

__version__ = "1.0.0b6"
__version__ = "1.0.0"

# EOF

0 comments on commit 21cab22

Please sign in to comment.