Added checking for chemical formula in perl-qt3.
This commit is contained in:
parent
d438ba41dd
commit
cf9777c507
@ -2388,6 +2388,12 @@ sub CreateInpFile
|
|||||||
my $Comp = layerTable->text($i-1,0);
|
my $Comp = layerTable->text($i-1,0);
|
||||||
$All{$LComp} = $Comp;
|
$All{$LComp} = $Comp;
|
||||||
my %LElComp=Chem::parse_formula($Comp);
|
my %LElComp=Chem::parse_formula($Comp);
|
||||||
|
foreach my $key (keys %LElComp) {
|
||||||
|
# Check if composition is understood
|
||||||
|
if ($key eq "" || Chem::Zof($key) eq "") {
|
||||||
|
$Check++;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($Comp eq "") {$Check++;}
|
if ($Comp eq "") {$Check++;}
|
||||||
|
|
||||||
# Densities of layers
|
# Densities of layers
|
||||||
@ -2403,8 +2409,8 @@ sub CreateInpFile
|
|||||||
if ($d eq "") {$Check++;}
|
if ($d eq "") {$Check++;}
|
||||||
|
|
||||||
# Sanity check, is the layer supposed to have value? are they all there?
|
# Sanity check, is the layer supposed to have value? are they all there?
|
||||||
if ($Check!=0) {
|
if ($Check!=0 ) {
|
||||||
my $ErrMsg="Error: Layer $i is empty. Expecting it to be defined!\n";
|
my $ErrMsg="Error: Bad chemical formula in Layer $i.\nPleach check!\n";
|
||||||
print STDERR $ErrMsg;
|
print STDERR $ErrMsg;
|
||||||
my $HelpWindow = Qt::MessageBox::information( this, "Error!",$ErrMsg);
|
my $HelpWindow = Qt::MessageBox::information( this, "Error!",$ErrMsg);
|
||||||
return "ERROR";
|
return "ERROR";
|
||||||
|
@ -363,8 +363,7 @@ sub CreateInpFile
|
|||||||
# Check if composition is understood
|
# Check if composition is understood
|
||||||
if ($key eq "" || Chem::Zof($key) eq "") {
|
if ($key eq "" || Chem::Zof($key) eq "") {
|
||||||
$Check++;
|
$Check++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if ($Comp eq "") {$Check++;}
|
if ($Comp eq "") {$Check++;}
|
||||||
# Write composition to results file header
|
# Write composition to results file header
|
||||||
|
Loading…
x
Reference in New Issue
Block a user