AiiDA on ubuntu 22.04

Ubuntu 22.04 installs recent RabbitMQ version that requires consumer_timeout configuration for AiiDA. See

RabbitMQ version to use · aiidateam/aiida-core Wiki · GitHub

What should be done is as follows:

sudo vi /etc/rabbitmq/rabbitmq.conf

add the line

consumer_timeout = 3600000000

Restart. RabbitMQ server

sudo systemctl restart rabbitmq-server.service

Check if this file is listed under the "Config files" section by

sudo rabbitmq-diagnostics status

If all OK, then

verdi config set warnings.rabbitmq_version false

AiiDA setup (aiida-core, aiida-vasp, aiida-phonoxpy) on an empty VM from scratch on Ubuntu 22.04

sudo apt install rabbitmq-server

Prepare miniforge and

conda install python postgresql

Installation into Conda environment — AiiDA 2.5.0.post0 documentation

git clone https://github.com/aiidateam/aiida-core.git
cd aiida-core
pip install -e ."[atomic_tools]" 

Initialize postgres, and prepare aiidadb. Now verdi quicksetup works nicely.

initdb -D /home/username/aiida-proj
pg_ctl -D /home/username/aiida-proj start
verdi quicksetup

Tab completion may be set in $CONDA_PREFIX/etc/conda/activate.d/.

https://aiida.readthedocs.io/projects/aiida-core/en/latest/howto/installation.html#activating-tab-completion

https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#saving-environment-variables

AiiDA plugins of aiida-vasp and aiida-phonoxpy are installed via github repositories with pip install -e . -vvv.

Specific scheduler plugin may be required for me.

Setting up computer and code.

How to run external codes — AiiDA 2.5.0.post0 documentation

For aiida-vasp POTCARs,

verdi data vasp-potcar uploadfamily ...

Maybe setting up local queueing system (gridengine), https://atztogo.hatenablog.com/entry/2020/08/07/105923

Files of calculation on AiiDA

Usage — AiiDA 2.5.0.post0 documentation

local_copy_list

Input files -> local file system -> remote working directory

remote_copy_list

Files on remote machine -> remote working directory

retrieve_list

Files on remote working directory -> local retrieved folder

retrieve_temporary_list

Files on remote working directory -> local temporary folder -> Files removed after parsing

AiiDA error handling

Dealing with Errors — AiiDA Tutorials

Migration of python version on conda for AiiDA

I install AiiDA on conda env. Python packages follow python release versions, and often newer python versions are preferable. But updating python version on a conda env by, e.g., conda update "python=3.11" fails when many packages were already installed because of the failure of solving dependency. Then, an easy choice is creating new env and install packages from scratch. This is much easier for me indeed.

Recent conda can rename env easily

conda rename -n orig_env backup_env

Create orig_env

conda create -n orig_env

Install packages (here python 3.11 for example)

conda install "python=3.11" postgresql

Having major version change of postgresql, db migration is necessary, see https://atztogo.hatenablog.com/entry/2023/05/06/154612.

Install other packages

conda install numpy scipy h5py pyyaml matplotlib-base c-compiler cxx-compiler "libblas=*=*mkl" spglib mkl-include boost eigen cmake ipython make

Activate (deactivate) setting has to be modified for zsh user like me.

cd $CONDA_PREFIX/etc/conda/activate.d/ 
mkdir bash
mv * bash
cp ~/.miniforge/envs/backup_env/etc/conda/activate.d/env_vars.sh .

Modify env_vars.sh. Do the same for deactivate. In my case following lines:

export AIIDA_PATH=~/aiida
eval "$(_VERDI_COMPLETE=zsh_source verdi)"
export HOST=`hostname`
autoload bashcompinit
bashcompinit
emulate sh -c 'source $CONDA_PREFIX/etc/conda/activate.d/bash/activate-binutils_linux-64.sh'
emulate sh -c 'source $CONDA_PREFIX/etc/conda/activate.d/bash/activate-gcc_linux-64.sh'
emulate sh -c 'source $CONDA_PREFIX/etc/conda/activate.d/bash/activate-gxx_linux-64.sh'
emulate sh -c 'source $CONDA_PREFIX/etc/conda/activate.d/bash/libblas_mkl_activate.sh'
emulate sh -c 'source $CONDA_PREFIX/etc/conda/activate.d/bash/libxml2_activate.sh'

are written in env_vars.sh. Then installing packages via pip. git-pull aiida-core, and

pip install -e ."[atomic_tools,docs,tests,rest]"

git-pull aiida-vasp, and

pip install -e ."[pre-commit,tests,graphs]"

Installed a different version of aiida-core, aiida-storage update may be necessary, but this is informed when verdi status or verdi daemon start, etc. So just follow it.

Transferring data in AiiDA

How to work with data — AiiDA 2.5.0.post0 documentation

Upgrade conda-forge postgresql from 14 to 15

Assume having old postgresql (v14) db directory exists at

/home/username/aiida-proj/psql

Upgrade postgresql (14 -> 15) of the current conda env (myproj)

Create a new conda env (psql) with old postgresql (14).

initdb -D /home/username/myproj/psql15
cp /home/username/myproj/psql/pg_hba.conf /home/username/myproj/psql15/
cp /home/username/myproj/psql/postgresql.conf /home/username/myproj/psql15/
pg_upgrade --old-datadir=/home/username/myproj/psql --new-datadir=/home/username/myproj/psql15 --old-bindir=/home/username/.miniforge/envs/psql/bin --new-bindir=/home/username/.miniforge/envs/myproj/bin --old-options '-c config_file=/home/username/myproj/psql/postgresql.conf' --new-options '-c config_file=/home/username/myproj/psql15/postgresql.conf' --check

If all OK, remove --check and rerun the above again.

mv /home/username/myproj/psql /home/username/myproj/psql14
ln -s /home/username/myproj/psql15 /home/username/myproj/psql

AiiDA v2.0 migration

eval "$(_VERDI_COMPLETE=zsh_source verdi)"
export AIIDA_WARN_v3=1
% conda update pip

In aiida-core

% find . -name "*.pyc" -delete
% rm -r ./*.egg-info
% git checkout develop
% git pull
% git checkout v2.0.1
% pip install -e ."[atomic_tools,docs,tests,rest]"
% verdi storage migrate
% verdi storage maintain --full

Migration log and old data

migration-repository-missing-subfolder-qxze5vt4.json
.aiida/repository/demo/repository