安装说明
系统要求
IM2ODE可以在所有主流Linux发行版上运行,包括:
- Ubuntu 16.04及以上
- CentOS 7及以上
- RedHat Enterprise Linux
- SUSE Linux Enterprise
- 其他符合POSIX标准的Unix-like系统
Windows用户可以通过WSL2运行IM2ODE。
依赖安装
1. 安装编译工具
bash
# Ubuntu/Debian
sudo apt install build-essential gfortran git wget
# CentOS/RHEL
sudo yum group install "Development Tools"
sudo yum install gcc-gfortran git wget2. (可选)安装VASP/LAMMPS
根据你的研究需求,安装对应的计算引擎:
- VASP:需要从官方获取授权并安装
- LAMMPS:可以从官网下载安装
编译IM2ODE
获取源码
bash
git clone https://github.com/YueyuZhang/IM2ODE.git
cd IM2ODE编译配置
IM2ODE的Makefile支持多种编译器,默认使用gfortran。如果你需要使用其他编译器(如Intel Fortran),可以编辑Makefile:
makefile
# 默认gfortran配置
FC = gfortran
FFLAGS = -O3 -ffast-math
# Intel Fortran配置(如果你使用ifort)
# FC = ifort
# FFLAGS = -O3 -xHost -ip开始编译
bash
make -j4 >& make.log编译过程中的信息会保存在make.log文件中,如果编译失败,可以查看该文件排查错误。
验证编译结果
编译成功后,会在bin目录下生成可执行文件:
bash
ls bin/
im2ode post_process环境变量配置
为了方便使用,可以将IM2ODE的bin目录添加到系统PATH中:
bash
# Bash用户
echo 'export PATH=/path/to/IM2ODE/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
# Zsh用户
echo 'export PATH=/path/to/IM2ODE/bin:$PATH' >> ~/.zshrc
source ~/.zshrc配置完成后,可以在任意目录直接调用im2ode和post_process命令。
测试安装
我们提供了多个测试案例来验证安装是否正确:
bash
# 运行体硅测试案例
cd examples/bulk_Si
./run.sh
# 运行二维材料测试案例
cd ../2D_MoS2
./run.sh如果测试案例正常运行并生成预期结果,说明安装成功。
常见问题
Q:编译时报错"gfortran: command not found"
A:请先安装gfortran编译器,参考上面的依赖安装步骤。
Q:运行时提示"libgfortran.so.5: cannot open shared object file"
A:缺少gfortran运行时库,安装对应的运行时包即可:
bash
# Ubuntu/Debian
sudo apt install libgfortran5
# CentOS/RHEL
sudo yum install libgfortranQ:如何启用MPI并行支持?
A:编辑Makefile,添加MPI编译选项,例如:
makefile
FC = mpif90
FFLAGS = -O3 -ffast-math -DMPI然后重新编译即可。