From 930402e4609e0512c9d22b332a552005033cb075 Mon Sep 17 00:00:00 2001 From: Zaher Salman Date: Mon, 10 Aug 2009 14:10:22 +0000 Subject: [PATCH] PerlQt3 GUI interface for trimsp7l. Requires trimsp7l binary and PerlQt3 modules. --- trimsp/TrimSPGUI/Chem.pm | 620 ++++++++ trimsp/TrimSPGUI/TrimSPGUI.pl | 1227 ++++++++++++++++ trimsp/TrimSPGUI/TrimSPGUItabs.ui | 2108 +++++++++++++++++++++++++++ trimsp/TrimSPGUI/TrimSPGUItabs.ui.h | 484 ++++++ 4 files changed, 4439 insertions(+) create mode 100644 trimsp/TrimSPGUI/Chem.pm create mode 100644 trimsp/TrimSPGUI/TrimSPGUI.pl create mode 100755 trimsp/TrimSPGUI/TrimSPGUItabs.ui create mode 100755 trimsp/TrimSPGUI/TrimSPGUItabs.ui.h diff --git a/trimsp/TrimSPGUI/Chem.pm b/trimsp/TrimSPGUI/Chem.pm new file mode 100644 index 0000000..63e255e --- /dev/null +++ b/trimsp/TrimSPGUI/Chem.pm @@ -0,0 +1,620 @@ + +package Chem; + +sub parse_formula { + my ($formula) = @_; +# print STDOUT "formula=$formula\n"; + my (%elements); + + #check balancing + return %elements if (!ParensBalanced($formula)); + + # replace other grouping with normal parens + $formula =~ tr/<>{}[]/()()()/; + + # get rid of any spaces + $formula =~ s/\s+//g; + + # perform macro expansion + foreach (keys(%macros)) { + $formula =~ s/$_/$macros{$_}/g; + } + + # determine initial compound coeficent + my $coef = ($formula =~ s/^(\d+\.?\d*)//) ? $1 : 1.0; + + # recursively process rest of formula + return internal_formula_parser($formula, $coef, %elements); +} + + +sub internal_formula_parser { + use Text::Balanced qw(extract_bracketed); + + my ($formula, $coef, %form) = @_; + my $tmp_coef; + + my ($extract, $remainder, $prefix) = + extract_bracketed($formula, '()', '[^(]*'); + + if (defined($extract) and $extract ne '') { + $extract =~ s/^\((.*)\)$/$1/; + if ($remainder =~ s/^(\d+\.?\d*)(.*)$/$2/) { + $tmp_coef = $1 * $coef; + } else { + $tmp_coef = $coef; + } + + # get formula of prefix ( it has no parens) + %form = add_formula_strings($prefix, $coef, %form) if ($prefix ne ''); + + # check remainder for more parens + %form = internal_formula_parser($remainder, $coef, %form) + if ($remainder ne ''); + + # check extract for more parens + %form = + internal_formula_parser($extract, $tmp_coef, %form); + ## we already know this is ne '' + } else { # get formula of complete string + %form = add_formula_strings($remainder, $coef, %form) + if ($remainder ne ''); + } + return %form; +} + + +sub add_formula_strings { + my ($formula, $coef, %elements) = @_; + +# print "Getting Formula of $formula\n"; + $formula =~ /^(?:([A-Z][a-z]*)(\d+\.?\d*)?)+$/o # XXX new + or die "Invalid Portion of Formula $formula"; + while ($formula =~ m/([A-Z][a-z]*)(\d+\.?\d*)?/go) { # XXX new + my ($elm, $count) = ($1, $2); + $count = 1 unless defined $count; + if (defined $elements{$elm}) { + $elements{$elm} += $count * $coef; + } else { + $elements{$elm} = $count * $coef; + } + } + return %elements; +} + +sub ParensBalanced { + my ($form) = @_; + my @stack = (); + my %pairs = ( + '<' => '>', + '{' => '}', + '[' => ']', + '(' => ')' + ); + + while ($form =~ m/([<>(){}\]\[])/go) { + my $current = $1; + if ($current =~ /[<({\[]/) { + push(@stack, $current); + next; + } + return 0 if (scalar(@stack) == 0); + return 0 if ($current ne $pairs{ pop @stack}); + } + return @stack ? 0 : 1; +} + +sub Zof { + my ($El) = @_; + + my %ElementsZ = ( + "Muon",1, + "Li8", 3, + "B12", 5, + "H",1, + "He", 2, + "Li", 3, + "Be", 4, + "B", 5, + "C", 6, + "N", 7, + "O", 8, + "F", 9, + "Ne", 10, + "Na", 11, + "Mg", 12, + "Al", 13, + "Si", 14, + "P", 15, + "S", 16, + "Cl", 17, + "Ar", 18, + "K", 19, + "Ca", 20, + "Sc", 21, + "Ti", 22, + "V", 23, + "Cr", 24, + "Mn", 25, + "Fe", 26, + "Co", 27, + "Ni", 28, + "Cu", 29, + "Zn", 30, + "Ga", 31, + "Ge", 32, + "As", 33, + "Se", 34, + "Br", 35, + "Kr", 36, + "Rb", 37, + "Sr", 38, + "Y", 39, + "Zr", 40, + "Nb", 41, + "Mo", 42, + "Tc", 43, + "Ru", 44, + "Rh", 45, + "Pd", 46, + "Ag", 47, + "Cd", 48, + "In", 49, + "Sn", 50, + "Sb", 51, + "Te", 52, + "I", 53, + "Xe", 54, + "Cs", 55, + "Ba", 56, + "La", 57, + "Ce", 58, + "Pr", 59, + "Nd", 60, + "Pm", 61, + "Sm", 62, + "Eu", 63, + "Gd", 64, + "Tb", 65, + "Dy", 66, + "Ho", 67, + "Er", 68, + "Tm", 69, + "Yb", 70, + "Lu", 71, + "Hf", 72, + "Ta", 73, + "W", 74, + "Re", 75, + "Os", 76, + "Ir", 77, + "Pt", 78, + "Au", 79, + "Hg", 80, + "Tl", 81, + "Pb", 82, + "Bi", 83, + "Po", 84, + "At", 85, + "Rn", 86, + "Fr", 87, + "Ra", 88, + "Ac", 89, + "Th", 90, + "Pa", 91, + "U", 92, + "", 0.0000 + ); + return $ElementsZ{$El}; +} + +sub Massof { + my ($El) = @_; + + my %ElementsA = ( + "Muon",0.113, + "Li8", 8.0, + "B12", 12.0, + "H", 1.00800, + "He", 4.00300, + "Li", 6.93900, + "Be", 9.01200, + "B", 10.81100, + "C", 12.01100, + "N", 14.00700, + "O", 15.99900, + "F", 18.99800, + "Ne", 20.18300, + "Na", 22.99000, + "Mg", 24.31200, + "Al", 26.98200, + "Si", 28.08600, + "P", 30.97400, + "S", 32.06400, + "Cl", 35.45300, + "Ar", 39.94800, + "K", 39.10200, + "Ca", 40.08000, + "Sc", 44.95600, + "Ti", 47.90000, + "V", 50.94200, + "Cr", 51.99600, + "Mn", 54.93800, + "Fe", 55.84700, + "Co", 58.93300, + "Ni", 58.71000, + "Cu", 63.54000, + "Zn", 65.37000, + "Ga", 69.72000, + "Ge", 72.59000, + "As", 74.92200, + "Se", 78.96000, + "Br", 79.90900, + "Kr", 83.80000, + "Rb", 85.47000, + "Sr", 87.62000, + "Y", 88.90500, + "Zr", 91.22000, + "Nb", 92.90600, + "Mo", 95.94000, + "Tc", 98.00000, + "Ru", 101.07000, + "Rh", 102.90500, + "Pd", 106.40000, + "Ag", 107.87000, + "Cd", 112.40000, + "In", 114.82000, + "Sn", 118.69000, + "Sb", 121.75000, + "Te", 127.60000, + "I", 126.90400, + "Xe", 131.30000, + "Cs", 132.90500, + "Ba", 137.34000, + "La", 138.91000, + "Ce", 140.12000, + "Pr", 140.90700, + "Nd", 144.24001, + "Pm", 147.00000, + "Sm", 150.35001, + "Eu", 151.96001, + "Gd", 157.25000, + "Tb", 158.92400, + "Dy", 162.50000, + "Ho", 164.92999, + "Er", 167.25999, + "Tm", 168.93401, + "Yb", 173.03999, + "Lu", 174.97000, + "Hf", 178.49001, + "Ta", 180.94800, + "W", 183.85001, + "Re", 186.20000, + "Os", 190.20000, + "Ir", 192.20000, + "Pt", 195.09000, + "Au", 196.96700, + "Hg", 200.59000, + "Tl", 204.37000, + "Pb", 207.19000, + "Bi", 208.98000, + "Po", 210.00000, + "At", 210.00000, + "Rn", 222.00000, + "Fr", 223.00000, + "Ra", 226.00000, + "Ac", 227.00000, + "Th", 232.03799, + "Pa", 231.00000, + "U", 238.03000, + "", 0.0000 + ); + return $ElementsA{$El}; + +} + +sub Dichteof { + my ($El) = @_; + + my %Dichte = ( + "H", 0.08, + "He", 0.12, + "Li", 0.53, + "Be", 1.85, + "B", 2.35, + "C", 3.51, + "N", 1.03, + "O", 2.00, + "F", 1.11, + "Ne", 1.50, + "Na", 0.97, + "Mg", 1.74, + "Al", 2.70, + "Si", 2.33, + "P", 1.00, + "S", 2.07, + "Cl", 2.03, + "Ar", 1.77, + "K", 0.86, + "Ca", 1.54, + "Sc", 2.99, + "Ti", 4.51, + "V", 6.09, + "Cr", 7.14, + "Mn", 7.44, + "Fe", 7.87, + "Co", 8.89, + "Ni", 8.91, + "Cu", 8.92, + "Zn", 7.14, + "Ga", 5.91, + "Ge", 5.32, + "As", 5.72, + "Se", 4.19, + "Br", 3.14, + "Kr", 3.10, + "Rb", 1.53, + "Sr", 2.63, + "Y", 4.47, + "Zr", 6.51, + "Nb", 8.58, + "Mo", 10.28, + "Tc", 11.49, + "Ru", 12.45, + "Rh", 12.41, + "Pd", 12.02, + "Ag", 10.49, + "Cd", 8.64, + "In", 7.31, + "Sn", 7.29, + "Sb", 6.69, + "Te", 6.25, + "I", 4.94, + "Xe", 3.80, + "Cs", 1.90, + "Ba", 3.65, + "La", 6.16, + "Ce", 6.77, + "Pr", 6.48, + "Nd", 7.00, + "Pm", 7.22, + "Sm", 7.54, + "Eu", 5.25, + "Gd", 7.89, + "Tb", 8.25, + "Dy", 8.56, + "Ho", 8.78, + "Er", 9.05, + "Tm", 9.32, + "Yb", 6.97, + "Lu", 9.84, + "Hf", 13.31, + "Ta", 16.68, + "W", 19.26, + "Re", 21.03, + "Os", 22.61, + "Ir", 22.65, + "Pt", 21.45, + "Au", 19.32, + "Hg", 13.55, + "Tl", 11.85, + "Pb", 11.34, + "Bi", 9.80, + "Po", 9.20, + "At", 0.10, + "Rn", 0.10, + "Fr", 0.10, + "Ra", 5.50, + "Ac", 10.07, + "Th", 11.72, + "Pa", 15.37, + "U", 18.97, + "", 0.0000 + ); + return $Dichte{$El}; +} + + +sub Elastof { + my ($El) = @_; + + my %Elast = ( + "H", 0.10000, + "He", 0.10000, + "Li", 1.63000, + "Be", 3.32000, + "B", 5.77000, + "C", 7.37000, + "N", 4.92000, + "O", 2.60000, + "F", 0.84000, + "Ne", 0.02000, + "Na", 1.11000, + "Mg", 1.51000, + "Al", 3.39000, + "Si", 4.63000, + "P", 3.43000, + "S", 2.85000, + "Cl", 1.40000, + "Ar", 0.08000, + "K", 0.93000, + "Ca", 1.84000, + "Sc", 3.90000, + "Ti", 4.85000, + "V", 5.31000, + "Cr", 4.10000, + "Mn", 2.92000, + "Fe", 4.28000, + "Co", 4.39000, + "Ni", 4.44000, + "Cu", 3.49000, + "Zn", 1.35000, + "Ga", 2.81000, + "Ge", 3.85000, + "As", 2.96000, + "Se", 2.25000, + "Br", 1.22000, + "Kr", 0.12000, + "Rb", 0.85000, + "Sr", 1.72000, + "Y", 4.37000, + "Zr", 6.25000, + "Nb", 7.57000, + "Mo", 6.82000, + "Tc", 6.85000, + "Ru", 6.74000, + "Rh", 5.75000, + "Pd", 3.89000, + "Ag", 2.95000, + "Cd", 1.16000, + "In", 2.52000, + "Sn", 3.14000, + "Sb", 2.75000, + "Te", 2.23000, + "I", 1.11000, + "Xe", 0.16000, + "Cs", 0.80000, + "Ba", 1.90000, + "La", 4.47000, + "Ce", 4.32000, + "Pr", 3.70000, + "Nd", 3.40000, + "Pm", 0.10000, + "Sm", 2.14000, + "Eu", 1.86000, + "Gd", 4.14000, + "Tb", 4.05000, + "Dy", 3.04000, + "Ho", 3.14000, + "Er", 3.29000, + "Tm", 2.42000, + "Yb", 1.60000, + "Lu", 4.43000, + "Hf", 6.44000, + "Ta", 8.10000, + "W", 8.90000, + "Re", 8.03000, + "Os", 8.17000, + "Ir", 6.94000, + "Pt", 5.84000, + "Au", 3.81000, + "Hg", 0.67000, + "Tl", 1.88000, + "Pb", 2.03000, + "Bi", 2.18000, + "Po", 1.50000, + "At", 0.10000, + "Rn", 0.20000, + "Fr", 0.10000, + "Ra", 1.66000, + "Ac", 4.25000, + "Th", 6.20000, + "Pa", 0.10000, + "U", 5.55000, + "", 0.00000 + ); + return $Elast{$El}; +} + +sub Stopicru { + my ($El) = @_; + + my %Stopicru = ( + "H", "1.25400,1.44000,242.60001,12000.00000,0.11590", + "He", "1.22900,1.39700,484.50000,5873.00000,0.05225", + "Li", "1.41100,1.60000,725.59998,3013.00000,0.04578", + "Be", "2.24800,2.59000,966.00000,153.80000,0.03475", + "B", "2.47400,2.81500,1206.00000,1060.00000,0.02855", + "C", "0.00000,2.60100,1701.00000,1279.00000,0.01638", + "N", "2.95400,3.35000,1683.00000,1900.00000,0.02513", + "O", "2.65200,3.00000,1920.00000,2000.00000,0.02230", + "F", "2.08500,2.35200,2157.00000,2634.00000,0.01816", + "Ne", "1.95100,2.19900,2393.00000,2699.00000,0.01568", + "Na", "2.54200,2.86900,2628.00000,1854.00000,0.01472", + "Mg", "3.79100,4.29300,2862.00000,1009.00000,0.01397", + "Al", "4.15400,4.73900,2766.00000,164.50000,0.02023", + "Si", "4.91400,5.59800,3193.00000,232.70000,0.01419", + "P", "3.23200,3.64700,3561.00000,1560.00000,0.01267", + "S", "3.44700,3.89100,3792.00000,1219.00000,0.01211", + "Cl", "5.30100,6.00800,3969.00000,645.09998,0.01183", + "Ar", "5.73100,6.50000,4253.00000,530.00000,0.01123", + "K", "5.15200,5.83300,4482.00000,545.70001,0.01129", + "Ca", "5.52100,6.25200,4710.00000,553.29999,0.01120", + "Sc", "5.20100,5.88400,4938.00000,560.90002,0.01000", + "Ti", "4.85800,5.48900,5260.00000,651.09998,0.00893", + "V", "4.47900,5.05500,5391.00000,952.29999,0.00912", + "Cr", "3.98300,4.48900,5616.00000,1336.00000,0.00841", + "Mn", "3.46900,3.90700,5725.00000,1461.00000,0.00883", + "Fe", "3.51900,3.96300,6065.00000,1243.00000,0.00778", + "Co", "3.14000,3.53500,6288.00000,1372.00000,0.00736", + "Ni", "3.55300,4.00400,6205.00000,555.09998,0.00876", + "Cu", "3.69600,4.19400,4649.00000,81.13000,0.02242", + "Zn", "4.21000,4.75000,6953.00000,295.20001,0.00681", + "Ga", "5.04100,5.69700,7137.00000,202.60001,0.00673", + "Ge", "5.55400,6.30000,6496.00000,110.00000,0.00969", + "As", "5.32300,6.01200,7611.00000,292.50000,0.00645", + "Se", "5.87400,6.65600,7395.00000,117.50000,0.00768", + "Br", "6.65800,7.53600,7694.00000,222.30000,0.00651", + "Kr", "6.41300,7.24000,11850.00000,153.70000,0.00288", + "Rb", "5.69400,6.42900,8478.00000,292.89999,0.00609", + "Sr", "6.33900,7.15900,8693.00000,330.29999,0.00600", + "Y", "6.40700,7.23400,8907.00000,367.79999,0.00589", + "Zr", "6.73400,7.60300,9120.00000,405.20001,0.00576", + "Nb", "6.90100,7.79100,9333.00000,442.70001,0.00559", + "Mo", "6.42400,7.24800,9545.00000,480.20001,0.00538", + "Tc", "6.79900,7.67100,9756.00000,517.59998,0.00532", + "Ru", "6.10900,6.88700,9966.00000,555.09998,0.00515", + "Rh", "5.92400,6.67700,10180.00000,592.50000,0.00492", + "Pd", "5.23800,5.90000,10380.00000,630.00000,0.00476", + "Ag", "5.34500,6.03800,6790.00000,397.79999,0.01676", + "Cd", "5.81400,6.55400,10800.00000,355.50000,0.00463", + "In", "6.22900,7.02400,11010.00000,370.89999,0.00454", + "Sn", "6.40900,7.22700,11210.00000,386.39999,0.00447", + "Sb", "7.50000,8.48000,8608.00000,348.00000,0.00907", + "Te", "6.97900,7.87100,11620.00000,392.39999,0.00440", + "I", "7.72500,8.71600,11830.00000,394.79999,0.00438", + "Xe", "8.33700,9.42500,10510.00000,269.60001,0.00621", + "Cs", "7.28700,8.21800,12230.00000,399.70001,0.00445", + "Ba", "7.89900,8.91100,12430.00000,402.10001,0.00451", + "La", "8.04100,9.07100,12630.00000,404.50000,0.00454", + "Ce", "7.48800,8.44400,12830.00000,406.89999,0.00442", + "Pr", "7.29100,8.21900,13030.00000,409.29999,0.00430", + "Nd", "7.09800,8.00000,13230.00000,411.79999,0.00418", + "Pm", "6.90900,7.78600,13430.00000,414.20001,0.00406", + "Sm", "6.72800,7.58000,13620.00000,416.60001,0.00398", + "Eu", "6.55100,7.38000,13820.00000,419.00000,0.00388", + "Gd", "6.73900,7.59200,14020.00000,421.39999,0.00386", + "Tb", "6.21200,6.99600,14210.00000,423.89999,0.00372", + "Dy", "5.51700,6.21000,14400.00000,426.29999,0.00363", + "Ho", "5.22000,5.87400,14600.00000,428.70001,0.00350", + "Er", "5.07100,5.70600,14790.00000,433.00000,0.00341", + "Tm", "4.92600,5.54200,14980.00000,433.50000,0.00334", + "Yb", "4.78800,5.38600,15170.00000,435.89999,0.00329", + "Lu", "4.89300,5.50500,15360.00000,438.29999,0.00324", + "Hf", "5.02800,5.65700,15550.00000,440.79999,0.00320", + "Ta", "4.73800,5.32900,15740.00000,443.20001,0.00319", + "W", "4.58700,5.16000,15410.00000,415.29999,0.00341", + "Re", "5.20100,5.85100,16120.00000,441.60001,0.00312", + "Os", "5.07100,5.70400,16300.00000,440.89999,0.00308", + "Ir", "4.94600,5.56300,16490.00000,440.10001,0.00296", + "Pt", "4.47700,5.03400,16670.00000,439.29999,0.00287", + "Au", "4.84400,5.45800,7852.00000,975.79999,0.02077", + "Hg", "4.30700,4.84300,17040.00000,487.79999,0.00288", + "Tl", "4.72300,5.31100,17220.00000,537.00000,0.00291", + "Pb", "5.31900,5.98200,17400.00000,586.29999,0.00287", + "Bi", "5.95600,6.70000,17800.00000,677.00000,0.00266", + "Po", "6.15800,6.92800,17770.00000,586.29999,0.00281", + "At", "6.20300,6.97900,17950.00000,586.29999,0.00278", + "Rn", "6.18100,6.95400,18120.00000,586.29999,0.00275", + "Fr", "6.94900,7.82000,18300.00000,586.29999,0.00274", + "Ra", "7.50600,8.44800,18480.00000,586.29999,0.00273", + "Ac", "7.64800,8.60900,18660.00000,586.29999,0.00270", + "Th", "7.71100,8.67900,18830.00000,586.29999,0.00264", + "Pa", "7.40700,8.33600,19010.00000,586.29999,0.00260", + "U", "7.29000,8.20400,19180.00000,586.29999,0.00267", + "", "0.00000,0.00000,0.00000,0.00000,0.00000" + ); + return $Stopicru{$El}; +} + +1; diff --git a/trimsp/TrimSPGUI/TrimSPGUI.pl b/trimsp/TrimSPGUI/TrimSPGUI.pl new file mode 100644 index 0000000..816ea17 --- /dev/null +++ b/trimsp/TrimSPGUI/TrimSPGUI.pl @@ -0,0 +1,1227 @@ +# Form implementation generated from reading ui file 'TrimSPGUItabs.ui' +# +# Created: Mon Aug 10 15:36:32 2009 +# by: The PerlQt User Interface Compiler (puic) +# +# WARNING! All changes made in this file will be lost! + + +use strict; +use utf8; + + +package TrimSPGUI; +use Qt; +use Qt::isa qw(Qt::Dialog); +use Qt::slots + ToggleScanSingle => [], + PrepLayers => [], + ProjSmartDefaults => [], + OpenHelpWindow => [], + CollectValues => [], + CreateInpFile => [], + StartSequenceOne => []; +use Qt::attributes qw( + Progress + tabs + LayersTab + ProjParam + textLabel1 + ProjType + NLabel + z0Label + dzLabel + ELabel + SigELabel + AlbleLabel + SigAngleLabel + SeedLabel + NProj + z0 + dz + E + SigE + Angle + SigAngle + Seed + groupBox15 + textLabelFN + FNPre + textLabelPath + Path + Start + Help + groupBox1 + textLabel1_4 + NL + textLabel2_4 + textLabel3 + textLabel4 + BoxL1 + L1Comp + L1rho + L1d + BoxL2 + L2d + L2Comp + L2rho + BoxL3 + L3d + L3Comp + L3rho + BoxL4 + L4d + L4Comp + L4rho + BoxL5 + L5d + L5Comp + L5rho + BoxL6 + L6d + L6Comp + L6rho + BoxL7 + L7d + L7Comp + L7rho + AddParTab + AddParam + textLabelEF + textLabelESB + textLabelSHEATH + textLabelERC + textLabelRD + KDEE2 + KDEE1 + textLabelIRL + textLabelIPOTR + textLabelIPOT + textLabelKDEE2 + textLabelKDEE1 + textLabelKK0R + textLabelCA + textLabelEmpty + lineEditEmpty + KK0R + KK0 + textLabelKK0 + EF + SHEATH + ERC + RD + CA + ESB + IPOT + IPOTR + IRL + ScansTab + ScanSeq + ScanMode + textLabel2 + SFrom + textLabel2_2 + STo + textLabel2_2_2_2 + SStep + LoopRadio + ListRadio + ScanList + buttonGroup2 + ERadio + SigERadio + NProjRadio + dRadio + ScandL + TrimSPGUIHelp +); + + + +sub NEW +{ + shift->SUPER::NEW(@_[0..3]); + + if ( name() eq "unnamed" ) + { + setName("TrimSPGUI" ); + } + setSizePolicy(Qt::SizePolicy(5, 5, 1, 1, this->sizePolicy()->hasHeightForWidth()) ); + setMinimumSize(Qt::Size(550, 500) ); + setMouseTracking(1 ); + setAcceptDrops(1 ); + setSizeGripEnabled(1 ); + setModal(1 ); + + + Progress = Qt::ProgressBar(this, "Progress"); + Progress->setGeometry( Qt::Rect(0, 525, 715, 20) ); + Progress->setFrameShape( &Qt::ProgressBar::WinPanel() ); + + tabs = Qt::TabWidget(this, "tabs"); + tabs->setGeometry( Qt::Rect(0, 0, 715, 525) ); + + LayersTab = Qt::Widget(tabs, "LayersTab"); + + ProjParam = Qt::GroupBox(LayersTab, "ProjParam"); + ProjParam->setGeometry( Qt::Rect(460, 0, 250, 290) ); + + my $LayoutWidget = Qt::Widget(ProjParam, '$LayoutWidget'); + $LayoutWidget->setGeometry( Qt::Rect(5, 25, 240, 260) ); + my $layout8 = Qt::VBoxLayout($LayoutWidget, 0, 0, '$layout8'); + + my $layout7 = Qt::HBoxLayout(undef, 0, 6, '$layout7'); + + textLabel1 = Qt::Label($LayoutWidget, "textLabel1"); + $layout7->addWidget(textLabel1); + + ProjType = Qt::ComboBox(0, $LayoutWidget, "ProjType"); + ProjType->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, ProjType->sizePolicy()->hasHeightForWidth()) ); + $layout7->addWidget(ProjType); + $layout8->addLayout($layout7); + + my $layout6 = Qt::HBoxLayout(undef, 0, 6, '$layout6'); + + my $layout5 = Qt::VBoxLayout(undef, 0, 0, '$layout5'); + + NLabel = Qt::Label($LayoutWidget, "NLabel"); + NLabel->setSizePolicy( Qt::SizePolicy(5, 5, 0, 0, NLabel->sizePolicy()->hasHeightForWidth()) ); + $layout5->addWidget(NLabel); + + z0Label = Qt::Label($LayoutWidget, "z0Label"); + $layout5->addWidget(z0Label); + + dzLabel = Qt::Label($LayoutWidget, "dzLabel"); + $layout5->addWidget(dzLabel); + + ELabel = Qt::Label($LayoutWidget, "ELabel"); + $layout5->addWidget(ELabel); + + SigELabel = Qt::Label($LayoutWidget, "SigELabel"); + $layout5->addWidget(SigELabel); + + AlbleLabel = Qt::Label($LayoutWidget, "AlbleLabel"); + $layout5->addWidget(AlbleLabel); + + SigAngleLabel = Qt::Label($LayoutWidget, "SigAngleLabel"); + $layout5->addWidget(SigAngleLabel); + + SeedLabel = Qt::Label($LayoutWidget, "SeedLabel"); + $layout5->addWidget(SeedLabel); + $layout6->addLayout($layout5); + + my $layout4 = Qt::VBoxLayout(undef, 0, 0, '$layout4'); + + NProj = Qt::LineEdit($LayoutWidget, "NProj"); + NProj->setSizePolicy( Qt::SizePolicy(7, 0, 0, 0, NProj->sizePolicy()->hasHeightForWidth()) ); + NProj->setMaximumSize( Qt::Size(32767, 32767) ); + $layout4->addWidget(NProj); + + z0 = Qt::LineEdit($LayoutWidget, "z0"); + z0->setMaximumSize( Qt::Size(32767, 32767) ); + $layout4->addWidget(z0); + + dz = Qt::LineEdit($LayoutWidget, "dz"); + $layout4->addWidget(dz); + + E = Qt::LineEdit($LayoutWidget, "E"); + $layout4->addWidget(E); + + SigE = Qt::LineEdit($LayoutWidget, "SigE"); + $layout4->addWidget(SigE); + + Angle = Qt::LineEdit($LayoutWidget, "Angle"); + $layout4->addWidget(Angle); + + SigAngle = Qt::LineEdit($LayoutWidget, "SigAngle"); + $layout4->addWidget(SigAngle); + + Seed = Qt::LineEdit($LayoutWidget, "Seed"); + $layout4->addWidget(Seed); + $layout6->addLayout($layout4); + $layout8->addLayout($layout6); + + groupBox15 = Qt::GroupBox(LayersTab, "groupBox15"); + groupBox15->setGeometry( Qt::Rect(460, 290, 250, 120) ); + + my $LayoutWidget_2 = Qt::Widget(groupBox15, '$LayoutWidget_2'); + $LayoutWidget_2->setGeometry( Qt::Rect(5, 20, 240, 90) ); + my $layout30 = Qt::VBoxLayout($LayoutWidget_2, 0, 0, '$layout30'); + + textLabelFN = Qt::Label($LayoutWidget_2, "textLabelFN"); + $layout30->addWidget(textLabelFN); + + FNPre = Qt::LineEdit($LayoutWidget_2, "FNPre"); + $layout30->addWidget(FNPre); + + textLabelPath = Qt::Label($LayoutWidget_2, "textLabelPath"); + $layout30->addWidget(textLabelPath); + + Path = Qt::LineEdit($LayoutWidget_2, "Path"); + $layout30->addWidget(Path); + + Start = Qt::PushButton(LayersTab, "Start"); + Start->setGeometry( Qt::Rect(595, 435, 80, 30) ); + Start->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, Start->sizePolicy()->hasHeightForWidth()) ); + + Help = Qt::PushButton(LayersTab, "Help"); + Help->setGeometry( Qt::Rect(505, 435, 80, 30) ); + Help->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, Help->sizePolicy()->hasHeightForWidth()) ); + + groupBox1 = Qt::GroupBox(LayersTab, "groupBox1"); + groupBox1->setGeometry( Qt::Rect(0, 0, 460, 500) ); + groupBox1->setFrameShape( &Qt::GroupBox::GroupBoxPanel() ); + groupBox1->setFrameShadow( &Qt::GroupBox::Sunken() ); + + my $LayoutWidget_3 = Qt::Widget(groupBox1, '$LayoutWidget_3'); + $LayoutWidget_3->setGeometry( Qt::Rect(5, 20, 450, 465) ); + my $layout27 = Qt::VBoxLayout($LayoutWidget_3, 11, 6, '$layout27'); + + my $layout19 = Qt::HBoxLayout(undef, 0, 6, '$layout19'); + + textLabel1_4 = Qt::Label($LayoutWidget_3, "textLabel1_4"); + $layout19->addWidget(textLabel1_4); + + NL = Qt::SpinBox($LayoutWidget_3, "NL"); + NL->setMaxValue( int(7) ); + NL->setMinValue( int(1) ); + $layout19->addWidget(NL); + my $spacer = Qt::SpacerItem(251, 20, &Qt::SizePolicy::Expanding, &Qt::SizePolicy::Minimum); + $layout19->addItem($spacer); + $layout27->addLayout($layout19); + + my $layout26 = Qt::HBoxLayout(undef, 0, 6, '$layout26'); + + textLabel2_4 = Qt::Label($LayoutWidget_3, "textLabel2_4"); + textLabel2_4->setSizePolicy( Qt::SizePolicy(0, 1, 0, 0, textLabel2_4->sizePolicy()->hasHeightForWidth()) ); + $layout26->addWidget(textLabel2_4); + my $spacer_2 = Qt::SpacerItem(101, 20, &Qt::SizePolicy::Fixed, &Qt::SizePolicy::Minimum); + $layout26->addItem($spacer_2); + + textLabel3 = Qt::Label($LayoutWidget_3, "textLabel3"); + textLabel3->setSizePolicy( Qt::SizePolicy(1, 5, 0, 0, textLabel3->sizePolicy()->hasHeightForWidth()) ); + $layout26->addWidget(textLabel3); + + textLabel4 = Qt::Label($LayoutWidget_3, "textLabel4"); + $layout26->addWidget(textLabel4); + $layout27->addLayout($layout26); + + BoxL1 = Qt::GroupBox($LayoutWidget_3, "BoxL1"); + + L1Comp = Qt::LineEdit(BoxL1, "L1Comp"); + L1Comp->setGeometry( Qt::Rect(10, 20, 180, 25) ); + + L1rho = Qt::LineEdit(BoxL1, "L1rho"); + L1rho->setGeometry( Qt::Rect(200, 20, 111, 25) ); + + L1d = Qt::LineEdit(BoxL1, "L1d"); + L1d->setGeometry( Qt::Rect(320, 20, 105, 25) ); + L1d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L1d->sizePolicy()->hasHeightForWidth()) ); + $layout27->addWidget(BoxL1); + + BoxL2 = Qt::GroupBox($LayoutWidget_3, "BoxL2"); + BoxL2->setEnabled( 0 ); + + L2d = Qt::LineEdit(BoxL2, "L2d"); + L2d->setGeometry( Qt::Rect(320, 20, 105, 25) ); + L2d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L2d->sizePolicy()->hasHeightForWidth()) ); + + L2Comp = Qt::LineEdit(BoxL2, "L2Comp"); + L2Comp->setGeometry( Qt::Rect(10, 20, 180, 25) ); + + L2rho = Qt::LineEdit(BoxL2, "L2rho"); + L2rho->setGeometry( Qt::Rect(200, 20, 111, 25) ); + $layout27->addWidget(BoxL2); + + BoxL3 = Qt::GroupBox($LayoutWidget_3, "BoxL3"); + BoxL3->setEnabled( 0 ); + + L3d = Qt::LineEdit(BoxL3, "L3d"); + L3d->setGeometry( Qt::Rect(320, 20, 105, 25) ); + L3d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L3d->sizePolicy()->hasHeightForWidth()) ); + + L3Comp = Qt::LineEdit(BoxL3, "L3Comp"); + L3Comp->setGeometry( Qt::Rect(10, 20, 180, 25) ); + + L3rho = Qt::LineEdit(BoxL3, "L3rho"); + L3rho->setGeometry( Qt::Rect(200, 20, 111, 25) ); + $layout27->addWidget(BoxL3); + + BoxL4 = Qt::GroupBox($LayoutWidget_3, "BoxL4"); + BoxL4->setEnabled( 0 ); + + L4d = Qt::LineEdit(BoxL4, "L4d"); + L4d->setGeometry( Qt::Rect(320, 20, 105, 25) ); + L4d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L4d->sizePolicy()->hasHeightForWidth()) ); + + L4Comp = Qt::LineEdit(BoxL4, "L4Comp"); + L4Comp->setGeometry( Qt::Rect(10, 20, 180, 25) ); + + L4rho = Qt::LineEdit(BoxL4, "L4rho"); + L4rho->setGeometry( Qt::Rect(200, 20, 111, 25) ); + $layout27->addWidget(BoxL4); + + BoxL5 = Qt::GroupBox($LayoutWidget_3, "BoxL5"); + BoxL5->setEnabled( 0 ); + + L5d = Qt::LineEdit(BoxL5, "L5d"); + L5d->setGeometry( Qt::Rect(320, 20, 105, 25) ); + L5d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L5d->sizePolicy()->hasHeightForWidth()) ); + + L5Comp = Qt::LineEdit(BoxL5, "L5Comp"); + L5Comp->setGeometry( Qt::Rect(10, 20, 180, 25) ); + + L5rho = Qt::LineEdit(BoxL5, "L5rho"); + L5rho->setGeometry( Qt::Rect(200, 20, 111, 25) ); + $layout27->addWidget(BoxL5); + + BoxL6 = Qt::GroupBox($LayoutWidget_3, "BoxL6"); + BoxL6->setEnabled( 0 ); + + L6d = Qt::LineEdit(BoxL6, "L6d"); + L6d->setGeometry( Qt::Rect(320, 20, 105, 25) ); + L6d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L6d->sizePolicy()->hasHeightForWidth()) ); + + L6Comp = Qt::LineEdit(BoxL6, "L6Comp"); + L6Comp->setGeometry( Qt::Rect(10, 20, 180, 25) ); + + L6rho = Qt::LineEdit(BoxL6, "L6rho"); + L6rho->setGeometry( Qt::Rect(200, 20, 111, 25) ); + $layout27->addWidget(BoxL6); + + BoxL7 = Qt::GroupBox($LayoutWidget_3, "BoxL7"); + BoxL7->setEnabled( 0 ); + + L7d = Qt::LineEdit(BoxL7, "L7d"); + L7d->setGeometry( Qt::Rect(320, 20, 105, 25) ); + L7d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L7d->sizePolicy()->hasHeightForWidth()) ); + + L7Comp = Qt::LineEdit(BoxL7, "L7Comp"); + L7Comp->setGeometry( Qt::Rect(10, 20, 180, 25) ); + + L7rho = Qt::LineEdit(BoxL7, "L7rho"); + L7rho->setGeometry( Qt::Rect(200, 20, 111, 25) ); + $layout27->addWidget(BoxL7); + tabs->insertTab( LayersTab, "" ); + + AddParTab = Qt::Widget(tabs, "AddParTab"); + + AddParam = Qt::GroupBox(AddParTab, "AddParam"); + AddParam->setGeometry( Qt::Rect(0, 0, 250, 210) ); + + textLabelEF = Qt::Label(AddParam, "textLabelEF"); + textLabelEF->setGeometry( Qt::Rect(12, 26, 63, 25) ); + + textLabelESB = Qt::Label(AddParam, "textLabelESB"); + textLabelESB->setGeometry( Qt::Rect(12, 51, 63, 25) ); + + textLabelSHEATH = Qt::Label(AddParam, "textLabelSHEATH"); + textLabelSHEATH->setGeometry( Qt::Rect(12, 76, 63, 25) ); + + textLabelERC = Qt::Label(AddParam, "textLabelERC"); + textLabelERC->setGeometry( Qt::Rect(12, 101, 63, 26) ); + + textLabelRD = Qt::Label(AddParam, "textLabelRD"); + textLabelRD->setGeometry( Qt::Rect(12, 127, 63, 25) ); + + KDEE2 = Qt::SpinBox(AddParam, "KDEE2"); + KDEE2->setGeometry( Qt::Rect(185, 100, 52, 26) ); + KDEE2->setMaxValue( int(3) ); + KDEE2->setMinValue( int(1) ); + KDEE2->setValue( int(3) ); + + KDEE1 = Qt::SpinBox(AddParam, "KDEE1"); + KDEE1->setGeometry( Qt::Rect(185, 75, 52, 26) ); + KDEE1->setMaxValue( int(5) ); + KDEE1->setMinValue( int(1) ); + KDEE1->setValue( int(4) ); + + textLabelIRL = Qt::Label(AddParam, "textLabelIRL"); + textLabelIRL->setGeometry( Qt::Rect(131, 177, 53, 25) ); + + textLabelIPOTR = Qt::Label(AddParam, "textLabelIPOTR"); + textLabelIPOTR->setGeometry( Qt::Rect(131, 152, 53, 25) ); + + textLabelIPOT = Qt::Label(AddParam, "textLabelIPOT"); + textLabelIPOT->setGeometry( Qt::Rect(131, 126, 53, 26) ); + + textLabelKDEE2 = Qt::Label(AddParam, "textLabelKDEE2"); + textLabelKDEE2->setGeometry( Qt::Rect(131, 101, 53, 25) ); + + textLabelKDEE1 = Qt::Label(AddParam, "textLabelKDEE1"); + textLabelKDEE1->setGeometry( Qt::Rect(131, 76, 53, 25) ); + + textLabelKK0R = Qt::Label(AddParam, "textLabelKK0R"); + textLabelKK0R->setGeometry( Qt::Rect(131, 51, 53, 25) ); + + textLabelCA = Qt::Label(AddParam, "textLabelCA"); + textLabelCA->setGeometry( Qt::Rect(12, 152, 63, 25) ); + + textLabelEmpty = Qt::Label(AddParam, "textLabelEmpty"); + textLabelEmpty->setEnabled( 0 ); + textLabelEmpty->setGeometry( Qt::Rect(12, 175, 63, 25) ); + + lineEditEmpty = Qt::LineEdit(AddParam, "lineEditEmpty"); + lineEditEmpty->setEnabled( 0 ); + lineEditEmpty->setGeometry( Qt::Rect(77, 175, 52, 25) ); + lineEditEmpty->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, lineEditEmpty->sizePolicy()->hasHeightForWidth()) ); + + KK0R = Qt::SpinBox(AddParam, "KK0R"); + KK0R->setGeometry( Qt::Rect(185, 50, 52, 26) ); + KK0R->setMaxValue( int(4) ); + KK0R->setMinValue( int(0) ); + KK0R->setValue( int(2) ); + + KK0 = Qt::SpinBox(AddParam, "KK0"); + KK0->setGeometry( Qt::Rect(185, 25, 52, 26) ); + KK0->setMaxValue( int(4) ); + KK0->setMinValue( int(0) ); + KK0->setValue( int(2) ); + + textLabelKK0 = Qt::Label(AddParam, "textLabelKK0"); + textLabelKK0->setGeometry( Qt::Rect(131, 25, 53, 25) ); + + EF = Qt::LineEdit(AddParam, "EF"); + EF->setGeometry( Qt::Rect(77, 26, 52, 25) ); + EF->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, EF->sizePolicy()->hasHeightForWidth()) ); + + SHEATH = Qt::LineEdit(AddParam, "SHEATH"); + SHEATH->setGeometry( Qt::Rect(77, 76, 52, 25) ); + SHEATH->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, SHEATH->sizePolicy()->hasHeightForWidth()) ); + + ERC = Qt::LineEdit(AddParam, "ERC"); + ERC->setGeometry( Qt::Rect(77, 101, 52, 26) ); + ERC->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, ERC->sizePolicy()->hasHeightForWidth()) ); + + RD = Qt::LineEdit(AddParam, "RD"); + RD->setGeometry( Qt::Rect(77, 127, 52, 25) ); + RD->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, RD->sizePolicy()->hasHeightForWidth()) ); + + CA = Qt::LineEdit(AddParam, "CA"); + CA->setGeometry( Qt::Rect(77, 152, 52, 25) ); + CA->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, CA->sizePolicy()->hasHeightForWidth()) ); + + ESB = Qt::LineEdit(AddParam, "ESB"); + ESB->setGeometry( Qt::Rect(77, 51, 52, 25) ); + ESB->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, ESB->sizePolicy()->hasHeightForWidth()) ); + + IPOT = Qt::SpinBox(AddParam, "IPOT"); + IPOT->setGeometry( Qt::Rect(185, 125, 52, 26) ); + IPOT->setMaxValue( int(3) ); + IPOT->setMinValue( int(1) ); + IPOT->setValue( int(2) ); + + IPOTR = Qt::SpinBox(AddParam, "IPOTR"); + IPOTR->setGeometry( Qt::Rect(185, 150, 52, 26) ); + IPOTR->setMaxValue( int(3) ); + IPOTR->setMinValue( int(1) ); + + IRL = Qt::SpinBox(AddParam, "IRL"); + IRL->setGeometry( Qt::Rect(186, 176, 52, 26) ); + IRL->setMaxValue( int(1) ); + tabs->insertTab( AddParTab, "" ); + + ScansTab = Qt::Widget(tabs, "ScansTab"); + + ScanSeq = Qt::GroupBox(ScansTab, "ScanSeq"); + ScanSeq->setGeometry( Qt::Rect(0, 0, 500, 165) ); + ScanSeq->setCheckable( 1 ); + ScanSeq->setChecked( 0 ); + + ScanMode = Qt::ButtonGroup(ScanSeq, "ScanMode"); + ScanMode->setGeometry( Qt::Rect(230, 20, 265, 140) ); + ScanMode->setCheckable( 0 ); + ScanMode->setChecked( 0 ); + ScanMode->setExclusive( 1 ); + ScanMode->setRadioButtonExclusive( 1 ); + + my $LayoutWidget_4 = Qt::Widget(ScanMode, '$LayoutWidget_4'); + $LayoutWidget_4->setGeometry( Qt::Rect(11, 103, 240, 23) ); + my $layout3 = Qt::HBoxLayout($LayoutWidget_4, 0, 0, '$layout3'); + + textLabel2 = Qt::Label($LayoutWidget_4, "textLabel2"); + $layout3->addWidget(textLabel2); + + SFrom = Qt::LineEdit($LayoutWidget_4, "SFrom"); + SFrom->setSizePolicy( Qt::SizePolicy(5, 5, 0, 0, SFrom->sizePolicy()->hasHeightForWidth()) ); + $layout3->addWidget(SFrom); + + textLabel2_2 = Qt::Label($LayoutWidget_4, "textLabel2_2"); + $layout3->addWidget(textLabel2_2); + + STo = Qt::LineEdit($LayoutWidget_4, "STo"); + STo->setSizePolicy( Qt::SizePolicy(5, 5, 0, 0, STo->sizePolicy()->hasHeightForWidth()) ); + $layout3->addWidget(STo); + + textLabel2_2_2_2 = Qt::Label($LayoutWidget_4, "textLabel2_2_2_2"); + $layout3->addWidget(textLabel2_2_2_2); + + SStep = Qt::LineEdit($LayoutWidget_4, "SStep"); + SStep->setSizePolicy( Qt::SizePolicy(5, 5, 0, 0, SStep->sizePolicy()->hasHeightForWidth()) ); + $layout3->addWidget(SStep); + + LoopRadio = Qt::RadioButton(ScanMode, "LoopRadio"); + LoopRadio->setGeometry( Qt::Rect(10, 75, 240, 22) ); + LoopRadio->setChecked( 1 ); + + ListRadio = Qt::RadioButton(ScanMode, "ListRadio"); + ListRadio->setGeometry( Qt::Rect(10, 20, 240, 22) ); + + ScanList = Qt::LineEdit(ScanMode, "ScanList"); + ScanList->setGeometry( Qt::Rect(10, 45, 240, 23) ); + + buttonGroup2 = Qt::ButtonGroup(ScanSeq, "buttonGroup2"); + buttonGroup2->setGeometry( Qt::Rect(10, 20, 216, 140) ); + buttonGroup2->setExclusive( 1 ); + + ERadio = Qt::RadioButton(buttonGroup2, "ERadio"); + ERadio->setGeometry( Qt::Rect(4, 22, 211, 24) ); + ERadio->setChecked( 1 ); + + SigERadio = Qt::RadioButton(buttonGroup2, "SigERadio"); + SigERadio->setGeometry( Qt::Rect(4, 47, 211, 24) ); + + NProjRadio = Qt::RadioButton(buttonGroup2, "NProjRadio"); + NProjRadio->setGeometry( Qt::Rect(4, 72, 211, 24) ); + + dRadio = Qt::RadioButton(buttonGroup2, "dRadio"); + dRadio->setGeometry( Qt::Rect(5, 99, 153, 24) ); + + ScandL = Qt::SpinBox(buttonGroup2, "ScandL"); + ScandL->setGeometry( Qt::Rect(158, 98, 56, 26) ); + ScandL->setMaxValue( int(7) ); + ScandL->setMinValue( int(1) ); + tabs->insertTab( ScansTab, "" ); + languageChange(); + my $resize = Qt::Size(716, 547); + $resize = $resize->expandedTo(minimumSizeHint()); + resize( $resize ); + clearWState( &Qt::WState_Polished ); + + Qt::Object::connect(ScanSeq, SIGNAL "toggled(bool)", this, SLOT "ToggleScanSingle()"); + Qt::Object::connect(Help, SIGNAL "clicked()", this, SLOT "OpenHelpWindow()"); + Qt::Object::connect(Start, SIGNAL "clicked()", this, SLOT "StartSequenceOne()"); + Qt::Object::connect(ERadio, SIGNAL "toggled(bool)", this, SLOT "ToggleScanSingle()"); + Qt::Object::connect(SigERadio, SIGNAL "toggled(bool)", this, SLOT "ToggleScanSingle()"); + Qt::Object::connect(NProjRadio, SIGNAL "toggled(bool)", this, SLOT "ToggleScanSingle()"); + Qt::Object::connect(ScandL, SIGNAL "valueChanged(int)", this, SLOT "ToggleScanSingle()"); + Qt::Object::connect(dRadio, SIGNAL "toggled(bool)", this, SLOT "ToggleScanSingle()"); + Qt::Object::connect(NL, SIGNAL "valueChanged(int)", this, SLOT "PrepLayers()"); + Qt::Object::connect(ProjType, SIGNAL "activated(int)", this, SLOT "ProjSmartDefaults()"); +} + + +# Sets the strings of the subwidgets using the current +# language. + +sub languageChange +{ + setCaption(trUtf8("TrimSPGUI") ); + ProjParam->setTitle( trUtf8("Projectile parameters") ); + textLabel1->setText( trUtf8("Projectile") ); + ProjType->clear(); + ProjType->insertItem( trUtf8("Muon") ); + ProjType->insertItem( trUtf8("Li8") ); + ProjType->insertItem( trUtf8("B12") ); + Qt::WhatsThis::add(ProjType, trUtf8("Choose the projectile type.")); + NLabel->setText( trUtf8("Number of projectiles") ); + z0Label->setText( trUtf8("Starting depth [nm]") ); + dzLabel->setText( trUtf8("Depth increment [nm]") ); + ELabel->setText( trUtf8("Energy [eV]") ); + SigELabel->setText( trUtf8("Energy sigma [eV]") ); + AlbleLabel->setText( trUtf8("Angle [deg]") ); + SigAngleLabel->setText( trUtf8("Angle sigma [deg]") ); + SeedLabel->setText( trUtf8("Random seed") ); + NProj->setText( trUtf8("10000") ); + Qt::WhatsThis::add(NProj, trUtf8("The number of projectiles to be implanted in the sample. Larger number better statistics.")); + z0->setText( trUtf8("0.0") ); + Qt::WhatsThis::add(z0, trUtf8("Consider implanted projectiles starting from this depth.")); + dz->setText( trUtf8("2.0") ); + Qt::WhatsThis::add(dz, trUtf8("The steps in implantation depth at which the number of stopped projectiles will be counted. Smaller number for finer implantation histogram.")); + E->setText( trUtf8("2000") ); + Qt::WhatsThis::add(E, trUtf8("The average implantation energy of the projectile.")); + SigE->setText( trUtf8("450") ); + Qt::WhatsThis::add(SigE, trUtf8("The spread in implantation energy. For muons this is typically 400-450 eV. For Li8 this is practically zero.")); + Angle->setText( trUtf8("0") ); + Qt::WhatsThis::add(Angle, trUtf8("The average implantation angle.")); + SigAngle->setText( trUtf8("15") ); + Qt::WhatsThis::add(SigAngle, trUtf8("The spread in implantation angles.")); + Seed->setText( trUtf8("78741") ); + Qt::WhatsThis::add(Seed, trUtf8("The random number generator seed.")); + groupBox15->setTitle( trUtf8("File Names") ); + textLabelFN->setText( trUtf8("File names prefix") ); + FNPre->setText( trUtf8("SrTiO3") ); + Qt::WhatsThis::add(FNPre, trUtf8("The names of the saved files will start with this prefix.")); + textLabelPath->setText( trUtf8("Save in subdirectory") ); + Path->setText( trUtf8("Muon_SrTiO3") ); + Qt::WhatsThis::add(Path, trUtf8("This is the path were the input/output files will be stored.")); + Start->setText( trUtf8("Start") ); + Help->setText( trUtf8("Help") ); + groupBox1->setTitle( trUtf8("Layers") ); + textLabel1_4->setText( trUtf8("Number of Layers") ); + Qt::WhatsThis::add(NL, trUtf8("Select the number of the layers of your structure (maximum 7 layers).")); + textLabel2_4->setText( trUtf8("Composition") ); + Qt::ToolTip::add(textLabel2_4, trUtf8("Chemical formula")); + textLabel3->setText( trUtf8("Density [g/cm3]") ); + textLabel4->setText( trUtf8("Thickness [nm]") ); + BoxL1->setTitle( trUtf8("Layer 1") ); + L1Comp->setText( trUtf8("SrTiO3") ); + Qt::ToolTip::add(L1Comp, trUtf8("Chemical formula of L1")); + Qt::WhatsThis::add(L1Comp, trUtf8("Insert the chemical formula here as you would write it.")); + L1rho->setText( trUtf8("5.12") ); + Qt::WhatsThis::add(L1rho, trUtf8("Insert the density of the layer here.")); + L1d->setText( trUtf8("200") ); + Qt::WhatsThis::add(L1d, trUtf8("Insert the thickness of the layer here.")); + BoxL2->setTitle( trUtf8("Layer 2") ); + BoxL3->setTitle( trUtf8("Layer 3") ); + BoxL4->setTitle( trUtf8("Layer 4") ); + BoxL5->setTitle( trUtf8("Layer 5") ); + BoxL6->setTitle( trUtf8("Layer 6") ); + BoxL7->setTitle( trUtf8("Layer 7") ); + tabs->changeTab( LayersTab, trUtf8("Layers") ); + AddParam->setTitle( trUtf8("Additional parameters") ); + textLabelEF->setText( trUtf8("EF") ); + textLabelESB->setText( trUtf8("ESB") ); + textLabelSHEATH->setText( trUtf8("SHEATH") ); + textLabelERC->setText( trUtf8("ERC") ); + textLabelRD->setText( trUtf8("RD") ); + textLabelIRL->setText( trUtf8("IRL") ); + textLabelIPOTR->setText( trUtf8("IPOTR") ); + textLabelIPOT->setText( trUtf8("IPOT") ); + textLabelKDEE2->setText( trUtf8("KDEE2") ); + textLabelKDEE1->setText( trUtf8("KDEE1") ); + textLabelKK0R->setText( trUtf8("KK0R") ); + textLabelCA->setText( trUtf8("CA") ); + textLabelEmpty->setText( undef ); + lineEditEmpty->setText( undef ); + textLabelKK0->setText( trUtf8("KK0") ); + EF->setText( trUtf8("0.5") ); + SHEATH->setText( trUtf8("0.0") ); + ERC->setText( trUtf8("0.0") ); + RD->setText( trUtf8("50.0") ); + CA->setText( trUtf8("1.0") ); + ESB->setText( trUtf8("0.0") ); + tabs->changeTab( AddParTab, trUtf8("Additional Parameters") ); + ScanSeq->setTitle( trUtf8("Scan sequence") ); + Qt::WhatsThis::add(ScanSeq, trUtf8("Select to scan a certain parameter in the simulation and produce multiple output files for each value of this parameter.")); + ScanMode->setTitle( trUtf8("Scan mode") ); + textLabel2->setText( trUtf8("From") ); + SFrom->setText( trUtf8("1000") ); + textLabel2_2->setText( trUtf8("To") ); + STo->setText( trUtf8("28000") ); + textLabel2_2_2_2->setText( trUtf8("Step") ); + SStep->setText( trUtf8("1000") ); + LoopRadio->setText( trUtf8("Loop") ); + Qt::WhatsThis::add(LoopRadio, trUtf8("The values of the scanned parameter are evenly spaced.")); + ListRadio->setText( trUtf8("List of values") ); + Qt::WhatsThis::add(ListRadio, trUtf8("The values of the scanned parameter are from a list.")); + ScanList->setText( trUtf8("1000,6000,10000") ); + Qt::WhatsThis::add(ScanList, trUtf8("A list of values to scan (separated by commas).")); + buttonGroup2->setTitle( trUtf8("Scan Parameter") ); + ERadio->setText( trUtf8("Energy") ); + Qt::WhatsThis::add(ERadio, trUtf8("Scan implantation energy.")); + SigERadio->setText( trUtf8("Energy sigma") ); + Qt::WhatsThis::add(SigERadio, trUtf8("Scan spread in implantation energy.")); + NProjRadio->setText( trUtf8("Projectile number") ); + Qt::WhatsThis::add(NProjRadio, trUtf8("Scan the number of implanted projectiles.")); + dRadio->setText( trUtf8("Thickness of Layer") ); + Qt::WhatsThis::add(dRadio, trUtf8("Scan the thickness of the selected layer.")); + Qt::WhatsThis::add(ScandL, trUtf8("This is the layer whose thickness will be scanned")); + tabs->changeTab( ScansTab, trUtf8("Scans (Disbaled)") ); +} + + +sub ToggleScanSingle +{ + + # Toggle between scan/single run mode + +# First collect some information + my %All=(); + $All{"ScanSeq"}=ScanSeq->isChecked(); + $All{"ERadio"}=ERadio->isChecked(); + $All{"SigERadio"}=SigERadio->isChecked(); + $All{"NProjRadio"}=NProjRadio->isChecked(); + $All{"dRadio"}=dRadio->isChecked(); + $All{"ScandL"}=ScandL->text(); + +# Enable everything + E->setDisabled(0); + E->setText("2000"); + SigE->setDisabled(0); + SigE->setText("450"); + NProj->setDisabled(0); + NProj->setText("10000"); + for (my $i=1;$i<=7;$i++) { + my $LayerName = "L".$i."d"; + my $LayerAttrib = child($LayerName); + $LayerAttrib->setDisabled(0); + } + + if ($All{"ScanSeq"}==1) { +# But if we are in scan mode disable the appropriate box + if ($All{"ERadio"}) { + E->setDisabled(1); + E->setText(""); + } elsif ($All{"SigERadio"}) { + SigE->setDisabled(1); + SigE->setText(""); + } elsif ($All{"NProjRadio"}) { + NProj->setDisabled(1); + NProj->setText(""); + } elsif($All{"dRadio"}) { + my $LayerName = "L".$All{"ScandL"}."d"; + my $LayerAttrib = child($LayerName); + $LayerAttrib->setDisabled(1); + $LayerAttrib->setText(""); + } +# and change title of tab to say enabled + tabs->changeTab( ScansTab, trUtf8("Scans (Enabled)") ); + } else { +# Otherwise the title of the tab says disabled + tabs->changeTab( ScansTab, trUtf8("Scans (Disabled)") ); + } + +} + +sub PrepLayers +{ + + my %All=(); + $All{"NL"}=NL->text(); + +# Enable layers up to required and disable the rest + for (my $i=1;$i<=7;$i++) { + my $LayerName = "BoxL".$i; + my $LayerAttrib = child($LayerName); + if ($i<=$All{"NL"}) { + $LayerAttrib->setDisabled(0); + } else { + $LayerAttrib->setDisabled(1); + } + } + +} + +sub ProjSmartDefaults +{ + + my %All=(); +# Get typeof projectile + $All{"ProjType"}=ProjType->currentText(); + + if ($All{"ProjType"} eq "Muon") { +# For a muon set Sigma E=450 eV and Sigman angle=15 degrees by default + SigE->setText("450"); + SigAngle->setText("15"); + } elsif ( $All{"ProjType"} eq "Li8") { +# For Li8 set Sigma E=0 eV and Sigam angle=0 degrees by default + SigE->setText("0"); + SigAngle->setText("0"); + } + +} + +sub OpenHelpWindow +{ + + use trimhelp; + my $w=trimhelp::NEW(); + $w->show; +# $w->setFocus(); +# $w->setActiveWindow(); +# $w->raise(); + +} + +sub CollectValues +{ + +# This subroutine returns a hash with all the values collected from the GUI. + my %All=(); + $All{"NL"}=NL->text(); +# Collect layers parameters + for (my $i=1;$i<=$All{"NL"};$i++) { + my $LComp = "L".$i."Comp"; + my $Lrho="L".$i."rho"; + my $Ld="L".$i."d"; + my $LCompAttrib = child($LComp); + my $LrhoAttrib=child($Lrho); + my $LdAttrib=child($Ld); + $All{"$LComp"}=$LCompAttrib->text(); + $All{"$Lrho"}=$LrhoAttrib->text(); + $All{"$Ld"}=$LdAttrib->text(); + } + +# Collect projectile parameters + $All{"ProjType"}=ProjType->currentText(); + $All{"NProj"}=NProj->text(); + $All{"z0"}=z0->text(); + $All{"dz"}=dz->text(); + $All{"E"}=E->text(); + $All{"SigE"}=SigE->text(); + $All{"Angle"}=Angle->text(); + $All{"SigAngle"}=SigAngle->text(); + $All{"Seed"}=Seed->text(); +# Format projectile parameters + $All{"NProj"}=sprintf("%8d",$All{"NProj"}); + $All{"z0"}=sprintf("%6.2f",$All{"z0"}); + $All{"dz"}=sprintf("%6.2f",$All{"dz"}); + $All{"E"}=sprintf("%11.2f",$All{"E"}); + $All{"SigE"}=sprintf("%8.2f",$All{"SigE"}); + $All{"Angle"}=sprintf("%8.2f",$All{"Angle"}); + $All{"SigAngle"}=sprintf("%8.2f",$All{"SigAngle"}); + $All{"Seed"}=sprintf("%6.0f.",$All{"Seed"}); + + +# Collect the additional parameters + $All{"EF"}=EF->text(); + $All{"ESB"}=ESB->text(); + $All{"SHEATH"}=SHEATH->text(); + $All{"ERC"}=ERC->text(); + $All{"RD"}=RD->text(); + $All{"CA"}=CA->text(); + $All{"KK0"}=KK0->text(); + $All{"KK0R"}=KK0R->text(); + $All{"KDEE1"}=KDEE1->text(); + $All{"KDEE2"}=KDEE2->text(); + $All{"IPOT"}=IPOT->text(); + $All{"IPOTR"}=IPOTR->text(); + $All{"IRL"}=IRL->text(); +# format additional parameters + $All{"EF"}=sprintf("%8.2f",$All{"EF"}); + $All{"ESB"}=sprintf("%8.2f",$All{"ESB"}); + $All{"SHEATH"}=sprintf("%8.2f",$All{"SHEATH"}); + $All{"ERC"}=sprintf("%8.2f",$All{"ERC"}); + $All{"RD"}=sprintf("%5.0f.",$All{"RD"}); + $All{"CA"}=sprintf("%6.2f",$All{"CA"}); + $All{"KK0"}=sprintf("%3d",$All{"KK0"}); + $All{"KK0R"}=sprintf("%3d",$All{"KK0R"}); + $All{"KDEE1"}=sprintf("%3d",$All{"KDEE1"}); + $All{"KDEE2"}=sprintf("%3d",$All{"KDEE2"}); + $All{"IPOT"}=sprintf("%3d",$All{"IPOT"}); + $All{"IPOTR"}=sprintf("%3d",$All{"IPOTR"}); + $All{"IRL"}=sprintf("%2d",$All{"IRL"}); + +# Filenames etc. + $All{"FNPre"}=FNPre->text(); + $All{"Path"}=Path->text(); + +# Scan parameters only if selected + $All{"ScanSeq"}=ScanSeq->isChecked(); + if ($All{"ScanSeq"}) { + $All{"ERadio"}=ERadio->isChecked(); + $All{"SigERadio"}=SigERadio->isChecked(); + $All{"NProjRadio"}=NProjRadio->isChecked(); + $All{"dRadio"}=dRadio->isChecked(); + $All{"ScandL"}=ScandL->text(); + $All{"ListRadio"}=ListRadio->isChecked(); + $All{"LoopRadio"}=LoopRadio->isChecked(); + $All{"ScanList"}=ScanList->text(); + $All{"SFrom"}=SFrom->text(); + $All{"STo"}=STo->text(); + $All{"SStep"}=SStep->text(); + } + +# Return values to caller + return %All; + +} + +sub CreateInpFile +{ + +# use lib "$ENV{HOME}/Projects/TrimSPGUI/Chem"; + use Chem; +# The proper way I think is not to have scan sequences implimented here +# but rather call this multiple times to generate the scan +# To resolve this, the function CreateInpFile will expect a unique thickness for each layer, +# one energy value, one energy sigma and one projectile number. +# These will be stored in keys L1/2/3/4/5/6/7d, E, SigE and NProj, respectively. + +# Chemical formulas will be parsed on the fly for each layer. However, we will check if +# all the layers have inputs for coposition, thickness and density. If not fail and crash :) + +# Values of Z,A as well as other needed parameters are obtained from Chem.pm. + +# This is the form of the input file: + my $TemplateFile= + " ProjZ ProjAM E SigE Angle SigAngle EF ESB SHEATH ERC + NProj Seed Seed Seed z0 RD dz CA KK0 KK0R KDEE1 KDEE2 IPOT IPOTR IRL + L1d L2d L3d L4d L5d L6d L7d L1rho L2rho L3rho L4rho L5rho L6rho L7rho L1CK L2CK L3CK L4CK L5CK L6CK L7CK + L1ELZ1 L1ELZ2 L1ELZ3 L1ELZ4 L1ELZ5 + L1ELW1 L1ELW2 L1ELW3 L1ELW4 L1ELW5 + L1ELC1 L1ELC2 L1ELC3 L1ELC4 L1ELC5 + L1ELE1 L1ELE2 L1ELE3 L1ELE4 L1ELE5 + L10301 L10302 L10303 L10304 L10305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L1ELST11 L1ELST21 L1ELST31 L1ELST41 L1ELST51 + L1ELST12 L1ELST22 L1ELST32 L1ELST42 L1ELST52 + L1ELST13 L1ELST23 L1ELST33 L1ELST43 L1ELST53 + L1ELST14 L1ELST24 L1ELST34 L1ELST44 L1ELST54 + L1ELST15 L1ELST25 L1ELST35 L1ELST45 L1ELST55 + L2ELZ1 L2ELZ2 L2ELZ3 L2ELZ4 L2ELZ5 + L2ELW1 L2ELW2 L2ELW3 L2ELW4 L2ELW5 + L2ELC1 L2ELC2 L2ELC3 L2ELC4 L2ELC5 + L2ELE1 L2ELE2 L2ELE3 L2ELE4 L2ELE5 + L20301 L20302 L20303 L20304 L20305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L2ELST11 L2ELST21 L2ELST31 L2ELST41 L2ELST51 + L2ELST12 L2ELST22 L2ELST32 L2ELST42 L2ELST52 + L2ELST13 L2ELST23 L2ELST33 L2ELST43 L2ELST53 + L2ELST14 L2ELST24 L2ELST34 L2ELST44 L2ELST54 + L2ELST15 L2ELST25 L2ELST35 L2ELST45 L2ELST55 + L3ELZ1 L3ELZ2 L3ELZ3 L3ELZ4 L3ELZ5 + L3ELW1 L3ELW2 L3ELW3 L3ELW4 L3ELW5 + L3ELC1 L3ELC2 L3ELC3 L3ELC4 L3ELC5 + L3ELE1 L3ELE2 L3ELE3 L3ELE4 L3ELE5 + L30301 L30302 L30303 L30304 L30305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L3ELST11 L3ELST21 L3ELST31 L3ELST41 L3ELST51 + L3ELST12 L3ELST22 L3ELST32 L3ELST42 L3ELST52 + L3ELST13 L3ELST23 L3ELST33 L3ELST43 L3ELST53 + L3ELST14 L3ELST24 L3ELST34 L3ELST44 L3ELST54 + L3ELST15 L3ELST25 L3ELST35 L3ELST45 L3ELST55 + L4ELZ1 L4ELZ2 L4ELZ3 L4ELZ4 L4ELZ5 + L4ELW1 L4ELW2 L4ELW3 L4ELW4 L4ELW5 + L4ELC1 L4ELC2 L4ELC3 L4ELC4 L4ELC5 + L4ELE1 L4ELE2 L4ELE3 L4ELE4 L4ELE5 + L40301 L40302 L40303 L40304 L40305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L4ELST11 L4ELST21 L4ELST31 L4ELST41 L4ELST51 + L4ELST12 L4ELST22 L4ELST32 L4ELST42 L4ELST52 + L4ELST13 L4ELST23 L4ELST33 L4ELST43 L4ELST53 + L4ELST14 L4ELST24 L4ELST34 L4ELST44 L4ELST54 + L4ELST15 L4ELST25 L4ELST35 L4ELST45 L4ELST55 + L5ELZ1 L5ELZ2 L5ELZ3 L5ELZ4 L5ELZ5 + L5ELW1 L5ELW2 L5ELW3 L5ELW4 L5ELW5 + L5ELC1 L5ELC2 L5ELC3 L5ELC4 L5ELC5 + L5ELE1 L5ELE2 L5ELE3 L5ELE4 L5ELE5 + L50301 L50302 L50303 L50304 L50305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L5ELST11 L5ELST21 L5ELST31 L5ELST41 L5ELST51 + L5ELST12 L5ELST22 L5ELST32 L5ELST42 L5ELST52 + L5ELST13 L5ELST23 L5ELST33 L5ELST43 L5ELST53 + L5ELST14 L5ELST24 L5ELST34 L5ELST44 L5ELST54 + L5ELST15 L5ELST25 L5ELST35 L5ELST45 L5ELST55 + L6ELZ1 L6ELZ2 L6ELZ3 L6ELZ4 L6ELZ5 + L6ELW1 L6ELW2 L6ELW3 L6ELW4 L6ELW5 + L6ELC1 L6ELC2 L6ELC3 L6ELC4 L6ELC5 + L6ELE1 L6ELE2 L6ELE3 L6ELE4 L6ELE5 + L60301 L60302 L60303 L60304 L60305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L6ELST11 L6ELST21 L6ELST31 L6ELST41 L6ELST51 + L6ELST12 L6ELST22 L6ELST32 L6ELST42 L6ELST52 + L6ELST13 L6ELST23 L6ELST33 L6ELST43 L6ELST53 + L6ELST14 L6ELST24 L6ELST34 L6ELST44 L6ELST54 + L6ELST15 L6ELST25 L6ELST35 L6ELST45 L6ELST55 + L7ELZ1 L7ELZ2 L7ELZ3 L7ELZ4 L7ELZ5 + L7ELW1 L7ELW2 L7ELW3 L7ELW4 L7ELW5 + L7ELC1 L7ELC2 L7ELC3 L7ELC4 L7ELC5 + L7ELE1 L7ELE2 L7ELE3 L7ELE4 L7ELE5 + L70301 L70302 L70303 L70304 L70305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L7ELST11 L7ELST21 L7ELST31 L7ELST41 L7ELST51 + L7ELST12 L7ELST22 L7ELST32 L7ELST42 L7ELST52 + L7ELST13 L7ELST23 L7ELST33 L7ELST43 L7ELST53 + L7ELST14 L7ELST24 L7ELST34 L7ELST44 L7ELST54 + L7ELST15 L7ELST25 L7ELST35 L7ELST45 L7ELST55 + "; + +# Get values from form + my %All = CollectValues(); + my $ProjType=$All{"ProjType"}; + $All{"ProjZ"}=sprintf("%6.2f",Chem::Zof($ProjType)); + $All{"ProjAM"}=sprintf("%6.2f",Chem::Massof($ProjType)); + + my $Check=0; +# Loop over layers an create appropriate values + for (my $i=1;$i<=7;$i++){ + $Check=0; +# Composition of layers + my $LComp="L".$i."Comp"; + my $LCompAttrib = child($LComp); + my $Comp = $LCompAttrib->text(); + my %LElComp=Chem::parse_formula($Comp); + if ($Comp eq "") {$Check++;} + +# Densities of layers + my $Lrho="L".$i."rho"; + my $LrhoAttrib = child($Lrho); + my $rho = $LrhoAttrib->text(); + $All{$Lrho}=sprintf("%6.2f",$rho); + if ($rho eq "") {$Check++;} + +# Thickness of layers + my $Ld ="L".$i."d"; + my $LdAttrib = child($Ld); + my $d = $LdAttrib->text(); + $All{$Ld}=sprintf("%8.2f",$d); + if ($d eq "") {$Check++;} + +# Sanity check, is the layer supposed to have value? are they all there? + if ($Check!=0 && $i<=$All{"NL"}) { + my $ErrMsg="Error: Layer $i is empty. Expecting it to be defined!\n"; + print STDERR $ErrMsg; +# my $ErrorDialog = Qt::ErrorMessage(TrimSPGUI); +# $ErrorDialog->message($ErrMsg); + return "ERROR"; + } + + my $tmp = "L".$i."CK"; + $All{$tmp}=sprintf("%6.2f",1.0); + + my $Sum = 0; + foreach (keys %LElComp) { + $Sum=$Sum+$LElComp{$_}; + } + if ($Sum==0) {$Sum=1;} + +# print STDOUT "Layer: ".$i."\n"; +# print STDOUT "Composition: ".$Comp."\n"; + + my @Els = keys %LElComp; + + for (my $NEl=1;$NEl<=5;$NEl++) { + my $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 $El030 = 30; + if ($El eq "") { $El030 = 0.0;} +# print STDOUT "$El, ElC=$ElC ElZ=$ElZ ElW=$ElW ElE=$ElE\n"; + $All{$LEkey."Z".$NEl}=sprintf("%8.4f",$ElZ); + $All{$LEkey."W".$NEl}=sprintf("%8.4f",$ElW); + $All{$LEkey."C".$NEl}=sprintf("%8.4f",$ElC); + $All{$LEkey."E".$NEl}=sprintf("%8.4f",$ElE); + $All{"L".$i."030".$NEl}=sprintf("%8.4f",$El030); + + my $ElST = Chem::Stopicru($El); + my @ElSTs = split (/,/,$ElST); + my $j=1; + foreach (@ElSTs) { + $LEkey = "L".$i."ELST".$NEl.$j; + $j++; + $All{$LEkey}=sprintf("%11.6f",$_); + } + } + } + + foreach my $key (keys %All) { +# print $key,$All{$key},"\n"; + if ($All{$key} ne ""){ + $TemplateFile =~ s/$key/$All{$key}/; +# Seed repeats three times + if ($key eq "Seed") { $TemplateFile =~ s/$key/$All{$key}/g;} + } + } + return $TemplateFile; + +} + +sub StartSequenceOne +{ + + my %All = CollectValues(); + my @SValues=(); + my $cmd=""; +# Create a subdirectory where all input/output files are saved + $cmd="mkdir ".$All{"Path"}; + system($cmd); +# Cleanup from old files + system("rm -f ausgabe*"); + + if ($All{"ScanSeq"}) { +# For a scan + $All{"ERadio"}=ERadio->isChecked(); + $All{"SigERadio"}=SigERadio->isChecked(); + $All{"NProjRadio"}=NProjRadio->isChecked(); + $All{"dRadio"}=dRadio->isChecked(); + $All{"ScandL"}=ScandL->text(); + $All{"ListRadio"}=ListRadio->isChecked(); + $All{"LoopRadio"}=LoopRadio->isChecked(); + $All{"ScanList"}=ScanList->text(); + $All{"SFrom"}=SFrom->text(); + $All{"STo"}=STo->text(); + $All{"SStep"}=SStep->text(); + if ($All{"ListRadio"}) { + @SValues=split(/,/,$All{"ScanList"}); + } elsif ($All{"LoopRadio"}) { + for (my $Val=$All{"SFrom"};$Val<=$All{"STo"};$Val=$Val+$All{"SStep"}) { + @SValues=(@SValues,$Val); + } + } + + my $ScanName = ""; + if ($All{"ERadio"}) { + $ScanName = "E"; + } elsif ($All{"SigERadio"}) { + $ScanName = "SigE"; + } elsif ($All{"NProjRadio"}) { + $ScanName = "NProj"; + } elsif ($All{"dRadio"}) { + $ScanName = "Ld".$All{"ScandL"}; + } + + my $ScanAttrib = child($ScanName); + my $Progress=0; + foreach (@SValues) { + $Progress=$Progress+100/$#SValues; + $ScanAttrib->setText($_); + my $eingabe1=CreateInpFile(); + if ($eingabe1 eq "ERROR") {return 0;} + my $FILENAME=$All{"FNPre"}."_".$ScanName.$_; + open (INPF,q{>}, "$FILENAME.inp" ); + print INPF $eingabe1; + close(INPF); +# Use windoz version +# system("cp $FILENAME.inp eingabe1.inp; wine TrimSP7L.exe"); +# Use Linux version + system("cp $FILENAME.inp eingabe1.inp; trimsp7l"); + Progress->setProgress($Progress); + foreach ("err","out","rge") { + system("mv -f ausgabe1.$_ $FILENAME.$_"); + } + $cmd="mv -f $FILENAME.* ".$All{"Path"}; + system($cmd); + } + } else { +# For a single run + my $eingabe1=CreateInpFile(); + if ($eingabe1 eq "ERROR") {return 0;} + my $FILENAME=$All{"FNPre"}; + open (INPF,q{>}, "$FILENAME.inp" ); + print INPF $eingabe1; + close(INPF); +# Use windoz version +# system("cp $FILENAME.inp eingabe1.inp; wine TrimSP7L.exe"); +# Use Linux version + system("cp $FILENAME.inp eingabe1.inp; trimsp7l"); + foreach ("err","out","rge") { + system("mv -f ausgabe1.$_ $FILENAME.$_"); + } + $cmd="mv -f $FILENAME.* ".$All{"Path"}; + system($cmd); + } +# Move the fort.33 file into the subdirectory and change its name + $cmd="mv -f fort.33 ".$All{"Path"}." ".$All{"FNPre"}."_Seq_Results.dat"; + system($cmd); + return 1; + +} + +1; + + +package main; + +use Qt; +use TrimSPGUI; + +my $a = Qt::Application(\@ARGV); +my $w = TrimSPGUI; +$a->setMainWidget($w); +$w->show; +exit $a->exec; diff --git a/trimsp/TrimSPGUI/TrimSPGUItabs.ui b/trimsp/TrimSPGUI/TrimSPGUItabs.ui new file mode 100755 index 0000000..8402234 --- /dev/null +++ b/trimsp/TrimSPGUI/TrimSPGUItabs.ui @@ -0,0 +1,2108 @@ + +TrimSPGUI + + + TrimSPGUI + + + + 0 + 0 + 716 + 547 + + + + + 5 + 5 + 1 + 1 + + + + + 550 + 500 + + + + TrimSPGUI + + + true + + + true + + + true + + + true + + + + Progress + + + + 0 + 525 + 715 + 20 + + + + WinPanel + + + + + tabs + + + + 0 + 0 + 715 + 525 + + + + + LayersTab + + + Layers + + + + ProjParam + + + + 460 + 0 + 250 + 290 + + + + Projectile parameters + + + + layout8 + + + + 5 + 25 + 240 + 260 + + + + + unnamed + + + 0 + + + 0 + + + + layout7 + + + + unnamed + + + + textLabel1 + + + Projectile + + + lineEdit3 + + + + + + Muon + + + + + Li8 + + + + + B12 + + + + ProjType + + + + 0 + 0 + 0 + 0 + + + + Choose the projectile type. + + + + + + + layout6 + + + + unnamed + + + + layout5 + + + + unnamed + + + 0 + + + 0 + + + + NLabel + + + + 5 + 5 + 0 + 0 + + + + Number of projectiles + + + lineEdit3_4 + + + + + z0Label + + + Starting depth [nm] + + + lineEdit3_5 + + + + + dzLabel + + + Depth increment [nm] + + + lineEdit3_5 + + + + + ELabel + + + Energy [eV] + + + lineEdit3_6 + + + + + SigELabel + + + Energy sigma [eV] + + + lineEdit3_7 + + + + + AlbleLabel + + + Angle [deg] + + + lineEdit3_8 + + + + + SigAngleLabel + + + Angle sigma [deg] + + + lineEdit3_9 + + + + + SeedLabel + + + Random seed + + + lineEdit3 + + + + + + + layout4 + + + + unnamed + + + 0 + + + + NProj + + + + 7 + 0 + 0 + 0 + + + + + 32767 + 32767 + + + + 10000 + + + The number of projectiles to be implanted in the sample. Larger number better statistics. + + + + + z0 + + + + 32767 + 32767 + + + + 0.0 + + + Consider implanted projectiles starting from this depth. + + + + + dz + + + 2.0 + + + The steps in implantation depth at which the number of stopped projectiles will be counted. Smaller number for finer implantation histogram. + + + + + E + + + 2000 + + + The average implantation energy of the projectile. + + + + + SigE + + + 450 + + + The spread in implantation energy. For muons this is typically 400-450 eV. For Li8 this is practically zero. + + + + + Angle + + + 0 + + + The average implantation angle. + + + + + SigAngle + + + 15 + + + The spread in implantation angles. + + + + + Seed + + + 78741 + + + The random number generator seed. + + + + + + + + + + + + groupBox15 + + + + 460 + 290 + 250 + 120 + + + + File Names + + + + layout30 + + + + 5 + 20 + 240 + 90 + + + + + unnamed + + + 0 + + + 0 + + + + textLabelFN + + + File names prefix + + + + + FNPre + + + SrTiO3 + + + The names of the saved files will start with this prefix. + + + + + textLabelPath + + + Save in subdirectory + + + + + Path + + + Muon_SrTiO3 + + + This is the path were the input/output files will be stored. + + + + + + + + Start + + + + 595 + 435 + 80 + 30 + + + + + 7 + 7 + 0 + 0 + + + + Start + + + + + Help + + + + 505 + 435 + 80 + 30 + + + + + 7 + 7 + 0 + 0 + + + + Help + + + + + groupBox1 + + + + 0 + 0 + 460 + 500 + + + + GroupBoxPanel + + + Sunken + + + Layers + + + + layout27 + + + + 5 + 20 + 450 + 465 + + + + + unnamed + + + + layout19 + + + + unnamed + + + + textLabel1_4 + + + Number of Layers + + + + + NL + + + 7 + + + 1 + + + Select the number of the layers of your structure (maximum 7 layers). + + + + + spacer2 + + + Horizontal + + + Expanding + + + + 251 + 20 + + + + + + + + layout26 + + + + unnamed + + + + textLabel2_4 + + + + 0 + 1 + 0 + 0 + + + + Composition + + + Chemical formula + + + + + spacer1 + + + Horizontal + + + Fixed + + + + 101 + 20 + + + + + + textLabel3 + + + + 1 + 5 + 0 + 0 + + + + Density [g/cm<sup>3</sup>] + + + + + textLabel4 + + + Thickness [nm] + + + + + + + BoxL1 + + + Layer 1 + + + + L1Comp + + + + 10 + 20 + 180 + 25 + + + + SrTiO3 + + + Chemical formula of L1 + + + Insert the chemical formula here as you would write it. + + + + + L1rho + + + + 200 + 20 + 111 + 25 + + + + 5.12 + + + Insert the density of the layer here. + + + + + L1d + + + + 320 + 20 + 105 + 25 + + + + + 0 + 0 + 0 + 0 + + + + 200 + + + Insert the thickness of the layer here. + + + + + + BoxL2 + + + false + + + Layer 2 + + + + L2d + + + + 320 + 20 + 105 + 25 + + + + + 0 + 0 + 0 + 0 + + + + + + L2Comp + + + + 10 + 20 + 180 + 25 + + + + + + L2rho + + + + 200 + 20 + 111 + 25 + + + + + + + BoxL3 + + + false + + + Layer 3 + + + + L3d + + + + 320 + 20 + 105 + 25 + + + + + 0 + 0 + 0 + 0 + + + + + + L3Comp + + + + 10 + 20 + 180 + 25 + + + + + + L3rho + + + + 200 + 20 + 111 + 25 + + + + + + + BoxL4 + + + false + + + Layer 4 + + + + L4d + + + + 320 + 20 + 105 + 25 + + + + + 0 + 0 + 0 + 0 + + + + + + L4Comp + + + + 10 + 20 + 180 + 25 + + + + + + L4rho + + + + 200 + 20 + 111 + 25 + + + + + + + BoxL5 + + + false + + + Layer 5 + + + + L5d + + + + 320 + 20 + 105 + 25 + + + + + 0 + 0 + 0 + 0 + + + + + + L5Comp + + + + 10 + 20 + 180 + 25 + + + + + + L5rho + + + + 200 + 20 + 111 + 25 + + + + + + + BoxL6 + + + false + + + Layer 6 + + + + L6d + + + + 320 + 20 + 105 + 25 + + + + + 0 + 0 + 0 + 0 + + + + + + L6Comp + + + + 10 + 20 + 180 + 25 + + + + + + L6rho + + + + 200 + 20 + 111 + 25 + + + + + + + BoxL7 + + + false + + + Layer 7 + + + + L7d + + + + 320 + 20 + 105 + 25 + + + + + 0 + 0 + 0 + 0 + + + + + + L7Comp + + + + 10 + 20 + 180 + 25 + + + + + + L7rho + + + + 200 + 20 + 111 + 25 + + + + + + + + + + + AddParTab + + + Additional Parameters + + + + AddParam + + + + 0 + 0 + 250 + 210 + + + + Additional parameters + + + + textLabelEF + + + + 12 + 26 + 63 + 25 + + + + EF + + + + + textLabelESB + + + + 12 + 51 + 63 + 25 + + + + ESB + + + + + textLabelSHEATH + + + + 12 + 76 + 63 + 25 + + + + SHEATH + + + + + textLabelERC + + + + 12 + 101 + 63 + 26 + + + + ERC + + + + + textLabelRD + + + + 12 + 127 + 63 + 25 + + + + RD + + + + + KDEE2 + + + + 185 + 100 + 52 + 26 + + + + 3 + + + 1 + + + 3 + + + + + KDEE1 + + + + 185 + 75 + 52 + 26 + + + + 5 + + + 1 + + + 4 + + + + + textLabelIRL + + + + 131 + 177 + 53 + 25 + + + + IRL + + + + + textLabelIPOTR + + + + 131 + 152 + 53 + 25 + + + + IPOTR + + + + + textLabelIPOT + + + + 131 + 126 + 53 + 26 + + + + IPOT + + + + + textLabelKDEE2 + + + + 131 + 101 + 53 + 25 + + + + KDEE2 + + + + + textLabelKDEE1 + + + + 131 + 76 + 53 + 25 + + + + KDEE1 + + + + + textLabelKK0R + + + + 131 + 51 + 53 + 25 + + + + KK0R + + + + + textLabelCA + + + + 12 + 152 + 63 + 25 + + + + CA + + + + + textLabelEmpty + + + false + + + + 12 + 175 + 63 + 25 + + + + + + + + + lineEditEmpty + + + false + + + + 77 + 175 + 52 + 25 + + + + + 7 + 7 + 0 + 0 + + + + + + + + + KK0R + + + + 185 + 50 + 52 + 26 + + + + 4 + + + 0 + + + 2 + + + + + KK0 + + + + 185 + 25 + 52 + 26 + + + + 4 + + + 0 + + + 2 + + + + + textLabelKK0 + + + + 131 + 25 + 53 + 25 + + + + KK0 + + + + + EF + + + + 77 + 26 + 52 + 25 + + + + + 7 + 7 + 0 + 0 + + + + 0.5 + + + + + SHEATH + + + + 77 + 76 + 52 + 25 + + + + + 7 + 7 + 0 + 0 + + + + 0.0 + + + + + ERC + + + + 77 + 101 + 52 + 26 + + + + + 7 + 7 + 0 + 0 + + + + 0.0 + + + + + RD + + + + 77 + 127 + 52 + 25 + + + + + 7 + 7 + 0 + 0 + + + + 50.0 + + + + + CA + + + + 77 + 152 + 52 + 25 + + + + + 7 + 7 + 0 + 0 + + + + 1.0 + + + + + ESB + + + + 77 + 51 + 52 + 25 + + + + + 7 + 7 + 0 + 0 + + + + 0.0 + + + + + IPOT + + + + 185 + 125 + 52 + 26 + + + + 3 + + + 1 + + + 2 + + + + + IPOTR + + + + 185 + 150 + 52 + 26 + + + + 3 + + + 1 + + + + + IRL + + + + 186 + 176 + 52 + 26 + + + + 1 + + + + + + + ScansTab + + + Scans (Disbaled) + + + + ScanSeq + + + + 0 + 0 + 500 + 165 + + + + Scan sequence + + + true + + + false + + + Select to scan a certain parameter in the simulation and produce multiple output files for each value of this parameter. + + + + ScanMode + + + + 230 + 20 + 265 + 140 + + + + Scan mode + + + false + + + false + + + true + + + true + + + + layout3 + + + + 11 + 103 + 240 + 23 + + + + + unnamed + + + 0 + + + 0 + + + + textLabel2 + + + From + + + + + SFrom + + + + 5 + 5 + 0 + 0 + + + + 1000 + + + + + textLabel2_2 + + + To + + + + + STo + + + + 5 + 5 + 0 + 0 + + + + 28000 + + + + + textLabel2_2_2_2 + + + Step + + + + + SStep + + + + 5 + 5 + 0 + 0 + + + + 1000 + + + + + + + LoopRadio + + + + 10 + 75 + 240 + 22 + + + + Loop + + + true + + + The values of the scanned parameter are evenly spaced. + + + + + ListRadio + + + + 10 + 20 + 240 + 22 + + + + List of values + + + The values of the scanned parameter are from a list. + + + + + ScanList + + + + 10 + 45 + 240 + 23 + + + + 1000,6000,10000 + + + A list of values to scan (separated by commas). + + + + + + buttonGroup2 + + + + 10 + 20 + 216 + 140 + + + + Scan Parameter + + + true + + + + ERadio + + + + 4 + 22 + 211 + 24 + + + + Energy + + + true + + + Scan implantation energy. + + + + + SigERadio + + + + 4 + 47 + 211 + 24 + + + + Energy sigma + + + Scan spread in implantation energy. + + + + + NProjRadio + + + + 4 + 72 + 211 + 24 + + + + Projectile number + + + Scan the number of implanted projectiles. + + + + + dRadio + + + + 5 + 99 + 153 + 24 + + + + Thickness of Layer + + + Scan the thickness of the selected layer. + + + + + ScandL + + + + 158 + 98 + 56 + 26 + + + + 7 + + + 1 + + + This is the layer whose thickness will be scanned + + + + + + + + + + ScanSeq + toggled(bool) + TrimSPGUI + ToggleScanSingle() + + + Help + clicked() + TrimSPGUI + OpenHelpWindow() + + + Start + clicked() + TrimSPGUI + StartSequenceOne() + + + ERadio + toggled(bool) + TrimSPGUI + ToggleScanSingle() + + + SigERadio + toggled(bool) + TrimSPGUI + ToggleScanSingle() + + + NProjRadio + toggled(bool) + TrimSPGUI + ToggleScanSingle() + + + ScandL + valueChanged(int) + TrimSPGUI + ToggleScanSingle() + + + dRadio + toggled(bool) + TrimSPGUI + ToggleScanSingle() + + + NL + valueChanged(int) + TrimSPGUI + PrepLayers() + + + ProjType + activated(int) + TrimSPGUI + ProjSmartDefaults() + + + + TrimSPGUItabs.ui.h + + + TrimSPGUIHelp; + + + ToggleScanSingle() + PrepLayers() + ProjSmartDefaults() + OpenHelpWindow() + CollectValues() + CreateInpFile() + StartSequenceOne() + + + diff --git a/trimsp/TrimSPGUI/TrimSPGUItabs.ui.h b/trimsp/TrimSPGUI/TrimSPGUItabs.ui.h new file mode 100755 index 0000000..fe77ad2 --- /dev/null +++ b/trimsp/TrimSPGUI/TrimSPGUItabs.ui.h @@ -0,0 +1,484 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you want to add, delete, or rename functions or slots, use +** Qt Designer to update this file, preserving your code. +** +** You should not define a constructor or destructor in this file. +** Instead, write your code in functions called init() and destroy(). +** These will automatically be called by the form's constructor and +** destructor. +*****************************************************************************/ + + +void TrimSPGUI::ToggleScanSingle() +{ + # Toggle between scan/single run mode + +# First collect some information + my %All=(); + $All{"ScanSeq"}=ScanSeq->isChecked(); + $All{"ERadio"}=ERadio->isChecked(); + $All{"SigERadio"}=SigERadio->isChecked(); + $All{"NProjRadio"}=NProjRadio->isChecked(); + $All{"dRadio"}=dRadio->isChecked(); + $All{"ScandL"}=ScandL->text(); + +# Enable everything + E->setDisabled(0); + E->setText("2000"); + SigE->setDisabled(0); + SigE->setText("450"); + NProj->setDisabled(0); + NProj->setText("10000"); + for (my $i=1;$i<=7;$i++) { + my $LayerName = "L".$i."d"; + my $LayerAttrib = child($LayerName); + $LayerAttrib->setDisabled(0); + } + + if ($All{"ScanSeq"}==1) { +# But if we are in scan mode disable the appropriate box + if ($All{"ERadio"}) { + E->setDisabled(1); + E->setText(""); + } elsif ($All{"SigERadio"}) { + SigE->setDisabled(1); + SigE->setText(""); + } elsif ($All{"NProjRadio"}) { + NProj->setDisabled(1); + NProj->setText(""); + } elsif($All{"dRadio"}) { + my $LayerName = "L".$All{"ScandL"}."d"; + my $LayerAttrib = child($LayerName); + $LayerAttrib->setDisabled(1); + $LayerAttrib->setText(""); + } +# and change title of tab to say enabled + tabs->changeTab( ScansTab, trUtf8("Scans (Enabled)") ); + } else { +# Otherwise the title of the tab says disabled + tabs->changeTab( ScansTab, trUtf8("Scans (Disabled)") ); + } +} + + +void TrimSPGUI::PrepLayers() +{ + my %All=(); + $All{"NL"}=NL->text(); + +# Enable layers up to required and disable the rest + for (my $i=1;$i<=7;$i++) { + my $LayerName = "BoxL".$i; + my $LayerAttrib = child($LayerName); + if ($i<=$All{"NL"}) { + $LayerAttrib->setDisabled(0); + } else { + $LayerAttrib->setDisabled(1); + } + } +} + + +void TrimSPGUI::ProjSmartDefaults() +{ + my %All=(); +# Get typeof projectile + $All{"ProjType"}=ProjType->currentText(); + + if ($All{"ProjType"} eq "Muon") { +# For a muon set Sigma E=450 eV and Sigman angle=15 degrees by default + SigE->setText("450"); + SigAngle->setText("15"); + } elsif ( $All{"ProjType"} eq "Li8") { +# For Li8 set Sigma E=0 eV and Sigam angle=0 degrees by default + SigE->setText("0"); + SigAngle->setText("0"); + } +} + + +void TrimSPGUI::OpenHelpWindow() +{ + use trimhelp; + my $w=trimhelp::NEW(); + $w->show; +# $w->setFocus(); +# $w->setActiveWindow(); +# $w->raise(); +} + +void TrimSPGUI::CollectValues() +{ +# This subroutine returns a hash with all the values collected from the GUI. + my %All=(); + $All{"NL"}=NL->text(); +# Collect layers parameters + for (my $i=1;$i<=$All{"NL"};$i++) { + my $LComp = "L".$i."Comp"; + my $Lrho="L".$i."rho"; + my $Ld="L".$i."d"; + my $LCompAttrib = child($LComp); + my $LrhoAttrib=child($Lrho); + my $LdAttrib=child($Ld); + $All{"$LComp"}=$LCompAttrib->text(); + $All{"$Lrho"}=$LrhoAttrib->text(); + $All{"$Ld"}=$LdAttrib->text(); + } + +# Collect projectile parameters + $All{"ProjType"}=ProjType->currentText(); + $All{"NProj"}=NProj->text(); + $All{"z0"}=z0->text(); + $All{"dz"}=dz->text(); + $All{"E"}=E->text(); + $All{"SigE"}=SigE->text(); + $All{"Angle"}=Angle->text(); + $All{"SigAngle"}=SigAngle->text(); + $All{"Seed"}=Seed->text(); +# Format projectile parameters + $All{"NProj"}=sprintf("%8d",$All{"NProj"}); + $All{"z0"}=sprintf("%6.2f",$All{"z0"}); + $All{"dz"}=sprintf("%6.2f",$All{"dz"}); + $All{"E"}=sprintf("%11.2f",$All{"E"}); + $All{"SigE"}=sprintf("%8.2f",$All{"SigE"}); + $All{"Angle"}=sprintf("%8.2f",$All{"Angle"}); + $All{"SigAngle"}=sprintf("%8.2f",$All{"SigAngle"}); + $All{"Seed"}=sprintf("%6.0f.",$All{"Seed"}); + + +# Collect the additional parameters + $All{"EF"}=EF->text(); + $All{"ESB"}=ESB->text(); + $All{"SHEATH"}=SHEATH->text(); + $All{"ERC"}=ERC->text(); + $All{"RD"}=RD->text(); + $All{"CA"}=CA->text(); + $All{"KK0"}=KK0->text(); + $All{"KK0R"}=KK0R->text(); + $All{"KDEE1"}=KDEE1->text(); + $All{"KDEE2"}=KDEE2->text(); + $All{"IPOT"}=IPOT->text(); + $All{"IPOTR"}=IPOTR->text(); + $All{"IRL"}=IRL->text(); +# format additional parameters + $All{"EF"}=sprintf("%8.2f",$All{"EF"}); + $All{"ESB"}=sprintf("%8.2f",$All{"ESB"}); + $All{"SHEATH"}=sprintf("%8.2f",$All{"SHEATH"}); + $All{"ERC"}=sprintf("%8.2f",$All{"ERC"}); + $All{"RD"}=sprintf("%5.0f.",$All{"RD"}); + $All{"CA"}=sprintf("%6.2f",$All{"CA"}); + $All{"KK0"}=sprintf("%3d",$All{"KK0"}); + $All{"KK0R"}=sprintf("%3d",$All{"KK0R"}); + $All{"KDEE1"}=sprintf("%3d",$All{"KDEE1"}); + $All{"KDEE2"}=sprintf("%3d",$All{"KDEE2"}); + $All{"IPOT"}=sprintf("%3d",$All{"IPOT"}); + $All{"IPOTR"}=sprintf("%3d",$All{"IPOTR"}); + $All{"IRL"}=sprintf("%2d",$All{"IRL"}); + +# Filenames etc. + $All{"FNPre"}=FNPre->text(); + $All{"Path"}=Path->text(); + +# Scan parameters only if selected + $All{"ScanSeq"}=ScanSeq->isChecked(); + if ($All{"ScanSeq"}) { + $All{"ERadio"}=ERadio->isChecked(); + $All{"SigERadio"}=SigERadio->isChecked(); + $All{"NProjRadio"}=NProjRadio->isChecked(); + $All{"dRadio"}=dRadio->isChecked(); + $All{"ScandL"}=ScandL->text(); + $All{"ListRadio"}=ListRadio->isChecked(); + $All{"LoopRadio"}=LoopRadio->isChecked(); + $All{"ScanList"}=ScanList->text(); + $All{"SFrom"}=SFrom->text(); + $All{"STo"}=STo->text(); + $All{"SStep"}=SStep->text(); + } + +# Return values to caller + return %All; +} + + +void TrimSPGUI::CreateInpFile() +{ +# use lib "$ENV{HOME}/Projects/TrimSPGUI/Chem"; + use Chem; +# The proper way I think is not to have scan sequences implimented here +# but rather call this multiple times to generate the scan +# To resolve this, the function CreateInpFile will expect a unique thickness for each layer, +# one energy value, one energy sigma and one projectile number. +# These will be stored in keys L1/2/3/4/5/6/7d, E, SigE and NProj, respectively. + +# Chemical formulas will be parsed on the fly for each layer. However, we will check if +# all the layers have inputs for coposition, thickness and density. If not fail and crash :) + +# Values of Z,A as well as other needed parameters are obtained from Chem.pm. + +# This is the form of the input file: + my $TemplateFile= + " ProjZ ProjAM E SigE Angle SigAngle EF ESB SHEATH ERC + NProj Seed Seed Seed z0 RD dz CA KK0 KK0R KDEE1 KDEE2 IPOT IPOTR IRL + L1d L2d L3d L4d L5d L6d L7d L1rho L2rho L3rho L4rho L5rho L6rho L7rho L1CK L2CK L3CK L4CK L5CK L6CK L7CK + L1ELZ1 L1ELZ2 L1ELZ3 L1ELZ4 L1ELZ5 + L1ELW1 L1ELW2 L1ELW3 L1ELW4 L1ELW5 + L1ELC1 L1ELC2 L1ELC3 L1ELC4 L1ELC5 + L1ELE1 L1ELE2 L1ELE3 L1ELE4 L1ELE5 + L10301 L10302 L10303 L10304 L10305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L1ELST11 L1ELST21 L1ELST31 L1ELST41 L1ELST51 + L1ELST12 L1ELST22 L1ELST32 L1ELST42 L1ELST52 + L1ELST13 L1ELST23 L1ELST33 L1ELST43 L1ELST53 + L1ELST14 L1ELST24 L1ELST34 L1ELST44 L1ELST54 + L1ELST15 L1ELST25 L1ELST35 L1ELST45 L1ELST55 + L2ELZ1 L2ELZ2 L2ELZ3 L2ELZ4 L2ELZ5 + L2ELW1 L2ELW2 L2ELW3 L2ELW4 L2ELW5 + L2ELC1 L2ELC2 L2ELC3 L2ELC4 L2ELC5 + L2ELE1 L2ELE2 L2ELE3 L2ELE4 L2ELE5 + L20301 L20302 L20303 L20304 L20305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L2ELST11 L2ELST21 L2ELST31 L2ELST41 L2ELST51 + L2ELST12 L2ELST22 L2ELST32 L2ELST42 L2ELST52 + L2ELST13 L2ELST23 L2ELST33 L2ELST43 L2ELST53 + L2ELST14 L2ELST24 L2ELST34 L2ELST44 L2ELST54 + L2ELST15 L2ELST25 L2ELST35 L2ELST45 L2ELST55 + L3ELZ1 L3ELZ2 L3ELZ3 L3ELZ4 L3ELZ5 + L3ELW1 L3ELW2 L3ELW3 L3ELW4 L3ELW5 + L3ELC1 L3ELC2 L3ELC3 L3ELC4 L3ELC5 + L3ELE1 L3ELE2 L3ELE3 L3ELE4 L3ELE5 + L30301 L30302 L30303 L30304 L30305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L3ELST11 L3ELST21 L3ELST31 L3ELST41 L3ELST51 + L3ELST12 L3ELST22 L3ELST32 L3ELST42 L3ELST52 + L3ELST13 L3ELST23 L3ELST33 L3ELST43 L3ELST53 + L3ELST14 L3ELST24 L3ELST34 L3ELST44 L3ELST54 + L3ELST15 L3ELST25 L3ELST35 L3ELST45 L3ELST55 + L4ELZ1 L4ELZ2 L4ELZ3 L4ELZ4 L4ELZ5 + L4ELW1 L4ELW2 L4ELW3 L4ELW4 L4ELW5 + L4ELC1 L4ELC2 L4ELC3 L4ELC4 L4ELC5 + L4ELE1 L4ELE2 L4ELE3 L4ELE4 L4ELE5 + L40301 L40302 L40303 L40304 L40305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L4ELST11 L4ELST21 L4ELST31 L4ELST41 L4ELST51 + L4ELST12 L4ELST22 L4ELST32 L4ELST42 L4ELST52 + L4ELST13 L4ELST23 L4ELST33 L4ELST43 L4ELST53 + L4ELST14 L4ELST24 L4ELST34 L4ELST44 L4ELST54 + L4ELST15 L4ELST25 L4ELST35 L4ELST45 L4ELST55 + L5ELZ1 L5ELZ2 L5ELZ3 L5ELZ4 L5ELZ5 + L5ELW1 L5ELW2 L5ELW3 L5ELW4 L5ELW5 + L5ELC1 L5ELC2 L5ELC3 L5ELC4 L5ELC5 + L5ELE1 L5ELE2 L5ELE3 L5ELE4 L5ELE5 + L50301 L50302 L50303 L50304 L50305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L5ELST11 L5ELST21 L5ELST31 L5ELST41 L5ELST51 + L5ELST12 L5ELST22 L5ELST32 L5ELST42 L5ELST52 + L5ELST13 L5ELST23 L5ELST33 L5ELST43 L5ELST53 + L5ELST14 L5ELST24 L5ELST34 L5ELST44 L5ELST54 + L5ELST15 L5ELST25 L5ELST35 L5ELST45 L5ELST55 + L6ELZ1 L6ELZ2 L6ELZ3 L6ELZ4 L6ELZ5 + L6ELW1 L6ELW2 L6ELW3 L6ELW4 L6ELW5 + L6ELC1 L6ELC2 L6ELC3 L6ELC4 L6ELC5 + L6ELE1 L6ELE2 L6ELE3 L6ELE4 L6ELE5 + L60301 L60302 L60303 L60304 L60305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L6ELST11 L6ELST21 L6ELST31 L6ELST41 L6ELST51 + L6ELST12 L6ELST22 L6ELST32 L6ELST42 L6ELST52 + L6ELST13 L6ELST23 L6ELST33 L6ELST43 L6ELST53 + L6ELST14 L6ELST24 L6ELST34 L6ELST44 L6ELST54 + L6ELST15 L6ELST25 L6ELST35 L6ELST45 L6ELST55 + L7ELZ1 L7ELZ2 L7ELZ3 L7ELZ4 L7ELZ5 + L7ELW1 L7ELW2 L7ELW3 L7ELW4 L7ELW5 + L7ELC1 L7ELC2 L7ELC3 L7ELC4 L7ELC5 + L7ELE1 L7ELE2 L7ELE3 L7ELE4 L7ELE5 + L70301 L70302 L70303 L70304 L70305 + 0.0000 0.0000 0.0000 0.0000 0.0000 + L7ELST11 L7ELST21 L7ELST31 L7ELST41 L7ELST51 + L7ELST12 L7ELST22 L7ELST32 L7ELST42 L7ELST52 + L7ELST13 L7ELST23 L7ELST33 L7ELST43 L7ELST53 + L7ELST14 L7ELST24 L7ELST34 L7ELST44 L7ELST54 + L7ELST15 L7ELST25 L7ELST35 L7ELST45 L7ELST55 + "; + +# Get values from form + my %All = CollectValues(); + my $ProjType=$All{"ProjType"}; + $All{"ProjZ"}=sprintf("%6.2f",Chem::Zof($ProjType)); + $All{"ProjAM"}=sprintf("%6.2f",Chem::Massof($ProjType)); + + my $Check=0; +# Loop over layers an create appropriate values + for (my $i=1;$i<=7;$i++){ + $Check=0; +# Composition of layers + my $LComp="L".$i."Comp"; + my $LCompAttrib = child($LComp); + my $Comp = $LCompAttrib->text(); + my %LElComp=Chem::parse_formula($Comp); + if ($Comp eq "") {$Check++;} + +# Densities of layers + my $Lrho="L".$i."rho"; + my $LrhoAttrib = child($Lrho); + my $rho = $LrhoAttrib->text(); + $All{$Lrho}=sprintf("%6.2f",$rho); + if ($rho eq "") {$Check++;} + +# Thickness of layers + my $Ld ="L".$i."d"; + my $LdAttrib = child($Ld); + my $d = $LdAttrib->text(); + $All{$Ld}=sprintf("%8.2f",$d); + if ($d eq "") {$Check++;} + +# Sanity check, is the layer supposed to have value? are they all there? + if ($Check!=0 && $i<=$All{"NL"}) { + my $ErrMsg="Error: Layer $i is empty. Expecting it to be defined!\n"; + print STDERR $ErrMsg; +# my $ErrorDialog = Qt::ErrorMessage(TrimSPGUI); +# $ErrorDialog->message($ErrMsg); + return "ERROR"; + } + + my $tmp = "L".$i."CK"; + $All{$tmp}=sprintf("%6.2f",1.0); + + my $Sum = 0; + foreach (keys %LElComp) { + $Sum=$Sum+$LElComp{$_}; + } + if ($Sum==0) {$Sum=1;} + +# print STDOUT "Layer: ".$i."\n"; +# print STDOUT "Composition: ".$Comp."\n"; + + my @Els = keys %LElComp; + + for (my $NEl=1;$NEl<=5;$NEl++) { + my $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 $El030 = 30; + if ($El eq "") { $El030 = 0.0;} +# print STDOUT "$El, ElC=$ElC ElZ=$ElZ ElW=$ElW ElE=$ElE\n"; + $All{$LEkey."Z".$NEl}=sprintf("%8.4f",$ElZ); + $All{$LEkey."W".$NEl}=sprintf("%8.4f",$ElW); + $All{$LEkey."C".$NEl}=sprintf("%8.4f",$ElC); + $All{$LEkey."E".$NEl}=sprintf("%8.4f",$ElE); + $All{"L".$i."030".$NEl}=sprintf("%8.4f",$El030); + + my $ElST = Chem::Stopicru($El); + my @ElSTs = split (/,/,$ElST); + my $j=1; + foreach (@ElSTs) { + $LEkey = "L".$i."ELST".$NEl.$j; + $j++; + $All{$LEkey}=sprintf("%11.6f",$_); + } + } + } + + foreach my $key (keys %All) { +# print $key,$All{$key},"\n"; + if ($All{$key} ne ""){ + $TemplateFile =~ s/$key/$All{$key}/; +# Seed repeats three times + if ($key eq "Seed") { $TemplateFile =~ s/$key/$All{$key}/g;} + } + } + return $TemplateFile; +} + + +void TrimSPGUI::StartSequenceOne() +{ + my %All = CollectValues(); + my @SValues=(); + my $cmd=""; +# Create a subdirectory where all input/output files are saved + $cmd="mkdir ".$All{"Path"}; + system($cmd); +# Cleanup from old files + system("rm -f ausgabe*"); + + if ($All{"ScanSeq"}) { +# For a scan + $All{"ERadio"}=ERadio->isChecked(); + $All{"SigERadio"}=SigERadio->isChecked(); + $All{"NProjRadio"}=NProjRadio->isChecked(); + $All{"dRadio"}=dRadio->isChecked(); + $All{"ScandL"}=ScandL->text(); + $All{"ListRadio"}=ListRadio->isChecked(); + $All{"LoopRadio"}=LoopRadio->isChecked(); + $All{"ScanList"}=ScanList->text(); + $All{"SFrom"}=SFrom->text(); + $All{"STo"}=STo->text(); + $All{"SStep"}=SStep->text(); + if ($All{"ListRadio"}) { + @SValues=split(/,/,$All{"ScanList"}); + } elsif ($All{"LoopRadio"}) { + for (my $Val=$All{"SFrom"};$Val<=$All{"STo"};$Val=$Val+$All{"SStep"}) { + @SValues=(@SValues,$Val); + } + } + + my $ScanName = ""; + if ($All{"ERadio"}) { + $ScanName = "E"; + } elsif ($All{"SigERadio"}) { + $ScanName = "SigE"; + } elsif ($All{"NProjRadio"}) { + $ScanName = "NProj"; + } elsif ($All{"dRadio"}) { + $ScanName = "Ld".$All{"ScandL"}; + } + + my $ScanAttrib = child($ScanName); + my $Progress=0; + foreach (@SValues) { + $Progress=$Progress+100/$#SValues; + $ScanAttrib->setText($_); + my $eingabe1=CreateInpFile(); + if ($eingabe1 eq "ERROR") {return 0;} + my $FILENAME=$All{"FNPre"}."_".$ScanName.$_; + open (INPF,q{>}, "$FILENAME.inp" ); + print INPF $eingabe1; + close(INPF); +# Use windoz version +# system("cp $FILENAME.inp eingabe1.inp; wine TrimSP7L.exe"); +# Use Linux version + system("cp $FILENAME.inp eingabe1.inp; trimsp7l"); + Progress->setProgress($Progress); + foreach ("err","out","rge") { + system("mv -f ausgabe1.$_ $FILENAME.$_"); + } + $cmd="mv -f $FILENAME.* ".$All{"Path"}; + system($cmd); + } + } else { +# For a single run + my $eingabe1=CreateInpFile(); + if ($eingabe1 eq "ERROR") {return 0;} + my $FILENAME=$All{"FNPre"}; + open (INPF,q{>}, "$FILENAME.inp" ); + print INPF $eingabe1; + close(INPF); +# Use windoz version +# system("cp $FILENAME.inp eingabe1.inp; wine TrimSP7L.exe"); +# Use Linux version + system("cp $FILENAME.inp eingabe1.inp; trimsp7l"); + foreach ("err","out","rge") { + system("mv -f ausgabe1.$_ $FILENAME.$_"); + } + $cmd="mv -f $FILENAME.* ".$All{"Path"}; + system($cmd); + } +# Move the fort.33 file into the subdirectory and change its name + $cmd="mv -f fort.33 ".$All{"Path"}." ".$All{"FNPre"}."_Seq_Results.dat"; + system($cmd); + return 1; +}