【分子动力学】分子动力学仿真软件Lammps最简单安装教程-Ubuntu20.04

分子动力学仿真软件Lammps最简单安装教程-Ubuntu20.04

    • 1. 安装前的准备
    • 2. 安装相关的依赖库
    • 3. 编译Lammps
    • 4. 根据需要安装额外的模块


1. 安装前的准备

1.1 安装好操作系统Ubuntu20.04, 其他版本也可以
1.2 下载好Lammps源代码 下载地址
主界面中找到download --> 下载最新的稳定版本即可(本人下载)
在这里插入图片描述
在这里插入图片描述
1.3 下载并安装四个编译工具

sudo apt-get install gcc    #安装gcc编译器
sudo apt-get install g++    #安装g++编译器
sudo apt-get install gfortran    #安装gfortran编译器
sudo apt-get install make    #安装make编译器

2. 安装相关的依赖库

Lammps源代码包解压后进入./src/MAKE/MACHINES,打开Makefile.ubuntu 查看所需要安装的库
在这里插入图片描述
在这里插入图片描述

#安装相关的库
sudo apt-get install mpi-default-bin  mpi-default-dev #MPICH
sudo apt-get install libfftw3-dev #FFTW
sudo apt-get install libjpeg-dev libpng-dev #有些人选择不安装,那就自己修改下make文件

3. 编译Lammps

进入src目录下开始编译

  1. 进入src目录,右键在终端打开
  2. 输入命令后编译
make mpi
  1. 可以在src目录下找到编译好的lmp_mpi (这个就是需要的东西)
  2. 将lmp_mpi 拷贝到指定文件夹下,并将改文件夹加入系统环境变量
#打开文本
sudo gedit ~/.bashrc 
#在文本最后添加lmp_mpi所在的路径 例如:
export PATH=/home/admin1/Lammps/lammps-2Aug2023/bin:$PATH
  1. 运行测试
#书写一个案例后进入文件夹打开终端
# 单核运行,不使用MPI
lmp_serial -in in.file
# 并行计算,使用MPICH框架
mpirun -np 4 lmp_mpi -in in.file

4. 根据需要安装额外的模块

  1. 进入src目录下右键在终端打开
  2. 查看已经安装的额外模块
make package-status
  1. 根据需求安装/卸载模块
make yes-name #安装模块
make no-name #卸载模块
  1. 重新编译lammps
make mpi
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一些使用LAMMPS软件进行分子动力学模拟冲击波的可能的输入文件(in文件): 1. Shock Wave Simulation with LAMMPS: ``` # Define the simulation box size variable lx equal 20.0 variable ly equal 20.0 variable lz equal 100.0 # Define the number of atoms variable natoms equal 64000 # Define the time step size variable dt equal 0.001 # Define the simulation temperature variable temp equal 300 # Define the simulation pressure variable press equal 10 # Define the output frequency variable dumpfreq equal 1000 # Define the simulation run time variable runfor equal 10000 # Define the simulation input units lj atom_style atomic dimension 3 boundary p p p read_data data.lj pair_style lj/cut 2.5 pair_coeff * * 1.0 1.0 2.5 neighbor 0.3 bin neigh_modify every 20 delay 0 check yes velocity all create ${temp} 87287 loop geom fix 1 all nve thermo 1000 thermo_style custom step temp press pe ke etotal lx ly lz timestep ${dt} # Define the shock wave fix 2 all langevin ${temp} ${temp} 100.0 904297 fix 3 all addforce 0.0 0.0 -${press} fix 4 all momentum 1 linear 1 1 1 # Define the output dump 1 all custom ${dumpfreq} dump.*.lammpstrj id type x y z dump_modify 1 sort id run ${runfor} ``` 2. Shock Wave Simulation of Graphene with LAMMPS: ``` # Define the simulation box size variable lx equal 100.0 variable ly equal 100.0 variable lz equal 10.0 # Define the number of atoms variable natoms equal 20000 # Define the time step size variable dt equal 0.001 # Define the simulation temperature variable temp equal 300 # Define the simulation pressure variable press equal 10 # Define the output frequency variable dumpfreq equal 1000 # Define the simulation run time variable runfor equal 10000 # Define the simulation input units real atom_style atomic boundary p p p read_data data.graphene pair_style airebo 3.0 1 1 pair_coeff * * CH.airebo C H neighbor 2.0 bin neigh_modify every 1 delay 0 check yes velocity all create ${temp} 87287 loop geom fix 1 all nve thermo 1000 thermo_style custom step temp press pe ke etotal lx ly lz timestep ${dt} # Define the shock wave fix 2 all langevin ${temp} ${temp} 100.0 904297 fix 3 all addforce 0.0 0.0 -${press} fix 4 all momentum 1 linear 1 1 1 # Define the output dump 1 all custom ${dumpfreq} dump.*.lammpstrj id type x y z dump_modify 1 sort id run ${runfor} ``` 以上是两个使用LAMMPS软件进行分子动力学模拟冲击波的输入文件示例,不同的模拟系统和参数可能需要使用不同的输入文件。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值