Matlab application in my research

NIXSW Simulation

NIXSW的原理

垂直入射X射线驻波技术的原理简单可以概括为: 单色X射线垂直入射晶体表面时,会形成周期与晶面间距相同的驻波,且该驻波从晶体内部延伸至真空,故表面吸附的原子分子亦处在驻波场中,可以通过调节驻波的波长观察原子分子的光电子发射变化,获得原子分子相对驻波场的具体位置,又因驻波的波节(波峰?)的位置与晶面位置一致,故可以确定原子分子与最表层原子的垂直距离,即原子在表面的高度的定量确定。

等式右侧为晶面间距,z为吸附原子相对于驻波波节的距离,即原子在表面的高度,这两个参数可从优化后得模型获得(z在模型中为分立的值,因此实际计算的时候右侧积分会转变为求和的计算),因此可以通过理论计算的模型获得右侧的值,而左侧D和也可通过二元一次方程解得。

matlab读取DFT优化后结构参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function [Direct2Cartesian, AllElements, Element_Num,Num_Element_PositionD,Num_Element_PositionC_Height] = Read_CONTCAR(NumOftopCu,filename)
%This function is used to read the information of optimized structure from
%VASP calculation.

%Direct2Cartesian is the matrix to transform the Direct coordinates to
%Cartesian coordiantes, i.e. the lattice parameters of the supercell.

%ALLElements contains all elemetns in the structure, for F4TCNQ/Cu(111) Cu
%C N F.

%Element_Num contains the Number of atoms of each element according to the
%order in AllElements.

%Num_Element_PositionD contains the Direct coordinates of all atoms with
%the same order in CONTCAR

%,Num_Element_PositionC_Height contains the heights of all atoms with
%the same order in CONTCAR

%NumOftopCu give the serial number of top-most atoms .

%filename the output from VASP, i.e. CONTCAR.

fid=fopen(filename);
Direct2Cartesian = cell2mat(textscan(fid, '%f %f %f',3, 'Headerlines', 2,'CollectOutput',1));
A=textscan(fid, '%s %s %s %s',1 , 'CollectOutput', 1);
%***** the number of %s should be changed to be the same as number of elements

AllElements=A{1,1};
B=textscan(fid, '%d %d %d %d',1, 'CollectOutput', 1);
Element_Num=B{1,1}; Total_atoms = sum(Element_Num);
C=textscan(fid, '%f %f %f %*s %*s %*s',Total_atoms, 'Headerlines', 3, 'CollectOutput',1);
% %*s %*s %*s is to find and ignore "T T T" or "F F F"
% The 'Headerlines' has to be 3 not 2.

AtomsPositionD = C{1,1};
Num_Element_PositionD=[[1:Total_atoms]' string([repelem(AllElements, Element_Num)]') AtomsPositionD];
AtomsPositionC= AtomsPositionD*Direct2Cartesian;
TopLayerSubHeight=mean(AtomsPositionC(NumOftopCu,3));
Atom_Height= AtomsPositionC(:,3)-TopLayerSubHeight;
disp(Atom_Height)
Num_Element_PositionC_Height=[[1:Total_atoms]' string([repelem(AllElements, Element_Num)]') AtomsPositionC Atom_Height];


fclose(fid);

#

文章目录
  1. 1. NIXSW Simulation
    1. 1.1. NIXSW的原理
    2. 1.2. matlab读取DFT优化后结构参数
      1. 1.2.1. #
,