百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 编程字典 > 正文

布里渊区及能带路径的可视化(布里渊区k点范围)

toyiye 2024-07-05 01:32 11 浏览 0 评论

先前本公众号已经介绍"五种方法生成能带结构计算的高对称点",使用里面的方法即可获取相应晶体对应的布里渊区图。在VASPKIT 1.20新版本中即将实现布里渊区及能带路径的可视化。相应的脚本文件(见文末代码)已经开放内测,感兴趣的可以到VASPKIT FAQs QQ 群331895604群文件下载。相比其它软件,VASPKIT可以更加方便实现自动标记对应能带计算的k点路径。

晶体结构的第一布里渊区可通过调用Voronoi图算法实现,特别感谢中科大郑奇靖老师提供了关于实现算法的建议。接下来我们演示如何调用VASPKIT结合python脚本实现布里渊区及能带路径的可视化:

第一步:我们以Cu和graphene为例,准备好POSCAR文件,注意一定是原胞结构(primtive cell)。然后分别运行vaspkit -303 (Cu 体相)和vaspkit -302 (二维体系graphene)生成包含推荐能带路径的KPATH.in文件和高对称点HIGH_SYMMETRY_POINTS文件;

===================== Structural Options ======================== 01) VASP Input Files Generator 02) Elastic-Properties 03) K-Path Generator 04) Structure Editor 05) Catalysis-ElectroChem Kit 06) Symmetry Search ===================== Electronic Options ======================== 11) Density-of-States 21) DFT Band-Structure 23) 3D Band-Structure 25) Hybrid-DFT Band-Structure 26) Fermi-Surface 28) Band-Structure Unfolding =========== Charge & Potential & Wavefunction Options =========== 31) Charge & Spin Density 42) Potential-Related 51) Wave-Function Analysis ====================== Misc Utilities =========================== 71) Optical-Properties 72) Molecular-Dynamics Kit 73) VASP2other Interface 91) Semiconductor Calculator 92) 2D-Materials Kit 0) Quit------------>>302 +-------------------------- Warm Tips --------------------------+ See An Example in vaspkit/examples/seek_kpath/graphene_2D. More details are given in arXiv:1806.04285 (2018) and refs. This feature is still experimental & check PRIMCELL.vasp file. +---------------------------------------------------------------+-->> (01) Reading Structural Parameters from POSCAR File... +-------------------------- Summary ----------------------------+ The vacuum slab is supposed to be along z axis Prototype: AB2 Total Atoms in Input Cell: 3 Lattice Constants in Input Cell: 3.190 3.190 12.000 Lattice Angles in Input Cell: 90.000 90.000 120.000 Total Atoms in Primitive Cell: 3 Lattice Constants in Primitive Cell: 3.190 3.190 12.000 Lattice Angles in Primitive Cell: 90.000 90.000 120.0002D Bravais Lattice: Hexagonal Point Group: 26 [ D3h ] International: P-6m2 Symmetry Operations: 12 Suggested K-Path: (shown in the next line) [ GAMMA-M-K-GAMMA ] +---------------------------------------------------------------+-->> (02) Written PRIMCELL.vasp file.-->> (03) Written HIGH_SYMMETRY_POINTS File for Reference.-->> (04) Written KPATH.in File for Band-Structure Calculation. +----------------------------WARNING----------------------------+ | Do NOT forget to copy PRIMCELL.vasp to POSCAR unless you know | | what you are doing. Otherwise you might get wrong results! | +---------------------------------------------------------------+`

第二步,终端运行python3 visualize_BZ.py (代码见下面)得到下图:

import numpy as np, numpy.linalg as nplfrom scipy.spatial import Voronoifrom itertools import productfrom matplotlib.patches import FancyArrowPatchfrom mpl_toolkits.mplot3d import proj3dimport matplotlib as mplmpl.rcParams['font.size'] = 12.

def read_poscar(poscar, species=None): poscar = open(poscar,'r') title = poscar.readline.strip scale = float(poscar.readline.strip) s = float(scale) lattice_vectors = [[ float(v) for v in poscar.readline().split() ], [ float(v) for v in poscar.readline().split() ], [ float(v) for v in poscar.readline().split() ]] lattice_vectors = np.array(lattice_vectors) reciprocal_lattice_vectors= np.linalg.inv(lattice_vectors).T reciprocal_lattice_vectors=reciprocal_lattice_vectors*np.pi*2return reciprocal_lattice_vectors

def read_high_symmetry_points: f = open("HIGH_SYMMETRY_POINTS",'r') fa=f.readline n=0 hpts= while True: fa=f.readline hpts.append(fa) n=n+1if fa.find('use') > 0: break f.close kpts= klabels= for i in range(0,n-3): kpts.append(hpts[i].split[0:3]) klabels.append(hpts[i].split[3]) kpts=np.array(kpts,dtype=np.float64)return kpts, klabels

def is_greek_alphabets(klabels): Greek_alphabets=['Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta','Theta', 'Iota','Kappa','Lambda','Mu','Nu','Xi','Omicron','Pi','Rho','Sigma','Tau','Upsilon','Phi','Chi','Psi','Pega'] group_labels=for i in range(len(klabels)): klabel=klabels[i] for j in range(len(Greek_alphabets)):if (klabel.find(Greek_alphabets[j].upper)>=0): latex_exp=r''+'$\\'+str(Greek_alphabets[j])+'$' klabel=klabel.replace(str(Greek_alphabets[j].upper),str(latex_exp))if (klabel.find('_')>0): n=klabel.find('_') klabel=klabel[:n]+'

+klabel[n:n+2]+'
+klabel[n+2:] group_labels.append(klabel) klabels=group_labelsreturn klabels

def read_kpath: kpath=np.loadtxt("KPATH.in", dtype=np.string_,skiprows=4)#print(kpath) kpath_labels = kpath[:,3].tolist kpath_labels = [i.decode('utf-8','ignore') for i in kpath_labels]for i in range(len(kpath_labels)):if kpath_labels[i]=="Gamma": kpath_labels[i]=u"Γ" kpaths=np.zeros((len(kpath_labels),3),dtype=float)for i in range(len(kpath_labels)): kpaths[i,:]=\ [float(x) for x in kpath[i][0:3]]return kpath_labels, kpaths

def get_Wigner_Seitz_BZ(lattice_vectors):# Inspired by http://www.thp.uni-koeln.de/trebst/Lectures/SolidState-2016/wigner_seitz_3d.py # Inspired by https://github.com/QijingZheng/VASP_FermiSurface/blob/master/fs.py latt = prefactors = [0., -1., 1.]for p in prefactors:for u in lattice_vectors: latt.append(p * u) lattice = for vs in product(latt, latt, latt): a = vs[0] + vs[1] + vs[2]if not any((a == x).all for x in lattice): lattice.append(a) voronoi = Voronoi(lattice) bz_facets = bz_ridges = bz_vertices = for pid, rid in zip(voronoi.ridge_points, voronoi.ridge_vertices):if(pid[0] == 0 or pid[1] == 0): bz_ridges.append(voronoi.vertices[np.r_[rid, [rid[0]]]]) bz_facets.append(voronoi.vertices[rid]) bz_vertices += rid bz_vertices = list(set(bz_vertices))return voronoi.vertices[bz_vertices], bz_ridges, bz_facets

class Arrow3D(FancyArrowPatch):def __init__(self, xs, ys, zs, *args, **kwargs): FancyArrowPatch.__init__(self, (0, 0), (0, 0), *args, **kwargs) self._verts3d = xs, ys, zsdef draw(self, renderer): xs3d, ys3d, zs3d = self._verts3d xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M) self.set_positions((xs[0], ys[0]), (xs[1], ys[1])) FancyArrowPatch.draw(self, renderer)

def visualize_BZ_matplotlib(points,ridges,facets,reciprocal_lattice_vectors,kpts,klabels,kpaths):import matplotlib as mplimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dfrom mpl_toolkits.mplot3d.art3d import Poly3DCollection fig = plt.figure(figsize=(8, 8)) ax = fig.add_subplot(111, projection='3d') basis_vector_clrs = ['r', 'g', 'b'] basis_vector_labs = ['x', 'y', 'z']for ii in range(3): arrow = Arrow3D([0,reciprocal_lattice_vectors[ii, 0]], [0,reciprocal_lattice_vectors[ii, 1]], [0,reciprocal_lattice_vectors[ii, 2]], color=basis_vector_clrs[ii], mutation_scale=20,lw=1,arrowstyle="->") ax.add_artist(arrow) ax.text(reciprocal_lattice_vectors[ii, 0], reciprocal_lattice_vectors[ii, 1],reciprocal_lattice_vectors[ii, 2], basis_vector_labs[ii])for ir in ridges: ax.plot(ir[:, 0], ir[:, 1], ir[:, 2], color='k', lw=1.5,alpha=0.5)for i in range(len(klabels)): kpt=np.dot(kpts[i,:],reciprocal_lattice_vectors) ax.scatter(kpt[0], kpt[1], kpt[2],c='b', marker='o',s=20,alpha=0.8) ax.text(kpt[0], kpt[1], kpt[2],klabels[i],c='b')for i in range(kpaths.shape[0]): kpaths[i,:]=np.dot(kpaths[i,:],reciprocal_lattice_vectors)for i in range(0,kpaths.shape[0],2): arrow = Arrow3D([kpaths[i,0],kpaths[i+1,0]],[kpaths[i,1],kpaths[i+1,1]],[kpaths[i,2],kpaths[i+1,2]],mutation_scale=20,lw=1.5,arrowstyle="->", color="magenta") ax.add_artist(arrow) ax.set_axis_off ax.view_init(elev=12, azim=23) plt.savefig('Brillouin_Zone.pdf',dpi=100) plt.show

def welcome: print('') print('+---------------------------------------------------------------+') print('| A VASPKIT Plugin to Visualize Brillouin Zone Using Matplotlib |') print('| Written by Vei WANG (wangvei@icloud.com) |') print('+---------------------------------------------------------------+') print('')

if __name__ == "__main__": welcome reciprocal_lattice_vectors=read_poscar('POSCAR') lattice_vectors=[np.array(reciprocal_lattice_vectors[0,:]),np.array(reciprocal_lattice_vectors[1,:]),np.array(reciprocal_lattice_vectors[2,:])] kpts,klabels=read_high_symmetry_points klabels=is_greek_alphabets(klabels) kpath_labels,kpaths=read_kpath points, ridges, facets = get_Wigner_Seitz_BZ(lattice_vectors) visualize_BZ_matplotlib(points, ridges, facets, reciprocal_lattice_vectors,kpts,klabels,kpaths)

相关推荐

如何用 coco 数据集训练 Detectron2 模型?

随着最新的Pythorc1.3版本的发布,下一代完全重写了它以前的目标检测框架,新的目标检测框架被称为Detectron2。本教程将通过使用自定义coco数据集训练实例分割模型,帮助你开始使...

CICD联动阿里云容器服务Kubernetes实践之Bamboo篇

本文档以构建一个Java软件项目并部署到阿里云容器服务的Kubernetes集群为例说明如何使用Bamboo在阿里云Kubernetes服务上运行RemoteAgents并在agents上...

Open3D-ML点云语义分割实验【RandLA-Net】

作为点云Open3D-ML实验的一部分,我撰写了文章解释如何使用Tensorflow和PyTorch支持安装此库。为了测试安装,我解释了如何运行一个简单的Python脚本来可视化名为...

清理系统不用第三方工具(系统自带清理软件效果好不?)

清理优化系统一定要借助于优化工具吗?其实,手动优化系统也没有那么神秘,掌握了方法和技巧,系统清理也是一件简单和随心的事。一方面要为每一个可能产生累赘的文件找到清理的方法,另一方面要寻找能够提高工作效率...

【信创】联想开先终端开机不显示grub界面的修改方法

原文链接:【信创】联想开先终端开机不显示grub界面的修改方法...

如意玲珑成熟度再提升,三大发行版支持教程来啦!

前期,我们已分别发布如意玲珑在deepinV23与UOSV20、openEuler24.03发行版的操作指南,本文,我们将为大家详细介绍Ubuntu24.04、Debian12、op...

118种常见的多媒体文件格式(英文简写)

MP4[?mpi?f??]-MPEG-4Part14(MPEG-4第14部分)AVI[e?vi??a?]-AudioVideoInterleave(音视频交错)MOV[m...

密码丢了急上火?码住7种console密码紧急恢复方式!

身为攻城狮的你,...

CSGO丨CS2的cfg指令代码分享(csgo自己的cfg在哪里?config文件位置在哪?)

?...

使用open SSL生成局域网IP地址证书

某些特殊情况下,用户内网访问多可文档管理系统时需要启用SSL传输加密功能,但只有IP,没有域名和证书。这种情况下多可提供了一种免费可行的方式,通过openSSL生成免费证书。此方法生成证书浏览器会提示...

Python中加载配置文件(python怎么加载程序包)

我们在做开发的时候经常要使用配置文件,那么配置文件的加载就需要我们提前考虑,再不使用任何框架的情况下,我们通常会有两种解决办法:完整加载将所有配置信息一次性写入单一配置文件.部分加载将常用配置信息写...

python开发项目,不得不了解的.cfg配置文件

安装软件时,经常会见到后缀为.cfg、.ini的文件,一般我们不用管,只要不删就行。因为这些是程序安装、运行时需要用到的配置文件。但对开发者来说,这种文件是怎么回事就必须搞清了。本文从.cfg文件的创...

瑞芯微RK3568鸿蒙开发板OpenHarmony系统修改cfg文件权限方法

本文适用OpenHarmony开源鸿蒙系统,本次使用的是开源鸿蒙主板,搭载瑞芯微RK3568芯片。深圳触觉智能专注研发生产OpenHarmony开源鸿蒙硬件,包括核心板、开发板、嵌入式主板,工控整机等...

Python9:图像风格迁移-使用阿里的接口

先不多说,直接上结果图。#!/usr/bin/envpython#coding=utf-8importosfromaliyunsdkcore.clientimportAcsClient...

Python带你打造个性化的图片文字识别

我们的目标:从CSV文件读取用户的文件信息,并将文件名称修改为姓名格式的中文名称,进行规范资料整理,从而实现快速对多个文件进行重命名。最终效果:将原来无规律的文件名重命名为以姓名为名称的文件。技术点:...

取消回复欢迎 发表评论:

请填写验证码