1旗唁、本文搬運(yùn)自ETasci-2013-SurfacePreparationHowTo饼煞,簡(jiǎn)單總結(jié)一下,方便大家
2雄坪、首先講一下思路:我們要找到新的單胞,然后我們做晶格基矢轉(zhuǎn)換再加一個(gè)真空層就行了屯蹦,其實(shí)很簡(jiǎn)單维哈。下面講解步驟。
首先你需要兩個(gè)東西登澜,一個(gè)是晶格結(jié)構(gòu)阔挠,需要時(shí)VESTA能夠打開的格式,這里以Material Project上下載下來(lái)的*.cif文件為例脑蠕。然后把文件拖入到VESTA中购撼。
然后就是找新的單胞,首先我們要找到單胞對(duì)應(yīng)的6個(gè)平面谴仙,當(dāng)然在這之前要先擴(kuò)展成超胞看起來(lái)比較方便迂求。(這一步的所有步驟都沒有改變?cè)畔⒅皇菫榱宋覀兛粗奖悖ㄏ旅娴膭h除原子之類的晃跺。)點(diǎn)左邊的Boundary揩局,然后把x,y掀虎,z改成3 3 3
然后我們的模型就變成超胞了凌盯。
點(diǎn)左上角的
Edit
驰怎,然后點(diǎn)Lattice Planes
,就出來(lái)編輯平面的窗口然后點(diǎn)
New
二打,就可以新建平面县忌,新建完了以后會(huì)顯示在左邊,這里添加6個(gè)平面,得到新的單胞芹枷,如下圖所示衅疙。刪除多余的原子,用最左側(cè)邊欄上的第二個(gè)鼠標(biāo)指針選中然后按鍵盤上的Del鍵即可刪除
然后我們就得到了新的單胞鸳慈,這里丟失了一些原子饱溢。
這里因?yàn)榫Ц耖g距和例子中的不一樣,所以截出來(lái)的單胞并不是很理想走芋,所以拿上面那個(gè)PDF中的來(lái)說(shuō)吧绩郎,實(shí)際操作中根據(jù)自己的需要來(lái)截,這一步是最關(guān)鍵的翁逞。
這個(gè)就是PDF中的例子給出的單胞肋杖,頂點(diǎn)上有4個(gè)原子挖函,像上邊一樣用左邊欄第二個(gè)箭頭選中4個(gè)原子下面的窗口會(huì)給出4個(gè)原子現(xiàn)在的坐標(biāo)怨喘,分別減去新的原點(diǎn)O‘的坐標(biāo)必怜,就得到了新的晶格基矢與原來(lái)的基矢的關(guān)系
終于得到了晶格變換矩陣
注意:到這里為止我們都沒有實(shí)際上改變?cè)瓉?lái)的晶格結(jié)構(gòu)文件暖途。下面我們就要改了
點(diǎn)Edit
>>Edit data
>>Unit cell
然后點(diǎn)Transform在Rotation matrixP中填上剛才得到的變換矩陣就得到了新的單胞驻售,下面就是添加真空層了芋浮,只需要File>>Export data選VASP的格式然后選笛卡爾坐標(biāo)镇草,再把c方向加大就行了。PP
VESTA建立截止面/移除部分isosurface
添加平面不僅可以幫助簡(jiǎn)立新的單胞竖伯,還可以幫助截取isosurface的一部分。
我在畫電荷密度的時(shí)候祟偷,有時(shí)候會(huì)遇到想去掉自己不想要的isosurface部分的想法但是直接像刪除原子那樣的方式是刪不掉的打厘,說(shuō)明書里有一個(gè)如何截圖像的方法户盯,名字叫做建立邊界平面。
同時(shí)按ctrl
吗伤、shift
足淆、B
就可以打開建立截止面的界面缸浦,然后輸入自己想要的截止面就可以了!
VESTA變換元胞后保持矢量與之前一致
按照上面描述的方法變換元胞之后卜高,原來(lái)設(shè)置的矢量有可能會(huì)改變方向掺涛,因?yàn)樵幕副桓淖兞诵嚼拢俏野l(fā)現(xiàn)只要在變換的時(shí)候選擇第二個(gè)選項(xiàng)就可以保持矢量不變拣帽,但是需要重新設(shè)置矢量和原子的對(duì)應(yīng)順序。
VESTA 批量添加矢量
VESTA里面添加矢量比較麻煩嚼锄,手動(dòng)一個(gè)一個(gè)點(diǎn),能不能通過(guò)腳本來(lái)實(shí)現(xiàn)呢区丑?答案是可以的修陡,因?yàn)閂ESTA的輸入文件prefix.vesta
實(shí)際上是一個(gè)文本文檔,所有的信息都以文本的方式存在里面魄鸦,那么只需要按照VESTA的格式把矢量寫進(jìn)去就可以了,上網(wǎng)一搜有人寫過(guò)了癣朗,于是就直接拿過(guò)來(lái)了号杏。腳本來(lái)自GitHub - hzr-piggy/plot_vec_VESTA斯棒,他參考了另一個(gè)人的寫法GitHub - lucydot/vesta_vectors荣暮。非常感謝他們!
輸入文件就是兩個(gè)砾跃,一個(gè)是需要修改的VESTA輸入文件骏啰,還有一個(gè)就是記錄矢量的文本文檔判耕,大致格式是這樣的
-0.05
-0.05
-0.05
0.1
0.1
0.1
就是把矢量分成每行一個(gè)數(shù)就可以了翘骂。這里只加了兩個(gè)矢量壁熄,需要加更多只需要也參照這個(gè)格式加下去就可以了。
def plot_vec(vesta_file, vec_file,
cutoff = 0.1,
radius=0.5, color=[255,0,0], penetrate = True, add_atom_radius = False,
scale_factor = 1,
delim = None, vec_type = "Cart", lat = None,
output_suffix = "_vec"):
# vesta_file: A *.vesta file
# vec_file: A file containing vectors having dimensions of 3N*1 (or 1*3N)
# with delimiter=delim i.e.
# x1
# y1
# z1
# x2
# y2
# z2
# .
# .
# .
# cutoff (Double): Angstrom below which vector will not show
# radius (Double): Set radius of vector
# color (Double 0-255): Set color of vector
# penetrate (Bool): Set whether vector penetrate atom
# add_atom_radius (Bool):Set whether to add atom radius to vector modulus
# scale_factor (Double): Scale vector in the figure
# delim: Delimiter in the vec_file
# vec_type: Type of vectors, can be "Cart" (Cartesian), "Lat" (Lattice vector notation [u v w], in reduced coord)
# or "Modulus" (Modulus along crystallographic axis). Default is 'Cart'
# lat: 3-by-3 lattice parameter in Angstrom required if vec_type == 'Cart'
import numpy as np
import re
import os
# Read input files
vesta_data = open(vesta_file,'r').read()
temp = np.loadtxt(vec_file,delimiter=delim)
N_dim = temp.shape[0]
temp = temp.reshape((N_dim//3,3))
# Convert to Modulus along crystallographic axis
if vec_type == 'Lat':
struct_match=re.findall(r'CELLP\n\s+(\d+\.\d+\s+\d+\.\d+\s+\d+\.\d+\s+)',vesta_data)[0]
cell = np.array([float(x) for x in struct_match.split()]) # cell lengths in angstrong
temp *= cell
elif vec_type == 'Cart':
assert lat is not None, '3-by-3 lattice parameter in Angstrom required if vec_type == Cart'
temp = temp@np.linalg.inv(lat)*np.linalg.norm(lat,axis=1)
# print(lat)
vectors = np.around(temp*scale_factor,decimals=3) # Round the disp to 3 decimals
# Find unique vectors
print(vectors)
vectors_unique = np.unique(vectors,axis=0)
# Vector penetrate atom or add atomic radius?
flag = int(penetrate)+int(add_atom_radius)*2
VECTR_str=r"\1"
VECTT_str=r"\1"
i = 1
for v in vectors:
if np.linalg.norm(v) > cutoff: # only create vector with modules > cutoff
VECTR_str += " {0} {1} {2} {3} 0\n".format(i,v[0],v[1],v[2]) # create vectors
atom_list = np.where((vectors == v).all(axis=1))[0]
for atom in atom_list:
print(atom)
VECTR_str += " {0} 0 0 0 0\n".format(atom+1) # create atom labels start from 1
VECTR_str += "0 0 0 0 0\n"
VECTT_str += " {0} {1} {2} {3} {4} {5}\n".format(i,radius, color[0], color[1], color[2], flag)
i += 1
output_data = re.sub(r"(VECTR\n)",VECTR_str,vesta_data)
output_data = re.sub(r"(VECTT\n)",VECTT_str,output_data)
# print(output_data)
name, ext = os.path.splitext(vesta_file)
file_out = open(name+output_suffix+ext,'w+')
file_out.write(output_data)
file_out.close()
mode = 12
plot_vec('NbAs.vesta', 'NbAs_vector'+str(mode)+'.dat',
cutoff = 0.1,
radius=0.4, color=[255,0,0], penetrate = False, add_atom_radius = False,
scale_factor =-1,
delim = None, vec_type = "Cart", lat = [[6.374959638, 0.003597502 , -0.000000000],
[ 4.478346762 , 4.537022058 , -0.000000000],
[-5.426653274 ,-2.270309811 , 2.457085633]],
output_suffix = "_vec"+str(mode))
VESTA保存帶電荷密度圖
VESTA為了保持vesta文件格式的簡(jiǎn)介一致性碳竟,將電荷密度這一類數(shù)據(jù)在保存的時(shí)候就刪掉了草丧,想要保存這一類數(shù)據(jù)需要將其再保存為一個(gè)XX.ggrid文件,然后打開的時(shí)候 Edit > volumetric-data 導(dǎo)入進(jìn)去就可以了莹桅。
VESTA 調(diào)節(jié)isosurface 透明度昌执,
VESTA中如果想要調(diào)節(jié)isosurface的透明度,是在properties里面然后打開isosurface選項(xiàng)里就可以調(diào)诈泼,關(guān)鍵在于理解兩個(gè)透明度的意思是什么懂拾,
這一點(diǎn)從這個(gè)圖上可以看出來(lái),其中O1和O2分別代變兩個(gè)方向的透明度厂汗,分別對(duì)應(yīng)opacity1和opacity2委粉,然后前面那個(gè)render from front to back 影響也很大呜师。