24小时热门版块排行榜    

Znn3bq.jpeg
查看: 902  |  回复: 1

Joannaouc

木虫 (著名写手)

[交流] 利用Grimme D2 scheme 手动计算dispersion (by MATLAB) 已有1人参与

好久之前写的东西,可能对大家有用。欢迎自行修改。请轻拍砖。
P.S. Dmol5.0 (not quite sure) 以上和VASP5.2以上可以利用程序在结构驰豫的时候就把dispersion加进去。这个当初是针对没有dispersion的dmol写的,刚写完没多久程序就更新到自带了。


function [Edisp] = Edisperse(filename)
%define the function to calculate dispersion energy
%modified on 09-03-2011

%open file and read
fid = fopen(filename,'r');

%following is the matrix storing Ro and C6 information
%of the atoms in the system
%
%first column is C6, second column is Ro
%
%line 1 for H
para(1,1) = 0.14;
para(1,2) = 1.001;
%line 2 for C
para(2,1) = 1.75;
para(2,2) = 1.452;
%line 3 for N
para(3,1) = 1.23;
para(3,2) = 1.397;
%line 4 for Li
para(4,1) = 1.61;
para(4,2) = 0.825;
%line 5 for Ti
para(5,1) = 10.80;
para(5,2) = 1.562;

%following is some other parameters
s6 = 0.75;
d = 20;

%read in coordinates and atom type of the atoms
[atype, x, y, z] = textread(filename, '%s %f %f %f');
l=length(x);

%allocate integer number to identify each atom kind
for i=1:l
    if (strcmp(atype(i),'H')==1)
        atomtype(i) = 1;
    elseif (strcmp(atype(i),'C')==1)
        atomtype(i) = 2;
    elseif (strcmp(atype(i),'N')==1)
        atomtype(i) = 3;
    elseif (strcmp(atype(i),'Li')==1)
        atomtype(i) = 4;
    else atomtype(i) = 5;
    end
end
atomtype = atomtype';

Edisp = 0;
for i = 1: (l-1)
    for j = (i+1):l
        Rr = para(atomtype(i),2) + para(atomtype(j),2);
        C6ij = sqrt (para(atomtype(i),1).* para(atomtype(j),1));
        Rij = sqrt ((x(i)-x(j)).^2+(y(i)-y(j)).^2+(z(i)-z(j)).^2);
        fdmpij = 1./(1+exp(-d*((Rij./Rr)-1)));
        Edisp = Edisp + (C6ij .* fdmpij) ./ (Rij.^6);
    end
end

Edisp = - Edisp .* s6;
%unit here is k kJ/mol
Edisp = Edisp .* 1000;
%unit here is kJ/mol
Edisp = Edisp ./ 2625.5 .*27.211;
%unit here is eV
回复此楼

» 猜你喜欢

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

hwying

新虫 (初入文坛)

重新开始
2楼2013-05-08 17:09:59
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 Joannaouc 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 2本,初试303,0860求调剂 +4 floriea 2026-04-12 6/300 2026-04-12 10:40 by floriea
[考研] 291求调剂 +11 关忆北. 2026-04-09 12/600 2026-04-12 10:32 by 逆水乘风
[考研] 347求调剂 +4 mhyqyy 2026-04-06 4/200 2026-04-12 02:27 by 秋豆菜芽
[考研] 22408调剂315分 +3 zhuangyan123 2026-04-09 3/150 2026-04-12 00:25 by 蓝云思雨
[考研] 求调剂 +6 电气300求调剂不 2026-04-08 6/300 2026-04-11 20:14 by 逆水乘风
[考研] 求调剂 +3 胃痉挛累了 2026-04-11 5/250 2026-04-11 14:13 by luhong1990
[考研] 一志愿211生物学280分 求调剂 +7 李rien 2026-04-05 7/350 2026-04-11 11:16 by 逆水乘风
[考研] 283求调剂 +22 那个噜子 2026-04-09 22/1100 2026-04-11 10:41 by 逆水乘风
[考研] 一志愿京区985,085401,与本科专业一致,电子信息工程, +4 阳光开朗的男孩 2026-04-10 4/200 2026-04-10 18:27 by shenrf
[考研] 08600生物与医药-327 +10 18755400796 2026-04-05 10/500 2026-04-10 08:14 by kangsm
[考研] 一志愿华工085600 331分 +6 天下ww 2026-04-09 6/300 2026-04-09 18:59 by l_paradox
[考研] 求调剂希望还是希望在山河四省附近 +3 快乐的小白鸽 2026-04-05 3/150 2026-04-09 17:36 by wp06
[考研] 材料工程322 +18 哈哈哈吼吼吼哈 2026-04-07 19/950 2026-04-09 10:44 by cymywx
[考研] 一志愿0807 数一英一 313 有没有二轮调剂 +11 emokidd 2026-04-08 12/600 2026-04-09 09:24 by wyf236
[考研] 一志愿985初试354分生物调剂 +3 031001 2026-04-06 3/150 2026-04-09 00:30 by Evan_Liu
[考研] 电子信息346 +4 zuoshaodian 2026-04-08 4/200 2026-04-08 11:54 by zzucheup
[考研] 22408 266求调剂 +11 masss11222 2026-04-07 14/700 2026-04-08 11:06 by yulian1987
[考研] 312求调剂 +4 LR6 2026-04-06 4/200 2026-04-07 08:42 by jp9609
[考研] 一志愿太原理工大学计算机技术专硕348,求调剂指导 +3 nexious 2026-04-05 3/150 2026-04-07 08:19 by jp9609
[考研] 081200-11408-276学硕求调剂 +5 崔wj 2026-04-05 5/250 2026-04-06 15:40 by lin-da
信息提示
请填处理意见