Fixed some bugs and cleaned up the code.

This commit is contained in:
2015-08-27 15:50:33 +02:00
parent 8948566ea2
commit 1dff2798a1

View File

@ -359,7 +359,11 @@ sub CreateInpFile
my $Comp = this->{ui}->layerTable->item($i-1,0)->text();
$All{$LComp} = $Comp;
my %LElComp=Chem::parse_formula($Comp);
foreach my $key (keys %LElComp) {if ($key eq "") {$Check++;}}
foreach my $key (keys %LElComp) {
if ($key eq "") {
$Check++;
}
}
if ($Comp eq "") {$Check++;}
# Write composition to results file header
@ -393,19 +397,23 @@ sub CreateInpFile
if ($Sum==0) {$Sum=1;}
my @Els = keys %LElComp;
#print join("--",@Els)."\n";
my $El="";
for (my $NEl=1;$NEl<=5;$NEl++) {
if ($NEl <= $#Els) {
my $El = "";
if ($#Els >= $NEl-1) {
$El = $Els[$NEl-1];
}
my $LEkey = "L".$i."EL";
my $ElZ = Chem::Zof($El);
my $ElW = Chem::Massof($El);
my $ElC = $LElComp{$El}/$Sum;
my $ElE = Chem::Elastof($El);
my $ElC = 0;
my $El030 = 30;
if ($El eq "") { $El030 = 0.0;}
if ($El) {
$ElC = $LElComp{$El}/$Sum;
} else {
$El030 = 0.0;
}
$All{$LEkey."Z".$NEl}=sprintf("%8.4f",$ElZ);
$All{$LEkey."W".$NEl}=sprintf("%8.4f",$ElW);
@ -571,7 +579,6 @@ sub StartSequenceOne
}
$iScan++;
print "iScan=".$iScan."\n";
}
} else {
# For a single run
@ -695,7 +702,7 @@ sub OpenFile
my $Attrib="";
foreach my $line (@lines) {
# Remove white spaces
# $line =~ s/\s+//g;
$line =~ s/\s+//g;
my @InitPar = split (/=/,$line);
# Check it is not empty or title line
if ($InitPar[0] || $InitPar[1]) {