计算化学公社
标题:
笛卡尔坐标与分数坐标的转化
[打印本页]
作者Author:
飞翔的小猪
时间:
2017-3-16 15:31
标题:
笛卡尔坐标与分数坐标的转化
MS新手,学习CO分子吸附在Pd(110)晶面的过程,不理解关于笛卡尔坐标与分数坐标的转换,下图中的xc,yc,zc的来源与自己算的不一样,最下面是自己的转化,求大神指点例子中的xc,yc
(, 下载次数 Times of downloads: 87)
上传 Uploaded
点击下载Click to download
(, 下载次数 Times of downloads: 123)
上传 Uploaded
点击下载Click to download
作者Author:
万里云
时间:
2017-3-16 17:14
本帖最后由 万里云 于 2017-3-16 17:18 编辑
坐标转换和量子力学中表象变换是一回事,可以直接套用公式<a|x>=<a|b><b|x>,其中<a|x>和<b|x>都是列向量,<a|b>是基组b在基组a下的表示矩阵。拿从分数坐标到笛卡尔坐标变换举例,<a|b>就是基矢笛卡尔坐标所组成矩阵的专置。
附两个笛卡尔坐标和分数坐标互换的matlab函数:
function y = cart2frac(latvec, x)
%
% latvec = [ a1x, a1y, a1z;
% a2x, a2y, a2z;
% a3x, a3y, a3z ]
%
% x = [ atom1x, atom1y, atom1z;
% atom2x, atom2y, atom2z;
% .......................
% atomNx, atomNy, atomNz ]
%
[ m, n ] = size(x);
y = zeros(m, n);
convmat = inv(latvec');
for k = 1:m
y(k,:) = (convmat * x(k,:)')';
end
复制代码
function y = frac2cart(latvec, x)
%
% latvec = [ a1x, a1y, a1z;
% a2x, a2y, a2z;
% a3x, a3y, a3z ]
%
% x = [ atom1x, atom1y, atom1z;
% atom2x, atom2y, atom2z;
% .......................
% atomNx, atomNy, atomNz ]
%
[ m, n ] = size(x);
y = zeros(m, n);
convmat = latvec';
for k = 1:m
y(k,:) = (convmat * x(k,:)')';
end
复制代码
以及一个由晶格常数计算基矢坐标的函数:
function y = latvec(latconst)
a = latconst(1);
b = latconst(2);
c = latconst(3);
alpha = latconst(4) / 180 * pi;
beta = latconst(5) / 180 * pi;
gamma = latconst(6) / 180 * pi;
y = zeros(3, 3);
y(1,:) = [ a, 0, 0 ];
y(2,:) = [ b*cos(gamma), b*sin(gamma), 0 ];
y(3,1) = c * cos(beta);
y(3,2) = c * (cos(alpha) - cos(beta)*cos(gamma)) / sin(gamma);
y(3,3) = c * sqrt(1 + 2*cos(alpha)*cos(beta)*cos(gamma) - cos(alpha)^2 - cos(beta)^2 - cos(gamma)^2) / sin(gamma);
复制代码
作者Author:
飞翔的小猪
时间:
2017-3-17 10:46
万里云 发表于 2017-3-16 17:14
坐标转换和量子力学中表象变换是一回事,可以直接套用公式=,其中和都是列向量,是基组b在基组a下的表示矩 ...
谢谢
欢迎光临 计算化学公社 (http://ccc.keinsci.com/)
Powered by Discuz! X3.3