Installing Demon with Intel and OpenMPI

DeMon (Density of Montréal) "is a software package for density functional theory (DFT) calculations. It uses the linear combination of Gaussian-type orbital (LCGTO) approach for the self-consistent solution of the Kohn-Sham (KS) DFT equations. The calculation of the four-center electron repulsion integrals is avoided by introducing an auxiliary function basis for the variational fitting of the Coulomb potential."

To acquire deMon you will need either an academic or non-academic license. As always with when performance is a priority, choosing source is much better than choosing a binary. However installation is far from simple.

Download the source code to an appropriate directory (/usr/local/src/DEMON. The minimal documentation provided is far from complete. To be sure, the code can be unpacked by just typing sh ./deMon2k.sh, but even that requires a little investigation. The following applies for version 3.0.1 and assumes that you have environment variables in place for Intel and the appropriate MPI (module load intel, module load openmpi-intel).

Firstly the shell script actually has a binary archive inside the shell script file, which isn't the best practise in my considered opinion.

Secondly, the script uses plain-shell rather than bash. This is important as the is the if-then conditional sequence later in the script will fail if you are just using shell. Change this from #!/bin/sh to #!/bin/bash. Plain shell will generate the following error;


./deMon2k.sh: 33: [[: not found
./deMon2k.sh: 33: [[: not found

Thirdly a leading comment in the script, suggesting which directory to move to after extraction, is incorrect. It is currently; #cd deMon.2.2.6 when what is needed is #cd deMon.3.0.1.

Fourthly, you almost certainly will need to change the configuration options. This install assumes you will be using Intel compilers and Openmpi-Intel. Change to the appropriate "database" (cd /usr/local/src/DEMON/deMon.3.0.1/deMon/3.0.1/database and modify the appropriate file (you might want to backup this file first), extending the libraries for linking and changing the paths. You will also need blas libaries For example;


module load atlas/3.9.1-intel
vim Linux-x86_64.mpi.ifort

#F90 /usr/lib64/openmpi/bin/mpif90
F90 /usr/local/openmpi/1.4.3-intel/bin/mpif90
# -L/opt/intel/mkl/10.2.2.025/lib/em64t
-L/usr/local/intel/Compiler/11.1/038/mkl/lib/
#-L/usr/lib64/atlas
-L/usr/local/atlas/3.9.1-intel/lib
LIBS -lmkl_intel_lp64 -lmkl_sequential -lmkl_core
-llapack -lf77blas -latlas -lcblas -lptcblas \
-lptf77blas -lclapack

Make the change to the install directory (cd /usr/local/src/DEMON/deMon.3.0.1/) and run ./install. Accept the license and choose a sensible place for the actual installation (e.g., /usr/local/demon/3.0.1. Choose an MPI compilation (option 4) and a compiler (in this case, Intel Fortran 90, 2).

The installer will then compile no less than 1334 source files. This might take a while. Oddly even after running this the installer spits out the following:

ld: cannot find -lmkl_intel_lp64
..
deMon compilation failed

So you'll have to go to the install directory and recompile from the object files.


cd /usr/local/demon/3.0.1/deMon/3.0.1/object.mpi
mpif90 -r8 -i4 -O3 -w95 -stand none -assume byterecl -L/usr/local/atlas/3.9.23-intel/lib -L/usr/local/intel/Compiler/11.1/038/mkl/lib/em64t/ -I/usr/local/3.0.1/deMon/3.0.1/include/usr/local/3.0.1/deMon/3.0.1/object.mpi/deMon.3.0.1.mpi -lmkl_intel_lp64 -lmkl_sequential -lmkl_core *.o -o demon

Which generated a demon binary and the acceptable warning /usr/local/intel/Compiler/11.1/069/lib/intel64//libimf.so: warning: warning: feupdateenv is not implemented and will always fail.

Finally you will be able set demon with environment modules. Note in this case that there is a new version is being used for each version rather than a symbolic link to a base file;

cd /usr/local/Modules/modulefiles/demon
vim 3.0.1

#%Module1.0#####################################################################
##
## $name modulefile
##
set name [lrange [split [ module-info name ] / ] 0 0 ]
set loading [module-info mode load]
proc ModulesHelp { } {
puts stderr "\tThis module sets the envinronment for $name v$ver"
}
module-whatis "Set environment variables to use Demon 3.0.1"
if { $loading && ![ is-loaded atlas/3.9.23-gcc ] } {
module load atlas/3.9.23-gcc
}
if { $loading && ![ is-loaded intel/11.1 ] } {
module load intel/11.1
}
if { $loading && ![ is-loaded openmpi-intel/1.5.1 ] } {
module load openmpi-intel/1.5.1
}
prepend-path --delim " " CPPFLAGS -I/usr/local/demon/3.0.1/deMon/3.0.1/include
prepend-path PATH /usr/local/demon/3.0.1/deMon/3.0.1/object.mpi/