首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在使用“严格的潜艇”时不允许使用Bareword

在使用“严格的潜艇”时不允许使用Bareword
EN

Stack Overflow用户
提问于 2018-08-10 04:11:31
回答 1查看 9.2K关注 0票数 2

我是高阻隔橡胶材料的研究人员。我遇到了一些问题的Perl使用材料学习软件。我不明白Perl错误意味着什么。

下面是Perl脚本及其错误

代码语言:javascript
复制
#!perl

use strict;

use Getopt::Long;
use MaterialsScript qw(:all);

for ( my $RxnRadius = my $MinRxnRadius; $RxnRadius <= my $MaxRxnRadius; $RxnRadius += 0.5 ) {

    my $xsdNameDist = sprintf( "%s_R%.2f", my $rootName, $RxnRadius );    #rename the new structure;

    if ( $RxnRadius > $MinRxnRadius ) {

        my $doc->Name = $xsdNameDist . "_init";
        ForciteGeomOpt( $doc, 20000 );                                    # run 20000 steps of Geometry Optimization

        my $results = ForciteDynamics( $doc, my $steps, "NPT" );
        $results->Trajectory->Delete;
    }

    for ( my $iteration = 1; $iteration <= my $IterationsPerRadius; $iteration++ ) {

        my $doc->Name = $xsdNameDist . "_" . $iteration;
        my $numBonds = createNewXlinks( $doc, $RxnRadius );
        my $reactedOligomerAtoms = 0;

        foreach my $atom ( @{ $doc->UnitCell->Atoms } ) {
            my $oligomerReactiveAtom;
            $reactedOligomerAtoms++ if ( $atom->Name =~ /^$oligomerReactiveAtom-\d/ );
        }

        my $conversion = 100 * my $totalOligomerAtoms;

        ( $reactedOligomerAtoms / $totalOligomerAtoms );

        if ( $numBonds == 0 ) {
            last;
        }

        optimizeAndPerturb( $doc );

        my $rowCounter;
        xlinkStatistics( $doc, $RxnRadius, $rowCounter );
        maxBondEnergy( $doc, $RxnRadius, $rowCounter ) if ( my $UseMaxBondEnergy );

        my $analysis_doc = Documents->New( "analyze.xsd" );
        $analysis_doc->CopyFrom( $doc );

        my $analyzeDuration;
        my $timeStep;

        my $steps   = ( $analyzeDuration * PICO_TO_FEMTO / $timeStep );
        my $freq    = int( $steps / 20 ); ### line 56
        my $results = Forcite Dynamics(
            $analysis_doc, $steps,
            "NPT",
            ( TrajectoryFrequency => $freq )
        );

        getTrajTempAndPressure( $results, $rowCounter, $RxnRadius );
        getEnergies( $results, $rowCounter );
        $analysis_doc->Delete;
        $results->Trajectory->Delete;

        if ( $conversion >= my $conversionTarget ) {

            my $numbondsDelete = my $xlinkCounter - $reactedOligomerAtoms - my $targetOligomerAtoms;

            if ( my $deleteExcessXlinks and $numbondsDelete > 0 ) {
                deleteExcessBonds( $doc, $numbondsDelete );
                xlink Statistics( $doc, "Final", $rowCounter );
            }
            else {
                my $textDoc->Append(
                    sprintf "There  are no excess bonds to delete\n "
                );
            }

            my $textDoc->Save;

            last;
        }

        Documents->SaveAll;
    }

    last if ( my $conversion >= my $conversionTarget );
}

my $doc->Name = my $rootName . "_final";
analyzeBonds( $doc );
XlinkSet( $doc );
Glasstransitiontemperature( $doc );
Documents->SaveAll;

给出

在PICO_TO_FEMTO第56行使用“严格的潜艇”时,不允许使用“-e”字样。 -e存在编译错误。

我不知道如何理解通知,也不知道如何解决问题。

EN

回答 1

Stack Overflow用户

发布于 2018-08-10 05:38:59

可能某种形式的PICO_TO_FEMTO在开始时是从您的MaterialsScriptuse导入的,因为它不是在脚本中定义的。

看一下自由的地方。我的假设是,它的名称实际上是$PICO_TO_FEMTO,一个带有$信号的简单标量变量。

Perl中的裸字是一个没有信号的标识符。如果是函数的话,就没问题了。但这可能是一个变量。

如果您想要定义一个裸字变量,您可以这样做:

代码语言:javascript
复制
use constant PICO_TO_FEMTO => 1000;

这将创建一个名为PICO_TO_FEMTO的函数,它总是在引擎盖下返回1000。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51778850

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档