源码先锋

源码先锋

MacOS系统安装ShengBTE

admin 200 116

本教程基于AppleSiliconM4芯片的macOS系统,默认Shell为zsh,包管理器为Homebrew。

1.安装依赖工具

使用Homebrew安装所需组件:

echo'exportDYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH'~/.zshrc
source~/.zshrc

验证环境变量设置:

echo$DYLD_LIBRARY_PATH
4.下载并编译ShengBTE4.1获取源码并准备编译配置
gitclone
cdshengbte
/
cdSrc
4.2检查工具路径(推荐)

确认实际路径以便正确配置:

whichmpif90
whichgfortran
find/opt/

以我安装的路径为例:

/opt/homebrew/bin/mpif90

/opt/homebrew/Cellar/open-mpi/5.0.7/include/

4.3编辑

根据路径填写如下内容:

MPIFC=/opt/homebrew/bin/mpif90

FCFLAGS=-O3-fopenmp\
-I/opt/homebrew/include\
-I/opt/homebrew/Cellar/open-mpi/5.0.7/include

LDFLAGS=-fopenmp\
-L/opt/homebrew/lib\
-L/opt/homebrew/Cellar/open-mpi/5.0.7/lib

LIBS=-llapack-lblas-lsymspg
4.4修复OpenMP报错

若出现如下编译错误:

Function'omp_get_thread_num'hasnoIMPLICITtype

应在文件开头添加:

useomp_lib
4.5编译ShengBTE

完成设置后开始编译:

makeclean
make

成功后将在上级目录生成ShengBTE可执行文件。

5.运行ShengBTE自带示例

ShengBTE提供了包含Si材料的测试输入文件,可直接运行测试:

cdTest-QE
mpirun-np2../ShengBTE

运行成功则显示:

Info:symmetrygroupF-43mdetected
Info:24symmetryoperations
Info:Thiscalculationisrunningon2MPIprocess(es)
Info:Ntot=1728
Info:Nlist=72
Info:abouttoobtainthespectrum
Info:expectingQuantumEspresso2nd-orderformat
Info:abouttosettheacousticfrequenciesatGammatozero
Info:originalvalues:
Info:omega(1,1)=-1.0637325153768564E-006rad/ps
Info:omega(1,2)=-7.1685042455799367E-007rad/ps
Info:omega(1,3)=-3.6795686840623725E-007rad/ps
Info:
Info:startcalculatingspecificheatandkappainthesmall-grainlimit
Info:Temperature=300.00000000000000
Info:Ntotal_plus=744806
Info:Ntotal_minus=889888
Info:max(N_plus),max(N_minus)41934226
Info:calculatingVp_plusandVp_
Info:100%done.
Info:
Info:Temperature=300.00000000000000
Info:Iteration:1Timer:54.701seconds
Info:Relativechange=4.3050694775070453E-002
Info:Iteration:2Timer:54.965seconds
Info:Relativechange=2.29368E-002
Info:Iteration:3Timer:55.227seconds
Info:Relativechange=1.0854734510184971E-003
Info:Iteration:4Timer:55.494seconds
Info:Relativechange=1.1990264474953931E-003
Info:Iteration:5Timer:55.762seconds
Info:Relativechange=3.6190955255322710E-005
Info:Iteration:6Timer:56.041seconds
Info:Relativechange=8.6267549862898885E-005
Info:Iteration:7Timer:56.308seconds
Info:Relativechange=1.54433E-005
Info:Iteration:8Timer:56.563seconds
Info:Relativechange=7.5852438801879826E-006
Info: