24小时热门版块排行榜    

Znn3bq.jpeg
查看: 416  |  回复: 0

AA小小木虫

金虫 (小有名气)

[求助] perl编程

#!/usr/bin/perl
    use strict;
    use warnings;
    use vars qw
    #open the multiframe trajectory structure file or die
    my $doc = $Documents{"abc.xtd"};
    if (!$doc) {die "no document";}
    my $trajectory = $doc->Trajectory;
    if ($trajectory->NumFrames>1) {
    print "Found ".$trajectory->NumFrames." frames in the trajectory
";
    # Open new xmol trajectory file
    my $xmolFile=Documents->New("trj.txt";
    #get atoms in the structure
    my $Beads = $doc->DisplayRange->Beads;
    my $NBeads=@$Beads;
    # loops over the frames
    my $framebegin=1;
    my $frameend=$trajectory->NumFrames;
    # my $frameend=10;
    for (my $frame=$framebegin; $frame<=$frameend; ++$frame){

$trajectory->CurrentFrame = $frame;
    #write header xyz
    $xmolFile->Append(sprintf "%i
", $NBeads);
    $xmolFile->Append(sprintf "%s %i
", "Frame",$frame);
    foreach my $Bead (@$Beads) {
    # write atom symbol and x-y-z- coordinates
    $xmolFile->Append(sprintf "%s %f %f %f
",$Bead->Name, $Bead->X, $Bead->Y, $Bead->Z);
    }
    }
    #close trajectory file
    $xmolFile->Close;
    }
    else {
    print "The " . $doc->Name . " is not a multiframe trajectory file
";
运行以上程序出现:Global symbol "%Documents" requires explicit package name at C:\Users\Administrator\AppData\Local\ActiveState\KomodoIDE\8.0\samples\perl_tutorials\abl.pl line 5.
Execution of C:\Users\Administrator\AppData\Local\ActiveState\KomodoIDE\8.0\samples\perl_tutorials\abl.pl aborted due to compilation errors.
怎么回事?该怎么改??
回复此楼

» 猜你喜欢

硬道理
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 AA小小木虫 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 人工智能320调剂08工类还有机会吗 +14 振—TZ 2026-04-10 15/750 2026-04-13 12:57 by Sealedwind
[考研] 材料工程281还有调剂机会吗 +30 xaw. 2026-04-11 31/1550 2026-04-13 08:42 by Sammy2
[教师之家] 山东双非院校考核超级无底线,领导幸灾乐祸,教师遭殃恐 +3 qut2026 2026-04-11 7/350 2026-04-12 20:24 by qut2026
[考研] 化学工程调剂289 +44 yang婷 2026-04-07 50/2500 2026-04-12 02:36 by 秋豆菜芽
[找工作] 山东高校教师考核超级无底线,员工过不下去啦 +4 qut2026 2026-04-09 9/450 2026-04-12 00:54 by qut2026
[考研] 考研求调剂 +3 ban班小七 2026-04-11 3/150 2026-04-11 20:48 by may_新宇
[考研] 本人女孩 +7 吼吼, 2026-04-10 9/450 2026-04-11 14:45 by ACS Nano——
[考研] 085410-273求调剂 +6 X1999 2026-04-10 6/300 2026-04-11 10:32 by Delta2012
[考研] 一志愿985机械学硕380求调剂 +5 关关雎鸠10 2026-04-11 5/250 2026-04-11 10:10 by 知念。A
[考研] 346,工科求调剂 +3 moser233 2026-04-09 3/150 2026-04-11 10:04 by zhq0425
[考研] 311求调剂 +13 xyp想读书 2026-04-10 14/700 2026-04-11 09:41 by 猪会飞
[考研] 085402通信工程调剂,有4项学科竞赛国奖(电赛国二),硕士研究生调剂自荐信。 +5 m永o不v言o弃m 2026-04-09 5/250 2026-04-11 09:33 by zhq0425
[考研] 中科院总分315求调剂 +8 lallalh 2026-04-09 8/400 2026-04-10 19:30 by dick_runner
[考研] 314求调剂 +18 xhhdjdjsjks 2026-04-09 19/950 2026-04-10 18:53 by HPUCZ
[考研] 085800 能源动力求调剂 +6 阿biu啊啊啊啊啊 2026-04-10 6/300 2026-04-10 15:03 by hemengdong
[考研] 286求调剂 +19 Faune 2026-04-08 20/1000 2026-04-09 08:36 by 哦哦123
[考研] 一志愿211,化学学硕,310分,本科重点双非,求调剂 +10 努力奋斗112 2026-04-07 10/500 2026-04-08 15:01 by screening
[考研] 求考研材料调剂 +3 材化李可 2026-04-07 3/150 2026-04-08 00:21 by JourneyLucky
[考研] 085602调剂 初试总分335 +3 19123253302 2026-04-06 3/150 2026-04-07 18:00 by jp9609
[考研] 307求调剂 +3 Youth@@ 2026-04-07 3/150 2026-04-07 09:25 by 小黑不怕难
信息提示
请填处理意见