Skip to content

Commit

Permalink
Merge pull request #57 from yakutovicha/release_1.0.0
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
yakutovicha committed Feb 13, 2020
2 parents 5748113 + 149bb2d commit f4327ce
Show file tree
Hide file tree
Showing 49 changed files with 3,857 additions and 498 deletions.
5 changes: 4 additions & 1 deletion .docker/my_init.d/add-codes.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash
set -em

su -c /opt/add-codes.sh aiida
su -c /opt/add-codes.sh ${SYSTEM_USER}

# Make /opt/aiida-raspa folder editable for the $SYSTEM_USER.
chown -R ${SYSTEM_USER}:${SYSTEM_USER} /opt/aiida-raspa/
17 changes: 14 additions & 3 deletions .docker/opt/add-codes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@ set -x
# Environment
export SHELL=/bin/bash

# Install the ddec and cp2k codes
RASPA_FOLDER=/home/aiida/code/aiida-raspa
# Activate conda.
__conda_setup="$('/opt/conda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/conda/etc/profile.d/conda.sh" ]; then
. "/opt/conda/etc/profile.d/conda.sh"
else
export PATH="/opt/conda/bin:$PATH"
fi
fi
unset __conda_setup

verdi code show raspa@localhost || verdi code setup --config ${RASPA_FOLDER}/.docker/raspa-code.yml --non-interactive
# Install raspa code.
verdi code show raspa@localhost || verdi code setup --config /opt/aiida-raspa/.docker/raspa-code.yml --non-interactive
4 changes: 2 additions & 2 deletions .docker/raspa-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ computer: localhost
description:
input_plugin: raspa
on_computer: True
remote_abs_path: /home/aiida/code/RASPA2_installed/bin/simulate
remote_abs_path: /opt/RASPA2_installed/bin/simulate
append_text:
prepend_text: export RASPA2_DIR=/home/aiida/code/RASPA2_installed/
prepend_text: export RASPA2_DIR=/opt/RASPA2_installed/
7 changes: 7 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build:
image: latest
python:
version: 3.6
pip_install: true
extra_requirements:
- "docs"
15 changes: 9 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ services:
before_install:
- python .ci/check_travis_tag.py
- docker build -t aiida_raspa_test .
- docker run -d aiida_raspa_test
- sleep 30 # wait untill the container is launched
- export DOCKERID=`docker run -d aiida_raspa_test`

script:
- "export DOCKERID=`docker ps -qf 'ancestor=aiida_raspa_test'`"
- docker exec --tty $DOCKERID wait-for-services
- "echo \"Docker ID: $DOCKERID\""
- "docker exec -it --user aiida \"$DOCKERID\" /bin/bash -l -c 'cd code/aiida-raspa/ && 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-raspa/ && py.test --cov aiida_raspa --cov-append .'"
- docker exec -it --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-raspa/ && 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-raspa/ && py.test --cov aiida_raspa --cov-append .'
- docker exec -it --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-raspa/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-raspa/ && 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 code/aiida-raspa/ && coveralls'

after_script:
- docker logs $DOCKERID

git:
depth: 3
55 changes: 19 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
FROM aiidateam/aiida-docker-stack
FROM aiidateam/aiida-core:latest

# Set HOME, PATH and RASPA_DIR variables:
ENV HOME="/home/aiida"
ENV RASPA2_DIR=${HOME}/code/RASPA2_installed
ENV PATH="/home/aiida/code/RASPA2_installed/bin/:${HOME}/.local/bin:${PATH}"
ENV PATH="/opt/RASPA2_installed/bin/:${PATH}"
ENV RASPA2_DIR=/opt/RASPA2_installed
ENV KILL_ALL_RPOCESSES_TIMEOUT=50

# Install necessary codes to build RASPA
RUN apt-get update && apt-get install -y --no-install-recommends \
WORKDIR /opt/

# Copy and install aiida-raspa plugin.
COPY . aiida-raspa
RUN pip install ./aiida-raspa[pre-commit,test,docs]

# Install coveralls.
RUN pip install coveralls

# Install necessary codes to build RASPA2.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* && apt-get update && apt-get install -y --no-install-recommends \
automake \
libtool

# Copy the current folder and change permissions
COPY . ${HOME}/code/aiida-raspa
RUN chown -R aiida:aiida ${HOME}/code

# Now do everything as the aiida user
USER aiida

# Download, compile and install RASPA into ~/code folder
WORKDIR ${HOME}/code/
# Download, compile and install RASPA into ~/code folder.
RUN git clone https://github.com/iRASPA/RASPA2.git RASPA2
WORKDIR ${HOME}/code/RASPA2
WORKDIR /opt/RASPA2
RUN rm -rf autom4te.cache
RUN mkdir m4
RUN aclocal
Expand All @@ -31,25 +33,6 @@ RUN ./configure --prefix=${RASPA2_DIR}
RUN make
RUN make install

# Set the plugin folder as the workdir
WORKDIR ${HOME}/code/aiida-raspa

# Install aiida-raspa plugin and coveralls
RUN pip install --user .[pre-commit,test]
RUN pip install --user coveralls

# Populate reentry cache for aiida user https://pypi.python.org/pypi/reentry/
RUN reentry scan

# Install the RASPA code to AiiDA
# Install the RASPA code to AiiDA.
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"]
COPY .docker/my_init.d/add-codes.sh /etc/my_init.d/50_add-codes.sh
202 changes: 32 additions & 170 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,201 +2,63 @@
[![Coverage Status](https://coveralls.io/repos/github/yakutovicha/aiida-raspa/badge.svg?branch=develop)](https://coveralls.io/github/yakutovicha/aiida-raspa?branch=develop)
[![PyPI version](https://badge.fury.io/py/aiida-raspa.svg)](https://badge.fury.io/py/aiida-raspa)

# aiida-raspa

# AiiDA RASPA
[AiiDA](http://www.aiida.net/) plugin for [RASPA2](https://github.com/iRASPA/RASPA2).

## Installation
Designed to work with with RASPA 2.0.37 or later.

# Documentation
The documentation for this package can be found on [Read the Docs](https://aiida-raspa.readthedocs.io/en/latest/).


# Installation
If you use ``pip``, you can install it as:
```
pip install aiida-raspa
```

If you want to install the plugin in an editable mode, run:
```
git clone https://github.com/yakutovicha/aiida-raspa
cd aiida-raspa
pip install -e . # also installs aiida, if missing (but not postgres)
```
In case the plugin does not appear in `verdi calculation plugins` list, run
```
reentry scan
pip install -e . # Also installs aiida, if missing (but not postgres/rabbitmq).
```
and try again.

In case the plugin does not appear in the output of `verdi plugin list aiida.calculations`,
run `reentry scan` and try again.

## Examples

See `examples` folder for complete examples of setting up a calculation or workflow.
# Examples
See `examples` folder for complete examples of setting up a calculation or a work chain.

simple calculation:
## Simple calculation
```shell
verdi daemon restart # make sure the daemon is running
cd examples/simple_calculations
verdi run test_raspa_base.py <code_label> --submit # submit test calculation
verdi calculation list -a -p1 # check status of calculation
```
workflow:
```shell
verdi daemon restart # make sure the daemon is running
cd examples/workflows
verdi run run_RaspaConverge_workflow.py <code_label> # submit test calculation
verdi work list -a -p1 # check status of calculation
```

## Analyzing output
```shell
$ verdi calculation show 7491
----------- ------------------------------------
type RaspaCalculation
pk 7491
uuid adc178d9-9f7e-4bbf-8283-8768f1964d9a
label
description
ctime 2019-01-10 15:38:20.103794+00:00
mtime 2019-01-10 15:39:24.799300+00:00
computer [3] deneb
code raspa
----------- ------------------------------------
##### INPUTS:
Link label PK Type
------------ ---- -------------
parameters 7490 ParameterData
structure 7489 CifData
##### OUTPUTS:
Link label PK Type
----------------- ---- -------------
remote_folder 7492 RemoteData
retrieved 7498 FolderData
output_parameters 7499 ParameterData
component_0 7500 ParameterData
```
Results that are for the framework and adsorbate can be obtained:
```shell
$ verdi calculation res 7491 # same as $ verdi data parameter show 7499
{
"ads_ads_coulomb_energy_average": 0.0,
"ads_ads_coulomb_energy_dev": 0.0,
"ads_ads_coulomb_energy_unit": "kJ/mol",
"ads_ads_total_energy_average": -4.4408682910929,
"ads_ads_total_energy_dev": 1.63152616602518,
"ads_ads_total_energy_unit": "kJ/mol",
"ads_ads_vdw_energy_average": -4.44086832435076,
"ads_ads_vdw_energy_dev": 1.63152614939625,
"ads_ads_vdw_energy_unit": "kJ/mol",
"adsorbate_density_average": 26.35203,
"adsorbate_density_dev": 4.63163,
"adsorbate_density_unit": "kg/m^3",
"cell_volume_average": 12025.61229,
"cell_volume_dev": 0.0,
"cell_volume_unit": "A^3",
"enthalpy_of_adsorption_average": -2092.24759,
"enthalpy_of_adsorption_dev": 315.039138,
"enthalpy_of_adsorption_unit": "K",
"exceeded_walltime": false,
"framework_density": "739.995779685958",
"framework_density_unit": "kg/m^3",
"framework_heat_capacity_average": 3082.15209,
"framework_heat_capacity_dev": 2889.16503,
"framework_heat_capacity_unit": "J/mol/K",
"host_ads_coulomb_energy_average": 0.0,
"host_ads_coulomb_energy_dev": 0.0,
"host_ads_coulomb_energy_unit": "kJ/mol",
"host_ads_total_energy_average": -176.211538447682,
"host_ads_total_energy_dev": 36.0785945303337,
"host_ads_total_energy_unit": "kJ/mol",
"host_ads_vdw_energy_average": -176.211538455997,
"host_ads_vdw_energy_dev": 36.0785944970758,
"host_ads_vdw_energy_unit": "kJ/mol",
"pressure_average": 0.0,
"pressure_dev": 0.0,
"pressure_unit": "Pa",
"temperature_average": 0.0,
"temperature_dev": 0.0,
"temperature_unit": "K",
"total_energy_average": -21727.4844,
"total_energy_dev": 4526.71327,
"total_energy_unit": "K"
}
```
Component specific results can be obtained:
```shell
$ verdi data parameter show 7499
{
"ads_ads_coulomb_energy_average": 0.0,
"ads_ads_coulomb_energy_dev": 0.0,
"ads_ads_coulomb_energy_unit": "kJ/mol",
"ads_ads_total_energy_average": -4.4408682910929,
"ads_ads_total_energy_dev": 1.63152616602518,
"ads_ads_total_energy_unit": "kJ/mol",
"ads_ads_vdw_energy_average": -4.44086832435076,
"ads_ads_vdw_energy_dev": 1.63152614939625,
"ads_ads_vdw_energy_unit": "kJ/mol",
"adsorbate_density_average": 26.35203,
"adsorbate_density_dev": 4.63163,
"adsorbate_density_unit": "kg/m^3",
"cell_volume_average": 12025.61229,
"cell_volume_dev": 0.0,
"cell_volume_unit": "A^3",
"enthalpy_of_adsorption_average": -2092.24759,
"enthalpy_of_adsorption_dev": 315.039138,
"enthalpy_of_adsorption_unit": "K",
"exceeded_walltime": false,
"framework_density": "739.995779685958",
"framework_density_unit": "kg/m^3",
"framework_heat_capacity_average": 3082.15209,
"framework_heat_capacity_dev": 2889.16503,
"framework_heat_capacity_unit": "J/mol/K",
"host_ads_coulomb_energy_average": 0.0,
"host_ads_coulomb_energy_dev": 0.0,
"host_ads_coulomb_energy_unit": "kJ/mol",
"host_ads_total_energy_average": -176.211538447682,
"host_ads_total_energy_dev": 36.0785945303337,
"host_ads_total_energy_unit": "kJ/mol",
"host_ads_vdw_energy_average": -176.211538455997,
"host_ads_vdw_energy_dev": 36.0785944970758,
"host_ads_vdw_energy_unit": "kJ/mol",
"pressure_average": 0.0,
"pressure_dev": 0.0,
"pressure_unit": "Pa",
"temperature_average": 0.0,
"temperature_dev": 0.0,
"temperature_unit": "K",
"total_energy_average": -21727.4844,
"total_energy_dev": 4526.71327,
"total_energy_unit": "K"
}
verdi run example_base.py <code_label> --submit # Submit example calculation.
verdi process list -a -p1 # Check status of calculation.
```

Files that are downloaded by the plugin to the local machine:
## Work chain
```shell
$ verdi calculation outputls 7491
_scheduler-stderr.txt
_scheduler-stdout.txt
output_framework_1.1.1_300.000000_500000.data
restart_framework_1.1.1_300.000000_500000
cd examples/workchains
verdi run example_base_restart_timeout.py <code_label> # Submit test calculation.
verdi process list -a -p1 # Check status of the work chain.
```

Cat the output file:
```shell
$ verdi calculation outputcat 7491 -p output_framework_1.1.1_300.000000_500000.data
...
Average adsorption energy <U_gh>_1-<U_h>_0 obtained from Widom-insertion:
(Note: the total heat of adsorption is dH=<U_gh>_1-<U_h>_0 - <U_g> - RT)
=========================================================================

Simulation finished, 1 warnings
WARNING: INAPPROPRIATE NUMBER OF UNIT CELLS USED

# License
MIT

Thu Jan 10 16:39:01 2019
Simulation finished on Thursday, January 10.
The end time was 04:39 PM.
```
# Contact
yakutovicha@gmail.com

## License

MIT
# Acknowledgements
This work is supported by:
* the [MARVEL National Centre for Competency in Research](http://nccr-marvel.ch) funded by the [Swiss National Science Foundation](http://www.snf.ch/en);
* the [MaX European Centre of Excellence](http://www.max-centre.eu/) funded by the Horizon 2020 EINFRA-5 program, Grant No. 676598;
* the [swissuniversities P-5 project "Materials Cloud"](https://www.materialscloud.org/swissuniversities).

## Contact
yakutovicha@gmail.com
<img src="miscellaneous/logos/MARVEL.png" alt="MARVEL" style="padding:10px;" width="150"/>
<img src="miscellaneous/logos/MaX.png" alt="MaX" style="padding:10px;" width="250"/>
<img src="miscellaneous/logos/swissuniversities.png" alt="swissuniversities" style="padding:10px;" width="250"/>
2 changes: 1 addition & 1 deletion aiida_raspa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
##############################################################################
"""AiiDA-RASPA plugins, parsers, workflows, etc ..."""

__version__ = "1.0.0a3"
__version__ = "1.0.0"

0 comments on commit f4327ce

Please sign in to comment.