LAMMPS 的安装与配置
· 阅读需 3 分钟
分子模拟开坑,我只是路过
先基于腾讯云尝试一下。
doc
先看文档 2.2.1. Read this first — LAMMPS documentation
If you want to avoid building LAMMPS yourself, read the preceding section about options available for downloading and installing executables. Details are discussed on the download page.
Add Yum Repository
先看 Configuring the LAMMPS-ICMS Snapshot Repository装一下源
Command Line Setup for Fedora, CentOS/RHEL with Yum
- Enabling the repository for Fedora 19, 20, and 21:
su -c 'yum localinstall --nogpgcheck http://git.icms.temple.edu/rpm/fedora/lammps-fedora-repo-1-2.noarch.rpm' - Enabling the repository for CentOS or RedHat Enterprise Linux 6.6 and later:
su -c 'yum localinstall --nogpgcheck http://git.icms.temple.edu/rpm/centos/lammps-centos-rhel-repo-1-2.noarch.rpm'
LAMMPS-ICMS RPM Repository
The LAMMPS distribution is split into multiple sub-packages and you only need to install the ones that you need.
到这里LAMMPS-ICMS RPM Repository 挑选需要的sub-packages
我装了这几个:
- lammps
- lammps-python
- lammps-common
yum install lammps lammps-python lammps-common
剩余的 lammps-doc 是PDF格式的没必要装在服务器上,lammps-openmpi和lammps-mpich 是并行化用的,目前只是试一试,暂时用不上。
Hello world
ref:
AL
- 下载Al99.eam.alloy
- 新建文件
vim calc_fcc.in# Find minimum energy fcc configuration# Mark Tschopp, 2010# ---------- Initialize Simulation ---------------------clearunits metaldimension 3boundary p p patom_style atomicatom_modify map array# ---------- Create Atoms ---------------------lattice fcc 4region box block 0 1 0 1 0 1 units latticecreate_box 1 boxlattice fcc 4 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1create_atoms 1 boxreplicate 1 1 1# ---------- Define Interatomic Potential ---------------------pair_style eam/alloypair_coeff * * Al99.eam.alloy Alneighbor 2.0 binneigh_modify delay 10 check yes# ---------- Define Settings ---------------------compute eng all pe/atomcompute eatoms all reduce sum c_eng# ---------- Run Minimization ---------------------reset_timestep 0fix 1 all box/relax iso 0.0 vmax 0.001thermo 10thermo_style custom step pe lx ly lz press pxx pyy pzz c_eatomsmin_style cgminimize 1e-25 1e-25 5000 10000variable natoms equal "count(all)"variable teng equal "c_eatoms"variable length equal "lx"variable ecoh equal "v_teng/v_natoms"print "Total energy (eV) = ${teng};"print "Number of atoms = ${natoms};"print "Lattice constant (Angstoms) = ${length};"print "Cohesive energy (eV) = ${ecoh};"print "All done!" - 跑起来
lmp_g++ < calc_fcc.in - 输出
Total energy (eV) = -13.4399999527351;Number of atoms = 4;Lattice constant (Angstoms) = 4.05000466178543;Cohesive energy (eV) = -3.35999998818377;All done!Total wall time: 0:00:00
FIN