24小时热门版块排行榜    

查看: 394  |  回复: 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小小木虫 的主题更新
信息提示
请填处理意见