24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 1665  |  回复: 2
【奖励】 本帖被评价2次,作者Bessel增加金币 1.6
本帖产生 1 个 模拟EPI ,点击这里进行查看

Bessel

木虫 (正式写手)


[资源] LAMMPS使用初体验,Debian 6.0

我是在Debian 6.0下编译安装的, 也在Ubuntu 10.04下编译通过。首先介绍一下并行编译的过程,然后以L-J相互作用势的液体为例,给出了in文件的写法。欢迎大家补充。

第一部分,安装

《1》首先安装所有依赖的包:
sudo aptitude install mpich-bin libmpich1.0gf  libmpich1.0-dev fftw2 fftw-dev libjpeg62 libjpeg62-dev libblas-dev liblapack-dev  gfortran gcc make build-essential autoconf automake1.9 cvs subversion libsdl-dev libgl1-mesa-dev fakeroot libnss3-dev gdb libglib2.0-0 libglib-perl dh-make cdbs debhelper kernel-package lsb-release module-assistant

《2》取消SSH的密码步骤
$ ssh-keygen -t dsa #中间提示输入密码,直接回车,会在生成文件~/.ssh/id_dsa.pub
$ cat id_dsa.pub >> authorized_keys
这样在运行mpirun的时候就不会有密码输入提示了

《3》下载lammps最新的安装包 http://lammps.sandia.gov/

《4》开始编译安装
(1)
go to ~/lammps/src:
运行如下命令:
make yes-all

make no-gpu

make no-user-atc

(2)

go to ~/lammps/lib/meam
运行如下命令:
make -f  Makefile.gfortran

(3)

go to ~/lammps/lib/poems
运行如下命令:
make -f Makefile.g++

(4)
go to  ~/lammps/lib/reax

make -f  Makefile.gfortran

(5)

go to ~/lammps/lib/awpmd

<5.1> go to ~/lammps/lib/awpmd/ivutils/include

在 logexc.h文件开头补上  #include

<5.2> go to the ~/lammps/lib/awpmd

修改 Makefile.openmpi文件, 把mpic++改为g++,修改完的样子应该是:

# include any MPI settings needed for the ATC library to build with
# the same MPI library that LAMMPS is built with

CC =            g++

......

修改完之后,运行

make -f Makefile.openmpi

(6) go to ~/lammps/src/MAKE
修改Makefile.g++文件,下面是修改之后的文件:


# g++ = RedHat Linux box, g++4, gfortran, MPICH2, FFTW

SHELL = /bin/sh

# ---------------------------------------------------------------------
# compiler/linker settings
# specify flags and libraries needed for your compiler

CC =                g++
CCFLAGS =        -g -O
DEPFLAGS =        -M
LINK =                g++
LINKFLAGS =        -g -O
LIB =           
ARCHIVE =        ar
ARFLAGS =        -rc
SIZE =                size

# ---------------------------------------------------------------------
# LAMMPS-specific settings
# specify settings for LAMMPS features you will use

# LAMMPS ifdef options, see doc/Section_start.html

LMP_INC =        -DLAMMPS_GZIP -DLAMMPS_JPEG

# MPI library, can be src/STUBS dummy lib
# INC = path for mpi.h, MPI compiler settings
# PATH = path for MPI library
# LIB = name of MPI library

MPI_INC =   -I/usr/lib/mpich/include
MPI_PATH =  -I/usr/lib/mpich/lib
MPI_LIB =   /usr/lib/mpich/lib/libmpich.a

# FFT library, can be -DFFT_NONE if not using PPPM from KSPACE package
# INC = -DFFT_FFTW, -DFFT_INTEL, -DFFT_NONE, etc, FFT compiler settings
# PATH = path for FFT library
# LIB = name of FFT library

FFT_INC =   -I/usr/include    -DFFT_FFTW
FFT_PATH =  -I/usr/lib
FFT_LIB =   /usr/lib/libfftw.a

# JPEG library, only needed if -DLAMMPS_JPEG listed with LMP_INC
# INC = path for jpeglib.h
# PATH = path for JPEG library
# LIB = name of JPEG library

JPG_INC =       -I/usr/include
JPG_PATH =         -I/usr/lib
JPG_LIB =        /usr/lib/libjpeg.a

# additional system settings needed by LAMMPS package libraries
# these settings are IGNORED if the corresponding LAMMPS package
#   (e.g. gpu, meam) is NOT included in the LAMMPS build
# SYSINC = settings to compile with
# SYSLIB = libraries to link with
# SYSPATH = paths to libraries

gpu_SYSINC =
meam_SYSINC =
reax_SYSINC =
user-atc_SYSINC =
user-awpmd_SYSINC =

gpu_SYSLIB =       -lcudart -lcuda
meam_SYSLIB =      -lgfortran
reax_SYSLIB =      -lgfortran
user-atc_SYSLIB =  -lblas -llapack
user-awpmd_SYSLIB =  -lblas -llapack

gpu_SYSPATH =      -L/usr/local/cuda/lib64
meam_SYSPATH =
reax_SYSPATH =
user-atc_SYSPATH =
user-awpmd_SYSPATH =

# ---------------------------------------------------------------------
# build rules and dependencies
# no need to edit this section

include        Makefile.package

EXTRA_INC = $(LMP_INC) $(PKG_INC) $(MPI_INC) $(FFT_INC) $(JPG_INC) (PKG_SYSINC)
EXTRA_PATH = $(PKG_PATH) $(MPI_PATH) $(FFT_PATH) $(JPG_PATH) $(PKG_SYSPATH)
EXTRA_LIB = $(PKG_LIB) $(MPI_LIB) $(FFT_LIB) $(JPG_LIB) $(PKG_SYSLIB)

# Link target

$(EXE):        $(OBJ)
        $(LINK) $(LINKFLAGS) $(EXTRA_PATH) $(OBJ) $(EXTRA_LIB) (LIB) -o $(EXE)
        $(SIZE) $(EXE)

# Library target

lib:        $(OBJ)
        $(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)

# Compilation rules

%.o:%.cpp
        $(CC) $(CCFLAGS) $(EXTRA_INC) -c $<

%.d:%.cpp
        $(CC) $(CCFLAGS) $(EXTRA_INC) $(DEPFLAGS) $< > $@

# Individual dependencies

DEPENDS = $(OBJ:.o=.d)
include $(DEPENDS)

(7) go to src
运行命令:

make g++

最后在src文件夹下找到lmp_g++可执行文件,编辑就算是结束了。可以把lmp_g++放到/usr/local/bin文件夹下,以后用着方便。

(8)L-J液体的in文件 in.lj, 具体命令的介绍可以参考lammps manual


# LJ system with NVE ensemble

units                lj
atom_style      atomic
lattice         fcc 0.8442
region          box block 0 5 0 5 0 5
create_box      1 box
create_atoms    1 box
mass            1 1.0
velocity        all create 3.0 825577 dist gaussian
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 no
fix             1 all nve
timestep        0.005
thermo          1000
run 10000

clear

(9)最后运行mpirun –np 2 /usr/local/bin/lmp_g++
回复此楼

» 收录本帖的淘帖专辑推荐

资源收集 condensed matter physics

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xufund

至尊木虫 (知名作家)


★★★★★ 五星级,优秀推荐

下去学习。谢谢
2楼2011-07-07 22:06:55
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

gxw0218

银虫 (著名写手)


★★★★★ 五星级,优秀推荐

不错,学习学习。
3楼2012-01-18 15:14:26
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 Bessel 的主题更新
☆ 无星级 ★ 一星级 ★★★ 三星级 ★★★★★ 五星级
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 294分080500材料科学与工程求调剂 +11 柳溪边 2026-03-26 12/600 2026-03-31 19:53 by Dyhoer
[考研] 070300化学专业279调剂 +9 哈哈哈^_^ 2026-03-31 9/450 2026-03-31 18:49 by jp9609
[考研] 318求调剂 +10 陈晨79 2026-03-30 10/500 2026-03-31 17:37 by 544594351
[考研] 362求调剂 +9 西南交材料专硕3 2026-03-31 9/450 2026-03-31 16:25 by w虫虫123
[考研] 一志愿中海洋材料357 +4 麦恩莉. 2026-03-30 4/200 2026-03-31 14:35 by 记事本2026
[考研] 一志愿211,335分,0856,求调剂院校和导师 +10 倾____萧 2026-03-27 11/550 2026-03-31 14:32 by fmesaito
[考研] 材料调剂 5+5 想要一壶桃花水 2026-03-25 11/550 2026-03-31 13:34 by Huaxue_Wang
[考研] 调剂求院校招收 +7 鹤鲸鸽 2026-03-28 7/350 2026-03-31 11:21 by oooqiao
[考研] 085600材料与化工329分求调剂 +5 这是有太阳哇 2026-03-25 5/250 2026-03-31 09:59 by luoyongfeng
[考研] 285求调剂 +6 AZMK 2026-03-29 9/450 2026-03-30 21:02 by dophin1985
[考研] 289求调剂 +16 新时代材料 2026-03-27 16/800 2026-03-30 19:04 by Wang200018
[考研] 295材料工程专硕求调剂 +10 1428151015 2026-03-27 10/500 2026-03-30 19:00 by 源_2020
[考研] 26考研-291分-厦门大学(085601)-柔性电子学院材料工程专业求调剂 +5 min3 2026-03-24 6/300 2026-03-30 18:42 by 544594351
[考研] 材料化工340求调剂 +3 jhx777 2026-03-30 3/150 2026-03-30 17:54 by JourneyLucky
[考研] 328求调剂 +8 嗯滴的基本都 2026-03-27 8/400 2026-03-30 17:20 by Wang200018
[考研] 085602 化学工程专硕 340分求调剂 +4 qianbai11 2026-03-29 4/200 2026-03-30 11:34 by 唐沐儿
[考研] 311求调剂 +10 lin0039 2026-03-26 10/500 2026-03-30 10:26 by herarysara
[考研] 299求调剂 +10 15188958825 2026-03-25 10/500 2026-03-29 17:51 by 王亮_大连医科大
[考研] 0703化学求调剂,各位老师看看我!!! +5 祁祺祺 2026-03-25 5/250 2026-03-27 21:44 by 东方猪猪
[考研] 调剂 +4 柚柚yoyo 2026-03-26 4/200 2026-03-26 20:43 by fmesaito
信息提示
请填处理意见