暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Siesta 安装教程 【4.1-b4】

开源视界 2020-05-04
2062


最新的Siesta版本为: 4.1-b4

提前告知:  本教程与本平台提供的其它教程一样,统一将软件安装到Linux用户家目录的softwares
路径下。如您希望安装到其它地方,简单修改一下编译配置时的参数即可。

同时本教程,假设你已经将zlib、hdf5、netcdf-c、netcdf-fortran安装到了家目录下的softwares
中对应的zlib_install
hdf5_install
netcdf_install
路径下。如果你安装这些库是在其它路径,请对应修改下文arch.make中的参数。


从Siesta官网下载最新版本的Siesta源码: https://departments.icmab.es/leem/siesta/。或者使用命令行下载工具curl或者wget来下载:

wget -c -O ${HOME}/softwares/siesta-4.1-b4.tar.gz https://launchpad.net/siesta/4.1/4.1-b4/+download/siesta-4.1-b4.tar.gz
复制


进入代码根目录,下的Obj文件夹:

cd siesta-4.1-b4/Obj
复制

然后执行以下命令:

bash ../Src/obj_setup.sh
复制

这将在执行Siesta的一个脚本来在当前路径下产生构建配置文件,此时需要修改arch.make文件中的一些参数。

需要修改指定的变量如下:

.SUFFIXES:
.SUFFIXES: .f .F .o .c .a .f90 .F90

SIESTA_ARCH =x86_64-unknown-linux-gnu--unknown

CC = gcc
FPP = $(FC) -E -P -x c
FC = mpif90  #gfortran
# FC_SERIAL = gfortran

FFLAGS = -O2 -fPIC -ftree-vectorize
# FFLAGS=-g

AR = ar
RANLIB = ranlib

SYS = nag

SP_KIND = 4
DP_KIND = 8
KINDS = $(SP_KIND) $(DP_KIND)

LDFLAGS =

COMP_LIBS = libsiestaLAPACK.a libsiestaBLAS.a

FPPFLAGS = $(DEFS_PREFIX)-DFC_HAVE_ABORT


# Dependency rules ---------

FFLAGS_DEBUG = -g -O1   # your appropriate flags here...

# added by EmuLab

# For GNU compiler
# the siesta guide tell me to add the FFLAGS and LIBS parameter below, but it get thing wrong,
# after comment them i succeeded in the compilation!
# FFLAGS += -fopenmp
# LIBS += -fopenmp

# OpenBLAS + LAPACK:
# OpenBLAS (OpenBLAS will default to build in LAPACK 3.6)
# LIBS += -L/opt/openblas/0.2.18/lib -lopenblas
# use the LAPACK and BLAS provided by SIESTA

# ScaLAPACK
# ScaLAPACK Only required for MPI compilation.
# LIBS += -L/opt/scalapack/2.0.2/lib -lscalapack

# NETCDF added by deqitang
INCFLAGS += -I${HOME}/softwares/netcdf_install/include
LDFLAGS += -L${HOME}/softwares/zlib_install/lib -Wl,-rpath=${HOME}/softwares/zlib_install/lib
LDFLAGS += -L${HOME}/softwares/hdf5_install/lib -Wl,-rpath=${HOME}/softwares/hdf5_install/lib
LDFLAGS += -L${HOME}/softwares/netcdf_install/lib -Wl,-rpath=${HOME}/softwares/netcdf_install/lib
LIBS += -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz
COMP_LIBS += libncdf.a libfdict.a
FPPFLAGS += -DCDF -DNCDF -DNCDF_4

#
DUMMY_FOX = --enable-dummy

# For netCDF support. Make sure you get a version compatible
# with the other options (for example, 32/64 bit). Don't forget
# to set -DCDF below.
NETCDF_ROOT      = ${HOME}/softwares/netcdf_install
NETCDF_LIBS      = -L$(NETCDF_ROOT)/lib -lnetcdff
NETCDF_INCFLAGS  = -I$(NETCDF_ROOT)/include

# HDF-5.
HDF5_ROOT      = ${HOME}/softwares/hdf5_install
HDF5_LIBS      = -L$(HDF5_ROOT)/lib -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5
HDF5_INCFLAGS  = -I$(HDF5_ROOT)/include
# end

COMP_LIBS += libfdict.a

LIBS = $(COMP_LIBS) $(NETCDF_LIBS)

#SIESTA needs an F90 interface to MPI
#This will give you SIESTA's own implementation
#If your compiler vendor offers an alternative, you may change
#to it here.
# MPI_INTERFACE=libmpi_f90.a

#MPI_INCLUDE=${HOME}/softwares/openmpi_install/include

# end by deqitang@

# The atom.f code is very vulnerable. Particularly the Intel compiler
# will make an erroneous compilation of atom.f with high optimization
# levels.
atom.o: atom.F
$(FC) -c $(FFLAGS_DEBUG) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F) $<

.c.o:
$(CC) -c $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) $<
.F.o:
$(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_fixed_F)  $<
.F90.o:
$(FC) -c $(FFLAGS) $(INCFLAGS) $(FPPFLAGS) $(FPPFLAGS_free_F90) $<
.f.o:
$(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_fixed_f)  $<
.f90.o:
$(FC) -c $(FFLAGS) $(INCFLAGS) $(FCFLAGS_free_f90)  $<
复制

然后执行make构建siesta:

make siesta
复制

构建完siesta后,如果你需要构建transiesta,需执行:

make clean
make transiesta
复制

还有一个常用的工具是tbtrans,其位于SIesta项目的./Util/TS/TBtrans目录下,通过下面命令来构建:

cd ../Util/TS/TBtrans
make
复制

注意Siesta的构建系统 没有提供make install。因此我们可以将编译的到的可执行程序移动到一个目录,然后将该路径添加到环境变量中,方便在终端中调用程序。

就此,常用的工具构建完毕。


在~/.bashrc文件中添加如下内容:

export PATH=\$PATH:/home/xxx/softwares/siesta_bin
复制

这里假设,我们将之前编译得到的siesta、transiesta、tbtrans程序都拷贝到了/home/xxx/softwares/siesta_bin
中。


更多关于Siesta的构建信息,请参见Siesta官方网站及其官方手册。

https://departments.icmab.es/leem/siesta/

文章转载自开源视界,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论