服务粉丝

我们一直在努力
当前位置:首页 > 财经 >

4步出图!相互作用能/结合能脚本:用法、视频、注解、代码全文!

日期: 来源:MS杨站长收集编辑:MS杨站长
【DFT入门资料下载】
呕血整理 | 50篇DFT计算开山级必引论文集,MS、VASP、QE、Gaussian、CP2K等经典之作!
下载链接!36小时MS教学视频:建模、自由能、过渡态、吸附能、结合能、能带、态密度、光学、声子、溶剂化计算等!
10000个晶体结构CIF文件:MOF、MXenes、催化、电池、二维材料、钙钛矿、金属、纳米管等
相互作用能,又称结合能,计算公式为:

E(interaction)=E(layer1+2) - E(layer1) - E(layer2)

研究两层(如无机表面与溶液、无机表面与聚合物、聚合物与聚合物)之间的相互作用时,需要跑分子动力学,并对其中每一帧的两层结构分别拆开进行能量计算,并执行上述减法。

轨迹长达数万帧时,手动操作可能得算1年,利用脚本只需不到1分钟

全脚本展示在本文最下方!
本次为大家介绍的是MS官方脚本-相互作用能的第4次改进版(第1版发布于2009年),针对Forcite/Gulp/Mesocite模块开发。
原作者为BIOVIA的Stephen Todd,该作者还有另一款针对DMol3开发的相互作用能的脚本,杨站长将在下次推文中发布。整个脚本已在最下方完全展示。
该脚本及配合使用案例,请在后台留言“脚本”下载(包含32个脚本)。
轨迹文件、脚本、运行结果皆包含在压缩包内的InteractionEnergy路径中。
脚本用法:
1:建好两层各自结构,用Build-Build Layers工具将两层组合在一起。
2. 采用Forcite模块,设置好系综等参数,跑分子动力学,得到轨迹*.xtd。
3. 打开脚本,将xtd文件名改成第2步得到的轨迹名称,点run on server运行,得到表格。


4. H列为相互作用能每平方埃,选中后点此功能作图。
杨站长注解:
1. 本脚本可以计算结构中两个层之间的相互作用,比如金属表面与聚合物之间、金属氧化物与溶液之间、聚合物与聚合物之间,只要能找到合适力场的,都可以计算。
2. 计算时,这两层必须被命名为Layer 1与Layer 2。
其实无须额外注意,一般采用build layer小工具构建的结构,默认名称就是这两者。两层结构均为电中性。
3. 本脚本只需要一个分子动力学的轨迹,无须调试。
4. 杨站长已将力场类型更改为COMPASS,如有需要请自行更改。
5. 本脚本采用的结合面为AB面,结合方向为C方向,三轴必须互相垂直。
6. 结构中必须有很厚的真空层,厚度必须大于非键截断半径。这里很容易出错
7. 本脚本将创建一个表格,将计算结果中的能量、结合能、结合能每平方埃的数据输出进表格中。
关注杨站长B站,持续更新各种脚本教程:https://space.bilibili.com/669166168

全脚本展示:

#!perl
# Author: Stephen Todd
# This script calculates the interaction energy between two layers in a structure.# The layers have to be defined as sets called Layer 1 and Layer 2 - these are the # default names assigned by the Layer builder.
# This also uses the default settings for Forcite - ie Universal with current charges. # You should change the settings if you want to use another forcefield or summation method.
# This script also assumes that the surface area is in the AB-plane.
# A study table is produced containing the layers, energies, interaction energy, and then# the interaction energy per angstrom^2.
# Note. The input trajectory should have a large vaccuum, greater than the# cut-off you are using in the non-bond calculation.
use strict;use MaterialsScript qw(:all);
################################################################################## Begin user editable settings#
my $filename = "Layer"; # Name of the trajectory without extensionmy $energySettings = [  CurrentForcefield => "COMPASS"]; # Change the ff if neededModules->Forcite->ChangeSettings( $energySettings );## End user editable settings#################################################################################

# Defines the trajectory document
my $doc = $Documents{"$filename.xtd"};
# Create a new study table to hold the structures and energies and set the headings
my $newStudyTable = Documents->New("$filename"."_IntEnergy.std");my $calcSheet = $newStudyTable->Sheets->Item(0);
$calcSheet->ColumnHeading(0) = "$filename Cell";$calcSheet->ColumnHeading(1) = "Energy of $filename Cell";$calcSheet->ColumnHeading(2) = "Layer 1";$calcSheet->ColumnHeading(3) = "Energy of Layer 1";$calcSheet->ColumnHeading(4) = "Layer 2";$calcSheet->ColumnHeading(5) = "Energy of layer 2";$calcSheet->ColumnHeading(6) = "Interaction Energy";$calcSheet->ColumnHeading(7) = "Interaction Energy per angstrom^2";
# Get the total number of frames in the trajectory
my $numFrames = $doc->Trajectory->NumFrames;
print "Calculating interaction energy for $numFrames frames on $filename trajectory\n";
# Calculates the area of the surface based on the surface being in the A-B plane
my $length1 = $doc->Lattice3D->LengthA;my $length2 = $doc->Lattice3D->LengthB;my $surfaceArea = $length1 * $length2;print "The surface area is $surfaceArea angstroms^2\n";
# Initialise Forcite. If you want to change the settings, you can load them or# use a change settings command here.
my $forcite = Modules->Forcite;
# Starts to loop over the frames in the trajectory
for ( my $count=1; $count<=$numFrames; $count++) {
print "Calculating energy for frame $count\n"; # Define the frame of the trajectory $doc->Trajectorys->Item(0)->CurrentFrame = $count;
# Create three documents to hold the temporary layers my $allDoc = Documents->New("all.xsd"); my $layer1Doc = Documents->New("Layer1.xsd"); my $layer2Doc = Documents->New("Layer2.xsd");
# Create a copy of the structure in temporary documents and delete # the layers that you don't need.
$allDoc->CopyFrom($doc);
$layer1Doc->CopyFrom($doc); $layer1Doc->DisplayRange->Sets("Layer 2")->Atoms->Delete;
$layer2Doc->CopyFrom($doc); $layer2Doc->DisplayRange->Sets("Layer 1")->Atoms->Delete;
# Put the structures in a study table for safekeeping
$calcSheet->Cell($count-1, 0) = $allDoc; $calcSheet->Cell($count-1, 2) = $layer1Doc; $calcSheet->Cell($count-1, 4) = $layer2Doc;
#Calculate the energies for all the layers and put in the study table
$forcite->Calculation->Run($allDoc, [Task => 'Energy']); $calcSheet->Cell($count-1, 1) = $allDoc->PotentialEnergy;
$forcite->Calculation->Run($layer1Doc, [Task => 'Energy']); $calcSheet->Cell($count-1, 3) = $layer1Doc->PotentialEnergy;
$forcite->Calculation->Run($layer2Doc, [Task => 'Energy']); $calcSheet->Cell($count-1, 5) = $layer2Doc->PotentialEnergy;
# Calculate the Interaction Energy from the cells in the Study Table
my $totalEnergy = $calcSheet->Cell($count-1,1); my $layer1Energy = $calcSheet->Cell($count-1,3); my $layer2Energy = $calcSheet->Cell($count-1,5);
my $interactionEnergy = $totalEnergy - ($layer1Energy + $layer2Energy); $calcSheet->Cell($count-1, 6) = $interactionEnergy;
my $interactionEnergyArea = $interactionEnergy / $surfaceArea; $calcSheet->Cell($count-1, 7) = $interactionEnergyArea;
# Discard the temporary documents
$allDoc->Discard; $layer1Doc->Discard; $layer2Doc->Discard;}print "Calculation complete.\n";

Materials Studio

领取方式

公众号后台留言“脚本”,下载该脚本及配合使用案例。

脚本 免费获取

长按识别二维码回复:脚本

长按识别二维码回复:脚本

长按识别二维码回复:脚本

长按识别二维码回复“脚本”,免费获取



相关阅读

  • Bash 初学者系列 #1:在 Bash 中使用函数

  • 点击上方蓝字 ● 关注Linux公社 当您的 bash 脚本变得越来越大时,事情会变得非常混乱!您可能会发现自己在 bash 脚本的不同部分一次又一次地重写相同的代码片段。幸运的是
  • 让你们久等了,低调不解释,尽快下载吧!

  • 前面给大家分享过几期有关 iOS 应用的推荐,得到了很多苹果用户的点赞,最近在公众号后台,我又收到了一部分粉丝的留言,有些人表示期待分享更多应用,那么今天就安排一波。Stay大家
  • 重离子碰撞实验中首次观测到整体自旋排列现象

  • 日前,中科院近代物理研究所等机构的科研人员参与RHIC-STAR国际合作实验研究,首次在重离子碰撞实验中观测到了反应末态粒子的整体自旋排列现象。该成果为研究夸克胶子等离子体
  • 超冷气体中玻色子激励效应首现

  • 科技日报北京1月17日电 (实习记者张佳欣)美国麻省理工学院—哈佛大学超冷原子中心研究人员最近首次在超冷气体中观察到玻色子增强的光散射。该发现发表在《自然·物理学》上,或
  • 世界杯决赛在即,来点足球发疯文学?

  • 今天晚上火热的卡塔尔世界杯就迎来了决赛,今年最大的看点莫过于是阿根廷复仇成功?还是法国卫冕冠军?图片来源:百度图片作为一个假足球粉,朋友圈里世界杯的赛

热门文章

  • “复活”半年后 京东拍拍二手杀入公益事业

  • 京东拍拍二手“复活”半年后,杀入公益事业,试图让企业捐的赠品、家庭闲置品变成实实在在的“爱心”。 把“闲置品”变爱心 6月12日,“益心一益·守护梦想每一步”2018年四

最新文章

  • 请查收!2023年版成都市市民价格信息指南

  • 水电气、教育、公共交通、停车收费……新一年这些与我们每个人生活息息相关的公用事业、公益服务价格收费标准是什么?今日,记者从市发改委获悉,《成都市市民价格信息指南》(2023