define <basedir> 你自己的安装路径。
1.BLAS
- Download the package from the netlib site: http://www.netlib.org/blas/blas.tgz
- Extract the package and enter into the newly created BLAS directory.
- Edit the make.inc file and modify the definition of the fortran compiler that now should be:
FORTRAN = gfortran OPTS = -O3 -ffree-line-length-none DRVOPTS = $(OPTS) NOOPT = LOADER = gfortran LOADOPTS =
- Now type make to compile, this will take a while.
- One compilation is finished, create the directory <basedir>/lib
mkdir <basedir>/lib
and copy the file blas_LINUX.a to <basedir>/lib/libblas.a
cp blas_LINUX.a <basedir>/lib/libblas.a
2.
LAPACK
We will use the open source reference implementation of Lapack.
- Get the Lapak package from netlib: http://www.netlib.org/lapack/lapack.tgz
- Extract the archive and enter the newly created lapack directory.
- Copy make.inc.example to make.inc:
cp make.inc.example make.inc
- Edit make.inc to indicate the compiler the will be used. The relevant part of the file should look like:
FORTRAN = gfortran OPTS = -O3 -ffree-line-length-none DRVOPTS = $(OPTS) NOOPT = LOADER = gfortran LOADOPTS =
- Now build the library with
make lib
- Copy the newly created library lapack_LINUX.a to <basedir>/lib/liblapack.a .
- 3.
GSL
- Get the source of the latest version of GSL from ftp://ftp.gnu.org/gnu/gsl/ , currently it is GSL 1.16: ftp://ftp.gnu.org/gnu/gsl/gsl-1.16.tar.gz .
- Extract the archive and enter the newly created directory.
- Run the configure script with:
./configure CC="gcc" --prefix=basedir --disable-shared --enable-static
- Compile and install:
make make install
4.
FFTW 3
- Get the sources for the latest version of FFTW, currently http://www.fftw.org/fftw-3.3.4.tar.gz .
- Extract the archive and enter the newly created directory.
- Configure:
./configure --prefix=basedir CC="gcc" CFLAGS="-O3" F77="gfortran" F77FLAGS="-O3 -ffree-line-length-none"
- Compile and install:
make make install
LibXC
- Get Libxc, currently http://www.tddft.org/programs/octopus/down.php?file=libxc/libxc-2.2.0.tar.gz .
- Extract the archive and enter the newly created directory.
tar -xvzf libxc-2.2.0.tar.gz cd libxc-2.2.0
- Configure:
./configure --prefix=basedir CC="gcc" CFLAGS="-O3" FC="gfortran" FCFLAGS="-O3 -ffree-line-length-none"
- Compile and install:
make make install
5.
Compilation of Octopus
After compiling the libraries, now we are ready to compile Octopus. These are the steps you have to follow:
- Download the last version of Octopus: http://www.tddft.org/programs/octopus/down.php?file=9.1/octopus-9.1.tar.gz
- Extract the file and enter the newly created directory.
- Define the following environment variables to be used by the configure script (we assume that you are using bash, if you are using another shell, the commands should be modified accordingly):
export LIBS_BLAS=<basedir>/lib/libblas.a export LIBS_LAPACK=<basedir>/lib/liblapack.a export LIBS_FFT=<basedir>/lib/libfftw3.a
- Now call the configure script:
./configure CC="<cc>" CFLAGS="<cflags>" FC="<fc>" FCFLAGS="<fcflags>" --prefix=<basedir> --with-gsl-prefix=<basedir> --with-libxc-prefix=<basedir>
- Compile and install
make make install
7.
Octopus应该会成功安装在你一开始设定的 basedir 文件夹内,可执行文件放在 basedir/bin/ 文件夹内,接下来将其路径添加到环境变量里,以便你可以只输入 octopus 就可运行, 而非 每次都要输入 basedir/bin/octopus 才行。
export PATH=$PATH:basedir/bin/octopus
8.简单例子运行测试
新建一空文件夹并进入,建立一个文件,命名为 inp ,并将其内容编辑为:
CalculationMode = gs
%Coordinates
'H' | 0 | 0 | 0
%
1
2
3
4
5
注:文件只能命名为 inp, octopus 只识别这个输入文件名
接下来试运行:
octopus &> output
1
即可运行octopus并将输出结果重定向到新建的 output 文件中。
若只运行:
octopus
1
则输出会在屏幕上实时显示。
————————————————