简介
The ALPS project (Algorithms and Libraries for Physics Simulations) is an open source effort aiming at providing high-end simulation codes for strongly correlated quantum mechanical systems as well as C++ libraries for simplifying the development of such code. ALPS strives to increase software reuse in the physics community.
ALPS项目(Algorithms and Libraries for Physics Simulations)是一个开源项目,旨在为强相关的量子力学系统提供高端模拟代码,以及简化此类代码开发的C++库。ALPS致力于提高物理学界的软件重用率。
conda 安装
如果系统中环境比较简单,建议使用 conda 来安装,方便快捷
conda create -n alps
conda activate alps
conda install -c conda-forge alps
源码编译安装
如果机器不能联网,或者 conda 环境有冲突时就需要从源代码安装
下载源代码
官网下载你需要的版本
这里我选用的是 alps-2.3.0-src-with-boost.tar.gz ,不建议使用 不带 boost 的版本,因为一般系统中会自带某个版本的 boost ,一是与 alps 不兼容,二是在编译时需要指定很多选项,容易出错,不如直接选择带 boost 版本的 alps
其他依赖库说明
- python 3
- ipython
- numpy
- mpich
- HDF5
- ZLIB
- gcc > 5
- 数学库 FFTW、LAPACK、BLAS 或者 INTEL MKL
安装
这里提示一下,安装 alps 还需要 python 3 以及 numpy 等一些必须的库和 HDF5 环境,这里建议提前安装好,避免后面出错,具体可以查看。下面我们正式开始安装:
cd /path/to/alps-2.3.0-src-with-boost/alps
mkdir _build
cd _build
cmake .. -DCMAKE_INSTALL_PREFIX=/path/you/want/to/install -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBoost_DIR:PATH=/path/to/alps-2.3.0-src-with-boost/boost
make -j 8(根据自己的电脑 CPU 而定)
make install
验证安装( python 环境)
export PATH=/path/you/want/to/install/bin:$PATH
export LD_LIBRARY_PATH=/path/you/want/to/install/bin:$LD_LIBRARY_PATH
alpspython
import pyalps
没有报错即安装成功
FAQs
Q1:出现 this linker was not configured to use sysroots
A1:ld 版本过低 / 原系统中 binutils 套件在编译时没有添加 --sysroot 选项 ,重新编译安装一份 binutils 套件即可
Q2:出现 std::xxxxxx 的问题
A1:这种情况一般是由于 gcc 版本过低不支持 c++ 11 语法导致的,切换高版本 gcc 即可
Q3:cmake 过程中出现缺少数学库
A3:需要在 LD_LIBRARY_PATH 中指定你安装的库的路径,并在 cmake 后面使用 -Dxxxxx 指定路径,具体的参数名称可以在 CMakeCache.txt 文件中查看