一lamps非并行安装1在终端输入:cd/mnt(源码包lammps.tar.gz放在/mnt下(cp/home/lab/Desktop/lammps.tar.gz/mnt))gunziplamps.tar.gztarxvflamps.tarmvlammps-5Dec10lmp(重命名为lmp)cdlmp/src/STUBSmakecleanmakecd/mnt/lmp/src/MAKEviMakefile.serial后出现#g++=RedHatLinuxbox,g++4,gfortran,noMPI,noFFTSHELL=/bin/sh#---------------------------------------------------------------------#compiler/linkersettings#specifyflagsandlibrariesneededforyourcompilerCC=g++4g++4该为g++CCFLAGS=-g-ODEPFLAGS=-MLINK=g++4g++4改为g++LINKFLAGS=-g-OLIB=ARCHIVE=arARFLAGS=-rcSIZE=size#---------------------------------------------------------------------然后存档,退出,终端输入cd/mnt/lmp/srcmakeclean-allmakeserial之后linux开始编译,最后会在/mnt/lmp/src下生成lmp_serial的可执行文件。mvlmp_seriallmp2计算一example终端输入:cd/mnt/lmp/e*/shearcp/mnt/lmp/src/lmp/mnt/lmp/e*/shear./lmpin.shear即开始计算二lammps的并行安装1安装fftw终端输入:cd/mntgunzipfftw-2.1.5.tar.gz(源码包fftw-2.1.5.tar.gz在/mnt下)tarxvffftw-2.1.5.tarcdfftw-2.1.5./configure–prefix=/opt/fftw--enable-floatmakemakeinstall(fftw-2.1.5即安装在/opt/fftw下)2安装mpich终端输入:cd/mntgunzipmpich2-1.3.1.tar.gztarxvfmpich2-1.3.1.tarcd/mpich2-1.3.1./configure–prefix==/opt/mpichmakemakeinstall(mpich即安装在/opt/mpich下)然后配置环境变量终端输入:cdvi.bashrc开始编译为If[-f/etc/bashrc];then./etc/bashrcfiexpotPATH=/opt/mpich/bin:$PATHexportLD_LIBRARY_PATH=/opt/mpich/lib:/opt/fftw/lib:$LD_LIBRARY_PATH3安装lammpscd/mntgunziplammps.tar.gztarxvflammps.tarmvlammps-5Dec10lmpcd/lmp/srcmakeyes-allmakeno-gpumakeno-user-atc(几个特殊的package:meam,poems,reax,gpu,user-atc需要特别安装,如下)cd/mnt/lmp/lib/meamlsmake–fMakefile.gfortran(安装meam)cd/mnt/lmp/lib/poemslsmake–fMakefile.g++cd/mnt/lmp/lib/reaxlsmake–fMakefile.gfortran(然后对Makefile.serial文件进行编译)cd/mnt/lmp/src/MAKEviMakefile.serial(按下i可修改)#g++=RedHatLinuxbox,g++4,gfortran,MPICH2,FFTWSHELL=/bin/sh#---------------------------------------------------------------------#compiler/linkersettings#specifyflagsandlibrariesneededforyourcompilerCC=g++4g++4改为mpic++CCFLAGS=-g-ODEPFLAGS=-MLINK=g++4g++4改为mpic++LINKFLAGS=-g-OLIB=ARCHIVE=arARFLAGS=-rcSIZE=size#---------------------------------------------------------------------#LAMMPS-specificsettings#specifysettingsforLAMMPSfeaturesyouwilluse#LAMMPSifdefoptions,seedoc/Section_start.htmlLMP_INC=-DLAMMPS_GZIP#MPIlibrary,canbesrc/STUBSdummylib#INC=pathformpi.h,MPIcompilersettings#PATH=pathforMPIlibrary#LIB=nameofMPIlibraryMPI_INC=-I/opt/mpich/include-DMPICH_SKIP_MPICXXMPI_PATH=-I/opt/mpich/libMPI_LIB=/opt/mpich/lib/libmpich.a#-lmpich-lpthread#FFTlibrary,canbe-DFFT_NONEifnotusingPPPMfromKSPACEpackage#INC=-DFFT_FFTW,-DFFT_INTEL,-DFFT_NONE,etc,FFTcompilersettings#PATH=pathforFFTlibrary#LIB=nameofFFTlibraryFFT_INC=-I/opt/fftw/include-DFFT_FFTWFFT_PATH=-I/opt/ffte/libFFT_LIB=/opt/fftw/libfftw.a#-lfftw#additionalsystemlibrariesneededbyLAMMPSpackagelibraries#thesesettingsareIGNOREDifthecorrespondingLAMMPSpackage#(e.g.gpu,meam)isNOTincludedintheLAMMPSbuild#SYSLIB=namesoflibraries#SYSPATH=pathsoflibrariesgpu_SYSLIB=-lcudartmeam_SYSLIB=-lmeam–lgfortranpoems_SYSLIB=-lpoems-lgfortranreax_SYSLIB=-lreax-lgfortranuser-atc_SYSLIB=-lblas-llapackgpu_SYSPATH=-L/usr/local/cuda/lib64meam_SYSPATH=-L/mnt/lmp/lib/meampoems_SYSPATH=-L/mnt/lmp/lib/poemsreax_SYSPATH=-L/mnt/lmp/lib/reaxuser-atc_SYSPATH=#---------------------------------------------------------------------#buildrulesanddependencies#noneedtoeditthissectionincludeMakefile.packageEXTRA_INC=$(LMP_INC)$(PKG_INC)$(MPI_INC)$(FFT_INC)EXTRA_PATH=$(PKG_PATH)$(MPI_PATH)$(FFT_PATH)$(PKG_SYSPATH)EXTRA_LIB=$(PKG_LIB)$(MPI_LIB)$(FFT_LIB)$(PKG_SYSLIB)#Linktarget$(EXE):$(OBJ)$(LINK)$(LINKFLAGS)$(EXTRA_PATH)$(OBJ)$(EXTRA_LIB)$(LIB)-o$(EXE)$(SIZE)$(EXE)#Librarytargetlib:$(OBJ)$(ARCHIVE)$(ARFLAGS)$(EXE)$(OBJ)#Compilationrules%.o:%.cpp$(CC)$(CCFLAGS)$(EXTRA_INC)-c$%.d:%.cpp$(CC)$(CCFLAGS)$(EXTRA_INC)$(DEPFLAGS)$$@#IndividualdependenciesDEPENDS=$(OBJ:.o=.d)include$(DEPENDS)存档退出(esc:wqexit),终端输入:cd/mnt/lmp/srcmakeclean-allmakeserial(lammps开始安装,最后可生成lmp_serial的可执行文件)mvlmp_seriallmp4并行计算一examplea:终端输入cd/mnt/lmp/examples/shearcp/opt/mpich/bin/mpirun/mnt/lmp/e*/shearcp/mnt/lmp/src/lmp/mnt/lmp/e*/shearmpirun–np4./lmpin.shear(lammps开始计算)b:终端输入cd/mnt/lmp/e*/shear/opt/mpich/bin/mpirun–np4/mnt/lmp/src/lmpin.shear