必须使用centos我以前一直在尝试使用7的环境Ubuntu20来安装block以及相应的,一直报错(可能是因为gcc版本过高)
- 安装g
su yum install gcc-c exit #记得退出root用户!!!
- 安装Intel编译器,参考资料
tar -zxvf parallel_studio_xe_2019_update1_cluster_edition.tgz cd parallel_studio_xe_2019_update1_cluster_edition ./install.sh vi ~/.bashrc ########~/.bashrc当然,在文件中,相应的路径需要更改####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################### source /home/xieqx/opt/intel/parallel_studio_xe_2019.1.053/psxevars.sh ######################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################## source ~/.bashrc
- 安装openmpi-1.10.3
tar -zxvf openmpi-1.10.3.tar.gz cd openmpi-1.10.3/ ./configure --prefix=/home/xieqx/opt/openmpi make all make install vi ~/.bashrc ########~/.bashrc当然,在文件中,相应的路径需要更改####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################### export PATH=/home/xieqx/opt/openmpi/bin:$PATH export LD_LIBRARY_PATH="/home/xieqx/opt/openmpi/lib:$LD_LIBRARY_PATH" ######################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################## source ~/.bashrc
- 安装boost.1.55.0,参考资料
tar -zxvf boost_1_55_0.tar.gz cd boost_1_55_0 ./bootstrap.sh --prefix=/home/xieqx/opt/boost_1_55_0 --with-libraries=all --with-toolset=intel-linux vi project-config.jam ######project-config.jam当然,在文件中,需要更改相应的路径####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################### using mpi : /home/xieqx/opt/openmpi/bin/mpicxx ; ######################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################## ./b2 -j16 --layout=tagged link=static,shared threading=multi install vi ~/.bashrc ########~/.bashrc当然,在文件中,相应的路径需要更改####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################### export BOOST_ROOT=/home/xieqx/opt/boost_1_55_0 export BOOST_INCLUDE=$BOOST_ROOT/include:$BOOST_INCLUDE export BOOST_LIB=$BOOST_ROOT/lib:$BOOST_LIB export LD_LIBRARY_PATH=$BOOST_ROOT/lib:$LD_LIBRARY_PATH #################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
source ~/.bashrc
- block1.5编译与安装,参考资料
tar -zxvf block-1.5.3.tar.gz
cp -r block-1.5.3 block-1.5.3_mpi #分别编译一份串行版本和一份mpi并行版本,做计算时两种都会用到
串行版本的部分Makefile文件(cat block-1.5.3/Makefile):
#Developed by Sandeep Sharma and Garnet K.-L. Chan, 2012
#Copyright (c) 2012, Garnet K.-L. Chan
#This program is integrated in Molpro with the permission of
#Sandeep Sharma and Garnet K.-L. Chan
######### GENERAL OPTIONS FOR USER #########
# change to icpc for Intel
CXX = icpc
MPICXX = mpiicpc
export CXX
export MPICXX
# BOOST include directory
#BOOSTINCLUDE = /home/sharma/apps/forServer/boost_1_53_0_mt/boost_1_53_0/
#BOOSTINCLUDE = /home/sharma/apps/boost/boost_1_55_0/
BOOSTINCLUDE = /home/xieqx/opt/boost_1_55_0/include
# set to yes if using BOOST version >= 1.56.0
USE_BOOST56 = no
ifeq ($(USE_BOOST56), yes)
B56 = -DBOOST_1_56_0
endif
# BOOST and LAPACK/BLAS linker
#BOOSTLIB = -L/home/sharma/apps/forServer/boost_1_53_0_mt/boost_1_53_0/stage/lib -lboost_serialization -lboost_system -lboost_filesystem
#BOOSTLIB = -L/home/sharma/apps/boost/boost_1_55_0/stage/lib -lboost_serialization -lboost_system -lboost_filesystem
#BOOSTLIB = -lboost_serialization -lboost_system -lboost_filesystem
BOOSTLIB = -L/home/xieqx/opt/boost_1_55_0/lib -lboost_system-mt -lboost_filesystem-mt -lboost_serialization-mt -lboost_mpi-mt
#LAPACKBLAS = -lblas -llapack
LAPACKBLAS = /usr/lib/liblapack.dylib /usr/lib/libblas.dylib
# set if we will use MPI or OpenMP
USE_MPI = no
OPENMP = no
# FLAGS for linking in MKL
USE_MKL = yes
ifeq ($(USE_MKL), yes)
MKLLIB = /home/xieqx/opt/intel/compilers_and_libraries/linux/mkl/lib/intel64`` LAPACKBLAS = -L${
MKLLIB} -lmkl_gf_lp64 -lmkl_sequential -lmkl_core #-lrt #-liomp5 MKLFLAGS = /home/xieqx/opt/intel/compilers_and_libraries/linux/mkl/include``
MKLOPT = -D_HAS_INTEL_MKL
else
MKLFLAGS = .
endif
######### ADVANCED OPTIONS (GENERALLY THESE DO NOT NEED TO BE SET) #########
# add Molcas interface to libqcdmrg.so
# molcas compilation w/ -64 option requires I8 as well
MOLCAS = no
# Link to Molpro
MOLPRO = no
# use this variable to set if we will use integer size of 8 or not.
# molpro compilation requires I8, since their integers are long
I8_OPT = no
# Optional MALLOC library
MALLOC = #-L/home/sharma/apps/forServer/tcalloc/tcalloc_install/lib -ltcmalloc
DOPROF = no
RUN_UNITTEST=no
ifeq ($(RUN_UNITTEST), yes)
UNITTEST = -DUNITTEST
endif
AR=ar
ARFLAGS=-qs
RANLIB=ranlib
ifeq ($(I8_OPT), yes)
I8 = -D_FORTINT_64
endif
EXECUTABLE = block.spin_adapted
BLOCKHOME = .
HOME = .
NEWMATINCLUDE = $(BLOCKHOME)/newmat10/
INCLUDE1 = $(BLOCKHOME)/include/
INCLUDE2 = $(BLOCKHOME)/
NEWMATLIB = $(BLOCKHOME)/newmat10/
BTAS = $(BLOCKHOME)/btas
.SUFFIXES: .C .cpp
MOLPROINCLUDE=.
ifeq ($(MOLPRO), yes)
MOLPROINCLUDE=$(BLOCKHOME)/../
MOLPRO_BLOCK= -DMOLPRO
endif
FLAGS = -I${MKLFLAGS} -I$(INCLUDE1) -I$(INCLUDE2) -I$(NEWMATINCLUDE) -I$(BOOSTINCLUDE) -I$(MOLPROINCLUDE) \
-I$(HOME)/modules/generate_blocks/ -I$(HOME)/modules/onepdm -I$(HOME)/modules/twopdm/ \
-I$(HOME)/modules/npdm -I$(HOME)/modules/two_index_ops -I$(HOME)/modules/three_index_ops -I$(HOME)/modules/four_index_ops -std=c++0x \
-I$(HOME)/modules/ResponseTheory -I$(HOME)/modules/nevpt2 -I$(HOME)/molcas -I$(HOME)/modules/mps_nevpt
LIBS += -L$(NEWMATLIB) -lnewmat $(BOOSTLIB) $(LAPACKBLAS) $(MALLOC) -lpthread -lrt
MPI_OPT = -DSERIAL
ifeq (icpc, $(CXX))
ifeq ($(OPENMP), yes)
OPENMP_FLAGS= -qopenmp
#ifeq ($(USE_MPI), yes)
#OPENMP_FLAGS += -lmpi_mt
#endif
endif
# Intel compiler
OPT = -DNDEBUG -O2 -g -funroll-loops #-ipo
# OPT = -g
ifeq ($(USE_MPI), no)
CXX = icpc
endif
endif
ifeq (g++, $(CXX))
ifeq ($(OPENMP), yes)
OPENMP_FLAGS= -fopenmp
#ifeq ($(USE_MPI), yes)
#OPENMP_FLAGS += -lmpi
#endif
endif
# GNU compiler
OPT = -DNDEBUG -O2 -g -funroll-loops -Werror
# OPT = -g -pg
endif
ifeq (clang++, $(CXX))
ifeq ($(OPENMP), yes)
OPENMP_FLAGS= -fopenmp #-D_OPENMP
endif
OPT = -DNDEBUG -g -Werror -funroll-loops
endif
ifeq ($(DOPROF),yes)
OPT += -pg
endif
ifeq ($(USE_MPI), yes)
MPI_OPT =
MPI_LIB = -lboost_mpi
LIBS += $(MPI_LIB)
CXX = $(MPICXX)
endif
并行版本的部分Makefile文件(cat block-1.5.3_mpi/Makefile):
#Developed by Sandeep Sharma and Garnet K.-L. Chan, 2012
#Copyright (c) 2012, Garnet K.-L. Chan
#This program is integrated in Molpro with the permission of
#Sandeep Sharma and Garnet K.-L. Chan
######### GENERAL OPTIONS FOR USER #########
# change to icpc for Intel
CXX = icpc
MPICXX = mpicxx
export CXX
export MPICXX
# BOOST include directory
#BOOSTINCLUDE = /home/sharma/apps/forServer/boost_1_53_0_mt/boost_1_53_0/
#BOOSTINCLUDE = /home/sharma/apps/boost/boost_1_55_0/
BOOSTINCLUDE = /home/xieqx/opt/boost_1_55_0/include
# set to yes if using BOOST version >= 1.56.0
USE_BOOST56 = no
ifeq ($(USE_BOOST56), yes)
B56 = -DBOOST_1_56_0
endif
# BOOST and LAPACK/BLAS linker
#BOOSTLIB = -L/home/sharma/apps/forServer/boost_1_53_0_mt/boost_1_53_0/stage/lib -lboost_serialization -lboost_system -lboost_filesystem
#BOOSTLIB = -L/home/sharma/apps/boost/boost_1_55_0/stage/lib -lboost_serialization -lboost_system -lboost_filesystem
#BOOSTLIB = -lboost_serialization -lboost_system -lboost_filesystem
BOOSTLIB = -L/home/xieqx/opt/boost_1_55_0/lib -lboost_system-mt -lboost_filesystem-mt -lboost_serialization-mt -lboost_mpi-mt
#LAPACKBLAS = -lblas -llapack
LAPACKBLAS = /usr/lib/liblapack.dylib /usr/lib/libblas.dylib
# set if we will use MPI or OpenMP
USE_MPI = yes
OPENMP = no
# FLAGS for linking in MKL
USE_MKL = yes
ifeq ($(USE_MKL), yes)
MKLLIB = /home/xieqx/opt/intel/compilers_and_libraries/linux/mkl/lib/intel64`` LAPACKBLAS = -L${
MKLLIB} -lmkl_gf_lp64 -lmkl_sequential -lmkl_core #-lrt #-liomp5 MKLFLAGS = /home/xieqx/opt/intel/compilers_and_libraries/linux/mkl/include``
MKLOPT = -D_HAS_INTEL_MKL
else
MKLFLAGS = .
endif
######### ADVANCED OPTIONS (GENERALLY THESE DO NOT NEED TO BE SET) #########
# add Molcas interface to libqcdmrg.so
# molcas compilation w/ -64 option requires I8 as well
MOLCAS = no
# Link to Molpro
MOLPRO = no
# use this variable to set if we will use integer size of 8 or not.
# molpro compilation requires I8, since their integers are long
I8_OPT = no
# Optional MALLOC library
MALLOC = #-L/home/sharma/apps/forServer/tcalloc/tcalloc_install/lib -ltcmalloc
DOPROF = no
RUN_UNITTEST=no
ifeq ($(RUN_UNITTEST), yes)
UNITTEST = -DUNITTEST
endif
AR=ar
ARFLAGS=-qs
RANLIB=ranlib
ifeq ($(I8_OPT), yes)
I8 = -D_FORTINT_64
endif
EXECUTABLE = block.spin_adapted
BLOCKHOME = .
HOME = .
NEWMATINCLUDE = $(BLOCKHOME)/newmat10/
INCLUDE1 = $(BLOCKHOME)/include/
INCLUDE2 = $(BLOCKHOME)/
NEWMATLIB = $(BLOCKHOME)/newmat10/
BTAS = $(BLOCKHOME)/btas
.SUFFIXES: .C .cpp
MOLPROINCLUDE=.
ifeq ($(MOLPRO), yes)
MOLPROINCLUDE=$(BLOCKHOME)/../
MOLPRO_BLOCK= -DMOLPRO
endif
FLAGS = -I${MKLFLAGS} -I$(INCLUDE1) -I$(INCLUDE2) -I$(NEWMATINCLUDE) -I$(BOOSTINCLUDE) -I$(MOLPROINCLUDE) \
-I$(HOME)/modules/generate_blocks/ -I$(HOME)/modules/onepdm -I$(HOME)/modules/twopdm/ \
-I$(HOME)/modules/npdm -I$(HOME)/modules/two_index_ops -I$(HOME)/modules/three_index_ops -I$(HOME)/modules/four_index_ops -std=c++0x \
-I$(HOME)/modules/ResponseTheory -I$(HOME)/modules/nevpt2 -I$(HOME)/molcas -I$(HOME)/modules/mps_nevpt
LIBS += -L$(NEWMATLIB) -lnewmat $(BOOSTLIB) $(LAPACKBLAS) $(MALLOC) -lpthread -lrt
MPI_OPT = -DSERIAL
ifeq (icpc, $(CXX))
ifeq ($(OPENMP), yes)
OPENMP_FLAGS= -qopenmp
#ifeq ($(USE_MPI), yes)
#OPENMP_FLAGS += -lmpi_mt
#endif
endif
# Intel compiler
OPT = -DNDEBUG -O2 -g -funroll-loops #-ipo
# OPT = -g
ifeq ($(USE_MPI), no)
CXX = icpc
endif
endif
ifeq (g++, $(CXX))
ifeq ($(OPENMP), yes)
OPENMP_FLAGS= -fopenmp
#ifeq ($(USE_MPI), yes)
#OPENMP_FLAGS += -lmpi
#endif
endif
# GNU compiler
OPT = -DNDEBUG -O2 -g -funroll-loops -Werror
# OPT = -g -pg
endif
ifeq (clang++, $(CXX))
ifeq ($(OPENMP), yes)
OPENMP_FLAGS= -fopenmp #-D_OPENMP
endif
OPT = -DNDEBUG -g -Werror -funroll-loops
endif
ifeq ($(DOPROF),yes)
OPT += -pg
endif
ifeq ($(USE_MPI), yes)
MPI_OPT =
# MPI_LIB = -lboost_mpi
LIBS += $(MPI_LIB)
CXX = $(MPICXX)
endif
在这两个文件夹下分别执行make操作进行编译,编译成功后会生成block.spin_adapted的可执行文件 ./block.spin_adapted -v显示版本
[xieqx@~/soft/block-1.5.3]$ls
alloc.h distribute.C hfOccGenerator.o main.C operatorUtilities.o rotationmat.C SpinQuantum.h StackOperators.h sweep_params.C
ApplyExcitation.C distribute.h include main.o orbstring.C rotationmat.h SpinQuantum.o StackOperators.o sweep_params.h
blas_calls.h distribute.o initblocks.C Makefile orbstring.h rotationmat.o SpinSpace.C stackopxop.C sweep_params.o
BlockAndDecimate.C dmrg.C initblocks.h MatrixBLAS.C orbstring.o saveBlock.C SpinSpace.h stackopxop.h Symmetry.C
BlockAndDecimate.o dmrg.o initblocks.o MatrixBLAS.h OverlapHelement.C saveBlock.o SpinSpace.o stackopxop.o Symmetry.h
block.spin_adapted dmrg_wrapper.h input.C MatrixBLAS.o overlaptensor.h Schedule.C StackBaseOperator.C Stackspinblock.C Symmetry.o
btas Doxyfile input.h modules pario.C Schedule.o StackBaseOperator.h Stackspinblock.h tensor_operator.h
Coefficients.C enumerator.h input.o molcas pario.h screen.C StackBaseOperator.o Stackspinblock.o timer.C
couplingCoeffs.C fci.C IrrepSpace.C new_anglib.C pario.o screen.h Stackdensity.C Stackwavefunction.C timer.h
couplingCoeffs.h fci.o IrrepSpace.h new_anglib.h partial_sweep.C screen.o Stackdensity.h Stackwavefunction.h timer.o
couplingCoeffs.o fciqmchelper.C IrrepSpace.o new_anglib.o partial_sweep.o set_stackspinblock_components.C Stackdensity.o Stackwavefunction.o wrapper.C
csf.C fciqmchelper.h IrrepVector.h newmat10 PTn.C set_stackspinblock_components.o stackguess_wavefunction.C StateInfo.C wrapper.h
csf.h fciqmchelper.o least_squares.C nonAbelianGroup.h pydmrg slater.C stackguess_wavefunction.h StateInfo.h
csf.o fiedler.C least_squares.h ObjectMatrix.h RDM.C slater.h stackguess_wavefunction.o StateInfo.o
CSFOverlapHelement.C fiedler.h least_squares.o operatorfunctions.C readinput.C slater.o StackMatrix.h sweep.C
davidson.C fiedler.o LICENSE.txt operatorfunctions.h readinput.o solver.C Stack_op_components.C sweep.h
davidson.h genetic linear.C operatorfunctions.o README.md solver.h Stack_op_components.h sweep_mps.C
davidson.o global.h linear.h operatorloops.h renormalise.C solver.o Stack_op_components.o sweep_mps.o
DeterminantMPS.C hfOccGenerator.C linear.o operatorUtilities.C renormalise.o SpinQuantum.C StackOperators.C sweep.o
[xieqx@~/soft/block-1.5.3]$./block.spin_adapted -v
Block 1.5
Copyright (C) 2012 Garnet K.-L. Chan
This program comes with ABSOLUTELY NO WARRANTY; for details see license file.
This is free software, and you are welcome to redistribute it
under certain conditions; see license file for details.
[xieqx@~/soft/block-1.5.3]$
[xieqx@~/soft/block-1.5.3]$cd ../block-1.5.3_mpi
[xieqx@~/soft/block-1.5.3_mpi]$
[xieqx@~/soft/block-1.5.3_mpi]$./block.spin_adapted -v
Runing with 1 processors
Block 1.5
Copyright (C) 2012 Garnet K.-L. Chan
This program comes with ABSOLUTELY NO WARRANTY; for details see license file.
This is free software, and you are welcome to redistribute it
under certain conditions; see license file for details.
[xieqx@~/soft/block-1.5.3_mpi]$
至此编译成功!
- block1.5测试 新建一个文件夹,将输入文件input.dat和FCIDUMP放入同一个目录下 测试样例文件可以在这里下载 然后进入该文件夹下,输入:
mpirun -np 8 ~/soft/block-1.5.3_mpi/block.spin_adapted input.dat > output.dat
大概十几分钟就能跑完
[xieqx@~/projects/test/dmrg]$grep "Sweep Energy" output.dat
M = 250 state = 0 Largest Discarded Weight = 0.000026014843 Sweep Energy = -75.705474036191
M = 250 state = 0 Largest Discarded Weight = 0.000041782909 Sweep Energy = -75.725627841175
M = 250 state = 0 Largest Discarded Weight = 0.000051375547 Sweep Energy = -75.726954724332
M = 250 state = 0 Largest Discarded Weight = 0.000055318758 Sweep Energy = -75.727272258978
M = 250 state = 0 Largest Discarded Weight = 0.000056636376 Sweep Energy = -75.727287704164
M = 250 state = 0 Largest Discarded Weight = 0.000055610107 Sweep Energy = -75.727381386985
M = 250 state = 0 Largest Discarded Weight = 0.000057005139 Sweep Energy = -75.727381550369
M = 250 state = 0 Largest Discarded Weight = 0.000055723209 Sweep Energy = -75.727397761647
M = 500 state = 0 Largest Discarded Weight = 0.000002430509 Sweep Energy = -75.728003316952
M = 500 state = 0 Largest Discarded Weight = 0.000006783278 Sweep Energy = -75.728269042467
M = 500 state = 0 Largest Discarded Weight = 0.000004838267 Sweep Energy = -75.728337829248
M = 500 state = 0 Largest Discarded Weight = 0.000005629606 Sweep Energy = -75.728377240795
M = 1000 state = 0 Largest Discarded Weight = 0.000000064270 Sweep Energy = -75.728482786182
M = 1000 state = 0 Largest Discarded Weight = 0.000000532083 Sweep Energy = -75.728530041981
M = 1000 state = 0 Largest Discarded Weight = 0.000000535186 Sweep Energy = -75.728537102866
M = 1000 state = 0 Largest Discarded Weight = 0.000000594517 Sweep Energy = -75.728540501593
M = 1500 state = 0 Largest Discarded Weight = 0.000000038229 Sweep Energy = -75.728549801981
M = 1500 state = 0 Largest Discarded Weight = 0.000000108157 Sweep Energy = -75.728552928337
M = 1500 state = 0 Largest Discarded Weight = 0.000000083221 Sweep Energy = -75.728553228557
M = 1500 state = 0 Largest Discarded Weight = 0.000000108247 Sweep Energy = -75.728553589157
M = 2000 state = 0 Largest Discarded Weight = 0.000000014057 Sweep Energy = -75.728555122387
M = 2000 state = 0 Largest Discarded Weight = 0.000000031446 Sweep Energy = -75.728555643996
M = 2000 state = 0 Largest Discarded Weight = 0.000000026226 Sweep Energy = -75.728555655265
M = 2000 state = 0 Largest Discarded Weight = 0.000000032085 Sweep Energy = -75.728555705199
M = 2500 state = 0 Largest Discarded Weight = 0.000000006421 Sweep Energy = -75.728556041274
M = 2500 state = 0 Largest Discarded Weight = 0.000000010485 Sweep Energy = -75.728556142407
M = 2500 state = 0 Largest Discarded Weight = 0.000000009581 Sweep Energy = -75.728556155459
M = 2500 state = 0 Largest Discarded Weight = 0.000000010344 Sweep Energy = -75.728556164891
M = 3000 state = 0 Largest Discarded Weight = 0.000000003392 Sweep Energy = -75.728556239665
M = 3000 state = 0 Largest Discarded Weight = 0.000000003294 Sweep Energy = -75.728556252670
M = 3000 state = 0 Largest Discarded Weight = 0.000000003032 Sweep Energy = -75.728556252876
M = 3000 state = 0 Largest Discarded Weight = 0.000000003340 Sweep Energy = -75.728556257874
M = 3500 state = 0 Largest Discarded Weight = 0.000000001083 Sweep Energy = -75.728556266035
M = 3500 state = 0 Largest Discarded Weight = 0.000000001691 Sweep Energy = -75.728556276443
M = 3500 state = 0 Largest Discarded Weight = 0.000000001664 Sweep Energy = -75.728556267040
M = 3500 state = 0 Largest Discarded Weight = 0.000000001193 Sweep Energy = -75.728556263445
M = 4000 state = 0 Largest Discarded Weight = 0.000000000652 Sweep Energy = -75.728556274482
M = 4000 state = 0 Largest Discarded Weight = 0.000000000657 Sweep Energy = -75.728556285708
M = 4000 state = 0 Largest Discarded Weight = 0.000000001007 Sweep Energy = -75.728556283060
M = 4000 state = 0 Largest Discarded Weight = 0.000000000564 Sweep Energy = -75.728556281318
M = 4500 state = 0 Largest Discarded Weight = 0.000000000001 Sweep Energy = -75.728556280679
M = 4500 state = 0 Largest Discarded Weight = 0.000000000000 Sweep Energy = -75.728556280658
M = 4500 state = 0 Largest Discarded Weight = 0.000000000000 Sweep Energy = -75.728556280652
M = 4500 state = 0 Largest Discarded Weight = 0.000000000000 Sweep Energy = -75.728556280651
M = 4500 state = 0 Largest Discarded Weight = 0.000000000000 Sweep Energy = -75.728556280651