| 查看: 401 | 回复: 0 | ||
[求助]
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. 怎么回事?该怎么改?? |
» 猜你喜欢
计算机、0854电子信息(085401-058412)调剂
已经有4人回复
基金申报
已经有3人回复
国自然申请面上模板最新2026版出了吗?
已经有9人回复
溴的反应液脱色
已经有6人回复
纳米粒子粒径的测量
已经有7人回复
常年博士招收(双一流,工科)
已经有4人回复
推荐一本书
已经有10人回复
参与限项
已经有5人回复
有没有人能给点建议
已经有5人回复
假如你的研究生提出不合理要求
已经有12人回复













;
回复此楼