[关闭]
@sculxb 2017-12-13T09:40:27.000000Z 字数 5699 阅读 3046

安装 Octopus

ubuntu 软件安装



显示找不到libxc库

安装libxc之后的提示

Libraries have been installed in:
/opt/etsf/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
    - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
    during execution
    - add LIBDIR to the 'LD_RUN_PATH' environment variable
    during linking
    - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
    - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for 
more information, such as the ld(1) and ld.so(8) manual pages.

这里最后的解决方式是在configure的时候加上安装位置

  1. ./configure --prefix=/home/cris/software/lib/libxc-3.0.0/bin
  2. #这里本来使用的4.0的版本但是后来发现使用4.0的版本会碰到报错
  3. ../../src/hamiltonian/libhamiltonian.a(xc.o):在函数‘calc_tb09_c.10006’中:
  4. xc_oct.f90:(.text+0x2693):对‘xc_f90_mgga_x_tb09_set_par_’未定义的引用
  5. ../../src/hamiltonian/libhamiltonian.a(xc.o):在函数‘__xc_oct_m_MOD_xc_get_vxc’中:
  6. xc_oct.f90:(.text+0x1e3dc):对‘xc_f90_gga_lb_set_par_’未定义的引用
  7. xc_oct.f90:(.text+0x1e40d):对‘xc_f90_gga_lb_set_par_’未定义的引用
  8. ../../src/hamiltonian/libhamiltonian.a(functionals.o):在函数‘__xc_functl_oct_m_MOD_xc_functl_init_functl’中:
  9. functionals_oct.f90:(.text+0x15da):对‘xc_f90_lda_c_xalpha_set_par_’未定义的引用
  10. functionals_oct.f90:(.text+0x17b5):对‘xc_f90_lda_c_1d_csc_set_par_’未定义的引用
  11. functionals_oct.f90:(.text+0x17d5):对‘xc_f90_lda_c_2d_prm_set_par_’未定义的引用
  12. functionals_oct.f90:(.text+0x18e9):对‘xc_f90_lda_x_1d_set_par_’未定义的引用
  13. collect2: error: ld returned 1 exit status
  14. Makefile:615: recipe for target 'octopus' failed
  15. make[3]: *** [octopus] Error 1
  16. make[3]: Leaving directory '/home/cris/software/octopus-7.1/src/main'
  17. Makefile:448: recipe for target 'all-recursive' failed
  18. make[2]: *** [all-recursive] Error 1
  19. make[2]: Leaving directory '/home/cris/software/octopus-7.1/src'
  20. Makefile:495: recipe for target 'all-recursive' failed
  21. make[1]: *** [all-recursive] Error 1
  22. make[1]: Leaving directory '/home/cris/software/octopus-7.1'
  23. Makefile:436: recipe for target 'all' failed
  24. make: *** [all] Error 2
  25. 后再在https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825934上发现这是一个bug就换成3.0版本就没问题了

一些关于编译的tips

  1. gcc sin.c -Im -L/lib -L/usr/lib # -I 加入某个函数库的意思 m 代表libm这个库(lib与.a或.so不用写)
  2. -L 后面的路径代表在这个路径里寻找
  3. .a 表示静态库 编译的时候会直接整合到执行程序当中
  4. .so 动态函数库 不整合到执行程序当中,在编译时只有一个 Pointer 函数库在执行时必须存在而且所在目录也不能变
  5. /etc/ld.so.conf 动态库缓存目录
  6. ldconfig -p 列出缓存中的库
  7. ./configure --prefix=/usr/local/supersparrow 表示安装完成将自动生成目录supersparrow,而且该软件所有的文件都被复制到这个目录
  8. ln -s 源文件 目标文件
  9. ###当我们需要在不同的目录,用到相同的文件时,我们不需要在每一个需要的目录下都放一个必须相同的文件,我们只要在某个固定的目录,放上该文件,然后在 其它的目录下用ln命令链接(link)它就可以,不必重复的占用磁盘空间
  10. ln -s log2013.log link2013

遇到报错checking for libxc... no (-I /usr/include -lxc)

改configure 把输出Could not find libxc 前面的if判断xyes改成xno

安装BLAS

下载解压然后make
然后在configure的时候加上

  1. --with-blas=/home/cris/software/lib/BLAS-3.8.0/blas_LINUX.a

安装lapack

下载解压

  1. cp make.inc.example make.inc
  2. make
  3. 遇到错误
  4. recipe for target 'znep.out' failed
  5. recipe for target 'lapack_testing' failed
  6. 但是已经生成了lapack.a 库文件,这里应该是make最后它会测试一下,而测试用的输入文件和输出文件不是编译需要生成的目标,所以这个报错不算是一个严格意义上的报错
  7. 这个时候configure遇到一个问题就是加两个--with-××的时候复制进去就直接执行了,后来发现是因为./configure后面没有加空格 加个空格然后在--with-***就可以了

安装gsl

  1. 先创建bin文件夹
  2. mkdir bin
  3. ./configure --prefix=/home/cris/software/lib/gsl-2.0/bin
  4. make
  5. make install ##注意这里不能加DESTDIR=/home/cris/software/lib/gsl-2.0/bin因为这句的作用跟前面prefix是重合的

安装mpich

  1. 下载稳定版本解压
  2. 新建bin文件夹
  3. ./configure --prefix=/home/cris/software/lib/mpich-3.2.1/bin
  4. make
  5. make install

最后安装octopus

  1. ./configure --prefix=/home/cris/software/octopus-7.1/ --with-libxc-prefix=/home/cris/software/lib/libxc-3.0.0/bin --with-blas=/home/cris/software/lib/BLAS-3.8.0/blas_LINUX.a --with-lapack=/home/cris/software/lib/lapack-3.8.0/liblapack.a --with-gsl-prefix=/home/cris/software/lib/gsl-2.0/bin --with-fftw-prefix=/home/cris/software/lib/fftw-3.3.7/bin --enable-mpi FC=/home/cris/software/lib/mpich-3.2.1/bin/bin/mpif90 CC=/home/cris/software/lib/mpich-3.2.1/bin/bin/mpicc
  2. 注意每个不连续的标签之间只能隔一个空格,否则就会刚复制进去就开始执行

make check
遇到问题

  1. error while loading shared libraries: libgsl.so.0:

找不到共享库libgsl,但是我们明明已经安装了,没有办法,只能把这个共享库路径添加到系统共享库路径里边去

  1. sudo vi /etc/ld.so.conf
  2. 加上一行
  3. /home/cris/software/lib/gsl-2.0/bin/lib
  4. 然后退出执行ldconfig就把这个共享库加载到缓存里去了

make check

  1. warning: libmpi.so.12, needed by /home/cris/software/lib/mpich-3.2.1/bin/lib/libmpifort.so, may conflict with libmpi.so.20

在ubuntu上面可以直接通过apt-get 的方式来安装

  1. sudo apt install libxc-dev
  2. sudo apt install libblas-dev libscalapack-mpi-dev
  3. sudo apt install liblapack-dev
  4. sudo apt install libfftw3-dev
  5. ./configure
  6. make
  7. makecheck

运行第一个例子

输入文件为

  1. CalculationMode = gs
  2. Units = eV_Angstrom
  3. FromScratch = yes
  4. Boxshape = minimum
  5. Radius = 6.0
  6. Spacing = 0.2
  7. XYZCoordinates = "adjusted.xyz"
  8. %Species
  9. 'Ag' | 107.8682 | spec_ps_hgh | 47 | 2 | 0
  10. %
  11. Output =dos+ density
  12. OutputHow = xcrysden
  1. 在当前文件夹下面输入
  2. mpirun -np 4 octopus

结果不幸报错

  1. Parser error: symbol 'spec_ps_hgh' used before being defined.
  2. -------------------------------------------------------
  3. Primary job terminated normally, but 1 process returned
  4. a non-zero exit code. Per user-direction, the job has been aborted.
  5. -------------------------------------------------------
  6. Parser error: symbol 'spec_ps_hgh' used before being defined.
  7. --------------------------------------------------------------------------
  8. mpirun detected that one or more processes exited with non-zero status, thus causing
  9. the job to be terminated. The first process to do so was:
  10. Process name: [[11048,1],0]
  11. Exit code: 1
  12. --------------------------------------------------------------------------

google了一下发现是输入文件里边指定的spec_ps_hgh被改变了识别不了,就换成官方提供的小例子

  1. CalculationMode = gs
  2. %Coordinates
  3. 'H' | 0 | 0 | 0
  4. %

就可以看到跑起来啦 :)

  1. mpirun -np 4 octopus &> out.log
  2. 在后边加上'> out.log'就可以不在屏幕输出,全部输出到这个out.log的文件中去,当然文件名可以自己随便指定

然后就照着http://octopus-code.org/wiki/Tutorial上面多尝试例子就好啦

在算盘上安装遇到的错误

  1. mpiexec_mu01: cannot connect to local mpd (/tmp/mpd2.console_xbLiu)

百度一下发现时mpd没有启动,输入

  1. mpdboot

解决之
还有找不到gsl库的问题,这个需要在root权限下将之前安装的gsl动态库加载到缓存库中去,在root权限下

  1. vi /etc/ld.so.conf
  2. #后面加上你的gsl里边那个动态库的地址(注意是你动态库的地址不是gsl整个库的地址,一般前者在后者的lib/文件夹下面)
  3. 然后执行
  4. ldconfig
  5. 就好了
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注