% dmrginst.tex $ this file belongs to the Molcas repository $*/

%============================================================================
\section{Installation of CheMPS2--\molcas\ interface for DMRG calculations}
\label{sec:chemps2_installation}

The CheMPS2--\molcas\ interface \cite{Phung2016,Wouters2016},
based on the Block--\molcas\ interface \cite{Nakatani2017},
can support DMRG-SS-CASPT2 and DMRG-SA-CASPT2 calculations.
It requires the following components:

HDF5: \file{https://support.hdfgroup.org/HDF5}\\
CheMPS2 binary: \file{https://github.com/SebWouters/CheMPS2/archive/v1.8.4.tar.gz}\\

HDF5 must be configured with Fortran, Fortran 2003, and C++ enabled:

\begin{sourcelisting}
./configure --enable-fortran --enable-fortran2003 --enable-cxx
\end{sourcelisting}

Make sure that both \file{libhdf5\_fortran.so} and \file{libhdf5.so} are generated.

For CheMPS2 binary installation, consult  

\begin{sourcelisting}
http://sebwouters.github.io/CheMPS2/sourcecode.html
\end{sourcelisting}

Note that only the version with the Open Multi-Processing (OpenMP) is supported,
thus build CheMPS2 with:

\begin{sourcelisting}
-DWITH_MPI=OFF
\end{sourcelisting}

In order to efficiently run the CheMPS2--\molcas\ interface, 
it is advisible to compile either serial or parallel \molcas with MPI.
An example:

\begin{sourcelisting}
./configure -compiler intel -parallel -64 -mpiroot /path/to/mpi/root \
            -mpirun /path/to/mpi/bin/mpirun -blas MKL -blas_lib -mkl=sequential \
            -hdf5_inc /path/to/hdf5/include \
            -hdf5_lib /path/to/hdf5/lib \
            -chemps2 /path/to/chemps2/binary
\end{sourcelisting}

The CheMPS2--\molcas\ interface can also be activated with CMake:

\begin{sourcelisting}
-DCHEMPS2=ON -DCHEMPS2_DIR=/path/to/chemps2/binary
\end{sourcelisting}


Before testing the CheMPS2--\molcas\ interface, make sure to increase stack size,
export OMP\_NUM\_THREADS, the CheMPS2 binary, and all the required libraries for CheMPS2.

\begin{sourcelisting}
ulimit -s unlimited
[export OMP_NUM_THREADS=...]
export PATH=/path/to/chemps2/binary:$PATH
\end{sourcelisting}

Verify the installation:

\begin{sourcelisting}
 molcas verify 850 851
 molcas verify benchmark:970
\end{sourcelisting}

