24小时热门版块排行榜    

查看: 409  |  回复: 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小小木虫 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 材料调剂 +3 匹克i 2026-03-23 3/150 2026-03-23 23:18 by peike
[考研] 一志愿武理材料工程348求调剂 +6  ̄^ ̄゜汗 2026-03-19 9/450 2026-03-23 19:53 by pswait
[考研] 336化工调剂 +4 王大坦1 2026-03-23 5/250 2026-03-23 18:32 by allen-yin
[考研] 350求调剂 +6 weudhdk 2026-03-19 6/300 2026-03-23 15:47 by tangyuan0840221
[考研] 276求调剂。有半年电池和半年高分子实习经历 +8 材料学257求调剂 2026-03-23 9/450 2026-03-23 13:01 by ztnimte
[考研] 北科281学硕材料求调剂 +8 tcxiaoxx 2026-03-20 9/450 2026-03-23 12:16 by tcxiaoxx
[考研] 352求调剂 +3 大米饭! 2026-03-22 3/150 2026-03-22 23:28 by king123!
[考研] 一志愿华中科技大学071000,求调剂 +4 沿岸有贝壳6 2026-03-21 4/200 2026-03-22 07:21 by ilovexiaobin
[考研] 初试 317 +7 半拉月丙 2026-03-20 7/350 2026-03-21 22:26 by peike
[考研] 化学调剂 +5 yzysaa 2026-03-21 5/250 2026-03-21 22:12 by peike
[考研] 0805 316求调剂 +3 大雪深藏 2026-03-18 3/150 2026-03-21 18:55 by 学员8dgXkO
[考研] 297求调剂 +3 喜欢还是不甘心 2026-03-20 3/150 2026-03-21 18:33 by 学员8dgXkO
[考研] 311求调剂 +3 勇敢的小吴 2026-03-20 3/150 2026-03-21 17:40 by ColorlessPI
[考研] 材料 271求调剂 +5 展信悦_ 2026-03-21 5/250 2026-03-21 17:29 by 学员8dgXkO
[基金申请] 学校已经提交到NSFC,还能修改吗? 40+4 babangida 2026-03-19 9/450 2026-03-21 16:12 by babangida
[考研] 南昌大学材料专硕311分求调剂 +6 77chaselx 2026-03-20 6/300 2026-03-21 07:24 by JourneyLucky
[考研] 085700资源与环境308求调剂 +12 墨墨漠 2026-03-18 13/650 2026-03-21 01:42 by JourneyLucky
[考研] 290求调剂 +7 ^O^乜 2026-03-19 7/350 2026-03-20 21:43 by JourneyLucky
[考研] 求调剂一志愿南京航空航天大学289分 +3 @taotao 2026-03-19 3/150 2026-03-20 21:34 by JourneyLucky
[考研] 0817 化学工程 299分求调剂 有科研经历 有二区文章 +22 rare12345 2026-03-18 22/1100 2026-03-20 20:39 by zhukairuo
信息提示
请填处理意见