Lammps 初學者——in 文件中文解析

1.初始化

Units:

Units 命令是用來設定模擬的原子類型。

Units style(lammps 現(xiàn)在提供的有 style=LJ、real、metal、si、cgs、electron)

LJ 是硬球模型

Real 是真實的原子模型

Metal 是金屬原子模型Si 是硅(半導體)原子模型Cgs

Electron 是電子模型

Dimension:

Dimension 命令是用來定義模擬的維度,默認情況為三維。

Dimension N (N=2,3)

Boundary:

Boundary 命令是用來設定模擬的邊界條件。

Boundary x y z (x,y,z=p,s,f,m 四種類型中的一種或者兩種)

P 是周期性邊界條件

S 是自由邊界條件(但是具有收縮性)

F 是固定邊界條件

M 是具有最小值的自由邊界條件(但是具有收縮性)

Atom-style:

Atom-style 定義了模擬體系中的原子屬性。

Delete-atoms: Pair-style:

Pair-style 定義了相互作用力場類型,即勢函數(shù)。

  1. 原子定義

1、

Read-data/read-restart:

Read-data 或 read-restart 為從 data 或 restart 文件中讀取內(nèi)容來定義原子。

2、

Lattice:

lattice 是用來原子類型構(gòu)建模型晶格結(jié)構(gòu)。

Lattice style scale keyword values...

Style 表示點陣類型,點陣類型有 none、sc、bcc、fcc、hcp、diamond、sq、

sq2、hex、custom。

Scale 表示構(gòu)建的點陣類型的單位長度

Keyword 表示后面可以追加 0 個或者多個關(guān)鍵字,關(guān)鍵字有 origin、orient、

spacing、a1、a2、a3、basis。各關(guān)鍵字意思為:

Region:

Create-box:

Create-box 命令用于在 region box 命令指定的區(qū)域內(nèi)創(chuàng)建一個模擬的盒子。

Create_box N region-ID

N 為使用該原子類型進行模擬

Region-ID 為使用區(qū)域的 ID 使用模擬域

Create-atoms:

Create-atoms 用于在所創(chuàng)建的模擬的盒子中填充某種原子。

Create_atoms type style args keyword values ...

  1. 設定: 力場系數(shù)()

Pair-coeff: 模擬參數(shù)

Timestep 是定義模擬的時間步長。

Timestep dt

Dt 為時間步長(時間單位),默認為 1ps

Reset-timestep:

Fix

Fix 為定義對部分原子或者對系綜的操作。

http://lammps.sandia.gov/doc/fix.html Fix ID group-ID style args

ID=指定的操作名稱編號(如 1、2、3…….) Group-ID=制定操作范圍的原子(如 all……)

Style=操作內(nèi)容,如何操作

Args=相關(guān)操作內(nèi)容的相關(guān)操作參數(shù)

Fix-nvt:恒定 N(原子數(shù)量)、V(體積)、T(溫度)對時間積分Fix-npt:恒定 N、P、T 對時間積分

Unfix:

Compute/compute-modify: 輸出選項

Thermo:

Thermo 命令用于定義每隔一定時間步長輸出一次采樣內(nèi)容。

Thermo N

每隔 N 個時間步長輸出一次采樣內(nèi)容至屏幕或者 log 文件

Thermo_style:

Thermo_style 命令主要是用來說明采樣的內(nèi)容,即輸出到屏幕或者 LOG

文件中的內(nèi)容。(http://lammps.sandia.gov/doc/thermo_style.html)

Thermo_style style args

Style=one、multi、custom

Args=特定的參數(shù)列表One args=none Multi args=none

Custom args=list of attributes

Possible attributes=step、elaosed、elaplong、dt、cpu、

Atoms、temp、press、pe、ke、otatal、enthalpy、

Evdwl、ecoul、epair、ebond、eangle、edihed、eimp、

Emol、elong、etail、

Vol、lx、ly、lz、xlo、xhi、ylo、yhi、zlo、zhi、

Xy、xz、yz、xlat、ylat、zlat、

Pxx、pyy、pzz、pxy、pyz、pxz、

Fmax、fnorm、

Cella、cellb、cellc、cellalpha、cellbeta、cellgamma、

c_ID、c_ID[I]、c_ID[I][J]、

f_ID、f_ID[I]、f_ID[I][J]、V_name

Dump:

Dump 命令主要是用來輸出計算后單個原子的相關(guān)信息的。

Dump ID group-ID style N file args

ID:自己給這個 dump 命令定義的一個代號(自定義)

group-ID:那些信息需要被輸出的原子群(預先定義好 group) Style:類型

N:每經(jīng)過多少時間步輸出信息

File: 輸 出 名 稱Args:相關(guān)參數(shù)(每個類型不同)

Restart:

  1. 運行

Run: Minimize:

例一

units metal # 單位為 lammps 中的 metel 類型

boundary p p p # 周期性邊界條件

atom_style atomic # 原子模式

lattice fcc 3.61 # Cu 的晶格常數(shù) 3.61

region box block 0 4 0 4 0 4 # x,y,z 各方向上的晶胞重復單元數(shù),也即區(qū)域大小

create_box 1 box # 將上述區(qū)域指定為模擬的盒子create_atoms 1 box # 將原子按晶格填滿盒子pair_style eam # 選取 Cu 的 EAM 勢作為模型pair_coeff * * Cu_u3.eam # EAM 勢文件名稱

run 0 # 運行 0 步,僅為啟動 lammps 的熱力學數(shù)據(jù)計算

variable E equal pe # 定義變量 E 為系統(tǒng)總勢能

variable N equal atoms # 定義變量 N 為系統(tǒng)總原子數(shù)

print "the number of atoms & system energy now are $N $E" # 打印信息

create_atoms 1 single 2.45 2.05 2.05 # 在該位置插入一個原子

min_style sd # 能量最小化模式,sd

minimize 1.0e-12 1.0e-12 1000 1000 # 能量最小化參數(shù),指數(shù)越大最小化程度越深

print "interstitial introduced, minimized: $N atoms, energy is $E"

fix 1 all nvt 100 100 100 drag 0.2 # nvt 系綜,原子數(shù)、體積和溫度保持不變;T=100K

timestep 0.005 # 步長 0.005fs run 1000 # 運行 1000 步

print "nvt performed, temperature up: $N atoms, total energy is $E"

fix 1 all nvt 100 0.0001 100 drag 0.2 # nvt 系綜,溫度由 100K 到 0.0001K

run 1000 # 運行 1000 步

print "nvt performed, temperature down: $N atoms, total energy is $E" compute 3 all pe/atom # 計算每個原子的勢能

compute 4 all ke/atom # 計算每個原子的動能

compute 5 all coord/atom 3.0 # 計算每個原子的近鄰原子數(shù)

dump 1 all custom 1 dump.atom id xs ys zs c_3 c_4 c_5 # 將信息寫入 dump.atom min_style sd

minimize 1.0e-12 1.0e-12 10000 10000 # 再次能量最小化

print "the final state: $N atoms, total energy is $E" # 打印信息

~

例二

boundary p s s # 邊界條件,拉伸方向

是周期性,其余是自由邊界;如果是薄膜拉伸則是兩個周期性,塊體則是三個周期性

units metal #單位制定義為

metal

atom_style atomic #原子類型

neigh_modifydelay 1 check yes # 鄰近原子列表更新速度

#create geometry

lattice fcc 3.61 # 定義晶胞為 fcc,晶格常數(shù) 3.61A

region box block 0 30 0 3 0 3 #定義一個長方體區(qū)域叫 box,長

30,寬和高是 3

create_box 1 box #創(chuàng)建了這樣一個 box

create_atoms 1 box #在 box 里創(chuàng)建了一種原子

mass 1 63.546 #定義這種原子的質(zhì)量

是 63.546

# potentials

pair_style eam # 定義勢函數(shù)是 EAM

pair_coef * * Cu_u3.eam #勢所需要的參數(shù)在此文件里

#define groups

region 1 block INF 1 INF INF INF INF # 定義了一個叫

1 的區(qū)域

group left region 1

#定義此區(qū)域里的原子叫 left

region 2 block 29 INF INF INF INF INF #定義了一個叫 2 的區(qū)域

group right region 2 #

定義此區(qū)域里的原子叫 right

group boundary union left right #定義 left+ right = boundary

group mobile subtract all left # 定義

mobile= all - left

# initialvelocities

velocity left set 0.0 0.0 0.0 # 設置

原子初速度為 0

computep all pressure thermo_temp # 計算應力,計算結(jié)果記為 p

variable pressx equal c_p[1] #定義變量 pressx=c_p[1],c_p[1]

的意思是 p 里第一個值

variable pressy equal c_p[2] #定義變量 pressy=c_p[2],c_p[2]

的意思是 p 里第二個值

variable pressz equal c_p[3] #定義變量 pressz=c_p[3],c_p[3]

的意思是 p 里第三個值

thermo_style custom step temp etotal press v_pressx v_pressy v_pressz vol

dump 1 all atom 1000 dump.tensile # 輸出結(jié)果到

dump.tensile

minimize 1.0e-6 1.0e-6 1000 1000 # 馳豫

fix 1 left setforce 0.0 NULL NULL #固定左邊的原子

fix 2 all npt 1.0 1.0 1.0 aniso 0.0 0.0 NULL NULL NULL NULL 10.0 drag 1.0

thermo 1000 #

每 1000 步輸出一次結(jié)果

timestep 0.002 #

時間步長 0.002ps

run 10000

#運行 10000 步

unfix2

fix 3 all nve

fix 4 all temp/rescale 100 1.0 1.0 5 1.0

fix 5 all deform 1000 x erate 0.002 units box #設置沿 x 方向拉伸,應變率為 0.002(1/ps)

compute s all stress/atom #計算每個原子上的應力,計算結(jié)果記為 s

compute strea all reduce sum c_s[1] #將 s 里第一個值求和,計算結(jié)果記為 strea

variable stressa equal c_strea/vol # 定義變量 stressa= strea/vol, vol 是體積

compute streb all reduce sum c_s[2] variable stressb equalc_streb/vol compute strec all reduce sum c_s[3] variable stressc equal c_strec/vol

thermo_style custom step tempetotal press v_stressa v_stressb v_stressc vol run 300000

最后,有相關(guān)需求歡迎通過微信公眾號聯(lián)系我們。

微信公眾號.jpg
登錄后免費查看全文
立即登錄
App下載
技術(shù)鄰APP
工程師必備
  • 項目客服
  • 培訓客服
  • 平臺客服

TOP

3
8