地域密着型エリア広告配信リクルートの地域密着型広告ドコイク?アドネットワーク Ads by ドコイク?[無料でホームページを作成] [通報・削除依頼]
[無料でホームページを作成] [通報・削除依頼]

LAMMPS(Linux)

 (準備中)ここでは古典的な分子動力学法であるLAMMPSのセットアップから基本的な計算までを解説する(熱伝導率が計算可能なので少しずつ調査する予定)。
-------------------------------------------------------------------------------
■ LAMMPS Install (CentOS 6.4, x86_64)

□ git
1. su
2. yum install git
※ which git で git がインストールされたアドレスが分かる。/usr/bin/git となる。

□ OpenMPIやFFTW は左欄の「ライブラリ」やUbuntu や CentOS の記述を参考にしてください。

□ LAMMPS (git install case)
1. git clone https://github.com/lammps/lammps lammps
 or git clone https://bitbucket.org/akohlmey/lammps lammps
※ 「Secondary mirrors」で問題なくダウンロードできた。

□ LAMMPS ( I recommend this case)
1. download: LAMMPS --- Stable version (http://lammps.sandia.gov/download.html#tar)
2. Download Now
3. tar zxvf lammps-stable.tar.gz
※ ○ LAMMPS --- Stable version -> ● LAMMPS --- Stable version にして、「Download Now」を押す。

□ Compiling (very simple case)
1. cd lam*
2. cd src
3. make mpi
※ mpirun -np 4 lmp_mpi

□ Compiling (lammps-stable.tar.gz, lammps-30oct14 case)
1. cd lam*
2. cd src
3. gedit $HOME/lam*/src/MAKE/Makefile.mpi
◇ ifort case
  cp $HOME/lam*/src/MAKE/OPTIONS/Makefile.intel_cpu $HOME/lam*/src/MAKE/Makefile.mpi
  gedit $HOME/lam*/src/MAKE/Makefile.mpi
  CC =        mpiicpc  -> CC =        mpicxx
  LINK =        mpiicpc -> LINK =        mpicxx
  LMP_INC =    -DLAMMPS_GZIP -DLAMMPS_JPEG -> LMP_INC =    -DLAMMPS_GZIP
  JPG_LIB =    -ljpeg -> JPG_LIB =
◇ using fftw3 that you compiled
  cp $HOME/lam*/src/MAKE/OPTIONS/Makefile.fftw $HOME/lam*/src/MAKE/Makefile.mpi
◇ cuda (GPU) case
  cp $HOME/lam*/src/MAKE/OPTIONS/Makefile.kokkos_cuda $HOME/lam*/src/MAKE/Makefile.mpi
4. make mpi
※ Please, see $HOME/lam*/src/MAKE/MACHINES'
※ mpirun -np 4 lmp_mpi < input.file

□ benchmark test
1. cd lam*
2. cd src
3. cp lmp_mpi ../bench
4. cd ../bench
5. mpirun -np 4 lmp_mpi < in.lj

□ standard (after compiling meam, etc. see below)
1. cd lam*
2. cd src
3. make package-status
  or make ps
4. make yes-std
5. make no-gpu
6. make no-kim
7. make no-voronoi
8. make mpi
※ retry: make clean-all -> make or make yes-std ......

□ standard (after compiling KIM API and VORONOI, see below)
1. cd lam*
2. cd src
3. make package-status
  or make ps
4. make yes-std
5. make no-gpu
6. make mpi
※ retry: make clean-all -> make or make yes-std ......
※ (unsuccess for kim library) make clean-all -> make no-kim -> make mpi

□ standard (after compiling meam, VORONOI, etc. see below)
1. cd lam*
2. cd src
3. make package-status
  or make ps
4. make yes-std
5. make no-poems
6. make no-gpu
7. make no-kim
8. make makelib
9. make makeshlib
10. make stubs
11. make mpi
※ retry: make clean-all -> make or make yes-std ......

-------------------------------------------------------------------------------
■ libraries and tools

□ libraries
  • atc (libatc.a): atomistic-to-continuum methods
     cd $HOME/lam*/lib/atc
     make -f Makefile.mpic++
  • linalg (liblinalg.a): set of BLAS and LAPACK routines needed by USER-ATC packag
     cd $HOME/lam*/lib/linalg
     make -f Makefile.gfortran
  • poems (libpoems.a): POEMS rigid-body integration package
     cd $HOME/lam*/lib/poems
     make -f Makefile.g++
     or make -f Makefile.icc
  • meam (libmean.a): modified embedded atom method (MEAM) potential
     cd $HOME/lam*/lib/meam
     make -f Makefile.gfortran
     or make -f Makefile.ifort
  • reax (libreax.a): ReaxFF potential
     cd $HOME/lam*/lib/reax
     make -f Makefile.gfortran
     or make -f Makefile.ifort
  • qmmm: quantum mechanics/molecular mechanics coupling interface
     cd $HOME/lam*/lib/qmmm
     make -f Makefile.gfortran
  • colvars (libcolvars.a): collective variable module (Metadynamics, ABF and more)
     cd $HOME/lam*/lib/colvars
     make -f Makefile.g++
  • awpmd (libawpmd.a): antisymmetrized wave packet molecular dynamics, AWPMD package
     cd $HOME/lam*/lib/awpmd
     make -f Makefile.mpicc
※ Please, see $HOME/lam*/lib/README

□ select library
1. cd lam*
2. cd src
3. make package-status
    make no-all
    make yes-meam
    make yes-reax
4. make package-status
5. make mpi
※ retry: make clean-all -> make or make yes-std ......

□ tools
1. cd lam*
2. cd tools
3. make

□ KIM API (openkim-api-v1.3.1)
1. download: https://openkim.org -> https://openkim.org/kim-api/#download
  "kim-api-vX.X.X.tgz"
2. tar zxvf openkim-api-v1.3.1.tgz
3. cd openkim-api-v1.3.1
4. cp Makefile.KIM_Config.example Makefile.KIM_Config
5. printf "g/^KIM_DIR/d\\ni\nKIM_DIR = `pwd`\n.\nw\nq\n" | ed Makefile.KIM_Config
6. gedit Makefile.KIM_Config (intel compiler case)
  KIM_COMPILERSUITE = GCC -> KIM_COMPILERSUITE = INTEL
7. make
8. gedit $HOME/lam*/src/KIM/Makefile.lammps
  kim_SYSINC = -I/home/username/openkim-api-v1.3.1/KIM_API
  kim_SYSLIB = -lkim
  kim_SYSPATH = -L/home/username/openkim-api-v1.3.1/KIM_API
※ tar zxvf openkim-api-v1.4.1.tgz needs gfortran > 4.7.0
※ (unsuccess for now) make install -> kim_SYSINC = -I/usr/local/lib/openkim-api-v1.3.1/KIM_API, etc.

□ KIM API (openkim-api-v1.7.0) (Intel compiler case, success)
1. download: https://openkim.org -> https://openkim.org/kim-api/#download
  "kim-api-vX.X.X.tgz"
2. tar zxvf openkim-api-v1.7.0.tgz
3. cd openkim-api-v1.7.0
4. cp Makefile.KIM_Config.example Makefile.KIM_Config
5. printf "g/^KIM_DIR/d\\ni\nKIM_DIR = `pwd`\n.\nw\nq\n" | ed Makefile.KIM_Config
6. gedit Makefile.KIM_Config (intel compiler case)
  KIM_COMPILERSUITE = INTEL
7. make
8. gedit $HOME/lam*/src/KIM/Makefile.lammps
  kim_SYSINC = -I/home/username/kim-api-v1.7.0/src
  kim_SYSLIB = -lkim-api-v1.7.0+INTEL.linux.64bit.dynamic-load
  kim_SYSPATH = -L/home/username/kim-api-v1.7.0/src

□ VORONOI (voro++-0.4.6)
1. download: http://math.lbl.gov/voro++/download/
2. tar zxvf voro++-0.4.6.tar.gz
3. cd vor*
4. gedit config.mk  (is not need to change this file for g++ case)
  Intel compiler case: CXX=g++ -> CXX=icpc
5. make
6. su
7. make install
8. gedit $HOME/lam*/src/VORONOI/Makefile.lammps  (is not need to change this file)

□ python ($HOME/lam*/python) (unsuccess)
1. cd lam*
2. cd src
3. make makeshlib
4. make -f Makefile.shlib mpi
5. make install-python

[1] http://piyajk.com/archives/334
[2] http://seesaawiki.jp/qolo/d/LAMMPS%A4%CE%A5%A4%A5%F3%A5%B9%A5%C8%A1%BC%A5%EB
[3] http://opencae.gifu-nct.ac.jp/pukiwiki/index.php?LAMMPS%A4%CE%BE%F0%CA%F3
[4] http://lammps.sandia.gov/tutorials/italy14/Compiling_LAMMPS.pdf
[5] http://levlafayette.com/node/121
[6] http://math.digi2.jp/math/lammps/installation/lammps-30Oct14-for-mac-os-x-03Nov2014.pdf
[7] http://qolo.sblo.jp/article/86235047.html
[8] http://www.kyphd.xyz/?p=1062
-------------------------------------------------------------------------------
■ GUI
  • octa (Win, Mac, or Linux)
1. download: http://www.octa.jp/index_jp.html
2. pass word: Please, see "What is OCTA (first line)" at http://www.octa.jp/OCTA/whatsOCTA.html
-------------------------------------------------------------------------------
■ graphic
  • VMD
1. download: http://www.ks.uiuc.edu/Research/vmd/ -> http://www.ks.uiuc.edu/Development/Download/download.cgi?PackageName=VMD -> Version 1.8.6 (2007-04-07) Platforms: -> LINUX_64 OpenGL
※ Username, Password を入力 -> New User Registration になる。
2. tar zxvf vmd-1.8.6.bin.LINUXAMD64.opengl.tar.gz
3. cd vmd*
4. su
5. ./configure; cd src; make install
References
http://lammps.sandia.gov/tutorials/italy14/VMD_Visualization_Scripting_TopoTools.pdf
http://sstxp.ee.ous.ac.jp/dokuwiki/doku.php?id=software:vmd
http://fujima.sci.ibaraki.ac.jp/faq/segment-error.html

Run (Macでは上手くいくが、Linuxでは上手くいかない。Version 1.8.6 ではダメか?)
1. vmd
2. VMD Main -> File -> New Molecule... 
3. Browse... -> 
4. Enable: All files
5. case.dump or dump.case
6. Determine file type: LAMMPS Trajectory -> Load
7. VMD Main -> speed (center) -> click arrow
 
  • Pizza -> Paraview
• Pizza
1. download: http://sourceforge.net/projects/pizza-py/files/ -> Download pizza-1Oct06.tar.gz (2.4 MB)
2. tar zxvf pizza-1Oct06.tar.gz
3. ln -s pizza-1Oct06 pizza
4. cd pizza/src
5. python -i pizza.py
※ エラーが出るので下記のモジュールをインストールする。
 
• PIL (Image Tk)
1. download: http://www.pythonware.com/products/pil/ -> PIL 1.1.7 -> Python Imaging Library 1.1.7 Source Kit
2. tar zxvf Imaging-1.1.7.tar.gz
3. cd Ima*
4. su
5. sudo python setup.py install

• Numeric
1. cd $HOME/pizza/src
2. geidt dump.py
3. import Numeric -> import numpy.oldnumeric as Numeric
※ 書き換えるのは172行目のところ

• gl (OpenGL.Tk)
私も参考HPの症状と同じになった。対策方法は見つからない。gl.pyとgl.pycをsrcから出す。
1. cd pizza/src
2. mv gl.py ../
3. mv gl.pyc ../

OpenGL (unsuccess for pizza)
1. su
2. yum install freeglut
3. yum install freeglut-devel
References (install OpenGL)
Ubuntu case: http://makkareru.hatenablog.com/entry/2013/04/05/013652
Fedora case: http://blog.livedoor.jp/vine_user/archives/50289862.html
using: http://ysflight.in.coocan.jp/programming/fssimplewindow/j.html

PyOpenGL (unsuccess for pizza)
1. download: http://pyopengl.sourceforge.net/documentation/installation.html -> https://pypi.python.org/pypi/PyOpenGL -> PyOpenGL 3.1.0 -> PyOpenGL-3.1.0.tar.gz
2. tar zxvf PyOpenGL-3.1.0.tar.gz
3. cd PyOpenGL-3.*
4. su
5. python setup.py install
References
http://pyopengl.sourceforge.net/documentation/installation.html

Togl (I dropped out)
1. download: http://togl.sourceforge.net/ -> http://togl.sourceforge.net/download.html -> http://sourceforge.net/projects/togl/files/ -> Download Togl2.0-8.4-Linux64.tar.gz (46.8 kB)
2. tar zxvf Togl2.0-8.4-Linux64.tar.gz
3. cd Tog*
途中であきらめた。

PyOpenGL-2.0.2.01 (unsuccess)
1. download: http://sourceforge.jp/projects/sfnet_pyopengl/downloads/PyOpenGL/2.0.2.01%20%28alpha%29/PyOpenGL-2.0.2.01.tar.gz/ -> PyOpenGL-2.0.2.01.tar.gz
2. cd PyOpenGL-2.*
3. su
4. python setup.py install
※ /usr/bin/ld: cannot find -lXi

• Pmw
1. download: http://pmw.sourceforge.net -> Download the latest version of Pmw as tar.gz file (with full documentation) -> Download Pmw-2.0.0.tar.gz (804.1 kB)
2. tar zxvf Pmw-2.0.0.tar.gz
3. cd Pm*
4. su
5. python setup.py install

• Pizza (using) 
1. mpirun -np 4 lmp_mpi < in.case
2. python -i $HOME/pizza/src/pizza.py
3. d = dump("dump.case")
4. v = vtk(d)
5. v.many("case")

・Paraview
1. download: http://www.paraview.org/download/
  Version of ParaView: v4.2
  Type of download: Paraview binary Installers
  Perating System: Linux 64-bit
  File to Download: ParaView-4.2.0-Linux-64bit.tar.gz
2. Download
3. tar zxvf ParaView-4.2.0-Linux-64bit.tar.gz
4. cd Para*
5. $HOME/Para*/bin/paraview
http://www.paraview.org/Wiki/ParaView:Build_And_Install

Paraview (Run)
1. File -> Open... -> File name: case..vtk -> files of type: Legacy VTK files(*.vtk) -> OK
2. Apply
3. Time: に値を入力する
※ *.dump, *.eam, *.meam, *.rigid, *.lammps も選択できる。
 
[1] http://www.octa.jp/index_jp.html
[2] http://lammps.sandia.gov/prepost.html
[3] http://lammps.sandia.gov/viz.html
[4] http://sourceforge.net/projects/pizza-py/files/
[5] http://lammps.sandia.gov/tutorials/italy14/VMD_Visualization_Scripting_TopoTools.pdf
-------------------------------------------------------------------------------
■ YouTube -------------------------------------------------------------------------------
■ tutorial
[1] http://lammps.sandia.gov/tutorials.html -> https://icme.hpc.msstate.edu/mediawiki/index.php/LAMMPS_tutorials
[2] http://lammps.sandia.gov/tutorials/italy14/italy_examples_Mar14.pdf
-------------------------------------------------------------------------------
■ potentials
http://www.ctcms.nist.gov/potentials
http://cst-www.nrl.navy.mil/ccm6/ap
http://enpub.fulton.asu.edu/cms/potentials/main/main.htm
[2] http://atsimpotentials.readthedocs.org/en/latest/potentials/eam_tabulation.html
-------------------------------------------------------------------------------
■ Input files
  • potential file
  • case.in
  • case.pbs
□ case.in
□ case.pbs
[1] https://icme.hpc.msstate.edu/mediawiki/index.php/LAMMPS_Help
[2] http://lammps.sandia.gov/doc/Section_commands.html
[3] http://wolverton.northwestern.edu/classes/458/lammps-input
-------------------------------------------------------------------------------
■ using

□ thermal conductivity (kappa)
  The NEMD methods use the formula kappa = dQ * dZ/dTemp where dQ =
energy flux, and dTemp/dZ = temperature gradient.
  The NEMD systems have 8000 atoms with a box length 2x larger in z, the
non-equilibrium direction.

◇ Non-equilibrium methods (NEMD case):
  • Direct thermosatting method ($HOME/lam*/examples/KAPPA/in.langevin)
mpirun -np 4 $HOME/lam*/src/lmp_mpi < in.langevin
・ log.lammps file (# setup problem)
    Lattice spacing in x,y,z -> dZ
・ log.lammps file
    Loop time of 39.8134 on 4 procs (4 MPI x 1 OpenMP) for 20000 steps with 8000 atoms
    XXX = ave of total in/out energy for 2 regions normalized by # of atoms (Step Temp Thot Tcold hot cold tdiff ave -> ( XXX = (cold - hot)/2 at last step)
    run time in tau = 20,000 steps at 0.005 tau timestep =  100
    # setup problem
    x = Lattice spacing in x
    y = Lattice spacing in y
    atoms * XXX / (run time in tau) / (x * y) / 2 -> dQ
    # thermal conductivity calculation
    Step Temp Thot Tcold tdiff ave -> ave -> dTemp
・kappa = dQ * dZ/dTemp
  • Muller-Plathe reverse perturbation method ($HOME/lam*/examples/KAPPA/in.mp)
mpirun -np 4 $HOME/lam*/src/lmp_mpi < in.mp
・ log.lammps file (# setup problem)
    Lattice spacing in x,y,z -> dZ
・ log.lammps file
    Loop time of 39.8134 on 4 procs (4 MPI x 1 OpenMP) for 20000 steps with 8000 atoms
    XXX = cumulative delta energy, tallied by fix thermal/conductivity (Step Temp E_pair TotEng 3 tdiff ave  -> XXX = value for 3 at last step)
    run time in tau = 20,000 steps at 0.005 tau timestep =  100
    # setup problem
    x = Lattice spacing in x
    y = Lattice spacing in y
    XXX / (run time in tau) / (x * y) / 2 -> dQ
    # thermal conductivity calculation
    Step Temp Thot Tcold tdiff ave -> ave -> dTemp
・kappa = dQ * dZ/dTemp
  • Variant of Muller-Plathe reverse perturbation method ($HOME/lam*/examples/KAPPA/in.heat)
mpirun -np 4 $HOME/lam*/src/lmp_mpi < in.heat
・ log.lammps file (# setup problem)
    Lattice spacing in x,y,z -> dZ
・ log.lammps file
    # 2nd equilibration
    fix heat = [fix             hot all heat 1 100.0 region hot] = 100.0
    # thermal conductivity calculation
    Loop time of 39.8134 on 4 procs (4 MPI x 1 OpenMP) for 20000 steps with 8000 atoms
    run time in tau = 20,000 steps at 0.005 tau timestep =  100
    # setup problem
    x = Lattice spacing in x
    y = Lattice spacing in y
    (run time in tau) * (fix heat) / (run time in tau) / (x * y) / 2 = (fix heat) / (x * y)  / 2 -> dQ
    Step Temp Thot Tcold tdiff ave -> ave -> dTemp
・kappa = dQ * dZ/dTemp
 
◇ Equilibrium method
  • Green-Kubo equilibrium method ($HOME/lam*/examples/KAPPA/in.heatflux)
mpirun -np 4 $HOME/lam*/src/lmp_mpi < in.heatflux
tail log.lammps or gedit log.lammps
running average conductivity: 3.2000083037132
 
-------------------------------------------------------------------------------
■ 熱伝導度

 分子動力学法による熱伝導度の計算は、解析的方法とは異なり、取り込む非調和項の次数を決定することなく、またフォノン散乱の独立性を仮定することなく(原子間ポテンシャルを仮定するのみで)熱伝導度を定量的に計算できる。
  • セル内に温度勾配を設ける直接法
人工的なフォノン散乱が生じるため過小評価される性質がある。
  • Green-Kubo公式を用いた平衡法
イオン性固体の場合には熱的な揺動によるノイズが大きく、正確な値を評価する為には非常に長い時間のシミュレーションが必要。
  • 摂動法
上記2つの手法の問題が解決される。

Reference:
[1] http://ci.nii.ac.jp/els/110002188027.pdf?id=ART0002441111&type=pdf&lang=jp&host=cinii&order_no=&ppv_type=0&lang_sw=&no=1412212064&cp=
[2] http://ir.library.osaka-u.ac.jp/dspace/bitstream/11094/787/1/25491_%E8%AB%96%E6%96%87.pdf
[3] http://www.jim.or.jp/journal/j/pdf3/69/01/61.pdf
[4] http://lammps.sandia.gov/tutorials.html -> http://lammps.sandia.gov/tutorials/italy14/italy_kappa_viscosity_Mar14.pdf
-------------------------------------------------------------------------------
■ その他
Free Energy: http://www.utdallas.edu/~son051000/comp/FreeE.pdf 
ICME Workshop: Molecular Dynamics witl LAMMPS by Andrew Ferguson: https://www.youtube.com/watch?v=TTDXJXJJi18
Introduction to Molecular Dynamics: https://www.youtube.com/watch?v=_TiQYNWJwYg , https://www.youtube.com/watch?v=1y4qDhzmWPw
VMD Tutorial for Beginners: https://www.youtube.com/watch?v=Fl3hmqCHYU4
GULP: https://nanochemistry.curtin.edu.au/gulp/
  http://accelrys.co.jp/resource-center/datasheets/Materials-Studio/gulp-jp.pdf
GROMOS: http://www.gromos.net/
  https://www.youtube.com/watch?v=vOJsmtFeSGk
  https://www.youtube.com/watch?v=BZNzYt_DUB0
Atomeye: http://li.mit.edu/Archive/Graphics/A/
  http://d.hatena.ne.jp/sumoak/20120615/1339769817
  http://www.fml.t.u-tokyo.ac.jp/~izumi/CMS/AtomEye_Jpn.pdf
  http://mm4.scitec.kobe-u.ac.jp/~yashiro/edu/atomeye/atomeye.html
-------------------------------------------------------------------------------
 
アクセス数
ページビュー数