## page was renamed from Download and installation ## page was renamed from Installation <> = Installation = == System requirements == In principle, BDF supports all Unix-like platforms. However, we strongly advise you to use BDF on a Linux platform together with Intel or GCC compilers because the BDF package was developed and most thoroughly tested on such platforms. System requirements of BDF are summarized as following lines: {{{ OS: Linux, Mac, FreeBSD, Unix Compiler: Fortran 90 compiler such as Intel, gfortran, g95 Support softwares: Python, make Parallel environments: MPI }}} == Configure and compile BDF package == Several steps are needed to install BDF package. 1. Set fortran and C compiler. . If you use bash shell, you can set fortran and C compiler: {{{ $export FC=ifort $export CC=gcc $export CXX=g++ }}} . Tips: If you ignored this step, the configure script will pick up the gfortran and gcc compiler as default. 2. Set blas and lapack library. The external Blas and Lapack libraries are needed for compiling BDF. In addition, C language Blas and Lapack are required. It is easiest to use Intel MKL. You only need to set "MATHLIB" and "MATHINCLUDE" as {{{ $export MATHLIB="-lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread" $export MATHINCLUDE="-I/opt/intel/mkl/include" }}} However, you may choose to use Blas and Lapack from netlib. You may download lapack library from http://www.netlib.org/lapack/lapack-3.6.0.tgz. Do not forget also compile "lapacke" and "cblas", which is a C interface for lapack and blas library. Then, you need to set "MATHLIB" and "MATHINCLUDE" {{{ $export MATHLIB="-L/Users/aaa/mathlib/ -llapack -lblas -llapacke -lcblas" $export MATHINCLUDE="-I/Users/aaa/lapack-3.6.0/lapacke/include -I/Users/aaa/lapack-3.6.0/cblas/include" }}} And, due to netlib only offer 32-bit cblas and lapacke officially, you need either modify codes from netlib, or specific FORTINT=int: {{{ $export MATHINCLUDE="-I/Users/aaa/lapack-3.6.0/lapacke/include -I/Users/aaa/lapack-3.6.0/cblas/include -DFORTINT='int'" }}} the latter option can make the package compile, but may meet unexpected errors when the job involves cblas and lapacke. 3.(optional)Set processor specific compiling flags. If you need to speed up the program, you can turn on specific compiling flag in config/simd.mh for example, you can turn on core-avx2 with intel compiler on intel CPU with Haswell microarchitecture or later on. {{{ SIMDFLAGS := -march=core-avx2 CFLAGS :=$(SIMDFLAGS) $(CFLAGS) CXXFLAGS :=$(SIMDFLAGS) $(CXXFLAGS) F77FLAGS :=$(SIMDFLAGS) $(F77FLAGS) F90FLAGS :=$(SIMDFLAGS) $(F90FLAGS) }}} 4. Configure BDF package. After setting compiler and mathematic library. You can configure BDF by command configure in BDF root directory. {{{ $./configure }}} Configure supports several parameters. {{{ --enable-debug=yes[no] Compile BDF in debug mode. --enable-i8=yes[no] Compile BDF with 64 bit integers. --enable-openmp=yes[no] Compile BDF with OpenMP support. --enable-mpi=yes[no] Compile BDF with MPI support. --enable-parallel=yes[no] Compiler BDF with MPI and OpenMP support. --enable-mkl=yes[no] Compiler BDF withIntel MKL support. }}} 5. Compile BDF package. {{{ $make }}} == Compile parallel bdf == Some of BDF modules support parallel calculation. You can compiler BDF as parallel mode. At present, we support MPI and OpenMP. 1. MPI and OpenMP hybrid. {{{ $./configure --enable-parallel=yes }}} 2. Only MPI. {{{ $./configure --enable-mpi=yes }}} 3. Only OpenMP. {{{ $./configure --enable-openmp=yes }}} == Examples of some typical installations == 1. A 64bit machine with intel compiler and MKL library. {{{ export FC=ifort export CC=gcc export CXX=g++ export MATHLIB="-lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread" export MATHINLCUDE="-I/opt/intel/mkl/include" ./configure --enable-i8=yes --enable-openmp=yes --enable-mkl=yes make }}} 2. A Mac laptop with gfortran, gcc and user compiled lapack and blas library {{{ $export FC=gfortran $export CC=gcc $export CXX=g++ $export MATHILIB="-L/Users/mike/mathlib -lblas -llapack" $export MATHINCLUDE="-I/Users/mike/lapack-3.6.0/lapacke/include -I/Users/mike/lapack-3.6.0/cblas/include" $./configure --enable-i8=yes --enable-openmp=yes $make }}} 3. A Linux cluster with fort, icc, openmpi and intel MKL library. . Check MPI flags by using command {{{ $mpif90 --shownme }}} . You may get such output. {{{ ifort -I/opt/openmpi/include -I/opt/openmpi/lib -L/opt/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -ldl -lm -Wl,--export-dynamic -lrt -lnsl -lutil }}} . You can compile bdf package as {{{ $export FC=ifort $export CC=icc $export CXX=icpc $export MATHLIB="-lmkl_intel_ilp64 -lmkl_sequential -lmkl_core -lpthread" $export MATHINCLUDE="I/opt/intel/mkl/include" $export MPILIB="-I/opt/openmpi/include -I/opt/openmpi/lib -L/opt/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -ldl -lm -Wl,--export-dynamic -lrt -lnsl -lutil" $./configure --enable-i8=yes --enable-parallel=yes --enable-mkl=yes $make }}} . If you only want to evoke MPI, just use {{{ $./configure --enable-i8=yes --enable-mpi=yes --enable-mkl=yes }}} == Enable PCM solver == PCM solver is interfaced with BDF to include solvent effect. By default PCM solver is disabled, since we have found this package to be less portable than other parts of the program so that compilation may fail on many machines. To enable PCM solver, you should use --enable-pcmsolver=yes in configuration. {{{ ./configure --enable-pcmsolver=yes }}} == Set system variables of BDF package == = Using dynamic library = For reducing program size and easy developing, dynamic library can be used. {{{ ./configure --enable-openmp=yes --enable-mkl=yes --enable-dyn=yes }}} == List of dynamic libraries == The extra libraries libcint,libgen1int,libxcfun are dynamic. The list of other dynamic libraries can be finded in variable "DYNUTL" in database/xianest.mh == Modifying libraries == If the modified code is code of static library, please rebuild the library and the programs use this library. Just type {{{ make }}} If the modified code is code of program, just rebuild the program. Just type {{{ make }}} After modifying dynamic libraries, just rebuild the library. You need to type {{{ make }}} If function calls are changed in both dynamic library and program, please rebuild the library first, then the executable modules. = Compile BDF-GTO by using Cmake = == Requirements == {{{ Cmake -- 3.15 or newer. }}} == Configure and compiling BDF == === Linux, MKL and ifort === You may use the shell script bootstrap to configure BDF. The configuration script bootstrap has such contains: {{{ #!/bin/bash # Configure for different platform #TARGET = $1 export FC=ifort export CC=gcc export CXX=g++ ./setup --fc=${FC} --cc=${CC} --cxx=${CXX} --int64 --mkl sequential $1 }}} You just need to use the following commands to configure, build and install BDF. {{{ ./bootstrap build cd build make -j8 make install }}} The command "bootstrap" will configure BDF in the first step. The python script setup is invoked, parameters in setup are set and pass to cmake. The cmake is executed by the setup command automatically to build BDF in the directory build. Then, you will enter in the directory and compile BDF via the command "make -j8". The parallel compiling is evoked. Finally, you will use the command "make install" to install BDF in the directory "build/bdf-pkg-full" or "build/bdf-pkg-pro". === Precompiled BLAS and Lapack from netlib === You may use the shell script bootstrap to configure BDF. You just need to use the command {{{ ./bootstrap build cd build make -j8 make install }}} The contents of bootstrap are {{{ #!/bin/bash export FC=gfortran export CC=gcc export CXX=g++ export LIBMATH="-L/Users/bsuo/Library/mathlib/lapack-3.8.0 -llapack -lblas -lcblas -llapacke" export INCMATH="-I/Users/bsuo/Library/mathlib/lapack-3.8.0/LAPACKE/include -I/Users/bsuo/Library/mathlib/lapack-3.8.0/CBLAS/include" ./setup --debug --int64 --mathinclude-flags="${INCMATH}" --mathlib-flags="${LIBMATH}" $1 }}} Here, Fortran, C, and C++ compilers are set first. Then, the link flags for blas and lapack libraries are set as LIBMATH. The directory of the lapacke head files is set as INCMATH. If you use MKL, you just need to set the proper parameters to variables LIBMATH and INCMATH. Here is an example to compile BDF with ifort, gcc, g++, and MKL. = Slater Type Orbital BDF (BDF-STO) installation = == System requirements == You'll need the following build tools to compile BDF: {{{ autoconf 2.59 or later (Unix only) libtool 2.1 or later (Unix only) python 2.6 or later certain linux distros need to install development packages for python (python-dev), zlib, (zlib1g-dev on Ubuntu, zlib-devel on OpenSUSE) lxml 2.3 or later (http://codespeak.net/lxml/index.html#download) a reasonable C compiler (gcc, icc, etc.) a reasonable Fortran compiler (gfortran, ifort, etc.) }}} == Configure and compile BDF-STO package == The simplest way to compile this package is: 1.'cd' to the directory containing the package's source code and type {{{ ./autogen.sh }}} to automatically generate Makefile.in and configure script if they do not exist. 2.Using following codes to configure and compile: {{{ mkdir build && cd build ../configure --enable-mkspec=YOUR-MKSPEC --prefix=/PATH/TO/INSTALL make install }}} Here YOUR-MKSPEC is the name of mkspec which match your OS and compiler configuration. For all supported configurations, please see those subdirectory names (except 'common') under the directory 'mkspecs', e.g. 'linux-intel-cxe2015'. If compile and test successfully, the bdf binary will be installed under the directory '/PATH/TO/INSTALL/bin'. There are some sample jobs under the directory 'testsuit/testjobs'. They will be installed under '/PATH/TO/INSTALL/share/bdf/testjobs' You can use following commands to run samples {{{ /path/to/install/bin/bdf testsuit/testjobs/h2o_dks.job }}} == Using XCFun in BDF-STO == All the following things should be done after autogen.sh 1.XCFun installation: {{{ git clone https://github.com/dftlibs/xcfun.git cd xcfun git checkout 355f42497a9cd17d16ae91da1f1aaaf93756ae8b cd .. && tar czf xcfun.tar.gz xcfun cd xcfun mkdir build && cd build cmake -DCMAKE_C_COMPILER=icc _DCMAKE_CXX_COMPILER=icpc -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_SHARED_LIBS=1 -DXC_MAX_ORDER=3 -DXCFUN_ENABLE_TESTS=0 -DCMAKE_INSTALL_PREFIX:PATH=/opt -DCMAKE_INSTALL_LIBDIR:PATH=lib .. make && make install }}} 2.Change the configure: {{{ ac_cv_fc_libs="$FCLIBS -lxcfun_f90_bindings -lxcfun" # Let the user override the test. }}} in line 7251.Add the dynamic link to configure,so configure will generate the makefile,which contains the "-lxcfun_f90_bindings -lxcfun" . 3.Change the src/nmr/Makefile.am: For example, {{{ -I/home/pzc/xcfun/include }}} should be added to AM_FCFLAGS and AM_FFLAGS 4.Configure and compile: {{{ mkdir build && cd build ../configure --enable-mkspec=YOUR-MKSPEC --prefix=/PATH/TO/INSTALL make install }}}