计算化学公社
标题:
Forcite中运行一个高熵合金建模脚本时报错
[打印本页]
作者Author:
Isaac023
时间:
2022-10-19 01:18
标题:
Forcite中运行一个高熵合金建模脚本时报错
新手参考了一下别人用自制脚本构建高尚氧化物模型,想要尝试构建自己的高熵合金模型
参考链接:
https://www.bilibili.com/video/B ... 00bd2e672534043d45b
以下为本人根据自身需要更改后的脚本:
#!perl
use strict;
use Getopt::Long;
use MaterialsScript qw(:all);
use List::Util qw(shuffle);
use POSIX;
my $doc = $Documents{"Ni.xsd"};
$doc->BuildSuperCell(10, 10, 10);
my $table = Documents->New("structure.std");
$table->ColumnHeading(0) = "Structure";
$table->ColumnHeading(1) = "energy";
for(my $i=1;$i<=20;$i++)
{
my $alloy = Documents->New("alloy.xsd");
$alloy -> CopyFrom($doc);
my $atoms = $alloy->UnitCell->Atoms;
my @shuffle = shuffle(@$atoms);
for(my $j=1;$j<=800;$j++)
{
my $changeatom = shift(@shuffle);
$changeatom -> ElementSymbol = "Co";
};
for(my $k=1;$k<=800;$k++)
{
my $changeatom = shift(@shuffle);
$changeatom -> ElementSymbol = "Cr";
};
for(my $l=1;$l<=800;$l++)
{
my $changeatom = shift(@shuffle);
$changeatom -> ElementSymbol = "Fe";
};
for(my $m=1;$m<=800;$m++)
{
my $changeatom = shift(@shuffle);
$changeatom -> ElementSymbol = "Sb";
};
my $results = Modules->Forcite->GeometryOptimization->Run($alloy, Settings(
'3DPeriodicElectrostaticSummationMethod' => 'Ewald',
'3DPeriodicvdWEwaldSumAccuracy' => 0.0001,
'3DPeriodicElectrostaticEwaldSumAccuracy' => 0.0001,
'3DPeriodicvdWAtomCubicSplineCutOff' => 15.5,
'3DPeriodicvdWChargeGroupCubicSplineCutOff' => 15.5,
CurrentForcefield => 'Universal',
ChargeAssignment => 'Charge using QEq',
UseMaxDisplacement => 'No',
KeepMotionGroupsRigid => 'No'));
my $results = Modules->Forcite->Analysis->RadialDistributionFunction($doc, Settings());
my $outRDFChart = $results->RDFChart;
my $outRDFChartAsStudyTable = $results->RDFChartAsStudyTable;
$table->Cell($i-1,0) = $results->Structure;
$table->Cell($i-1,1) = $results->Structure->PotentialEnergy;
$table->Cell($i-1,2) = $results->RDFChart;
$Documents{"alloy.xsd"}->Delete;
$Documents{"alloy Convergence.xcd"}->Delete;
$Documents{"alloy Energies.xcd"}->Delete;
$Documents{"Status.txt"}->Delete;
$Documents{"alloy.txt"}->Delete;
$Documents{"alloy Forcite RDF.std"}->Delete;
$Documents{"alloy Forcite RDF.xcd"}->Delete;
}
运行脚本后发现以下报错:
There is no function or property named "Structure" on type "KeyValuePairs" at -e line 59.
在Forcite-Analysis的RDF中确实没有Structure这个选项:
[url=]图片 Image[/url]
原视频中最后能得到20个循环计算后每个结构的结果:
不知道这个代码到底哪里出了问题?还请各位大佬帮忙看看。
作者Author:
xujc1983
时间:
2022-10-19 10:58
$table->Cell($i-1,0) = $results->Structure; 计算结果里没有这个Structure项,应该直接用$alloy就可以了:
$table->Cell($i-1,0) = $alloy;
$table->Cell($i-1,1) = $results->Structure->PotentialEnergy; 这句也应该是
$table->Cell($i-1,1) = $alloy->PotentialEnergy;
另外:
my $results = Modules->Forcite->Analysis->RadialDistributionFunction($doc, Settings());
这里计算RDF的不应该是$alloy嘛
作者Author:
Isaac023
时间:
2022-10-19 16:07
按照您的意见修改后已能够算出完整结果,非常感谢
欢迎光临 计算化学公社 (http://bbs.keinsci.com/)
Powered by Discuz! X3.3