Compiling Qbics ==================== To compile Qbics, please follow the instructions step-by-step. One-key Build ------------------- Fundamental Components ------------------------- The following fundamental components are needed: - ``gcc``, version >= 8.0; - ``make``, version >= 3.8; - ``OpenMPI``, version >= 3.0, if OpenMPI is enabled; - ``nvcc``, version >= 11.0, if CUDA is enabled; Third-party Libraries ---------------------- ``Boost`` and ``Eigen`` ++++++++++++++++++++++++++++ ``Boost`` and ``Eigen`` are two header-only libraries that do not need compilation. They can be obtained from: - ``Boost``: https://www.boost.org/ - ``Eigen``: https://eigen.tuxfamily.org/ After you download the source files, decompress them. You will find directories called ``boost`` and ``Eigen``, respectively. Copy ``boost`` and ``Eigen`` to a suitable path, say ``/home/zhang/libs``. This will be the value for ``$INCBOOST`` and ``$INCEIGEN`` in the corresponding Makefile. Of course, if your system has already installed ``Boost`` and ``Eigen`` somewhere, just use those then. ``libxc`` +++++++++++++ ``libxc`` is a density functional library. It can be obtained from https://libxc.gitlab.io/. You can compile it using the following instructions: .. code-block:: bash $ bzip2 -d libxc-x.x.x.tar.bz2 $ tar -xvf libxc-x.x.x.tar $ cd libxc-x.x.x $ autoreconf -i $ ./configure --prefix=/home/zhang/libs/libxc $ make -CFLAGS="-std=c99 -O2" $ make install Now, all ``libxc`` files are available in ``/home/zhang/libs/libxc``. Of course, if your system has already installed ``libxc`` somewhere, just use it then. ``libfftw3`` +++++++++++++ ``libfftw3`` is an efficient library for fast Fourier transformation. It can be obtained from https://www.fftw.org/download.html. You can compile it using the following instructions: .. code-block:: bash $ tar -xzf fftw-x.x.x.tar.gz $ cd fftw-x.x.x $ ./configure --prefix=/home/zhang/libs/fftw --enable-openmp $ make $ make install Now, all ``libfftw3`` files are available in ``/home/zhang/libs/fftw``. Of course, if your system has already installed ``libfftw3`` somewhere, just use it then. ``plumed`` +++++++++++++++ ``plumed`` is a library for enhanced sampling algorithms. It can be obtained from https://github.com/plumed/plumed2/releases/. You can compile it using the following instructions: .. code-block:: bash $ unzip plumed2-x.x.x.zip $ cd plumed2-x.x.x $ ./configure --prefix=/home/zhang/libs/plumed2 --disable-mpi --disable-external-lapack --disable-external-blas $ make $ make install Of course, if your system has already installed ``plumed`` somewhere, just use it then. ``dftd3-lib`` +++++++++++++++ ``dftd3-lib`` is a library for carrying out DFT-D3 calculations. It can be obtained from https://github.com/dftbplus/dftd3-lib. You can compile it using the following instructions: .. code-block:: bash $ unzip dftd3-lib-master.zip $ cd dftd3-lib-master $ make lib $ cp lib /home/zhang/libs/dftd3-lib -r Of course, if your system has already installed ``dftd3-lib`` somewhere, just use it then. Edit Makefile ------------------------------ After decompressing the source file archive, you can find several Makefiles: +------------------------+-----------------------------------------------------------+ |``Makefile-win-cpu`` | Native Windows version, OpenMP parallelized. | +------------------------+-----------------------------------------------------------+ |``Makefile-linux-cpu`` | Linux version, OpenMP parallelized. | +------------------------+-----------------------------------------------------------+ |``Makefile-linux-gpu`` | Linux version, OpenMP parallelized, GPU enabled. | +------------------------+-----------------------------------------------------------+ Open the suitable one, say ``Makefile-linux-cpu``, you can find the following: .. code-block:: bash :linenos: :caption: Makefile-linux-cpu CODEINFO = -DCodeCommit="\"`git rev-parse HEAD`\"" \ -DCodeFlag="\"official version\"" \ -DCodeMajorVer=0 \ -DCodeMinorVer=1 \ -DCodeUser="\"`whoami | sed 's/\\\\/\\\\\\\\/g'`\"" \ -DCodeMachine="\"`hostname`\"" \ -DCodeCompiler="\"`$(CXX) --version | head -n 1`"\" \ -DCodeCompFlags="\"$(CXXFLAG)"\" \ -DCodeLibs="\"$(LIBS)"\" \ -DOSLinux \ -DNDEBUG CXX = g++ CXXFLAG = -O2 -fno-exceptions --std=c++17 -fopenmp -ffast-math -fno-finite-math-only -fexpensive-optimizations -Wall -mavx2 -mfma CC = gcc CCFLAG = -O2 -fopenmp -Wall FC = gfortran FCFLAG = -O2 -fopenmp -Wall NCC = nvcc NCCFLAG = -O2 -use_fast_math -arch=compute_75 -code=sm_75 # Third-party library LIBGNU = -lgfortran -lquadmath -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive LIBXC = /opt/libxc-5.2.3/lib/libxc.a LIBFFTW3 = /opt/fftw-3.3.10/lib/libfftw3.a /opt/fftw-3.3.10/lib/libfftw3_omp.a LIBDFTD = /opt/dftd3-3.2/dftd3-lib-0.9/lib/libdftd3.a LIBJSON = /opt/jsoncpp/lib/libjsoncpp.a LIBLEPTON = /opt/lepton/liblepton.a LIBCUDA = LIBSPONGE = LIBS = $(LIBXC) $(LIBFFTW3) $(LIBDFTD) $(LIBJSON) $(LIBLEPTON) $(LIBGNU) # Third-party include INCBOOST = -I/opt/include/boost_1_78_0 INCEIGEN = -I/opt/include/eigen-3.4.0 INCLIBXC = -I/opt/libxc-5.2.3/include INCFFTW3 = -I/opt/fftw-3.3.10/include INCDFTD = -I/opt/dftd3-3.2/dftd3-lib-0.9/lib INCJSON = -I/opt/jsoncpp/include INCLEPTON = -I/opt/lepton INCCUDA = -I/usr/local/cuda-11.4/targets/x86_64-linux/include INCS = $(INCBOOST) $(INCEIGEN) $(INCLIBXC) $(INCFFTW3) $(INCDFTD) $(INCJSON) $(INCLEPTON) - You can modify the macro ``CodeFlag`` to give the code a unique identifier. - You can change ``CXXFLAG``, ``FCFLAG`` or ``NCCFLAG`` to add suitable optimization options according to your systems. - You should change ``LIBXC``, ``INCBOOST``, etc. to provide the correct paths of libraries and header files. Compile ------------------------- After editing your Makefile, say ``Makefile-linux-cpu``, just run the following command: .. code-block:: bash $ make -f Makefile-linux-cpu -j After a long time, everything is ready in ``bin``. You can copy ``bin`` to anywhere you like.