11
11
$atoms_params{edge} = 'K';
12
12
$atoms_params{elem} = 'H';
13
my @help_button = (-foreground=>$config{colors}{activehighlightcolor},
14
-font=>$config{fonts}{small},
15
-relief=>'flat', -borderwidth=>0,
16
-activeforeground=>$config{colors}{mbutton},
13
my @help_button = (-foreground => $config{colors}{activehighlightcolor},
14
-font => $config{fonts}{small},
17
-cursor => $mouse_over_cursor,
18
-activeforeground => $config{colors}{mbutton},
19
21
my $fr = $atoms -> LabFrame(-label=>'Titles',
45
47
$fr -> Button(@help_button,
46
48
-text=>'Space group', -command=>[\&Echo, $click_help{'Space group'}])
47
49
-> grid(-column=>0, -row=>0, -sticky=>'e', -padx=>2, -pady=>2);
48
$widgets{atoms_space} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
50
$widgets{atoms_space} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
50
52
-validatecommand=>[\&set_atoms_params, 'space'])
51
53
-> grid(-column=>1, -row=>0, -padx=>2, -pady=>2);
54
56
## lattice constants
55
57
$fr -> Button(@help_button, -text=>'A', -command=>[\&Echo, $click_help{'A'}])
56
58
-> grid(-column=>0, -row=>1, -sticky=>'e', -padx=>2);
57
$widgets{atoms_a} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
59
$widgets{atoms_a} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
59
61
-validatecommand=>[\&set_atoms_params, 'a'])
60
62
-> grid(-column=>1, -row=>1);
61
63
$fr -> Button(@help_button, -text=>'B', -command=>[\&Echo, $click_help{'B'}])
62
64
-> grid(-column=>0, -row=>2, -sticky=>'e', -padx=>2);
63
$widgets{atoms_b} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
65
$widgets{atoms_b} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
65
67
-validatecommand=>[\&set_atoms_params, 'b'])
66
68
-> grid(-column=>1, -row=>2);
67
69
$fr -> Button(@help_button, -text=>'C', -command=>[\&Echo, $click_help{'C'}])
68
70
-> grid(-column=>0, -row=>3, -sticky=>'e', -padx=>2);
69
$widgets{atoms_c} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
71
$widgets{atoms_c} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
71
73
-validatecommand=>[\&set_atoms_params, 'c'])
72
74
-> grid(-column=>1, -row=>3);
75
77
$fr -> Button(@help_button, -text=>'Alpha', -command=>[\&Echo, $click_help{'Alpha'}])
76
78
-> grid(-column=>0, -row=>4, -sticky=>'e', -padx=>2);
77
$widgets{atoms_alpha} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
79
$widgets{atoms_alpha} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
79
81
-validatecommand=>[\&set_atoms_params, 'alpha'])
80
82
-> grid(-column=>1, -row=>4);
81
83
$fr -> Button(@help_button, -text=>'Beta', -command=>[\&Echo, $click_help{'Beta'}])
82
84
-> grid(-column=>0, -row=>5, -sticky=>'e', -padx=>2);
83
$widgets{atoms_beta} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
85
$widgets{atoms_beta} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
85
87
-validatecommand=>[\&set_atoms_params, 'beta'])
86
88
-> grid(-column=>1, -row=>5);
87
89
$fr -> Button(@help_button, -text=>'Gamma', -command=>[\&Echo, $click_help{'Gamma'}])
88
90
-> grid(-column=>0, -row=>6, -sticky=>'e', -padx=>2);
89
$widgets{atoms_gamma} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
91
$widgets{atoms_gamma} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
91
93
-validatecommand=>[\&set_atoms_params, 'gamma'])
92
94
-> grid(-column=>1, -row=>6);
97
99
$fr -> Button(@help_button,
98
100
-text=>'Cluster size', -command=>[\&Echo, $click_help{'Cluster size'}])
99
101
-> grid(-column=>0, -row=>7, -sticky=>'e', -padx=>2, -pady=>2);
100
$widgets{atoms_rmax} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
102
$widgets{atoms_rmax} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
101
103
-validate=>'key',
102
104
-validatecommand=>[\&set_atoms_params, 'rmax'])
103
105
-> grid(-column=>1, -row=>7, -padx=>2);
115
117
$fr -> Button(@help_button,
116
118
-text=>'Shift vector', -command=>[\&Echo, $click_help{'Shift vector'}])
117
119
-> grid(-column=>0, -row=>9, -sticky=>'e', -padx=>2);
118
$widgets{atoms_shiftx} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
120
$widgets{atoms_shiftx} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
119
121
-validate=>'key',
120
122
-validatecommand=>[\&set_atoms_params, 'shiftx'])
121
123
-> grid(-column=>1, -row=>9, -padx=>2);
122
$widgets{atoms_shifty} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
124
$widgets{atoms_shifty} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
123
125
-validate=>'key',
124
126
-validatecommand=>[\&set_atoms_params, 'shifty'])
125
127
-> grid(-column=>1, -row=>10, -padx=>2);
126
$widgets{atoms_shiftz} = $fr -> Entry(-width=>10, -font=>$config{gds}{font},
128
$widgets{atoms_shiftz} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed},
127
129
-validate=>'key',
128
130
-validatecommand=>[\&set_atoms_params, 'shiftz'])
129
131
-> grid(-column=>1, -row=>11, -padx=>2);
138
140
-scrollbars => 'osoe',
139
141
-background => $config{colors}{background},
140
-font => $config{gds}{font},
142
-font => $config{fonts}{fixed},
141
143
-selectmode => 'extended',
142
144
-selectbackground => $config{colors}{selected},
143
145
-browsecmd => \&atoms_edit,
151
153
-anchor=>'center',
152
154
-foreground=>$config{colors}{activehighlightcolor});
153
155
$atoms_styles{normal} = $atoms_list -> ItemStyle('text',
154
-font=>$config{gds}{font},
156
-font=>$config{fonts}{fixed},
155
157
-foreground=>$config{colors}{foreground},
156
158
-selectforeground=>$config{colors}{foreground},
157
159
-background=>$config{colors}{background});
158
160
$atoms_styles{centered} = $atoms_list -> ItemStyle('text',
159
-font=>$config{gds}{font},
161
-font=>$config{fonts}{fixed},
160
162
-anchor=>'center',
161
163
-foreground=>$config{colors}{foreground},
162
164
-selectforeground=>$config{colors}{foreground},
192
194
$atoms_list -> columnWidth(6, -char=>10);
194
196
$atoms_styles{normal} = $atoms_list -> ItemStyle('text',
195
-font=>$config{gds}{font},
197
-font=>$config{fonts}{fixed},
196
198
-foreground=>$config{colors}{foreground},
197
199
-selectforeground=>$config{colors}{foreground},
198
200
-background=>$config{colors}{background});
199
201
$atoms_styles{centered} = $atoms_list -> ItemStyle('text',
200
-font=>$config{gds}{font},
202
-font=>$config{fonts}{fixed},
201
203
-anchor=>'center',
202
204
-foreground=>$config{colors}{foreground},
203
205
-selectforeground=>$config{colors}{foreground},
223
225
#if ($config{atoms}{elem} eq 'menu') {
225
227
# $widgets{atoms_elem} = $fr -> BrowseEntry(-label => "Element ",
228
# -disabledforeground => $config{colors}{foreground},
229
# -state => 'readonly',
226
230
# -font=>$config{fonts}{small},
227
231
# -foreground=>$config{colors}{activehighlightcolor},
310
314
-title => 'Artemis: Question...',
311
315
-buttons => ['Import atoms.inp', 'Blank page', 'Cancel'],
312
316
-default_button => 'Blank page',
317
-font => $config{fonts}{med},
313
318
-popover => 'cursor');
315
320
my $answer = $dialog->Show();
536
541
-title => 'Artemis: Question importing atoms.inp...',
537
542
-buttons => ['Yes', 'No'],
538
543
-default_button => 'Yes',
544
-font => $config{fonts}{med},
539
545
-popover => 'cursor');
541
547
my $response = $dialog->Show();
954
960
## read titles and edge -- which is ok since the current must be
955
961
## showing, but also need to update them in case of clicking away
956
962
## and back before running
957
965
atoms_save_page($current);
958
966
Echo("Refreshed atoms parameters ...");
999
1007
my $tag_bad = 0;
1000
1008
my $xtal_warnings = q{};
1001
1009
##foreach my $k (sort (grep /^atoms_elem_\d+$/, (keys %widgets))) {
1011
foreach my $s (@{ $paths{$current}->get("atoms_atoms") }) {
1012
check_for_third($s, $count);
1015
atoms_save_page($current);
1002
1016
foreach my $s (@{ $paths{$current}->get("atoms_atoms") }) {
1003
1017
$sites[$nsites] = Xray::Xtal::Site -> new($nsites);
1004
1018
## this mess allows for simple fractions and such
1034
1048
-title => 'Artemis: Question...',
1035
1049
-buttons => ['Yes, continue', 'No, cancel'],
1036
1050
-default_button => 'No, cancel',
1051
-font => $config{fonts}{med},
1037
1052
-popover => 'cursor');
1038
1053
my $answer = $dialog->Show();
1039
1054
if ($answer eq 'No, cancel') {
1159
1174
#$widgets{feff_inptext} -> delete('1.0', 'end');
1160
1175
#$widgets{feff_inptext} -> insert('1.0', $feff);
1161
1176
$widgets{feff_inptext} -> Load(File::Spec->catfile($project_folder, $id, "feff.inp"));
1177
$widgets{feff_inptext} -> tagAdd("feffinp", qw(1.0 end));
1162
1178
$widgets{feff_inptext} -> ResetUndo;
1163
1179
$fefftabs -> pageconfigure('feff.inp', -state=>'normal');
1164
1180
$fefftabs -> raise('feff.inp');
1195
1211
#print "$edge $absorber $z\n";
1196
1212
return ($edge, $absorber, $is_odd);
1215
sub check_for_third {
1216
my ($site, $row) = @_;
1217
my @col = (q{}, qw(x y z));
1218
foreach my $coord (1, 2, 3) {
1219
my $val = Xray::Atoms::number($site->[$coord], 1); # watch out for fractions
1220
my $diff = abs($val - THIRD);
1221
my $id = $site->[4] || $site->[0];
1222
if ( ($diff < DELTA) and ($diff > EPSILON) ) {
1224
$top -> Dialog(-bitmap => 'questhead',
1225
-text => "The $col[$coord] coordinate of $id is very close to 1/3. Atoms and Feff operate at 5 digits of precision. Do you want to use the value $site->[$coord] or should Artemis change this value to 1/3?",
1226
-title => 'Artemis: Question...',
1227
-buttons => ["Use $site->[$coord]", 'Change to 1/3'],
1228
-default_button => 'Change to 1/3',
1229
-font => $config{fonts}{med},);
1231
#$dialog->Subwidget("message")->configure(-width=>100);
1232
my $answer = $dialog->Show();
1233
if ($answer eq "Change to 1/3") {
1234
$widgets{atoms_list} -> itemConfigure($row, $coord+2, -text=>"1/3");
1235
$atoms[$row]->[$coord] = 0.33333;
1238
$diff = abs($val - TWOTH);
1239
if ( ($diff < DELTA) and ($diff > EPSILON) ) {
1241
$top -> Dialog(-bitmap => 'questhead',
1242
-text => "The $coord coordinate of $id is very close to 2/3. Atoms and Feff operate at 5 digits of precision. Do you want to use the value $site->[$coord] or should Artemis change this value to 2/3?",
1243
-title => 'Artemis: Question...',
1244
-buttons => ["Use $site->[$coord]", 'Change to 2/3'],
1245
-default_button => 'Change to 2/3',
1246
-font => $config{fonts}{med},);
1248
my $answer = $dialog->Show();
1249
if ($answer eq "Change to 2/3") {
1250
$widgets{atoms_list} -> itemConfigure($row, $coord+2, -text=>"2/3");
1251
$atoms[$row]->[$coord] = 0.66667;