TrimSPGUI with perl-qt3 fully functioning with the new simulation code with unlimited number of layers. Still needs some testing.

This commit is contained in:
salman 2013-04-04 12:02:43 +00:00
parent 9fbfe0f151
commit 4903617863
7 changed files with 561 additions and 1288 deletions

View File

@ -16,13 +16,13 @@ DIALECT =
prefix = /usr/local
OPS=-c $(DIALECT) $(WARN) $(DEBUG)
all : trimsp7l
all : trimspNL
trimsp7l : trimsp7l.F
trimsp7l : trimspNL.F
$(FC) -o $@ $<
clean:
rm -f *.o *~ \#* .#* trimsp7l
rm -f *.o *~ \#* .#* trimspNL
install:
mv trimsp7l $(prefix)/bin/.
mv trimspNL $(prefix)/bin/.

View File

@ -1,7 +1,7 @@
#!/bin/bash
# Copyright 2009 by Zaher Salman and the LEM Group.
export TRIMBIN=/usr/local/bin/trimsp7l
export TRIMBIN=/usr/local/bin/trimspNL
export PERLLIB=$HOME/LEM/simulation/trimsp/src/TrimSPGUI
perl $PERLLIB/TrimSPGUI.pl

View File

@ -1,12 +1,12 @@
[Layers]
NL=1
NL=2
L1Comp=SrTiO3
L1rho=5.12
L1d=200
L2Comp=
L2rho=
L2d=
L2Comp=LaAlO3
L2rho=6.7
L2d=200
L3Comp=
L3rho=
L3d=
@ -36,12 +36,14 @@ Seed= 78741.
[Files]
FNPre=SrTiO3
Path=./
Path=/tmp/.
[ScanSequence]
ScanSeq=
ERadio=1
SigERadio=
AngleRadio=
SigAngleRadio=
NProjRadio=
dRadio=
ListRadio=

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'TrimSPGUI.ui'
#
# Created: Wed Mar 13 15:36:56 2013
# Created: Thu Apr 4 13:53:16 2013
# by: The PerlQt User Interface Compiler (puic)
#
# WARNING! All changes made in this file will be lost!
@ -16,6 +16,7 @@ use Qt::isa qw(Qt::MainWindow);
use Qt::slots
ToggleScanSingle => [],
PrepLayers => [],
removeRowFromTable => [],
ProjSmartDefaults => [],
OpenHelpWindow => [],
CollectValues => [],
@ -36,40 +37,6 @@ use Qt::attributes qw(
Progress
tabs
LayersTab
groupBox1
textLabel1_4
NL
textLabel2_4
textLabel3
textLabel4
BoxL1
L1rho
L1d
L1Comp
BoxL2
L2rho
L2d
L2Comp
BoxL3
L3Comp
L3rho
L3d
BoxL4
L4Comp
L4rho
L4d
BoxL5
L5Comp
L5rho
L5d
BoxL6
L6Comp
L6rho
L6d
BoxL7
L7Comp
L7rho
L7d
ProjParam
textLabel1
ProjType
@ -97,6 +64,10 @@ use Qt::attributes qw(
Browse
Start
Quit
groupBox1
textLabel1_4
NL
LayerTable
AddParTab
AddParam
textLabelEF
@ -1319,161 +1290,26 @@ sub NEW
tabs = Qt::TabWidget(centralWidget(), "tabs");
tabs->setGeometry( Qt::Rect(11, 11, 714, 526) );
tabs->setSizePolicy( Qt::SizePolicy(4, 4, 0, 0, tabs->sizePolicy()->hasHeightForWidth()) );
LayersTab = Qt::Widget(tabs, "LayersTab");
groupBox1 = Qt::GroupBox(LayersTab, "groupBox1");
groupBox1->setGeometry( Qt::Rect(5, 0, 445, 485) );
groupBox1->setFrameShape( &Qt::GroupBox::GroupBoxPanel() );
groupBox1->setFrameShadow( &Qt::GroupBox::Sunken() );
my $LayoutWidget = Qt::Widget(LayersTab, '$LayoutWidget');
$LayoutWidget->setGeometry( Qt::Rect(455, 0, 250, 480) );
my $layout13 = Qt::VBoxLayout($LayoutWidget, 0, 0, '$layout13');
my $LayoutWidget = Qt::Widget(groupBox1, '$LayoutWidget');
$LayoutWidget->setGeometry( Qt::Rect(5, 20, 435, 460) );
my $layout27 = Qt::VBoxLayout($LayoutWidget, 11, 3, '$layout27');
ProjParam = Qt::GroupBox($LayoutWidget, "ProjParam");
my $layout19 = Qt::HBoxLayout(undef, 0, 6, '$layout19');
textLabel1_4 = Qt::Label($LayoutWidget, "textLabel1_4");
$layout19->addWidget(textLabel1_4);
NL = Qt::SpinBox($LayoutWidget, "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, "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, "textLabel3");
textLabel3->setSizePolicy( Qt::SizePolicy(1, 5, 0, 0, textLabel3->sizePolicy()->hasHeightForWidth()) );
$layout26->addWidget(textLabel3);
textLabel4 = Qt::Label($LayoutWidget, "textLabel4");
$layout26->addWidget(textLabel4);
$layout27->addLayout($layout26);
BoxL1 = Qt::GroupBox($LayoutWidget, "BoxL1");
BoxL1->setMargin( int(0) );
L1rho = Qt::LineEdit(BoxL1, "L1rho");
L1rho->setGeometry( Qt::Rect(200, 20, 111, 25) );
L1d = Qt::LineEdit(BoxL1, "L1d");
L1d->setGeometry( Qt::Rect(320, 20, 85, 25) );
L1d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L1d->sizePolicy()->hasHeightForWidth()) );
L1Comp = Qt::LineEdit(BoxL1, "L1Comp");
L1Comp->setGeometry( Qt::Rect(10, 20, 180, 25) );
$layout27->addWidget(BoxL1);
BoxL2 = Qt::GroupBox($LayoutWidget, "BoxL2");
BoxL2->setEnabled( 0 );
L2rho = Qt::LineEdit(BoxL2, "L2rho");
L2rho->setGeometry( Qt::Rect(200, 20, 111, 25) );
L2d = Qt::LineEdit(BoxL2, "L2d");
L2d->setGeometry( Qt::Rect(320, 20, 85, 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) );
$layout27->addWidget(BoxL2);
BoxL3 = Qt::GroupBox($LayoutWidget, "BoxL3");
BoxL3->setEnabled( 0 );
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) );
L3d = Qt::LineEdit(BoxL3, "L3d");
L3d->setGeometry( Qt::Rect(320, 20, 85, 25) );
L3d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L3d->sizePolicy()->hasHeightForWidth()) );
$layout27->addWidget(BoxL3);
BoxL4 = Qt::GroupBox($LayoutWidget, "BoxL4");
BoxL4->setEnabled( 0 );
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) );
L4d = Qt::LineEdit(BoxL4, "L4d");
L4d->setGeometry( Qt::Rect(320, 20, 85, 25) );
L4d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L4d->sizePolicy()->hasHeightForWidth()) );
$layout27->addWidget(BoxL4);
BoxL5 = Qt::GroupBox($LayoutWidget, "BoxL5");
BoxL5->setEnabled( 0 );
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) );
L5d = Qt::LineEdit(BoxL5, "L5d");
L5d->setGeometry( Qt::Rect(320, 20, 85, 25) );
L5d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L5d->sizePolicy()->hasHeightForWidth()) );
$layout27->addWidget(BoxL5);
BoxL6 = Qt::GroupBox($LayoutWidget, "BoxL6");
BoxL6->setEnabled( 0 );
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) );
L6d = Qt::LineEdit(BoxL6, "L6d");
L6d->setGeometry( Qt::Rect(320, 20, 85, 25) );
L6d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L6d->sizePolicy()->hasHeightForWidth()) );
$layout27->addWidget(BoxL6);
BoxL7 = Qt::GroupBox($LayoutWidget, "BoxL7");
BoxL7->setEnabled( 0 );
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) );
L7d = Qt::LineEdit(BoxL7, "L7d");
L7d->setGeometry( Qt::Rect(320, 20, 85, 25) );
L7d->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, L7d->sizePolicy()->hasHeightForWidth()) );
$layout27->addWidget(BoxL7);
my $LayoutWidget_2 = Qt::Widget(LayersTab, '$LayoutWidget_2');
$LayoutWidget_2->setGeometry( Qt::Rect(455, 0, 250, 480) );
my $layout13 = Qt::VBoxLayout($LayoutWidget_2, 0, 0, '$layout13');
ProjParam = Qt::GroupBox($LayoutWidget_2, "ProjParam");
my $LayoutWidget_3 = Qt::Widget(ProjParam, '$LayoutWidget_3');
$LayoutWidget_3->setGeometry( Qt::Rect(5, 25, 240, 260) );
my $layout8 = Qt::VBoxLayout($LayoutWidget_3, 0, 0, '$layout8');
my $LayoutWidget_2 = Qt::Widget(ProjParam, '$LayoutWidget_2');
$LayoutWidget_2->setGeometry( Qt::Rect(5, 25, 240, 260) );
my $layout8 = Qt::VBoxLayout($LayoutWidget_2, 0, 0, '$layout8');
my $layout7 = Qt::HBoxLayout(undef, 0, 6, '$layout7');
textLabel1 = Qt::Label($LayoutWidget_3, "textLabel1");
textLabel1 = Qt::Label($LayoutWidget_2, "textLabel1");
$layout7->addWidget(textLabel1);
ProjType = Qt::ComboBox(0, $LayoutWidget_3, "ProjType");
ProjType = Qt::ComboBox(0, $LayoutWidget_2, "ProjType");
ProjType->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, ProjType->sizePolicy()->hasHeightForWidth()) );
$layout7->addWidget(ProjType);
$layout8->addLayout($layout7);
@ -1482,85 +1318,85 @@ sub NEW
my $layout5 = Qt::VBoxLayout(undef, 0, 0, '$layout5');
NLabel = Qt::Label($LayoutWidget_3, "NLabel");
NLabel = Qt::Label($LayoutWidget_2, "NLabel");
NLabel->setSizePolicy( Qt::SizePolicy(5, 5, 0, 0, NLabel->sizePolicy()->hasHeightForWidth()) );
$layout5->addWidget(NLabel);
z0Label = Qt::Label($LayoutWidget_3, "z0Label");
z0Label = Qt::Label($LayoutWidget_2, "z0Label");
$layout5->addWidget(z0Label);
dzLabel = Qt::Label($LayoutWidget_3, "dzLabel");
dzLabel = Qt::Label($LayoutWidget_2, "dzLabel");
$layout5->addWidget(dzLabel);
ELabel = Qt::Label($LayoutWidget_3, "ELabel");
ELabel = Qt::Label($LayoutWidget_2, "ELabel");
$layout5->addWidget(ELabel);
SigELabel = Qt::Label($LayoutWidget_3, "SigELabel");
SigELabel = Qt::Label($LayoutWidget_2, "SigELabel");
$layout5->addWidget(SigELabel);
AlbleLabel = Qt::Label($LayoutWidget_3, "AlbleLabel");
AlbleLabel = Qt::Label($LayoutWidget_2, "AlbleLabel");
$layout5->addWidget(AlbleLabel);
SigAngleLabel = Qt::Label($LayoutWidget_3, "SigAngleLabel");
SigAngleLabel = Qt::Label($LayoutWidget_2, "SigAngleLabel");
$layout5->addWidget(SigAngleLabel);
SeedLabel = Qt::Label($LayoutWidget_3, "SeedLabel");
SeedLabel = Qt::Label($LayoutWidget_2, "SeedLabel");
$layout5->addWidget(SeedLabel);
$layout6->addLayout($layout5);
my $layout4 = Qt::VBoxLayout(undef, 0, 0, '$layout4');
NProj = Qt::LineEdit($LayoutWidget_3, "NProj");
NProj = Qt::LineEdit($LayoutWidget_2, "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_3, "z0");
z0 = Qt::LineEdit($LayoutWidget_2, "z0");
z0->setMaximumSize( Qt::Size(32767, 32767) );
$layout4->addWidget(z0);
dz = Qt::LineEdit($LayoutWidget_3, "dz");
dz = Qt::LineEdit($LayoutWidget_2, "dz");
$layout4->addWidget(dz);
E = Qt::LineEdit($LayoutWidget_3, "E");
E = Qt::LineEdit($LayoutWidget_2, "E");
$layout4->addWidget(E);
SigE = Qt::LineEdit($LayoutWidget_3, "SigE");
SigE = Qt::LineEdit($LayoutWidget_2, "SigE");
$layout4->addWidget(SigE);
Angle = Qt::LineEdit($LayoutWidget_3, "Angle");
Angle = Qt::LineEdit($LayoutWidget_2, "Angle");
$layout4->addWidget(Angle);
SigAngle = Qt::LineEdit($LayoutWidget_3, "SigAngle");
SigAngle = Qt::LineEdit($LayoutWidget_2, "SigAngle");
$layout4->addWidget(SigAngle);
Seed = Qt::LineEdit($LayoutWidget_3, "Seed");
Seed = Qt::LineEdit($LayoutWidget_2, "Seed");
$layout4->addWidget(Seed);
$layout6->addLayout($layout4);
$layout8->addLayout($layout6);
$layout13->addWidget(ProjParam);
groupBox15 = Qt::GroupBox($LayoutWidget_2, "groupBox15");
groupBox15 = Qt::GroupBox($LayoutWidget, "groupBox15");
my $LayoutWidget_4 = Qt::Widget(groupBox15, '$LayoutWidget_4');
$LayoutWidget_4->setGeometry( Qt::Rect(6, 23, 240, 100) );
my $layout14 = Qt::VBoxLayout($LayoutWidget_4, 0, 0, '$layout14');
my $LayoutWidget_3 = Qt::Widget(groupBox15, '$LayoutWidget_3');
$LayoutWidget_3->setGeometry( Qt::Rect(6, 23, 240, 100) );
my $layout14 = Qt::VBoxLayout($LayoutWidget_3, 0, 0, '$layout14');
textLabelFN = Qt::Label($LayoutWidget_4, "textLabelFN");
textLabelFN = Qt::Label($LayoutWidget_3, "textLabelFN");
$layout14->addWidget(textLabelFN);
FNPre = Qt::LineEdit($LayoutWidget_4, "FNPre");
FNPre = Qt::LineEdit($LayoutWidget_3, "FNPre");
$layout14->addWidget(FNPre);
textLabelPath = Qt::Label($LayoutWidget_4, "textLabelPath");
textLabelPath = Qt::Label($LayoutWidget_3, "textLabelPath");
$layout14->addWidget(textLabelPath);
my $layout13_2 = Qt::HBoxLayout(undef, 0, 6, '$layout13_2');
Path = Qt::LineEdit($LayoutWidget_4, "Path");
Path = Qt::LineEdit($LayoutWidget_3, "Path");
$layout13_2->addWidget(Path);
Browse = Qt::PushButton($LayoutWidget_4, "Browse");
Browse = Qt::PushButton($LayoutWidget_3, "Browse");
Browse->setSizePolicy( Qt::SizePolicy(7, 0, 0, 0, Browse->sizePolicy()->hasHeightForWidth()) );
$layout13_2->addWidget(Browse);
$layout14->addLayout($layout13_2);
@ -1568,18 +1404,60 @@ sub NEW
my $layout12 = Qt::HBoxLayout(undef, 4, 6, '$layout12');
Start = Qt::PushButton($LayoutWidget_2, "Start");
Start = Qt::PushButton($LayoutWidget, "Start");
Start->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, Start->sizePolicy()->hasHeightForWidth()) );
Start->setMinimumSize( Qt::Size(0, 25) );
Start->setPixmap( $image1 );
$layout12->addWidget(Start);
Quit = Qt::PushButton($LayoutWidget_2, "Quit");
Quit = Qt::PushButton($LayoutWidget, "Quit");
Quit->setSizePolicy( Qt::SizePolicy(7, 7, 0, 0, Quit->sizePolicy()->hasHeightForWidth()) );
Quit->setMinimumSize( Qt::Size(0, 25) );
Quit->setPixmap( $image2 );
$layout12->addWidget(Quit);
$layout13->addLayout($layout12);
groupBox1 = Qt::GroupBox(LayersTab, "groupBox1");
groupBox1->setGeometry( Qt::Rect(5, 0, 445, 485) );
groupBox1->setFrameShape( &Qt::GroupBox::GroupBoxPanel() );
groupBox1->setFrameShadow( &Qt::GroupBox::Sunken() );
my $LayoutWidget_4 = Qt::Widget(groupBox1, '$LayoutWidget_4');
$LayoutWidget_4->setGeometry( Qt::Rect(8, 25, 432, 460) );
my $layout66 = Qt::VBoxLayout($LayoutWidget_4, 11, 6, '$layout66');
my $layout19 = Qt::HBoxLayout(undef, 0, 6, '$layout19');
textLabel1_4 = Qt::Label($LayoutWidget_4, "textLabel1_4");
$layout19->addWidget(textLabel1_4);
NL = Qt::SpinBox($LayoutWidget_4, "NL");
NL->setMaxValue( int(100) );
NL->setMinValue( int(1) );
$layout19->addWidget(NL);
my $spacer = Qt::SpacerItem(240, 20, &Qt::SizePolicy::Expanding, &Qt::SizePolicy::Minimum);
$layout19->addItem($spacer);
$layout66->addLayout($layout19);
LayerTable = Qt::Table($LayoutWidget_4, "LayerTable");
LayerTable->setNumCols(LayerTable->numCols() + 1);
LayerTable->horizontalHeader()->setLabel(LayerTable->numCols() - 1, trUtf8("Composition"));
LayerTable->setNumCols(LayerTable->numCols() + 1);
LayerTable->horizontalHeader()->setLabel(LayerTable->numCols() - 1, trUtf8("Density [g/cm^3]"));
LayerTable->setNumCols(LayerTable->numCols() + 1);
LayerTable->horizontalHeader()->setLabel(LayerTable->numCols() - 1, trUtf8("Thickness [Å]"));
LayerTable->setSizePolicy( Qt::SizePolicy(4, 4, 100, 100, LayerTable->sizePolicy()->hasHeightForWidth()) );
LayerTable->setMinimumSize( Qt::Size(410, 405) );
LayerTable->setAcceptDrops( 1 );
LayerTable->setResizePolicy( &Qt::Table::AutoOneFit() );
LayerTable->setDragAutoScroll( 1 );
LayerTable->setNumRows( int(1) );
LayerTable->setNumCols( int(3) );
LayerTable->setRowMovingEnabled( 0 );
LayerTable->setReadOnly( 0 );
LayerTable->setSelectionMode( &Qt::Table::NoSelection() );
LayerTable->setFocusStyle( &Qt::Table::FollowStyle() );
$layout66->addWidget(LayerTable);
tabs->insertTab( LayersTab, "" );
AddParTab = Qt::Widget(tabs, "AddParTab");
@ -1789,23 +1667,23 @@ sub NEW
my $LayoutWidget_6 = Qt::Widget(ConfigTab, '$LayoutWidget_6');
$LayoutWidget_6->setGeometry( Qt::Rect(10, 20, 680, 80) );
my $layout27_2 = Qt::GridLayout($LayoutWidget_6, 1, 1, 11, 6, '$layout27_2');
my $layout27 = Qt::GridLayout($LayoutWidget_6, 1, 1, 11, 6, '$layout27');
my $layout26_2 = Qt::HBoxLayout(undef, 0, 6, '$layout26_2');
my $layout26 = Qt::HBoxLayout(undef, 0, 6, '$layout26');
textLabel1_2_2 = Qt::Label($LayoutWidget_6, "textLabel1_2_2");
textLabel1_2_2->setSizePolicy( Qt::SizePolicy(0, 5, 0, 0, textLabel1_2_2->sizePolicy()->hasHeightForWidth()) );
textLabel1_2_2->setMinimumSize( Qt::Size(110, 0) );
textLabel1_2_2->setMaximumSize( Qt::Size(130, 32767) );
$layout26_2->addWidget(textLabel1_2_2);
$layout26->addWidget(textLabel1_2_2);
TrimGUIPath = Qt::LineEdit($LayoutWidget_6, "TrimGUIPath");
$layout26_2->addWidget(TrimGUIPath);
$layout26->addWidget(TrimGUIPath);
GUIPathBrowse = Qt::PushButton($LayoutWidget_6, "GUIPathBrowse");
$layout26_2->addWidget(GUIPathBrowse);
$layout26->addWidget(GUIPathBrowse);
$layout27_2->addLayout($layout26_2, 1, 0);
$layout27->addLayout($layout26, 1, 0);
my $layout25 = Qt::HBoxLayout(undef, 0, 6, '$layout25');
@ -1821,7 +1699,7 @@ sub NEW
TrimBinBrowse = Qt::PushButton($LayoutWidget_6, "TrimBinBrowse");
$layout25->addWidget(TrimBinBrowse);
$layout27_2->addLayout($layout25, 0, 0);
$layout27->addLayout($layout25, 0, 0);
tabs->insertTab( ConfigTab, "" );
fileNewAction= Qt::Action(this, "fileNewAction");
@ -1897,7 +1775,6 @@ sub NEW
resize( $resize );
clearWState( &Qt::WState_Polished );
Qt::Object::connect(L1Comp, SIGNAL "textChanged(const QString&)", this, SLOT "findDensity()");
Qt::Object::connect(TrimBinBrowse, SIGNAL "clicked()", this, SLOT "TrimBin()");
Qt::Object::connect(GUIPathBrowse, SIGNAL "clicked()", this, SLOT "GUIPath()");
Qt::Object::connect(plotFractionsAction, SIGNAL "activated()", this, SLOT "PlotFraction()");
@ -1924,36 +1801,10 @@ sub NEW
Qt::Object::connect(helpContentsAction, SIGNAL "activated()", this, SLOT "OpenHelpWindow()");
Qt::Object::connect(fileQuitAction, SIGNAL "activated()", this, SLOT "ConfirmQuit()");
Qt::Object::connect(fileChangeDirAction, SIGNAL "activated()", this, SLOT "DirectoryBrowse()");
Qt::Object::connect(L2Comp, SIGNAL "textChanged(const QString&)", this, SLOT "findDensity()");
Qt::Object::connect(L3Comp, SIGNAL "textChanged(const QString&)", this, SLOT "findDensity()");
Qt::Object::connect(L4Comp, SIGNAL "textChanged(const QString&)", this, SLOT "findDensity()");
Qt::Object::connect(L5Comp, SIGNAL "textChanged(const QString&)", this, SLOT "findDensity()");
Qt::Object::connect(L6Comp, SIGNAL "textChanged(const QString&)", this, SLOT "findDensity()");
Qt::Object::connect(L7Comp, SIGNAL "textChanged(const QString&)", this, SLOT "findDensity()");
Qt::Object::connect(LayerTable, SIGNAL "valueChanged(int,int)", this, SLOT "findDensity()");
setTabOrder(tabs, NL);
setTabOrder(NL, L1Comp);
setTabOrder(L1Comp, L1rho);
setTabOrder(L1rho, L1d);
setTabOrder(L1d, L2Comp);
setTabOrder(L2Comp, L2rho);
setTabOrder(L2rho, L2d);
setTabOrder(L2d, L3Comp);
setTabOrder(L3Comp, L3rho);
setTabOrder(L3rho, L3d);
setTabOrder(L3d, L4Comp);
setTabOrder(L4Comp, L4rho);
setTabOrder(L4rho, L4d);
setTabOrder(L4d, L5Comp);
setTabOrder(L5Comp, L5rho);
setTabOrder(L5rho, L5d);
setTabOrder(L5d, L6Comp);
setTabOrder(L6Comp, L6rho);
setTabOrder(L6rho, L6d);
setTabOrder(L6d, L7Comp);
setTabOrder(L7Comp, L7rho);
setTabOrder(L7rho, L7d);
setTabOrder(L7d, ProjType);
setTabOrder(NL, ProjType);
setTabOrder(ProjType, NProj);
setTabOrder(NProj, z0);
setTabOrder(z0, dz);
@ -1998,27 +1849,6 @@ sub NEW
sub languageChange
{
setCaption(trUtf8("TrimSP GUI") );
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/cm<sup>3</sup>]") );
textLabel4->setText( trUtf8("Thickness [Å]") );
BoxL1->setTitle( trUtf8("Layer 1") );
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."));
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."));
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") );
ProjParam->setTitle( trUtf8("Projectile parameters") );
textLabel1->setText( trUtf8("Projectile") );
ProjType->clear();
@ -2064,6 +1894,12 @@ sub languageChange
Quit->setText( undef );
Qt::ToolTip::add(Quit, trUtf8("Quit"));
Qt::WhatsThis::add(Quit, trUtf8("Quit the application."));
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)."));
LayerTable->horizontalHeader()->setLabel( 0, trUtf8("Composition") );
LayerTable->horizontalHeader()->setLabel( 1, trUtf8("Density [g/cm^3]") );
LayerTable->horizontalHeader()->setLabel( 2, trUtf8("Thickness [Å]") );
tabs->changeTab( LayersTab, trUtf8("Layers") );
AddParam->setTitle( trUtf8("Additional parameters") );
textLabelEF->setText( trUtf8("EF") );
@ -2201,6 +2037,7 @@ sub ToggleScanSingle
$All{"ScandL"}=ScandL->text();
$All{"ListRadio"}=ListRadio->isChecked();
$All{"LoopRadio"}=LoopRadio->isChecked();
$All{"NL"}=NL->text();
# Enable everything
E->setDisabled(0);
@ -2213,10 +2050,9 @@ sub ToggleScanSingle
# SigAngle->setText("15");
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);
for (my $i=1;$i<=$All{"NL"};$i++) {
my $LayerAttrib = LayerTable->item($i-1,2);
$LayerAttrib->setEnabled(1);
}
# Enable depth increment for Energy scan only
@ -2247,28 +2083,21 @@ sub ToggleScanSingle
Angle->setDisabled(0);
SigAngle->setDisabled(0);
NProj->setDisabled(0);
my $LayerName = "L".$All{"ScandL"}."d";
my $LayerAttrib = child($LayerName);
$LayerAttrib->setDisabled(0);
LayerTable->setColumnReadOnly(2,0);
# then disable one
if ($All{"ERadio"}) {
E->setDisabled(1);
# E->setText("");
} elsif ($All{"SigERadio"}) {
SigE->setDisabled(1);
# SigE->setText("");
} elsif ($All{"AngleRadio"}) {
Angle->setDisabled(1);
# Angle->setText("");
} elsif ($All{"SigAngleRadio"}) {
SigAngle->setDisabled(1);
# SigAngle->setText("");
} elsif ($All{"NProjRadio"}) {
NProj->setDisabled(1);
# NProj->setText("");
} elsif($All{"dRadio"}) {
$LayerAttrib->setDisabled(1);
# $LayerAttrib->setText("");
my $LayerAttrib = LayerTable->item($All{"ScandL"}-1,2);
$LayerAttrib->setEnabled(0);
}
# and change title of tab to say enabled
tabs->changeTab( ScansTab, trUtf8("Scans (Enabled)") );
@ -2285,19 +2114,47 @@ 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);
# Prepare enough Rows in table for layers
my $OldNL=LayerTable->numRows();
if ($OldNL<=$All{"NL"}) {
LayerTable->setNumRows($All{"NL"});
} else {
for (my $i=$All{"NL"};$i<=$OldNL-1;$i++) {
print $i."\n";
removeRowFromTable($i);
}
}
}
sub removeRowFromTable
{
# This function is to remove rows from table
# I cannot use the standard removeRow() due to a bug in perl-qt3
# This is a good and simple workaround.
# Takes as an input the row number to be removed
my ($deadRow) = @_;
# Loop over columns and take items of the row to remove
for my $col (0..LayerTable->numCols()-1) {
my $dummy=LayerTable->item($deadRow, $col);
# In the items is not defined the row can be removed by simply
# reducing the number of rows in table
if ($dummy ne "") {
LayerTable->takeItem(LayerTable->item($deadRow, $col));
for my $row ($deadRow..LayerTable->numRows()-2) {
my $item = LayerTable->item($row+1, $col);
LayerTable->takeItem($item);
LayerTable->setItem($row, $col, $item);
}
}
}
LayerTable->setNumRows(LayerTable->numRows()-1);
}
sub ProjSmartDefaults
{
@ -2373,12 +2230,9 @@ sub CollectValues
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();
$All{"$LComp"}=LayerTable->text($i-1,0);
$All{"$Lrho"}=LayerTable->text($i-1,1);
$All{"$Ld"}=LayerTable->text($i-1,2);
}
# Collect projectile parameters
@ -2486,11 +2340,18 @@ sub CreateInpFile
# Values of Z,A as well as other needed parameters are obtained from Chem.pm.
# This is the form of the input file:
# This is the form of the begining 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
NProj Seed Seed Seed z0 RD dz CA KK0 KK0R KDEE1 KDEE2 IPOT IPOTR IRL";
# Then comes the number of layers (new format) for example 4 layers:
# N_Layers=4
$TemplateFile=$TemplateFile."\n"."N_Layers=NL"."\n";
# Then loop over the layers and for each give the following structure
my $TemplateLayer=
"L1d L1rho L1CK
L1ELZ1 L1ELZ2 L1ELZ3 L1ELZ4 L1ELZ5
L1ELW1 L1ELW2 L1ELW3 L1ELW4 L1ELW5
L1ELC1 L1ELC2 L1ELC3 L1ELC4 L1ELC5
@ -2502,74 +2363,8 @@ sub CreateInpFile
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"};
@ -2577,37 +2372,39 @@ sub CreateInpFile
$All{"ProjAM"}=sprintf("%6.2f",Chem::Massof($ProjType));
my $Check=0;
my $Layer="";
my $Li="";
# Loop over layers an create appropriate values
for (my $i=1;$i<=7;$i++){
for (my $i=1;$i<=$All{"NL"};$i++){
$Li = "L".$i;
$Layer = $TemplateLayer;
$Layer =~ s/L1/$Li/g;
$TemplateFile=$TemplateFile.$Layer;
$Check=0;
# Composition of layers
my $LComp="L".$i."Comp";
my $LCompAttrib = child($LComp);
my $Comp = $LCompAttrib->text();
my $Comp = LayerTable->text($i-1,0);
$All{$LComp} = $Comp;
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();
my $rho = LayerTable->text($i-1,1);
$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();
my $d = LayerTable->text($i-1,2);
$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"}) {
if ($Check!=0) {
my $ErrMsg="Error: Layer $i is empty. Expecting it to be defined!\n";
print STDERR $ErrMsg;
my $HelpWindow = Qt::MessageBox::information( this, "Error!",$ErrMsg);
# my $ErrorDialog = Qt::ErrorMessage(TrimSPGUI);
# $ErrorDialog->message($ErrMsg);
return "ERROR";
}
@ -2619,10 +2416,7 @@ sub CreateInpFile
$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++) {
@ -2634,7 +2428,7 @@ sub CreateInpFile
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);
@ -2653,7 +2447,6 @@ sub CreateInpFile
}
foreach my $key (keys %All) {
# print $key,$All{$key},"\n";
if ($All{$key} ne ""){
$TemplateFile =~ s/$key/$All{$key}/;
# Seed repeats three times
@ -2959,20 +2752,37 @@ sub OpenFile
my @InitPar = split (/=/,$line);
# Check it is not empty or title line
if ($InitPar[0] ne "" && $InitPar[1] ne "") {
$Attrib = child($InitPar[0]);
if ($Types{$InitPar[0]} == 1) {
$Attrib->setValue($InitPar[1]);
} elsif ($Types{$InitPar[0]} == 2 ) {
if($InitPar[1] == 1) {
$Attrib->setChecked(1);
} else {
$Attrib->setChecked(0);
}
} elsif ($Types{$InitPar[0]} == 3) {
$Attrib-> setCurrentText($InitPar[1]);
# First take care of the layers, with patters L?Comp, L?rho, L?d
my $CRow=$InitPar[0];
if ($InitPar[0] =~ m/L.*Comp$/ ) {
$CRow =~ s/\D//g;
LayerTable->setText($CRow-1,0,$InitPar[1]);
} elsif ($InitPar[0] =~ m/L.*rho$/ ) {
$CRow =~ s/\D//g;
LayerTable->setText($CRow-1,1,$InitPar[1]);
} elsif ($InitPar[0] =~ m/L.*d$/ ) {
$CRow =~ s/\D//g;
LayerTable->setText($CRow-1,2,$InitPar[1]);
} else {
$Attrib->setText($InitPar[1]);
}
$Attrib = child($InitPar[0]);
if ($Types{$InitPar[0]} == 1) {
$Attrib->setValue($InitPar[1]);
# Create enough rows in LayerTable
if ($InitPar[0] eq "NL") {
LayerTable->setNumRows($InitPar[1]);
}
} elsif ($Types{$InitPar[0]} == 2 ) {
if($InitPar[1] == 1) {
$Attrib->setChecked(1);
} else {
$Attrib->setChecked(0);
}
} elsif ($Types{$InitPar[0]} == 3) {
$Attrib-> setCurrentText($InitPar[1]);
} else {
$Attrib->setText($InitPar[1]);
}
}
}
}
}
@ -2985,29 +2795,21 @@ sub SaveFile
my %All = CollectValues();
my $InitFile="
[Layers]
NL=$All{'NL'}
L1Comp=$All{'L1Comp'}
L1rho=$All{'L1rho'}
L1d=$All{'L1d'}
L2Comp=$All{'L2Comp'}
L2rho=$All{'L2rho'}
L2d=$All{'L2d'}
L3Comp=$All{'L3Comp'}
L3rho=$All{'L3rho'}
L3d=$All{'L3d'}
L4Comp=$All{'L4Comp'}
L4rho=$All{'L4rho'}
L4d=$All{'L4d'}
L5Comp=$All{'L5Comp'}
L5rho=$All{'L5rho'}
L5d=$All{'L5d'}
L6Comp=$All{'L6Comp'}
L6rho=$All{'L6rho'}
L6d=$All{'L6d'}
L7Comp=$All{'L7Comp'}
L7rho=$All{'L7rho'}
L7d=$All{'L7d'}
NL=$All{'NL'}";
for (my $i=1;$i<=$All{"NL"};$i++){
my $Li="L".$i;
my $LComp=$Li."Comp";
my $Lrho=$Li."rho";
my $Ld=$Li."d";
$InitFile=$InitFile."
$LComp=$All{$LComp}
$Lrho=$All{$Lrho}
$Ld=$All{$Ld}
";
}
$InitFile=$InitFile."
[ProjectileParameters]
ProjType=$All{'ProjType'}
NProj=$All{'NProj'}
@ -3054,29 +2856,21 @@ sub SaveFileAs
my %All = CollectValues();
my $InitFile="
[Layers]
NL=$All{'NL'}
L1Comp=$All{'L1Comp'}
L1rho=$All{'L1rho'}
L1d=$All{'L1d'}
L2Comp=$All{'L2Comp'}
L2rho=$All{'L2rho'}
L2d=$All{'L2d'}
L3Comp=$All{'L3Comp'}
L3rho=$All{'L3rho'}
L3d=$All{'L3d'}
L4Comp=$All{'L4Comp'}
L4rho=$All{'L4rho'}
L4d=$All{'L4d'}
L5Comp=$All{'L5Comp'}
L5rho=$All{'L5rho'}
L5d=$All{'L5d'}
L6Comp=$All{'L6Comp'}
L6rho=$All{'L6rho'}
L6d=$All{'L6d'}
L7Comp=$All{'L7Comp'}
L7rho=$All{'L7rho'}
L7d=$All{'L7d'}
NL=$All{'NL'}";
for (my $i=1;$i<=$All{"NL"};$i++){
my $Li="L".$i;
my $LComp=$Li."Comp";
my $Lrho=$Li."rho";
my $Ld=$Li."d";
$InitFile=$InitFile."
$LComp=$All{$LComp}
$Lrho=$All{$Lrho}
$Ld=$All{$Ld}
";
}
$InitFile=$InitFile."
[ProjectileParameters]
ProjType=$All{'ProjType'}
NProj=$All{'NProj'}
@ -3108,6 +2902,7 @@ SFrom=$All{'SFrom'}
STo=$All{'STo'}
SStep=$All{'SStep'}
";
my $file=Qt::FileDialog::getSaveFileName(
"TrimSP.cfg",
"TrimSP GUI Initialization file (*.cfg)",
@ -3171,15 +2966,16 @@ sub findDensity
use Chem;
# Get sender name to know which layer
my $sender = sender()->name();
# Generate the name of the density field
my $rhoSender = substr($sender,0,2)."rho";
# Get the compound formula
my $Compound = sender() -> text();
my $CCol=sender()->currentColumn();
if ($CCol==0) {
# The composition changed, find density
my $CRow=sender()->currentRow();
my $Compound=sender()->text($CRow,$CCol);
# See if you have the density
my $Density=Chem::Densities($Compound);
my $Density=Chem::Densities($Compound);
# If the density is in the database submit it
my $rho = child($rhoSender);
$rho -> setText($Density);
sender()->setText($CRow,1,$Density);
}
}

View File

@ -46,6 +46,14 @@
<height>526</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>4</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QWidget">
<property name="name">
<cstring>LayersTab</cstring>
@ -53,595 +61,6 @@
<attribute name="title">
<string>Layers</string>
</attribute>
<widget class="QGroupBox">
<property name="name">
<cstring>groupBox1</cstring>
</property>
<property name="geometry">
<rect>
<x>5</x>
<y>0</y>
<width>445</width>
<height>485</height>
</rect>
</property>
<property name="frameShape">
<enum>GroupBoxPanel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="title">
<string>Layers</string>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout27</cstring>
</property>
<property name="geometry">
<rect>
<x>5</x>
<y>20</y>
<width>435</width>
<height>460</height>
</rect>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="spacing">
<number>3</number>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout19</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1_4</cstring>
</property>
<property name="text">
<string>Number of Layers</string>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
<cstring>NL</cstring>
</property>
<property name="maxValue">
<number>7</number>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="whatsThis" stdset="0">
<string>Select the number of the layers of your structure (maximum 7 layers).</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>251</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout26</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel2_4</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>1</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Composition</string>
</property>
<property name="toolTip" stdset="0">
<string>Chemical formula</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Fixed</enum>
</property>
<property name="sizeHint">
<size>
<width>101</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QLabel">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Density [g/cm&lt;sup&gt;3&lt;/sup&gt;]</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>textLabel4</cstring>
</property>
<property name="text">
<string>Thickness [Å]</string>
</property>
</widget>
</hbox>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>BoxL1</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="title">
<string>Layer 1</string>
</property>
<widget class="QLineEdit">
<property name="name">
<cstring>L1rho</cstring>
</property>
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>5.12</string>
</property>
<property name="whatsThis" stdset="0">
<string>Insert the density of the layer here.</string>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L1d</cstring>
</property>
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>200</string>
</property>
<property name="whatsThis" stdset="0">
<string>Insert the thickness of the layer here.</string>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L1Comp</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>SrTiO3</string>
</property>
<property name="toolTip" stdset="0">
<string>Chemical formula of L1</string>
</property>
<property name="whatsThis" stdset="0">
<string>Insert the chemical formula here as you would write it.</string>
</property>
</widget>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>BoxL2</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 2</string>
</property>
<widget class="QLineEdit">
<property name="name">
<cstring>L2rho</cstring>
</property>
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L2d</cstring>
</property>
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L2Comp</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>BoxL3</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 3</string>
</property>
<widget class="QLineEdit">
<property name="name">
<cstring>L3Comp</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L3rho</cstring>
</property>
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L3d</cstring>
</property>
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>BoxL4</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 4</string>
</property>
<widget class="QLineEdit">
<property name="name">
<cstring>L4Comp</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L4rho</cstring>
</property>
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L4d</cstring>
</property>
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>BoxL5</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 5</string>
</property>
<widget class="QLineEdit">
<property name="name">
<cstring>L5Comp</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L5rho</cstring>
</property>
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L5d</cstring>
</property>
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>BoxL6</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 6</string>
</property>
<widget class="QLineEdit">
<property name="name">
<cstring>L6Comp</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L6rho</cstring>
</property>
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L6d</cstring>
</property>
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>BoxL7</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Layer 7</string>
</property>
<widget class="QLineEdit">
<property name="name">
<cstring>L7Comp</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>180</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L7rho</cstring>
</property>
<property name="geometry">
<rect>
<x>200</x>
<y>20</y>
<width>111</width>
<height>25</height>
</rect>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>L7d</cstring>
</property>
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>85</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</widget>
</vbox>
</widget>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout13</cstring>
@ -1166,6 +585,156 @@
</widget>
</vbox>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>groupBox1</cstring>
</property>
<property name="geometry">
<rect>
<x>5</x>
<y>0</y>
<width>445</width>
<height>485</height>
</rect>
</property>
<property name="frameShape">
<enum>GroupBoxPanel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="title">
<string>Layers</string>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout66</cstring>
</property>
<property name="geometry">
<rect>
<x>8</x>
<y>25</y>
<width>432</width>
<height>460</height>
</rect>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout19</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1_4</cstring>
</property>
<property name="text">
<string>Number of Layers</string>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
<cstring>NL</cstring>
</property>
<property name="maxValue">
<number>100</number>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="whatsThis" stdset="0">
<string>Select the number of the layers of your structure (maximum 7 layers).</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>240</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<widget class="QTable">
<column>
<property name="text">
<string>Composition</string>
</property>
</column>
<column>
<property name="text">
<string>Density [g/cm^3]</string>
</property>
</column>
<column>
<property name="text">
<string>Thickness [Å]</string>
</property>
</column>
<property name="name">
<cstring>LayerTable</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>4</hsizetype>
<vsizetype>4</vsizetype>
<horstretch>100</horstretch>
<verstretch>100</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>410</width>
<height>405</height>
</size>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="resizePolicy">
<enum>AutoOneFit</enum>
</property>
<property name="dragAutoScroll">
<bool>true</bool>
</property>
<property name="numRows">
<number>1</number>
</property>
<property name="numCols">
<number>3</number>
</property>
<property name="rowMovingEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>NoSelection</enum>
</property>
<property name="focusStyle">
<enum>FollowStyle</enum>
</property>
</widget>
</vbox>
</widget>
</widget>
</widget>
<widget class="QWidget">
<property name="name">
@ -2661,12 +2230,6 @@
</image>
</images>
<connections>
<connection>
<sender>L1Comp</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>TrimSPGUI</receiver>
<slot>findDensity()</slot>
</connection>
<connection>
<sender>TrimBinBrowse</sender>
<signal>clicked()</signal>
@ -2824,38 +2387,8 @@
<slot>DirectoryBrowse()</slot>
</connection>
<connection>
<sender>L2Comp</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>TrimSPGUI</receiver>
<slot>findDensity()</slot>
</connection>
<connection>
<sender>L3Comp</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>TrimSPGUI</receiver>
<slot>findDensity()</slot>
</connection>
<connection>
<sender>L4Comp</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>TrimSPGUI</receiver>
<slot>findDensity()</slot>
</connection>
<connection>
<sender>L5Comp</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>TrimSPGUI</receiver>
<slot>findDensity()</slot>
</connection>
<connection>
<sender>L6Comp</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>TrimSPGUI</receiver>
<slot>findDensity()</slot>
</connection>
<connection>
<sender>L7Comp</sender>
<signal>textChanged(const QString&amp;)</signal>
<sender>LayerTable</sender>
<signal>valueChanged(int,int)</signal>
<receiver>TrimSPGUI</receiver>
<slot>findDensity()</slot>
</connection>
@ -2863,27 +2396,6 @@
<tabstops>
<tabstop>tabs</tabstop>
<tabstop>NL</tabstop>
<tabstop>L1Comp</tabstop>
<tabstop>L1rho</tabstop>
<tabstop>L1d</tabstop>
<tabstop>L2Comp</tabstop>
<tabstop>L2rho</tabstop>
<tabstop>L2d</tabstop>
<tabstop>L3Comp</tabstop>
<tabstop>L3rho</tabstop>
<tabstop>L3d</tabstop>
<tabstop>L4Comp</tabstop>
<tabstop>L4rho</tabstop>
<tabstop>L4d</tabstop>
<tabstop>L5Comp</tabstop>
<tabstop>L5rho</tabstop>
<tabstop>L5d</tabstop>
<tabstop>L6Comp</tabstop>
<tabstop>L6rho</tabstop>
<tabstop>L6d</tabstop>
<tabstop>L7Comp</tabstop>
<tabstop>L7rho</tabstop>
<tabstop>L7d</tabstop>
<tabstop>ProjType</tabstop>
<tabstop>NProj</tabstop>
<tabstop>z0</tabstop>
@ -2927,6 +2439,7 @@
<slots>
<slot>ToggleScanSingle()</slot>
<slot>PrepLayers()</slot>
<slot>removeRowFromTable()</slot>
<slot>ProjSmartDefaults()</slot>
<slot>OpenHelpWindow()</slot>
<slot>CollectValues()</slot>

View File

@ -44,6 +44,7 @@ void TrimSPGUI::ToggleScanSingle()
$All{"ScandL"}=ScandL->text();
$All{"ListRadio"}=ListRadio->isChecked();
$All{"LoopRadio"}=LoopRadio->isChecked();
$All{"NL"}=NL->text();
# Enable everything
E->setDisabled(0);
@ -56,10 +57,9 @@ void TrimSPGUI::ToggleScanSingle()
# SigAngle->setText("15");
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);
for (my $i=1;$i<=$All{"NL"};$i++) {
my $LayerAttrib = LayerTable->item($i-1,2);
$LayerAttrib->setEnabled(1);
}
# Enable depth increment for Energy scan only
@ -90,28 +90,21 @@ void TrimSPGUI::ToggleScanSingle()
Angle->setDisabled(0);
SigAngle->setDisabled(0);
NProj->setDisabled(0);
my $LayerName = "L".$All{"ScandL"}."d";
my $LayerAttrib = child($LayerName);
$LayerAttrib->setDisabled(0);
LayerTable->setColumnReadOnly(2,0);
# then disable one
if ($All{"ERadio"}) {
E->setDisabled(1);
# E->setText("");
} elsif ($All{"SigERadio"}) {
SigE->setDisabled(1);
# SigE->setText("");
} elsif ($All{"AngleRadio"}) {
Angle->setDisabled(1);
# Angle->setText("");
} elsif ($All{"SigAngleRadio"}) {
SigAngle->setDisabled(1);
# SigAngle->setText("");
} elsif ($All{"NProjRadio"}) {
NProj->setDisabled(1);
# NProj->setText("");
} elsif($All{"dRadio"}) {
$LayerAttrib->setDisabled(1);
# $LayerAttrib->setText("");
my $LayerAttrib = LayerTable->item($All{"ScandL"}-1,2);
$LayerAttrib->setEnabled(0);
}
# and change title of tab to say enabled
tabs->changeTab( ScansTab, trUtf8("Scans (Enabled)") );
@ -127,18 +120,48 @@ 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);
# Prepare enough Rows in table for layers
my $OldNL=LayerTable->numRows();
if ($OldNL<=$All{"NL"}) {
LayerTable->setNumRows($All{"NL"});
} else {
for (my $i=$All{"NL"};$i<=$OldNL-1;$i++) {
print $i."\n";
removeRowFromTable($i);
}
}
}
# LayerTable->horizontalHeader()->setResizeMode(Qt::HeaderView::Stretch);
# LayerTable->adjustColumn(0);
# LayerTable->adjustColumn(1);
# LayerTable->adjustColumn(2);
}
void TrimSPGUI::removeRowFromTable()
{
# This function is to remove rows from table
# I cannot use the standard removeRow() due to a bug in perl-qt3
# This is a good and simple workaround.
# Takes as an input the row number to be removed
my ($deadRow) = @_;
# Loop over columns and take items of the row to remove
for my $col (0..LayerTable->numCols()-1) {
my $dummy=LayerTable->item($deadRow, $col);
# In the items is not defined the row can be removed by simply
# reducing the number of rows in table
if ($dummy ne "") {
LayerTable->takeItem(LayerTable->item($deadRow, $col));
for my $row ($deadRow..LayerTable->numRows()-2) {
my $item = LayerTable->item($row+1, $col);
LayerTable->takeItem($item);
LayerTable->setItem($row, $col, $item);
}
}
}
LayerTable->setNumRows(LayerTable->numRows()-1);
}
void TrimSPGUI::ProjSmartDefaults()
{
@ -211,12 +234,9 @@ void TrimSPGUI::CollectValues()
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();
$All{"$LComp"}=LayerTable->text($i-1,0);
$All{"$Lrho"}=LayerTable->text($i-1,1);
$All{"$Ld"}=LayerTable->text($i-1,2);
}
# Collect projectile parameters
@ -308,7 +328,6 @@ void TrimSPGUI::CollectValues()
return %All;
}
void TrimSPGUI::CreateInpFile()
{
use Chem;
@ -323,11 +342,18 @@ void TrimSPGUI::CreateInpFile()
# Values of Z,A as well as other needed parameters are obtained from Chem.pm.
# This is the form of the input file:
# This is the form of the begining 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
NProj Seed Seed Seed z0 RD dz CA KK0 KK0R KDEE1 KDEE2 IPOT IPOTR IRL";
# Then comes the number of layers (new format) for example 4 layers:
# N_Layers=4
$TemplateFile=$TemplateFile."\n"."N_Layers=NL"."\n";
# Then loop over the layers and for each give the following structure
my $TemplateLayer=
"L1d L1rho L1CK
L1ELZ1 L1ELZ2 L1ELZ3 L1ELZ4 L1ELZ5
L1ELW1 L1ELW2 L1ELW3 L1ELW4 L1ELW5
L1ELC1 L1ELC2 L1ELC3 L1ELC4 L1ELC5
@ -339,74 +365,8 @@ void TrimSPGUI::CreateInpFile()
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"};
@ -414,37 +374,39 @@ void TrimSPGUI::CreateInpFile()
$All{"ProjAM"}=sprintf("%6.2f",Chem::Massof($ProjType));
my $Check=0;
my $Layer="";
my $Li="";
# Loop over layers an create appropriate values
for (my $i=1;$i<=7;$i++){
for (my $i=1;$i<=$All{"NL"};$i++){
$Li = "L".$i;
$Layer = $TemplateLayer;
$Layer =~ s/L1/$Li/g;
$TemplateFile=$TemplateFile.$Layer;
$Check=0;
# Composition of layers
my $LComp="L".$i."Comp";
my $LCompAttrib = child($LComp);
my $Comp = $LCompAttrib->text();
my $Comp = LayerTable->text($i-1,0);
$All{$LComp} = $Comp;
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();
my $rho = LayerTable->text($i-1,1);
$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();
my $d = LayerTable->text($i-1,2);
$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"}) {
if ($Check!=0) {
my $ErrMsg="Error: Layer $i is empty. Expecting it to be defined!\n";
print STDERR $ErrMsg;
my $HelpWindow = Qt::MessageBox::information( this, "Error!",$ErrMsg);
# my $ErrorDialog = Qt::ErrorMessage(TrimSPGUI);
# $ErrorDialog->message($ErrMsg);
return "ERROR";
}
@ -456,10 +418,7 @@ void TrimSPGUI::CreateInpFile()
$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++) {
@ -471,7 +430,7 @@ void TrimSPGUI::CreateInpFile()
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);
@ -490,7 +449,6 @@ void TrimSPGUI::CreateInpFile()
}
foreach my $key (keys %All) {
# print $key,$All{$key},"\n";
if ($All{$key} ne ""){
$TemplateFile =~ s/$key/$All{$key}/;
# Seed repeats three times
@ -500,7 +458,6 @@ void TrimSPGUI::CreateInpFile()
return $TemplateFile;
}
void TrimSPGUI::StartSequenceOne()
{
my %All = CollectValues();
@ -789,20 +746,37 @@ void TrimSPGUI::OpenFile()
my @InitPar = split (/=/,$line);
# Check it is not empty or title line
if ($InitPar[0] ne "" && $InitPar[1] ne "") {
$Attrib = child($InitPar[0]);
if ($Types{$InitPar[0]} == 1) {
$Attrib->setValue($InitPar[1]);
} elsif ($Types{$InitPar[0]} == 2 ) {
if($InitPar[1] == 1) {
$Attrib->setChecked(1);
} else {
$Attrib->setChecked(0);
}
} elsif ($Types{$InitPar[0]} == 3) {
$Attrib-> setCurrentText($InitPar[1]);
# First take care of the layers, with patters L?Comp, L?rho, L?d
my $CRow=$InitPar[0];
if ($InitPar[0] =~ m/L.*Comp$/ ) {
$CRow =~ s/\D//g;
LayerTable->setText($CRow-1,0,$InitPar[1]);
} elsif ($InitPar[0] =~ m/L.*rho$/ ) {
$CRow =~ s/\D//g;
LayerTable->setText($CRow-1,1,$InitPar[1]);
} elsif ($InitPar[0] =~ m/L.*d$/ ) {
$CRow =~ s/\D//g;
LayerTable->setText($CRow-1,2,$InitPar[1]);
} else {
$Attrib->setText($InitPar[1]);
}
$Attrib = child($InitPar[0]);
if ($Types{$InitPar[0]} == 1) {
$Attrib->setValue($InitPar[1]);
# Create enough rows in LayerTable
if ($InitPar[0] eq "NL") {
LayerTable->setNumRows($InitPar[1]);
}
} elsif ($Types{$InitPar[0]} == 2 ) {
if($InitPar[1] == 1) {
$Attrib->setChecked(1);
} else {
$Attrib->setChecked(0);
}
} elsif ($Types{$InitPar[0]} == 3) {
$Attrib-> setCurrentText($InitPar[1]);
} else {
$Attrib->setText($InitPar[1]);
}
}
}
}
}
@ -814,29 +788,21 @@ void TrimSPGUI::SaveFile()
my %All = CollectValues();
my $InitFile="
[Layers]
NL=$All{'NL'}
L1Comp=$All{'L1Comp'}
L1rho=$All{'L1rho'}
L1d=$All{'L1d'}
L2Comp=$All{'L2Comp'}
L2rho=$All{'L2rho'}
L2d=$All{'L2d'}
L3Comp=$All{'L3Comp'}
L3rho=$All{'L3rho'}
L3d=$All{'L3d'}
L4Comp=$All{'L4Comp'}
L4rho=$All{'L4rho'}
L4d=$All{'L4d'}
L5Comp=$All{'L5Comp'}
L5rho=$All{'L5rho'}
L5d=$All{'L5d'}
L6Comp=$All{'L6Comp'}
L6rho=$All{'L6rho'}
L6d=$All{'L6d'}
L7Comp=$All{'L7Comp'}
L7rho=$All{'L7rho'}
L7d=$All{'L7d'}
NL=$All{'NL'}";
for (my $i=1;$i<=$All{"NL"};$i++){
my $Li="L".$i;
my $LComp=$Li."Comp";
my $Lrho=$Li."rho";
my $Ld=$Li."d";
$InitFile=$InitFile."
$LComp=$All{$LComp}
$Lrho=$All{$Lrho}
$Ld=$All{$Ld}
";
}
$InitFile=$InitFile."
[ProjectileParameters]
ProjType=$All{'ProjType'}
NProj=$All{'NProj'}
@ -882,29 +848,21 @@ void TrimSPGUI::SaveFileAs()
my %All = CollectValues();
my $InitFile="
[Layers]
NL=$All{'NL'}
L1Comp=$All{'L1Comp'}
L1rho=$All{'L1rho'}
L1d=$All{'L1d'}
L2Comp=$All{'L2Comp'}
L2rho=$All{'L2rho'}
L2d=$All{'L2d'}
L3Comp=$All{'L3Comp'}
L3rho=$All{'L3rho'}
L3d=$All{'L3d'}
L4Comp=$All{'L4Comp'}
L4rho=$All{'L4rho'}
L4d=$All{'L4d'}
L5Comp=$All{'L5Comp'}
L5rho=$All{'L5rho'}
L5d=$All{'L5d'}
L6Comp=$All{'L6Comp'}
L6rho=$All{'L6rho'}
L6d=$All{'L6d'}
L7Comp=$All{'L7Comp'}
L7rho=$All{'L7rho'}
L7d=$All{'L7d'}
NL=$All{'NL'}";
for (my $i=1;$i<=$All{"NL"};$i++){
my $Li="L".$i;
my $LComp=$Li."Comp";
my $Lrho=$Li."rho";
my $Ld=$Li."d";
$InitFile=$InitFile."
$LComp=$All{$LComp}
$Lrho=$All{$Lrho}
$Ld=$All{$Ld}
";
}
$InitFile=$InitFile."
[ProjectileParameters]
ProjType=$All{'ProjType'}
NProj=$All{'NProj'}
@ -936,6 +894,7 @@ SFrom=$All{'SFrom'}
STo=$All{'STo'}
SStep=$All{'SStep'}
";
my $file=Qt::FileDialog::getSaveFileName(
"TrimSP.cfg",
"TrimSP GUI Initialization file (*.cfg)",
@ -1010,19 +969,22 @@ void TrimSPGUI::TrimBin()
return $file;
}
void TrimSPGUI::findDensity()
{
use Chem;
# Get sender name to know which layer
my $sender = sender()->name();
# Generate the name of the density field
my $rhoSender = substr($sender,0,2)."rho";
# Get the compound formula
my $Compound = sender() -> text();
my $CCol=sender()->currentColumn();
if ($CCol==0) {
# The composition changed, find density
my $CRow=sender()->currentRow();
my $Compound=sender()->text($CRow,$CCol);
# See if you have the density
my $Density=Chem::Densities($Compound);
my $Density=Chem::Densities($Compound);
# If the density is in the database submit it
my $rho = child($rhoSender);
$rho -> setText($Density);
sender()->setText($CRow,1,$Density);
}
}

View File

@ -393,7 +393,7 @@ C Second line: simulation related parameters
& ,IPOTR,IRL
C Third line: Number of layers
read(11,66) NLayers
66 format(8x,I4)
66 format(9x,I4)
LMAX=NLayers
C Here we read the NLayers structure
DO I=1,NLayers