External Programs

Currently, the only way to enable MiMiC in the supported programs comes in the form of patches, which should be applied to the original source codes.

The following instructions mostly follow the compilation of the original software. Therefore, if you come across any problems unrelated to MiMiC, please consult their respective manuals.

CPMD

In your ${SOURCE_DIR} directory, download CPMD 4.3 and all available patches including the MiMiC patch (MiMiC.tar.gz) from the official CPMD website, unpack, and copy the patches to the CPMD directory:

tar -zxvf cpmd-v4.3.tar.gz
tar -zxvf MiMiC.tar.gz
cp patch.to.* MiMiC_CPMD-4.3.patch PLUMED_CPMD-4.3.patch CPMD

Enter the CPMD directory and first apply all official patches in strictly sequential order:

cd CPMD
for patch_no in 4612 4615 4616 4621 4624 4650; do
  patch -p0 < patch.to.${patch_no}
done

When applying patch.to.4650, if you encounter a GROMOS-related error message, just ignore it and hit the enter key twice. The same patch may also fail a change in the manual (because it is already there). If so then you can also ignore this error message.

Then apply the MiMiC patch:

patch -p0 < MiMiC_CPMD-4.3.patch

Before we proceed to the actual compilation, it is necessary to export paths to the library and include directories containing MiMiC:

export CPATH=${INSTALL_DIR}/include:${CPATH}
export LIBRARY_PATH=${INSTALL_DIR}/lib:${INSTALL_DIR}/lib64:${LIBRARY_PATH}
export LD_LIBRARY_PATH=${INSTALL_DIR}/lib:${INSTALL_DIR}/lib64:${LD_LIBRARY_PATH}

Depending on the Linux distribution, the libraries might be installed either in lib or lib64. The commands above cover both possibilities. You can always inspect the content of your ${INSTALL_DIR} to check which path applies in your case.

See Enabling support for PLUMED if you want to enable support for PLUMED in CPMD.

Now configure the build using the configure.sh script. Choose a configuration file from the configure directory that is most suitable for your target system, switch to the build directory, and compile:

./configure.sh -DEST=build -omp -mimic <configuration-file-name>
cd build
make

Attention

Make sure that your selected configuration supports MPI, as this is required by MiMiC. There are no further checks and you would discover the incompatibility during runtime.

Using GCC

If you are using gfortran to compile CPMD, you first have to export the INSTALL_DIR variable:

export INSTALL_DIR

and then manually edit selected configuration file by appending the following lines:

FFLAGS=${FFLAGS}" -I${INSTALL_DIR}/include -fallow-argument-mismatch -ffree-line-length-none"
LIBS=${LIBS}" -L${INSTALL_DIR}/lib -L${INSTALL_DIR}/lib64"

Depending on your machine, the libraries might be installed either in lib or lib64. The lines above cover both possibilities. You can always inspect the content of your ${INSTALL_DIR} to check which path applies in your case.

Optionally, as a final touch you can create a symlink to the CPMD binary in INSTALL_DIR:

mkdir -p ${INSTALL_DIR}/bin
cd ${INSTALL_DIR}/bin
ln -s ${SOURCE_DIR}/CPMD/build/bin/cpmd.x

Pseudopotentials

Pseudopotentials are not distributed with CPMD, so do not forget to download them either from the CPMD website or your favourite pseudopotential repository.

Enabling support for PLUMED

To enable support for PLUMED in CPMD, there are a few additional steps. First you need to have PLUMED installed. If you already have a working PLUMED installation, you can skip the PLUMED installation part.

Note

We have tested PLUMED v2.6.5, v2.7.4, v2.8.0, and v2.8.1, but it is likely that other versions of PLUMED 2 are also compatible with the CPMD patch provided in the MiMiC tarball.

Installing PLUMED

Here we provide a quick installation guide for PLUMED. For more detailed information please consult the official PLUMED documentation.

First move to the source directory, download PLUMED v2.8.1 from the official PLUMED website, and unpack it:

cd ${SOURCE_DIR}
wget https://github.com/plumed/plumed2/releases/download/v2.8.1/plumed-2.8.1.tgz
tar -zxvf plumed-2.8.1.tgz

Then enter the PLUMED source directory, configure, build, and install:

cd plumed-2.8.1
./configure CXX=<c++-mpi-wrapper> --prefix=${INSTALL_DIR}
make
make install

Finally, set the following environment variables:

export PATH=${INSTALL_DIR}/bin:${PATH}
export LIBRARY_PATH=${INSTALL_DIR}/lib:${LIBRARY_PATH}
export LD_LIBRARY_PATH=${INSTALL_DIR}/lib:${LD_LIBRARY_PATH}
export PLUMED_KERNEL=${INSTALL_DIR}/lib/libplumedKernel.so
export PLUMED_VIMPATH=${INSTALL_DIR}/lib/plumed/vim
export PYTHONPATH=${INSTALL_DIR}/lib/plumed/python:${PYTHONPATH}

Move to the CPMD source directory, create a new PLUMED patch, and apply it:

cd ${SOURCE_DIR}/CPMD
plumed patch -n CPMD-4.3
plumed patch -p -e CPMD-4.3 -d PLUMED_CPMD-4.3.patch

Finally, add the -plumed option in the configuration step.

GROMACS

In your ${SOURCE_DIR} directory, download and unpack GROMACS 2021.6 from the official GROMACS website:

tar -zxvf gromacs-2021.6.tar.gz

Download the MiMiC patch for GROMACS, copy it to the GROMACS directory, and apply it:

cp MiMiC_GROMACS-2021.patch gromacs-2021.6/
cd gromacs-2021.6
patch -p1 < MiMiC_GROMACS-2021.patch

Create a build directory, enter it, configure the build by running CMake, build, and finally install:

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DGMX_DOUBLE=ON -DGMX_MPI=ON -DGMX_MIMIC=ON \
      -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCMAKE_PREFIX_PATH=${INSTALL_DIR} ..
make
make install

You are free to use any other flags, but those shown here are required for a successful build of MiMiC-enabled GROMACS.