| 1 |
# -*- cperl -*- |
| 2 |
## This file is part of Artemis, copyright (c) 2002-2008 Bruce Ravel |
| 3 |
## |
| 4 |
## The Atoms interface |
| 5 |
|
| 6 |
|
| 7 |
sub make_atoms { |
| 8 |
|
| 9 |
my $atoms = $_[0]; |
| 10 |
|
| 11 |
$atoms_params{edge} = 'K'; |
| 12 |
$atoms_params{elem} = 'H'; |
| 13 |
my @help_button = (-foreground => $config{colors}{activehighlightcolor}, |
| 14 |
-font => $config{fonts}{small}, |
| 15 |
-relief => 'flat', |
| 16 |
-borderwidth => 0, |
| 17 |
-cursor => $mouse_over_cursor, |
| 18 |
-activeforeground => $config{colors}{mbutton}, |
| 19 |
); |
| 20 |
|
| 21 |
my $fr = $atoms -> LabFrame(-label=>'Titles', |
| 22 |
-foreground=>$config{colors}{activehighlightcolor}, |
| 23 |
-labelside=>'acrosstop') |
| 24 |
-> pack(-side=>'top', -fill=>'x'); |
| 25 |
$widgets{atoms_titles} = $fr -> Scrolled("Text", |
| 26 |
-scrollbars=>'e', |
| 27 |
-height=>3) |
| 28 |
-> pack(-side=>'top', -expand=>1, -fill=>'x'); |
| 29 |
$widgets{atoms_titles} -> Subwidget("yscrollbar") |
| 30 |
->configure(-background=>$config{colors}{background}, |
| 31 |
($is_windows) ? () : (-width=>8)); |
| 32 |
&disable_mouse3($widgets{atoms_titles}->Subwidget("text")); |
| 33 |
|
| 34 |
|
| 35 |
my $main = $atoms -> Frame() |
| 36 |
-> pack(-side=>'top', -expand=>1, -fill=>'both'); |
| 37 |
|
| 38 |
$fr = $main -> Frame() |
| 39 |
-> pack(-side=>'left', -anchor=>'n'); |
| 40 |
|
| 41 |
## space group |
| 42 |
## my $lfr = $fr -> LabFrame(-label=>'Space group', |
| 43 |
## -foreground=>$config{colors}{activehighlightcolor}, |
| 44 |
## -labelside=>'acrosstop') |
| 45 |
## -> grid(-column=>0, -row=>0, -columnspan=>2, -padx=>2); |
| 46 |
## &labframe_help($lfr); |
| 47 |
$fr -> Button(@help_button, |
| 48 |
-text=>'Space group', -command=>[\&Echo, $click_help{'Space group'}]) |
| 49 |
-> grid(-column=>0, -row=>0, -sticky=>'e', -padx=>2, -pady=>2); |
| 50 |
$widgets{atoms_space} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 51 |
-validate=>'key', |
| 52 |
-validatecommand=>[\&set_atoms_params, 'space']) |
| 53 |
-> grid(-column=>1, -row=>0, -padx=>2, -pady=>2); |
| 54 |
## -> pack(-padx=>4, -pady=>4); |
| 55 |
|
| 56 |
## lattice constants |
| 57 |
$fr -> Button(@help_button, -text=>'A', -command=>[\&Echo, $click_help{'A'}]) |
| 58 |
-> grid(-column=>0, -row=>1, -sticky=>'e', -padx=>2); |
| 59 |
$widgets{atoms_a} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 60 |
-validate=>'key', |
| 61 |
-validatecommand=>[\&set_atoms_params, 'a']) |
| 62 |
-> grid(-column=>1, -row=>1); |
| 63 |
$fr -> Button(@help_button, -text=>'B', -command=>[\&Echo, $click_help{'B'}]) |
| 64 |
-> grid(-column=>0, -row=>2, -sticky=>'e', -padx=>2); |
| 65 |
$widgets{atoms_b} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 66 |
-validate=>'key', |
| 67 |
-validatecommand=>[\&set_atoms_params, 'b']) |
| 68 |
-> grid(-column=>1, -row=>2); |
| 69 |
$fr -> Button(@help_button, -text=>'C', -command=>[\&Echo, $click_help{'C'}]) |
| 70 |
-> grid(-column=>0, -row=>3, -sticky=>'e', -padx=>2); |
| 71 |
$widgets{atoms_c} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 72 |
-validate=>'key', |
| 73 |
-validatecommand=>[\&set_atoms_params, 'c']) |
| 74 |
-> grid(-column=>1, -row=>3); |
| 75 |
|
| 76 |
## lattice angles |
| 77 |
$fr -> Button(@help_button, -text=>'Alpha', -command=>[\&Echo, $click_help{'Alpha'}]) |
| 78 |
-> grid(-column=>0, -row=>4, -sticky=>'e', -padx=>2); |
| 79 |
$widgets{atoms_alpha} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 80 |
-validate=>'key', |
| 81 |
-validatecommand=>[\&set_atoms_params, 'alpha']) |
| 82 |
-> grid(-column=>1, -row=>4); |
| 83 |
$fr -> Button(@help_button, -text=>'Beta', -command=>[\&Echo, $click_help{'Beta'}]) |
| 84 |
-> grid(-column=>0, -row=>5, -sticky=>'e', -padx=>2); |
| 85 |
$widgets{atoms_beta} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 86 |
-validate=>'key', |
| 87 |
-validatecommand=>[\&set_atoms_params, 'beta']) |
| 88 |
-> grid(-column=>1, -row=>5); |
| 89 |
$fr -> Button(@help_button, -text=>'Gamma', -command=>[\&Echo, $click_help{'Gamma'}]) |
| 90 |
-> grid(-column=>0, -row=>6, -sticky=>'e', -padx=>2); |
| 91 |
$widgets{atoms_gamma} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 92 |
-validate=>'key', |
| 93 |
-validatecommand=>[\&set_atoms_params, 'gamma']) |
| 94 |
-> grid(-column=>1, -row=>6); |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
## cluster size and edge |
| 99 |
$fr -> Button(@help_button, |
| 100 |
-text=>'Cluster size', -command=>[\&Echo, $click_help{'Cluster size'}]) |
| 101 |
-> grid(-column=>0, -row=>7, -sticky=>'e', -padx=>2, -pady=>2); |
| 102 |
$widgets{atoms_rmax} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 103 |
-validate=>'key', |
| 104 |
-validatecommand=>[\&set_atoms_params, 'rmax']) |
| 105 |
-> grid(-column=>1, -row=>7, -padx=>2); |
| 106 |
$fr -> Button(@help_button, -text=>'Edge', -command=>[\&Echo, $click_help{'Edge'}]) |
| 107 |
-> grid(-column=>0, -row=>8, -sticky=>'e', -padx=>2, -pady=>2); |
| 108 |
$widgets{atoms_edge} = $fr -> Optionmenu(-options=>[qw/K L3 L2 L1 none/], |
| 109 |
-textvariable=>\$atoms_params{edge}, |
| 110 |
-borderwidth=>1, |
| 111 |
-command=>\&set_edge, |
| 112 |
) |
| 113 |
-> grid(-column=>1, -row=>8, -sticky=>'w', -padx=>2); |
| 114 |
|
| 115 |
|
| 116 |
## shift vector |
| 117 |
$fr -> Button(@help_button, |
| 118 |
-text=>'Shift vector', -command=>[\&Echo, $click_help{'Shift vector'}]) |
| 119 |
-> grid(-column=>0, -row=>9, -sticky=>'e', -padx=>2); |
| 120 |
$widgets{atoms_shiftx} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 121 |
-validate=>'key', |
| 122 |
-validatecommand=>[\&set_atoms_params, 'shiftx']) |
| 123 |
-> grid(-column=>1, -row=>9, -padx=>2); |
| 124 |
$widgets{atoms_shifty} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 125 |
-validate=>'key', |
| 126 |
-validatecommand=>[\&set_atoms_params, 'shifty']) |
| 127 |
-> grid(-column=>1, -row=>10, -padx=>2); |
| 128 |
$widgets{atoms_shiftz} = $fr -> Entry(-width=>10, -font=>$config{fonts}{fixed}, |
| 129 |
-validate=>'key', |
| 130 |
-validatecommand=>[\&set_atoms_params, 'shiftz']) |
| 131 |
-> grid(-column=>1, -row=>11, -padx=>2); |
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
## scrolled hlist of atom sites |
| 136 |
my $atoms_list; |
| 137 |
$atoms_list = $main -> Scrolled("HList", |
| 138 |
-columns => 7, |
| 139 |
-header => 1, |
| 140 |
-scrollbars => 'osoe', |
| 141 |
-background => $config{colors}{background}, |
| 142 |
-font => $config{fonts}{fixed}, |
| 143 |
-selectmode => 'extended', |
| 144 |
-selectbackground => $config{colors}{selected}, |
| 145 |
-browsecmd => \&atoms_edit, |
| 146 |
#-command => sub{1;}, |
| 147 |
) |
| 148 |
-> pack(-side=>'right', -expand=>1, -fill=>'both'); |
| 149 |
$widgets{atoms_list} = $atoms_list; |
| 150 |
|
| 151 |
$atoms_styles{header} = $atoms_list -> ItemStyle('text', |
| 152 |
-font=>$config{fonts}{small}, |
| 153 |
-anchor=>'center', |
| 154 |
-foreground=>$config{colors}{activehighlightcolor}); |
| 155 |
$atoms_styles{normal} = $atoms_list -> ItemStyle('text', |
| 156 |
-font=>$config{fonts}{fixed}, |
| 157 |
-foreground=>$config{colors}{foreground}, |
| 158 |
-selectforeground=>$config{colors}{foreground}, |
| 159 |
-background=>$config{colors}{background}); |
| 160 |
$atoms_styles{centered} = $atoms_list -> ItemStyle('text', |
| 161 |
-font=>$config{fonts}{fixed}, |
| 162 |
-anchor=>'center', |
| 163 |
-foreground=>$config{colors}{foreground}, |
| 164 |
-selectforeground=>$config{colors}{foreground}, |
| 165 |
-background=>$config{colors}{background}); |
| 166 |
|
| 167 |
$atoms_list -> Subwidget("hlist") -> headerCreate(0, -text=>"", |
| 168 |
-style=>$atoms_styles{header}, |
| 169 |
-headerbackground=>$config{colors}{background},); |
| 170 |
$atoms_list -> Subwidget("hlist") -> headerCreate(1, -text=>"Core", |
| 171 |
-style=>$atoms_styles{header}, |
| 172 |
-headerbackground=>$config{colors}{background},); |
| 173 |
$atoms_list -> Subwidget("hlist") -> headerCreate(2, -text=>"El", |
| 174 |
-style=>$atoms_styles{header}, |
| 175 |
-headerbackground=>$config{colors}{background},); |
| 176 |
$atoms_list -> Subwidget("hlist") -> headerCreate(3, -text=>"X", |
| 177 |
-style=>$atoms_styles{header}, |
| 178 |
-headerbackground=>$config{colors}{background},); |
| 179 |
$atoms_list -> Subwidget("hlist") -> headerCreate(4, -text=>"Y", |
| 180 |
-style=>$atoms_styles{header}, |
| 181 |
-headerbackground=>$config{colors}{background},); |
| 182 |
$atoms_list -> Subwidget("hlist") -> headerCreate(5, -text=>"Z", |
| 183 |
-style=>$atoms_styles{header}, |
| 184 |
-headerbackground=>$config{colors}{background},); |
| 185 |
$atoms_list -> Subwidget("hlist") -> headerCreate(6, -text=>"Tag", |
| 186 |
-style=>$atoms_styles{header}, |
| 187 |
-headerbackground=>$config{colors}{background},); |
| 188 |
|
| 189 |
$atoms_list -> Subwidget("hlist") -> columnWidth(0, -char=>3); |
| 190 |
##$atoms_list -> Subwidget("hlist") -> columnWidth(2, -char=>3); |
| 191 |
$atoms_list -> Subwidget("hlist") -> columnWidth(3, -char=>8); |
| 192 |
$atoms_list -> Subwidget("hlist") -> columnWidth(4, -char=>8); |
| 193 |
$atoms_list -> Subwidget("hlist") -> columnWidth(5, -char=>8); |
| 194 |
$atoms_list -> Subwidget("hlist") -> columnWidth(6, -char=>10); |
| 195 |
|
| 196 |
$atoms_styles{normal} = $atoms_list -> ItemStyle('text', |
| 197 |
-font=>$config{fonts}{fixed}, |
| 198 |
-foreground=>$config{colors}{foreground}, |
| 199 |
-selectforeground=>$config{colors}{foreground}, |
| 200 |
-background=>$config{colors}{background}); |
| 201 |
$atoms_styles{centered} = $atoms_list -> ItemStyle('text', |
| 202 |
-font=>$config{fonts}{fixed}, |
| 203 |
-anchor=>'center', |
| 204 |
-foreground=>$config{colors}{foreground}, |
| 205 |
-selectforeground=>$config{colors}{foreground}, |
| 206 |
-background=>$config{colors}{background}); |
| 207 |
|
| 208 |
|
| 209 |
$atoms_list->bind('<ButtonPress-3>',\&atoms_post_menu); |
| 210 |
BindMouseWheel($atoms_list); |
| 211 |
$atoms_list -> Subwidget("xscrollbar") |
| 212 |
-> configure(-background=>$config{colors}{background}, |
| 213 |
($is_windows) ? () : (-width=>8)); |
| 214 |
$atoms_list -> Subwidget("yscrollbar") |
| 215 |
-> configure(-background=>$config{colors}{background}, |
| 216 |
($is_windows) ? () : (-width=>8)); |
| 217 |
|
| 218 |
my $edit = $atoms -> LabFrame(-label=>'Edit selected site', |
| 219 |
-foreground=>$config{colors}{activehighlightcolor}, |
| 220 |
-labelside=>'acrosstop' ) |
| 221 |
-> pack(-side=>'top', -padx=>2); |
| 222 |
$fr = $edit -> Frame() |
| 223 |
-> pack(-side=>'top', -expand=>1, -fill=>'x', -padx=>2); |
| 224 |
|
| 225 |
#if ($config{atoms}{elem} eq 'menu') { |
| 226 |
# my @elem_list; |
| 227 |
# $widgets{atoms_elem} = $fr -> BrowseEntry(-label => "Element ", |
| 228 |
# -disabledforeground => $config{colors}{foreground}, |
| 229 |
# -state => 'readonly', |
| 230 |
# -font=>$config{fonts}{small}, |
| 231 |
# -foreground=>$config{colors}{activehighlightcolor}, |
| 232 |
# -width=>5, |
| 233 |
# -variable => \$atoms_params{elem}, |
| 234 |
# ##-choices => \@elem_list, |
| 235 |
# -browsecmd=>sub{1;}, |
| 236 |
# ); |
| 237 |
# map { $widgets{atoms_elem}-> insert('end', get_symbol($_)) } (1..9); |
| 238 |
# $widgets{atoms_elem} -> pack(-side=>'left'); |
| 239 |
# } else { |
| 240 |
$fr -> Label(-text=>'Element:', |
| 241 |
-font=>$config{fonts}{small}, |
| 242 |
-foreground=>$config{colors}{activehighlightcolor}) |
| 243 |
-> pack(-side=>'left'); |
| 244 |
$widgets{atoms_elem} = $fr -> Entry(-width=>5) |
| 245 |
-> pack(-side=>'left'); |
| 246 |
#}; |
| 247 |
|
| 248 |
$fr -> Frame(-width=>8) |
| 249 |
-> pack(-side=>'left'); |
| 250 |
|
| 251 |
|
| 252 |
$fr -> Label(-text=>'Tag:', |
| 253 |
-font=>$config{fonts}{small}, |
| 254 |
-foreground=>$config{colors}{activehighlightcolor}) |
| 255 |
-> pack(-side=>'left'); |
| 256 |
$widgets{atoms_tag} = $fr -> Entry(-width=>10) |
| 257 |
-> pack(-side=>'left'); |
| 258 |
$fr -> Frame() |
| 259 |
-> pack(-side=>'left', -expand=>1, -fill=>'x'); |
| 260 |
$fr -> Button(-text=>"Define", @button2_list, -width=>15, |
| 261 |
-command=>\&atoms_define) |
| 262 |
-> pack(-side=>'left', -anchor=>'e', -padx=>8); |
| 263 |
|
| 264 |
$fr = $edit -> Frame() |
| 265 |
-> pack(-side=>'top', -expand=>1, -fill=>'x', -pady=>2, -padx=>2); |
| 266 |
$fr -> Label(-text=>'X:', |
| 267 |
-font=>$config{fonts}{small}, |
| 268 |
-foreground=>$config{colors}{activehighlightcolor}) |
| 269 |
-> pack(-side=>'left'); |
| 270 |
$widgets{atoms_x} = $fr -> Entry(-width=>7) |
| 271 |
-> pack(-side=>'left'); |
| 272 |
$fr -> Label(-text=>'Y:', |
| 273 |
-font=>$config{fonts}{small}, |
| 274 |
-foreground=>$config{colors}{activehighlightcolor}) |
| 275 |
-> pack(-side=>'left'); |
| 276 |
$widgets{atoms_y} = $fr -> Entry(-width=>7) |
| 277 |
-> pack(-side=>'left'); |
| 278 |
$fr -> Label(-text=>'Z:', |
| 279 |
-font=>$config{fonts}{small}, |
| 280 |
-foreground=>$config{colors}{activehighlightcolor}) |
| 281 |
-> pack(-side=>'left'); |
| 282 |
$widgets{atoms_z} = $fr -> Entry(-width=>7) |
| 283 |
-> pack(-side=>'left'); |
| 284 |
$fr -> Frame() |
| 285 |
-> pack(-side=>'left', -expand=>1, -fill=>'x'); |
| 286 |
|
| 287 |
|
| 288 |
$fr -> Button(-text=>"New", @button2_list, -width=>15, |
| 289 |
-command=>\&atoms_new_site) |
| 290 |
-> pack(-side=>'right', -anchor=>'e', -padx=>8); |
| 291 |
|
| 292 |
foreach (qw(elem x y z tag)) { |
| 293 |
$widgets{"atoms_".$_} -> bind("<KeyPress-Return>", \&atoms_define); |
| 294 |
}; |
| 295 |
|
| 296 |
|
| 297 |
## run and document buttons |
| 298 |
$fr = $atoms -> Frame() |
| 299 |
-> pack(-side=>'bottom', -fill=>'x'); |
| 300 |
$widgets{help_runfeff} = |
| 301 |
$fr -> Button(-text=>"Document: Atoms", @button2_list, -width=>1, |
| 302 |
-command=>sub{pod_display("artemis_atoms.pod")} ) |
| 303 |
-> pack(-side=>'right', -fill=>'x', -padx=>2, -pady=>2, -expand =>1); |
| 304 |
$fr -> Button(-text=>'Run Atoms', @button2_list, -width=>1, |
| 305 |
-command=>\&run_atoms) |
| 306 |
-> pack(-side=>'left', -fill=>'x', -padx=>2, -pady=>2, -expand =>1); |
| 307 |
}; |
| 308 |
|
| 309 |
|
| 310 |
sub new_atoms { |
| 311 |
my $dialog = |
| 312 |
$top -> Dialog(-bitmap => 'questhead', |
| 313 |
-text => "Do you want to import an existing atoms.inp file or start with a blank page?", |
| 314 |
-title => 'Artemis: Question...', |
| 315 |
-buttons => ['Import atoms.inp', 'Blank page', 'Cancel'], |
| 316 |
-default_button => 'Blank page', |
| 317 |
-font => $config{fonts}{med}, |
| 318 |
-popover => 'cursor'); |
| 319 |
&posted_Dialog; |
| 320 |
my $answer = $dialog->Show(); |
| 321 |
SWITCH: { |
| 322 |
($answer eq 'Import atoms.inp') and do { |
| 323 |
Echo("Importing Atoms data"); |
| 324 |
&import_atoms; |
| 325 |
return; |
| 326 |
}; |
| 327 |
($answer eq 'Blank page') and do { |
| 328 |
Echo("Opening blank Atoms page"); |
| 329 |
last SWITCH; |
| 330 |
}; |
| 331 |
($answer eq 'Cancel') and do { |
| 332 |
Echo("Canceled new Atoms page"); |
| 333 |
return; |
| 334 |
}; |
| 335 |
}; |
| 336 |
|
| 337 |
my $data = $paths{$current}->data; |
| 338 |
## assign an id to this feff calc |
| 339 |
my $id = $data . '.feff' . $n_feff; |
| 340 |
|
| 341 |
## &initialize_project(0); |
| 342 |
## make a project feff folder |
| 343 |
my $project_feff_dir = &initialize_feff($id); |
| 344 |
|
| 345 |
$paths{$id} = Ifeffit::Path -> new(id => $id, |
| 346 |
type => 'feff', |
| 347 |
path => File::Spec->catfile($project_folder, $id), |
| 348 |
data => $data, |
| 349 |
lab => 'FEFF'.$n_feff, |
| 350 |
family => \%paths, |
| 351 |
atoms_atoms => [], |
| 352 |
); |
| 353 |
&clear_atoms; |
| 354 |
initialize_atoms($id); |
| 355 |
$paths{$id} -> make(mode=>1); |
| 356 |
my @autoparams; |
| 357 |
$#autoparams = 6; |
| 358 |
(@autoparams = autoparams_define($id, $n_feff, 0, 0)) if $config{autoparams}{do_autoparams}; |
| 359 |
$paths{$id} -> make(autoparams=>[@autoparams]); |
| 360 |
|
| 361 |
$list -> add($id, -text=>'FEFF'.$n_feff, -style=>$list_styles{noplot}); |
| 362 |
$list -> setmode($id, 'close'); |
| 363 |
$list -> setmode($paths{$data}->get('id'), 'close') |
| 364 |
if ($list -> getmode($paths{$data}->get('id')) eq 'none'); |
| 365 |
|
| 366 |
&set_fit_button('fit'); |
| 367 |
display_page($id); |
| 368 |
project_state(0); |
| 369 |
++$n_feff; |
| 370 |
Echo("Made new atoms page"); |
| 371 |
|
| 372 |
|
| 373 |
}; |
| 374 |
|
| 375 |
|
| 376 |
sub clear_atoms { |
| 377 |
my $feff = $paths{$current}->feff; |
| 378 |
return unless $feff; |
| 379 |
$widgets{atoms_list} -> delete('all'); |
| 380 |
$paths{$feff} -> make(atoms_atoms=>[]); |
| 381 |
foreach (qw(elem x y z tag a b c alpha beta gamma shiftx shifty shiftz space rmax)) { |
| 382 |
$widgets{"atoms_".$_}->delete(0, 'end'); |
| 383 |
$paths{$feff} -> make("atoms_".$_ => ""); |
| 384 |
}; |
| 385 |
$widgets{atoms_titles}->delete('1.0', 'end'); |
| 386 |
$paths{$feff} -> make(atoms_titles=>""); |
| 387 |
$atoms_params{edge} = 'K'; |
| 388 |
$paths{$feff} -> make(atoms_edge=>'K'); |
| 389 |
}; |
| 390 |
|
| 391 |
|
| 392 |
sub initialize_atoms { |
| 393 |
my $this = $_[0]; |
| 394 |
foreach my $k (qw(a b c alpha beta gamma shiftx shifty shiftz)) { |
| 395 |
$paths{$this} -> make("atoms_$k"=>0); |
| 396 |
}; |
| 397 |
$paths{$this} -> make(atoms_space => ""); |
| 398 |
$paths{$this} -> make(atoms_rmax => 6); |
| 399 |
$paths{$this} -> make(atoms_titles => ""); |
| 400 |
$paths{$this} -> make(atoms_edge => "K"); |
| 401 |
$atoms_params{natoms} = 0; |
| 402 |
$atoms_params{edge} = "K"; |
| 403 |
}; |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
sub import_atoms { |
| 408 |
|
| 409 |
my ($file, $just_parse, $this_feff) = @_; |
| 410 |
unless ($file and (-e $file)) { |
| 411 |
##local $Tk::FBox::a; |
| 412 |
##local $Tk::FBox::b; |
| 413 |
my $path = $current_data_dir || cwd; |
| 414 |
my $types = [['Atoms input files', '*.inp'], |
| 415 |
['CIF files', '*.cif'], |
| 416 |
['Atoms and CIF files', ['*.inp','*.cif']], |
| 417 |
['All files', '*'],]; |
| 418 |
$file ||= $top -> getOpenFile(-filetypes=>$types, |
| 419 |
##(not $is_windows) ? |
| 420 |
## (-sortcmd=>sub{$Tk::FBox::a cmp $Tk::FBox::b}) : () , |
| 421 |
-initialdir=>$path, |
| 422 |
-title => "Artemis: Open an Atoms input file"); |
| 423 |
return unless ($file); |
| 424 |
}; |
| 425 |
## take care that this is really an atoms.inp file |
| 426 |
Error("\"$file\" is not an Atoms input file"), return unless ((Ifeffit::Files->is_atoms($file)) or |
| 427 |
(Ifeffit::Files->is_cif($file)) ); |
| 428 |
|
| 429 |
track({file=>$file, mode=>"reading from", command=>sub{my $size = -s $file; print "size : $size\n"}}) if $debug_file_path; |
| 430 |
my $data = ($this_feff) ? (split(/\./, $this_feff))[0] : $paths{$current}->data; |
| 431 |
my ($nm, $pth, $sff) = fileparse($file,".inp",".INP",".Inp",".cif", ".CIF",".Cif"); |
| 432 |
push_mru($file, 1, "atoms") unless ($just_parse); |
| 433 |
|
| 434 |
my $record_number = 0; |
| 435 |
#if ($STAR::Parser and ($sff =~ /cif/i)) { |
| 436 |
if ($STAR_Parser_exists and Ifeffit::Files->is_cif($file)) { |
| 437 |
my @data = STAR::Parser->parse($file); |
| 438 |
my $n = $#data+1; |
| 439 |
if ($#data) { |
| 440 |
my $db = $top->DialogBox(-title=>"Artemis: multi-record CIF file", |
| 441 |
-buttons=>['OK', 'Cancel'], |
| 442 |
-default_button=>'OK',); |
| 443 |
$db->add('Label', -text=>"$nm contains $n records.", |
| 444 |
-foreground=>$config{colors}{activehighlightcolor},) |
| 445 |
-> pack(); |
| 446 |
$db->add('Label', -text=>"Which do you want to import?", |
| 447 |
-foreground=>$config{colors}{activehighlightcolor},) |
| 448 |
-> pack(); |
| 449 |
my $i = 0; |
| 450 |
foreach my $d (@data) { |
| 451 |
$db->add('Radiobutton', |
| 452 |
-text => $d->get_item_data(-item=>"_chemical_name_systematic") || basename($file), |
| 453 |
-value => $i, |
| 454 |
-variable => \$record_number, ) |
| 455 |
-> pack(-anchor=>'w'); |
| 456 |
++$i; |
| 457 |
}; |
| 458 |
&posted_Dialog; |
| 459 |
my $response = $db->Show; |
| 460 |
Echo("CIF import canceled"), return if ($response eq 'Cancel'); |
| 461 |
}; |
| 462 |
}; |
| 463 |
|
| 464 |
## assign an id to this feff calc |
| 465 |
my $id = $this_feff || $data . '.feff' . $n_feff; |
| 466 |
|
| 467 |
Echo("Importing crystallography file ... "); |
| 468 |
## &initialize_project(0); |
| 469 |
## make a project feff folder |
| 470 |
unless ($just_parse) { |
| 471 |
$paths{$id} = Ifeffit::Path |
| 472 |
-> new(id=>$id, type=>'feff', mode=>0, |
| 473 |
data=>$data, lab=>'FEFF'.$n_feff, family=>\%paths, |
| 474 |
); |
| 475 |
$paths{$id} -> make(path=>File::Spec->catfile($project_folder, $id)); |
| 476 |
$paths{$id} -> make(mode => $paths{$id}->get('mode')+1); |
| 477 |
my @autoparams; |
| 478 |
$#autoparams = 6; |
| 479 |
(@autoparams = autoparams_define($id, $n_feff, 0, 0)) if $config{autoparams}{do_autoparams}; |
| 480 |
$paths{$id} -> make(autoparams=>[@autoparams]); |
| 481 |
}; |
| 482 |
|
| 483 |
my $project_feff_dir = ($paths{$id}->get('linkto')) ? $paths{$id}->get('path') : &initialize_feff($id); |
| 484 |
|
| 485 |
|
| 486 |
my $project_atoms = ($STAR_Parser_exists and Ifeffit::Files->is_cif($file)) ? |
| 487 |
File::Spec->catfile($project_feff_dir, "$nm.cif") : |
| 488 |
File::Spec->catfile($project_feff_dir, "atoms.inp"); |
| 489 |
copy($file, $project_atoms) unless ($file eq $project_atoms); |
| 490 |
initialize_atoms($id); |
| 491 |
|
| 492 |
## =============================== parse the input file, |
| 493 |
my $keywords = Xray::Atoms -> new(); |
| 494 |
$keywords -> make('identity'=>"Artemis $VERSION", die=>0, quiet=>1); |
| 495 |
if ($STAR_Parser_exists and ($sff =~ /cif/i)) { |
| 496 |
$keywords -> parse_input($project_atoms, 0, 'cif', $record_number); |
| 497 |
} else { |
| 498 |
$keywords -> parse_input($project_atoms, 0, 'inp'); |
| 499 |
}; |
| 500 |
## any problems??? |
| 501 |
|
| 502 |
$paths{$id} -> make(atoms_core=>""); |
| 503 |
foreach my $k (qw(a b c alpha beta gamma edge core rmax space)) { |
| 504 |
$paths{$id} -> make("atoms_$k"=>$keywords->{$k}); |
| 505 |
}; |
| 506 |
my ($i, $cr) = (0,0); |
| 507 |
@atoms = (); |
| 508 |
foreach my $s (@{$keywords->{'sites'}}) { |
| 509 |
$atoms[$i] = $s; |
| 510 |
($cr ||= $i) if (lc($paths{$id}->get('atoms_core')) eq lc($$s[0])); |
| 511 |
($cr = $i) if (lc($paths{$id}->get('atoms_core')) eq lc($$s[4])); |
| 512 |
++$i; |
| 513 |
}; |
| 514 |
$paths{$id} -> make("atoms_atoms"=>[@atoms]); |
| 515 |
##populate_atoms($id); |
| 516 |
|
| 517 |
$cr ||= 0; |
| 518 |
my $abs = $atoms[$cr]->[0]; |
| 519 |
$paths{$id}->make(atoms_edge=>(get_Z($abs) > 57) ? "L3" : "K") |
| 520 |
unless (lc($paths{$id}->get('atoms_edge')) =~ /(k|l[123])/); |
| 521 |
my $titles = join("<NL>", @{$keywords->{'title'}}); |
| 522 |
#foreach my $t (@{$keywords->{'title'}}) { |
| 523 |
# $titles .= $t . "<NL>"; |
| 524 |
#}; |
| 525 |
$paths{$id} -> make(atoms_titles=>$titles); |
| 526 |
my @shiftvec = @{$keywords->{shift}}; |
| 527 |
$paths{$id} -> make(atoms_shiftx=>$shiftvec[0], atoms_shifty=>$shiftvec[1], atoms_shiftz=>$shiftvec[2]); |
| 528 |
|
| 529 |
undef $keywords; |
| 530 |
|
| 531 |
unless ($just_parse) { |
| 532 |
$list -> add($id, -text=>'FEFF'.$n_feff, -style=>$list_styles{noplot}); |
| 533 |
$list -> setmode($id, 'close'); |
| 534 |
$list -> setmode($paths{$data}->get('id'), 'close') |
| 535 |
if ($list -> getmode($paths{$data}->get('id')) eq 'none'); |
| 536 |
|
| 537 |
|
| 538 |
if ($pth and (-e File::Spec->catfile($pth, "feff.inp"))) { |
| 539 |
my $dialog = |
| 540 |
$top -> Dialog(-bitmap => 'questhead', |
| 541 |
-text => "There is a feff.inp in this folder. Would you like to import it as well?", |
| 542 |
-title => 'Artemis: Question importing atoms.inp...', |
| 543 |
-buttons => ['Yes', 'No'], |
| 544 |
-default_button => 'Yes', |
| 545 |
-font => $config{fonts}{med}, |
| 546 |
-popover => 'cursor'); |
| 547 |
&posted_Dialog; |
| 548 |
my $response = $dialog->Show(); |
| 549 |
if ($response eq 'Yes') { |
| 550 |
my $project_feff = File::Spec->catfile($project_feff_dir, "feff.inp"); |
| 551 |
copy(File::Spec->catfile($pth, "feff.inp"), $project_feff); |
| 552 |
$paths{$id} -> make(mode => $paths{$id}->get('mode')+2); |
| 553 |
}; |
| 554 |
}; |
| 555 |
|
| 556 |
&set_fit_button('fit'); |
| 557 |
display_page($id); |
| 558 |
project_state(0); |
| 559 |
++$n_feff; |
| 560 |
$fefftabs -> raise('Atoms'); |
| 561 |
}; |
| 562 |
Echo("Importing crystallography file ... done!"); |
| 563 |
if (Ifeffit::Files->is_cif($file)) { |
| 564 |
run_atoms("atoms", File::Spec->catfile($project_feff_dir, "atoms.inp")); |
| 565 |
unlink File::Spec->catfile($project_feff_dir, "feff.inp"); |
| 566 |
Echo("You imported a CIF file. Don't forget to set the absorber!"); |
| 567 |
}; |
| 568 |
}; |
| 569 |
|
| 570 |
|
| 571 |
sub populate_atoms { |
| 572 |
my $this = $_[0]; |
| 573 |
|
| 574 |
$widgets{atoms_list}->delete('all'); |
| 575 |
|
| 576 |
@atoms = @{ $paths{$current}->get("atoms_atoms") }; |
| 577 |
my $row = 0; |
| 578 |
$atoms_params{core} = 0; |
| 579 |
foreach my $s (@atoms) { |
| 580 |
my $n = $row+1; |
| 581 |
$widgets{atoms_list} -> add($row); |
| 582 |
$widgets{atoms_list} -> itemCreate($row, 0, -text=>$n, |
| 583 |
-style=>$atoms_styles{centered}); |
| 584 |
$widgets{atoms_list} -> itemCreate($row, 1, -itemtype=>'window', |
| 585 |
-widget=>$widgets{atoms_list}->Radiobutton(-variable => \$atoms_params{core}, |
| 586 |
-foreground => $config{colors}{foreground}, |
| 587 |
-activeforeground => $config{colors}{foreground}, |
| 588 |
-selectcolor => $config{colors}{check}, |
| 589 |
-value => $row, |
| 590 |
-text => "", |
| 591 |
-command => \&set_core)); |
| 592 |
$widgets{atoms_list} -> itemCreate($row, 2, -text=>$s->[0], |
| 593 |
-style=>$atoms_styles{normal}); |
| 594 |
$widgets{atoms_list} -> itemCreate($row, 3, -text=>$s->[1], |
| 595 |
-style=>$atoms_styles{normal}); |
| 596 |
$widgets{atoms_list} -> itemCreate($row, 4, -text=>$s->[2], |
| 597 |
-style=>$atoms_styles{normal}); |
| 598 |
$widgets{atoms_list} -> itemCreate($row, 5, -text=>$s->[3], |
| 599 |
-style=>$atoms_styles{normal}); |
| 600 |
$widgets{atoms_list} -> itemCreate($row, 6, -text=>$s->[4], |
| 601 |
-style=>$atoms_styles{normal}); |
| 602 |
($atoms_params{core} = $row) if (($s->[4] eq $paths{$current}->get("atoms_core")) or |
| 603 |
($s->[0] eq $paths{$current}->get("atoms_core"))); |
| 604 |
++$row; |
| 605 |
}; |
| 606 |
$atoms_params{natoms} = $row; |
| 607 |
## clear out the edit area |
| 608 |
foreach (qw(elem x y z tag)) { |
| 609 |
$widgets{"atoms_".$_}->delete(0, 'end'); |
| 610 |
}; |
| 611 |
$widgets{atoms_list} -> selectionClear; |
| 612 |
$widgets{atoms_list} -> anchorClear; |
| 613 |
}; |
| 614 |
|
| 615 |
|
| 616 |
sub set_edge { |
| 617 |
$paths{$current} -> make(atoms_edge=>$atoms_params{edge}); |
| 618 |
}; |
| 619 |
|
| 620 |
sub set_atp_menu { |
| 621 |
my (%atp, @menu); |
| 622 |
foreach my $d ($Xray::Atoms::atp_dir, $setup->find('atoms', 'atp_personal')) { |
| 623 |
opendir A, $d; |
| 624 |
foreach (grep /(.+)\.atp$/, readdir A) { |
| 625 |
my $key = substr($_, 0, -4); |
| 626 |
++$atp{$key}; |
| 627 |
}; |
| 628 |
closedir A; |
| 629 |
}; |
| 630 |
my $menu = $feff_menu -> cget('-menu') -> entrycget(' Write special output', '-menu'); |
| 631 |
foreach my $a (sort(keys(%atp))) { |
| 632 |
next if ($a =~ /(dafs|powder|template)/); |
| 633 |
$menu -> add('command', -label=>$a, @menu_args, |
| 634 |
-command=>sub{&run_atoms($a)}); |
| 635 |
}; |
| 636 |
#my $menu = $feff_menu -> Menu(-menuitems=>\@menu); |
| 637 |
#$feff_menu -> menu -> entryconfigure(12, -menuitems=>\@menu, -state=>'normal'); |
| 638 |
}; |
| 639 |
|
| 640 |
|
| 641 |
sub set_atoms_params { |
| 642 |
|
| 643 |
my ($k, $entry, $prop) = (shift, shift, shift); |
| 644 |
|
| 645 |
if ($k =~ /^([abc]|rmax)/) { |
| 646 |
($entry =~ /^\s*$/) and ($entry = 0); # error checking ... |
| 647 |
($entry =~ /^\s*\.\s*$/) and ($entry = 0); # a sole . |
| 648 |
($entry =~ /^\s*-?(\d+\.?\d*|\.\d+)\s*$/) or return 0; |
| 649 |
($entry < 0) and return 0; |
| 650 |
} elsif (($k eq 'alpha') or ($k eq 'beta') or ($k eq 'gamma')) { |
| 651 |
($entry =~ /^\s*$/) and ($entry = 0); # error checking ... |
| 652 |
($entry =~ /^\s*\.\s*$/) and ($entry = 0); # a sole . |
| 653 |
($entry =~ /^\s*-?(\d+\.?\d*|\.\d+)\s*$/) or return 0; |
| 654 |
($entry < 0) and return 0; |
| 655 |
($entry > 180) and return 0; |
| 656 |
} elsif ($k =~ /(elem|tag)_(\d+)/) { |
| 657 |
my $key = join("_", "atoms", "core", $2); |
| 658 |
$paths{$current} -> make("atoms_$k"=>$entry); |
| 659 |
$widgets{$key} -> configure(-value => |
| 660 |
lc($paths{$current}->get("atoms_tag_$2")) || |
| 661 |
lc($paths{$current}->get("atoms_elem_$2")) || |
| 662 |
$2 ); |
| 663 |
|
| 664 |
} elsif ($k =~ /^shift/) { # skip check to allow writing |
| 665 |
# fractions, just check later |
| 666 |
1; |
| 667 |
}; |
| 668 |
## also skip the check on the space group symbol |
| 669 |
|
| 670 |
$paths{$current} -> make("atoms_$k"=>$entry); |
| 671 |
project_state(0); |
| 672 |
return 1; |
| 673 |
}; |
| 674 |
|
| 675 |
|
| 676 |
sub atoms_edit { |
| 677 |
my $row = $widgets{atoms_list}->info('anchor'); |
| 678 |
foreach (qw(elem x y z tag)) { |
| 679 |
$widgets{"atoms_".$_}->delete(0, 'end'); |
| 680 |
}; |
| 681 |
#if ($config{atoms}{elem} eq 'menu') { |
| 682 |
# $atoms_params{elem} = $widgets{atoms_list} -> itemCget($row, 2, '-text'); |
| 683 |
#} else { |
| 684 |
$widgets{atoms_elem} -> insert('end', $widgets{atoms_list} -> itemCget($row, 2, '-text') || ""); |
| 685 |
#}; |
| 686 |
$widgets{atoms_x} -> insert('end', $widgets{atoms_list} -> itemCget($row, 3, '-text') || ""); |
| 687 |
$widgets{atoms_y} -> insert('end', $widgets{atoms_list} -> itemCget($row, 4, '-text') || ""); |
| 688 |
$widgets{atoms_z} -> insert('end', $widgets{atoms_list} -> itemCget($row, 5, '-text') || ""); |
| 689 |
$widgets{atoms_tag} -> insert('end', $widgets{atoms_list} -> itemCget($row, 6, '-text') || ""); |
| 690 |
$widgets{atoms_x} -> focus(); |
| 691 |
}; |
| 692 |
|
| 693 |
sub atoms_define { |
| 694 |
my $row; |
| 695 |
Error("You did not supply an element symbol."), return if (lc($widgets{atoms_elem}->get()) =~ /^\s*$/); |
| 696 |
unless (lc($widgets{atoms_elem}->get()) =~ /^$Ifeffit::Files::elem_regex$/) { |
| 697 |
Error($widgets{atoms_elem}->get() . " is not a valid element symbol."); |
| 698 |
$widgets{atoms_elem}->focus; |
| 699 |
$widgets{atoms_elem}->selectionRange(0, 'end'); |
| 700 |
return; |
| 701 |
}; |
| 702 |
## this is true if redefining an old site, false if this is a new site |
| 703 |
my $redefine = $widgets{atoms_list}->info('anchor'); |
| 704 |
if (defined $redefine and ($redefine ne "")) { |
| 705 |
$row = $redefine; |
| 706 |
} else { |
| 707 |
$row = $atoms_params{natoms}; |
| 708 |
$widgets{atoms_list} -> add($row); |
| 709 |
}; |
| 710 |
|
| 711 |
my $tag = $widgets{atoms_tag}->get(); |
| 712 |
$tag =~ s/\s//g; |
| 713 |
$widgets{atoms_tag}->delete(qw(0 end)); |
| 714 |
$widgets{atoms_tag}->insert('end', $tag); |
| 715 |
## fill the data structure |
| 716 |
$atoms[$row] = [ucfirst(lc($widgets{atoms_elem}->get())), |
| 717 |
$widgets{atoms_x}->get(), |
| 718 |
$widgets{atoms_y}->get(), |
| 719 |
$widgets{atoms_z}->get(), |
| 720 |
$tag, |
| 721 |
1 |
| 722 |
]; |
| 723 |
|
| 724 |
## fill in the table |
| 725 |
$widgets{atoms_list} -> itemCreate($row, 1, -itemtype=>'window', |
| 726 |
-widget=>$widgets{atoms_list}->Radiobutton(-variable => \$atoms_params{core}, |
| 727 |
-foreground => $config{colors}{foreground}, |
| 728 |
-activeforeground => $config{colors}{foreground}, |
| 729 |
-selectcolor => $config{colors}{check}, |
| 730 |
-value => $row, |
| 731 |
-text => "", |
| 732 |
-command => \&set_core)); |
| 733 |
$widgets{atoms_list} -> itemCreate($row, 2, -text=>ucfirst(lc($widgets{atoms_elem}->get())), |
| 734 |
-style=>$atoms_styles{normal}); |
| 735 |
$widgets{atoms_list} -> itemCreate($row, 3, -text=>$widgets{atoms_x}->get()||0, |
| 736 |
-style=>$atoms_styles{normal}); |
| 737 |
$widgets{atoms_list} -> itemCreate($row, 4, -text=>$widgets{atoms_y}->get()||0, |
| 738 |
-style=>$atoms_styles{normal}); |
| 739 |
$widgets{atoms_list} -> itemCreate($row, 5, -text=>$widgets{atoms_z}->get()||0, |
| 740 |
-style=>$atoms_styles{normal}); |
| 741 |
$widgets{atoms_list} -> itemCreate($row, 6, -text=>$tag, |
| 742 |
-style=>$atoms_styles{normal}); |
| 743 |
unless (defined $redefine and ($redefine ne "")) { |
| 744 |
++$atoms_params{natoms}; |
| 745 |
$widgets{atoms_list} -> itemCreate($row, 0, -text=>$atoms_params{natoms}, |
| 746 |
-style=>$atoms_styles{centered}); |
| 747 |
}; |
| 748 |
$paths{$current}->make(atoms_atoms=>[@atoms]); |
| 749 |
project_state(0); |
| 750 |
$atoms_params{core} = 0 if ($atoms_params{natoms} == 1); |
| 751 |
my $n = $row+1; |
| 752 |
Echo("Defined " . ucfirst(lc($widgets{atoms_elem}->get())) . " at site " . $n); |
| 753 |
}; |
| 754 |
|
| 755 |
## callback attached to the core radiobuttons |
| 756 |
sub set_core { |
| 757 |
$paths{$current}->make(atoms_core=>$atoms[$atoms_params{core}]->[4]||$atoms[$atoms_params{core}]->[0]); |
| 758 |
project_state(0); |
| 759 |
}; |
| 760 |
|
| 761 |
sub atoms_new_site { |
| 762 |
foreach (qw(elem x y z tag)) { |
| 763 |
$widgets{"atoms_".$_}->delete(0, 'end'); |
| 764 |
}; |
| 765 |
$widgets{atoms_list} -> selectionClear; |
| 766 |
$widgets{atoms_list} -> anchorClear; |
| 767 |
$widgets{atoms_elem} -> focus; |
| 768 |
}; |
| 769 |
|
| 770 |
|
| 771 |
sub post_sgb { |
| 772 |
Error("Sorry! The space group browser is currently broken. It'll get fixed eventually."); |
| 773 |
return; |
| 774 |
if (ref($sgb) =~ /SGB/) { |
| 775 |
($sgb->state() eq "normal") ? $sgb->raise : $sgb->deiconify; |
| 776 |
$top -> update; |
| 777 |
return; |
| 778 |
} |
| 779 |
my @feff = &all_feff; |
| 780 |
Error("Viewing the space group browser requires that at least one Feff calculation exist"), |
| 781 |
return unless @feff; |
| 782 |
my @sgb_args = (-sgbActive => $config{colors}{activehighlightcolor}, |
| 783 |
-sgbGroup => $config{colors}{mbutton}, |
| 784 |
-button => $config{colors}{button}, |
| 785 |
-buttonActive => $config{colors}{activebutton}, |
| 786 |
-buttonLabel => $config{colors}{warning_fg}, |
| 787 |
-buttonFont => $config{fonts}{small}, |
| 788 |
-sgbFont => $config{fonts}{med}, |
| 789 |
); |
| 790 |
$sgb = $top |
| 791 |
-> SGB(-SpaceWidget=>\$widgets{atoms_space}); |
| 792 |
$sgb->configure(@sgb_args); |
| 793 |
$sgb->Show; |
| 794 |
}; |
| 795 |
|
| 796 |
sub atoms_post_menu { |
| 797 |
|
| 798 |
## figure out where the user clicked |
| 799 |
my $w = shift; |
| 800 |
my $Ev = $w->XEvent; |
| 801 |
delete $w->{'shiftanchor'}; |
| 802 |
my $entry = $w->GetNearest($Ev->y, 1); |
| 803 |
return unless (defined($entry) and length($entry)); |
| 804 |
|
| 805 |
## select and anchor the right-clicked parameter |
| 806 |
my @which = $w->selectionGet(); |
| 807 |
$w->anchorSet($entry); |
| 808 |
my $clicked = $w->info('anchor'); |
| 809 |
if (grep {/^$clicked$/} @which) { |
| 810 |
## right click within the current extended selection |
| 811 |
1; |
| 812 |
} else { |
| 813 |
## right clicked outside the current extended selection |
| 814 |
$w->selectionClear; |
| 815 |
$w->selectionSet($entry); |
| 816 |
@which = $w->selectionGet(); |
| 817 |
}; |
| 818 |
&atoms_edit; |
| 819 |
|
| 820 |
## post the message with parameter-appropriate text |
| 821 |
my ($name, $index, $type); |
| 822 |
my @sites = @{ $paths{$current}->get("atoms_atoms") }; |
| 823 |
if ($#which > 0) { |
| 824 |
$index = $w->info('anchor'); |
| 825 |
$name = "these atoms"; |
| 826 |
$type = 'extended'; |
| 827 |
} else { |
| 828 |
$index = $which[0]; |
| 829 |
$name = ($sites[$index]->[4]) ? '"'.$sites[$index]->[4].'"' : '"'.$sites[$index]->[0].'"'; |
| 830 |
}; |
| 831 |
my $anchor = ($sites[$index]->[4]) ? '"'.$sites[$index]->[4].'"' : '"'.$sites[$index]->[0].'"'; |
| 832 |
my ($X, $Y) = ($Ev->X, $Ev->Y); |
| 833 |
$top -> |
| 834 |
Menu(-tearoff=>0, |
| 835 |
-menuitems=>[ |
| 836 |
[ cascade=>"Move $anchor ...", |
| 837 |
-tearoff=>0, |
| 838 |
-menuitems=>[ |
| 839 |
[ command=>"before ...", |
| 840 |
-command=>sub{atoms_move("before")}], |
| 841 |
[ command=>"after ...", |
| 842 |
-command=>sub{atoms_move("after")}], |
| 843 |
]], |
| 844 |
[ command=>"Copy $anchor", |
| 845 |
-command=>[\&atoms_copy, $index]], |
| 846 |
[ command=>"Discard $name", |
| 847 |
-command=>[\&atoms_delete, \@which]], |
| 848 |
]) |
| 849 |
-> Post($X, $Y); |
| 850 |
$w -> break; |
| 851 |
}; |
| 852 |
|
| 853 |
|
| 854 |
sub atoms_save_page { |
| 855 |
my $which = $_[0] || $current; |
| 856 |
## store the sites |
| 857 |
$paths{$which} -> make(atoms_atoms=>[@atoms]); |
| 858 |
## store the entry box parameters |
| 859 |
foreach my $k (qw(a b c alpha beta gamma rmax space)) { |
| 860 |
$paths{$which} -> make("atoms_$k" => $widgets{"atoms_$k"}->get()); |
| 861 |
}; |
| 862 |
## store non-entry widgets |
| 863 |
$paths{$which} -> make(atoms_edge => $atoms_params{edge}); |
| 864 |
$paths{$which} -> make(atoms_core => $atoms[$atoms_params{core}]->[4] || $atoms[$atoms_params{core}]->[0]); |
| 865 |
## store the titles |
| 866 |
my $titles = $widgets{atoms_titles}->get('1.0', 'end'); |
| 867 |
$titles =~ s/\n/<NL>/g; |
| 868 |
$paths{$which} -> make(atoms_titles=>$titles); |
| 869 |
}; |
| 870 |
|
| 871 |
|
| 872 |
sub atoms_move { |
| 873 |
my $which = $_[0]; |
| 874 |
my $where = ""; |
| 875 |
my $whch = $widgets{atoms_list}->info('anchor'); |
| 876 |
my $row = (ref($whch) eq 'ARRAY') ? $$whch[0] : $whch; |
| 877 |
if (($which eq 'before') or ($which eq 'after')) { |
| 878 |
my $tomove = $atoms[$row]->[4] || $atoms[$row]->[0]; |
| 879 |
my $label = "Move \"$tomove\" $which site number: "; |
| 880 |
my $dialog = get_string($dmode, $label, \$where); |
| 881 |
$dialog -> waitWindow; # the get_string dialog will be |
| 882 |
# destroyed once the user hits ok, |
| 883 |
# then we can move on... |
| 884 |
return unless ($where); |
| 885 |
Error("Specify a site index as the target when moving a site."), return unless ($where =~ /^\d+$/); |
| 886 |
} elsif ($which eq 'up') { |
| 887 |
return unless $row; |
| 888 |
$where = $row; |
| 889 |
$which = 'before'; |
| 890 |
Echo("This site is at the top of the list."), return if ($where == 0); |
| 891 |
} elsif ($which eq 'down') { |
| 892 |
return unless $row; |
| 893 |
$where = $row + 1; |
| 894 |
$which = 'after'; |
| 895 |
Echo("This site is at the bottom of the list."), return if ($where == $#atoms+1); |
| 896 |
}; |
| 897 |
|
| 898 |
## have the target, identify location in @atoms array |
| 899 |
my $target = $where-1; |
| 900 |
($target = $#atoms) if ($target > $#atoms); |
| 901 |
($target = 1) if ($target < 1); |
| 902 |
|
| 903 |
--$target if ($row < $target); |
| 904 |
my $save = splice(@atoms, $row, 1); |
| 905 |
if ($which eq 'before') { |
| 906 |
@atoms = (@atoms[0..$target-1], $save, @atoms[$target..$#atoms]); |
| 907 |
} elsif ($which eq 'after') { |
| 908 |
@atoms = (@atoms[0..$target], $save, @atoms[$target+1..$#atoms]); |
| 909 |
$target += 1; |
| 910 |
}; |
| 911 |
$paths{$current}->make(atoms_atoms=>[@atoms]); |
| 912 |
project_state(0); |
| 913 |
populate_atoms(); |
| 914 |
$widgets{atoms_list}->selectionClear; |
| 915 |
$widgets{atoms_list}->anchorSet($target); |
| 916 |
$widgets{atoms_list}->selectionSet($target); |
| 917 |
atoms_edit(); |
| 918 |
}; |
| 919 |
|
| 920 |
sub atoms_copy { |
| 921 |
my $which = $_[0]; |
| 922 |
splice(@atoms, $which, 1, $atoms[$which], $atoms[$which]); |
| 923 |
$paths{$current}->make(atoms_atoms=>[@atoms]); |
| 924 |
populate_atoms($current); |
| 925 |
my $message = "Made a copy of "; |
| 926 |
$message .= $atoms[$which]->[4]||$atoms[$which]->[0]; |
| 927 |
$message .= " and inserted it at site "; |
| 928 |
++$which; |
| 929 |
$widgets{atoms_list} -> selectionSet($which); |
| 930 |
$widgets{atoms_list} -> anchorSet($which); |
| 931 |
&atoms_edit; |
| 932 |
project_state(0); |
| 933 |
++$which; |
| 934 |
Echo($message.$which); |
| 935 |
}; |
| 936 |
|
| 937 |
sub atoms_delete { |
| 938 |
my $which = $_[0]; |
| 939 |
my $i = 0; |
| 940 |
foreach my $w (@$which) { |
| 941 |
my $ww = $w-$i; |
| 942 |
my $elem = $atoms[$ww]->[0]; |
| 943 |
splice(@atoms, $ww, 1); |
| 944 |
$paths{$current}->make(atoms_atoms=>[@atoms]); |
| 945 |
populate_atoms($current); |
| 946 |
++$w; ++$i; |
| 947 |
Echo("Discarded the $elem atom at site $w"); |
| 948 |
}; |
| 949 |
project_state(0); |
| 950 |
($atoms_params{core}=0) if ($atoms_params{core} > $#atoms); |
| 951 |
$plotr_button -> focus(); |
| 952 |
}; |
| 953 |
|
| 954 |
sub run_atoms { |
| 955 |
|
| 956 |
my $atp = $_[0]; |
| 957 |
my $file = $_[1]; |
| 958 |
#print "in run_atoms: $atp\n"; |
| 959 |
Echo("Running atoms ... "); |
| 960 |
|
| 961 |
## read titles and edge -- which is ok since the current must be |
| 962 |
## showing, but also need to update them in case of clicking away |
| 963 |
## and back before running |
| 964 |
atoms_new_site(); |
| 965 |
$top->focus; |
| 966 |
atoms_save_page($current); |
| 967 |
Echo("Refreshed atoms parameters ..."); |
| 968 |
|
| 969 |
## autosave |
| 970 |
&save_project(0,1); |
| 971 |
|
| 972 |
## are there lattice constants? |
| 973 |
my $is_ok = 0; |
| 974 |
foreach my $x (qw(a b c)) { |
| 975 |
my $val = $widgets{"atoms_$x"} -> get; |
| 976 |
++$is_ok if (($val =~ /^\s*-?(\d+\.?\d*|\.\d+)\s*$/) and ($val > 0)); |
| 977 |
}; |
| 978 |
Error("Atoms aborted! You did not specify any lattice constants."), return unless $is_ok; |
| 979 |
|
| 980 |
Error("Atoms aborted! You must select an absorber atom by clicking on its button in the \"Core\" column."), |
| 981 |
return if ((not $paths{$current}->get("atoms_core")) or |
| 982 |
($paths{$current}->get('atoms_core') eq '^^nothing^^') or |
| 983 |
($paths{$current}->get('atoms_core') =~ /^\s*$/)); |
| 984 |
my $core_ok = ""; |
| 985 |
$core_ok = $paths{$current}->get('atoms_core') || ""; |
| 986 |
Error("Atoms aborted! You did not identify the atomic species of the site you selected as the absorber."), |
| 987 |
return if (($core_ok =~ /^\s*$/) or ($core_ok =~ /^\d+$/)); |
| 988 |
|
| 989 |
|
| 990 |
$top -> Busy(); |
| 991 |
## fill the Cell object |
| 992 |
my $cell = Xray::Xtal::Cell -> new(); |
| 993 |
$cell -> make( Space_group=>$paths{$current}->get('atoms_space') ); |
| 994 |
my ($this_sg) = $cell -> attributes('Space_group'); |
| 995 |
unless ($this_sg) { |
| 996 |
$top -> Unbusy(); |
| 997 |
Error("Invalid space group. Atoms aborted."); |
| 998 |
return; |
| 999 |
}; |
| 1000 |
foreach my $param (qw(a b c alpha beta gamma)) { |
| 1001 |
next unless ($paths{$current}->get("atoms_$param") =~ /^\s*(\d+\.?\d*|\.\d+)\s*$/); |
| 1002 |
$cell -> make( $param=>$paths{$current}->get("atoms_$param") ); |
| 1003 |
}; |
| 1004 |
## fill the Site objects |
| 1005 |
my (@sites, @ksites); |
| 1006 |
my $nsites = 0; |
| 1007 |
my $keywords = Xray::Atoms -> new(die=>1); |
| 1008 |
my $tag_bad = 0; |
| 1009 |
my $xtal_warnings = q{}; |
| 1010 |
##foreach my $k (sort (grep /^atoms_elem_\d+$/, (keys %widgets))) { |
| 1011 |
my $count = 0; |
| 1012 |
foreach my $s (@{ $paths{$current}->get("atoms_atoms") }) { |
| 1013 |
check_for_third($s, $count); |
| 1014 |
++$count; |
| 1015 |
}; |
| 1016 |
atoms_save_page($current); |
| 1017 |
foreach my $s (@{ $paths{$current}->get("atoms_atoms") }) { |
| 1018 |
$sites[$nsites] = Xray::Xtal::Site -> new($nsites); |
| 1019 |
## this mess allows for simple fractions and such |
| 1020 |
$sites[$nsites] -> make(Element=>$s->[0], |
| 1021 |
X=>Xray::Atoms::number($s->[1], 1) + |
| 1022 |
Xray::Atoms::number($paths{$current}->get('atoms_shiftx'),1), |
| 1023 |
Y=>Xray::Atoms::number($s->[2], 1) + |
| 1024 |
Xray::Atoms::number($paths{$current}->get('atoms_shifty'),1), |
| 1025 |
Z=>Xray::Atoms::number($s->[3], 1) + |
| 1026 |
Xray::Atoms::number($paths{$current}->get('atoms_shiftz'),1), ); |
| 1027 |
if ($s->[4]) { |
| 1028 |
$sites[$nsites] -> make(Tag=>$s->[4]); |
| 1029 |
$tag_bad = 1 if ($s->[4] =~ /^\d+$/); |
| 1030 |
}; |
| 1031 |
($s->[5]) && ( $sites[$nsites] -> make(Occupancy=>$s->[5]) ); |
| 1032 |
$xtal_warnings .= $sites[$nsites] -> {message_buffer}; |
| 1033 |
$sites[$nsites] -> reset_message_buffer; |
| 1034 |
++$nsites; |
| 1035 |
push @{$keywords->{sites}}, $s; |
| 1036 |
}; |
| 1037 |
if ($tag_bad) { |
| 1038 |
$top -> Unbusy; |
| 1039 |
Error("Atoms aborted! A site tag cannot be an integer."); |
| 1040 |
return; |
| 1041 |
}; |
| 1042 |
my ($ed, $abs, $is_odd) = odd_edge_absorber($current); |
| 1043 |
if ($is_odd) { |
| 1044 |
my $message = "Measuring the $ed edge of $abs seems odd. Is this correct?"; |
| 1045 |
|
| 1046 |
my $dialog = |
| 1047 |
$top -> Dialog(-bitmap => 'questhead', |
| 1048 |
-text => $message, |
| 1049 |
-title => 'Artemis: Question...', |
| 1050 |
-buttons => ['Yes, continue', 'No, cancel'], |
| 1051 |
-default_button => 'No, cancel', |
| 1052 |
-font => $config{fonts}{med}, |
| 1053 |
-popover => 'cursor'); |
| 1054 |
my $answer = $dialog->Show(); |
| 1055 |
if ($answer eq 'No, cancel') { |
| 1056 |
$top -> Unbusy; |
| 1057 |
Echo("Aborting Atoms due to odd edge/absorber combination."); |
| 1058 |
return; |
| 1059 |
}; |
| 1060 |
}; |
| 1061 |
if ($xtal_warnings) { |
| 1062 |
Error("There are possible problems reading the crystallographic data."); |
| 1063 |
post_message($xtal_warnings, 'Error messages'); |
| 1064 |
$xtal_warnings = q{}; |
| 1065 |
}; |
| 1066 |
|
| 1067 |
## load all the values back into an Atoms keyword object |
| 1068 |
$keywords -> make(identity => "Artemis $VERSION", |
| 1069 |
die => 1, |
| 1070 |
quiet => 1, |
| 1071 |
program => 'Artemis', |
| 1072 |
edge => $paths{$current}->get('atoms_edge'), |
| 1073 |
core => $paths{$current}->get('atoms_core'), |
| 1074 |
space => $paths{$current}->get('atoms_space'), |
| 1075 |
a => $paths{$current}->get('atoms_a'), |
| 1076 |
b => $paths{$current}->get('atoms_b'), |
| 1077 |
c => $paths{$current}->get('atoms_c'), |
| 1078 |
alpha => $paths{$current}->get('atoms_alpha'), |
| 1079 |
beta => $paths{$current}->get('atoms_beta'), |
| 1080 |
gamma => $paths{$current}->get('atoms_gamma'), |
| 1081 |
rmax => $paths{$current}->get('atoms_rmax'), |
| 1082 |
argon => 0, |
| 1083 |
krypton => 0, |
| 1084 |
nitrogen => 0, |
| 1085 |
); |
| 1086 |
$keywords -> make(shift => $paths{$current}->get('atoms_shiftx'), |
| 1087 |
$paths{$current}->get('atoms_shifty'), |
| 1088 |
$paths{$current}->get('atoms_shiftz'),); |
| 1089 |
map { $keywords -> make(title=>$_) } (split(/<NL>/, $paths{$current}->get('atoms_titles'))); |
| 1090 |
Echo("Read crystallographic parameters ..."); |
| 1091 |
|
| 1092 |
## =============================== error check, populate the cell, set rmax |
| 1093 |
$cell -> verify_cell(); |
| 1094 |
$cell -> populate(\@sites); |
| 1095 |
my $trouble = $keywords -> verify_keywords($cell, \@sites, 1); |
| 1096 |
if ($trouble) { |
| 1097 |
$top -> Unbusy(); |
| 1098 |
Error("Trouble found among the parameters. Atoms aborted."); |
| 1099 |
return; |
| 1100 |
}; |
| 1101 |
|
| 1102 |
my $message = ""; |
| 1103 |
$message .= $cell -> warn_shift(); |
| 1104 |
$message .= $cell -> cell_check(); |
| 1105 |
post_message($message, 'Atoms warnings') if $message; |
| 1106 |
Echo("Processed crystallographic parameters ..."); |
| 1107 |
|
| 1108 |
|
| 1109 |
my (@cluster, @neutral); |
| 1110 |
my ($atoms, $feff) = ""; |
| 1111 |
if ($atp) { |
| 1112 |
build_cluster($cell, $keywords, \@cluster, \@neutral); |
| 1113 |
my ($default_name, $is_feff) = |
| 1114 |
&parse_atp($atp, $cell, $keywords, \@cluster, \@neutral, \$atoms); |
| 1115 |
Echo("Made ATP output ($atp)"); |
| 1116 |
if ($file) { |
| 1117 |
open A, ">".$file; |
| 1118 |
print A $atoms; |
| 1119 |
close A; |
| 1120 |
} else { |
| 1121 |
$notes{files} -> delete(qw(1.0 end)); |
| 1122 |
$notes{files} -> insert('end', $atoms); |
| 1123 |
$notes{files} -> yviewMoveto(0); |
| 1124 |
$current_file = $default_name; |
| 1125 |
$top -> update; |
| 1126 |
$generic_name = $default_name; |
| 1127 |
raise_palette('files'); |
| 1128 |
}; |
| 1129 |
} else { |
| 1130 |
my $echomsg = "Made ATP output ("; |
| 1131 |
build_cluster($cell, $keywords, \@cluster, \@neutral); |
| 1132 |
my ($default_name, $is_feff) = |
| 1133 |
&parse_atp('atoms', $cell, $keywords, \@cluster, \@neutral, \$atoms); |
| 1134 |
$echomsg .= "atoms "; |
| 1135 |
my $feffv = $config{atoms}{template}; |
| 1136 |
## my $feffv = "feff"; |
| 1137 |
## ($feffv = 'feff7') if ($config{atoms}{feff_version} == 7); |
| 1138 |
## ($feffv = 'feff8_exafs') if ($config{atoms}{feff_version} == 8); |
| 1139 |
($default_name, $is_feff) = |
| 1140 |
&parse_atp($feffv, $cell, $keywords, \@cluster, \@neutral, \$feff); |
| 1141 |
$echomsg .= "$feffv) ..."; |
| 1142 |
Echo($echomsg); |
| 1143 |
}; |
| 1144 |
|
| 1145 |
## refill Path object and widgets with results from the atoms run |
| 1146 |
my @lattice = $cell -> attributes("A", "B", "C", "Alpha", "Beta", "Gamma"); |
| 1147 |
$paths{$current}->make(atoms_a => $lattice[0]); |
| 1148 |
$paths{$current}->make(atoms_b => $lattice[1]); |
| 1149 |
$paths{$current}->make(atoms_c => $lattice[2]); |
| 1150 |
$paths{$current}->make(atoms_alpha => $lattice[3]); |
| 1151 |
$paths{$current}->make(atoms_beta => $lattice[4]); |
| 1152 |
$paths{$current}->make(atoms_gamma => $lattice[5]); |
| 1153 |
foreach my $p (qw(a b c alpha beta gamma)) { |
| 1154 |
$widgets{"atoms_$p"} -> configure(-validate=>'none'); |
| 1155 |
$widgets{"atoms_$p"} -> delete(0, 'end'); |
| 1156 |
$widgets{"atoms_$p"} -> insert('end', $paths{$current}->get("atoms_$p")); |
| 1157 |
$widgets{"atoms_$p"} -> configure(-validate=>'key'); |
| 1158 |
}; |
| 1159 |
|
| 1160 |
## skip this block if this is just some ol' atp output |
| 1161 |
unless ($atp) { |
| 1162 |
|
| 1163 |
## save the atoms.inp and feff.inp files |
| 1164 |
my $id = $paths{$current}->get('id'); |
| 1165 |
my $atoms_file = File::Spec->catfile($project_folder, $id, "atoms.inp"); |
| 1166 |
open ATOMSFILE, ">".$atoms_file or die "could not open $atoms_file for writing"; |
| 1167 |
print ATOMSFILE $atoms; |
| 1168 |
close ATOMSFILE; |
| 1169 |
my $feff_file = File::Spec->catfile($project_folder, $id, "feff.inp"); |
| 1170 |
open FEFFFILE, ">".$feff_file or die "could not open $feff_file for writing"; |
| 1171 |
print FEFFFILE $feff; |
| 1172 |
close FEFFFILE; |
| 1173 |
|
| 1174 |
## send the feff.inp to its tab and display that tab |
| 1175 |
#$widgets{feff_inptext} -> delete('1.0', 'end'); |
| 1176 |
#$widgets{feff_inptext} -> insert('1.0', $feff); |
| 1177 |
$widgets{feff_inptext} -> Load(File::Spec->catfile($project_folder, $id, "feff.inp")); |
| 1178 |
$widgets{feff_inptext} -> tagAdd("feffinp", qw(1.0 end)); |
| 1179 |
$widgets{feff_inptext} -> ResetUndo; |
| 1180 |
$fefftabs -> pageconfigure('feff.inp', -state=>'normal'); |
| 1181 |
$fefftabs -> raise('feff.inp'); |
| 1182 |
|
| 1183 |
$paths{$current} -> make(mode => $paths{$current}->get('mode')+2) unless |
| 1184 |
($paths{$current}->get('mode') & 2); |
| 1185 |
}; |
| 1186 |
|
| 1187 |
project_state(0); |
| 1188 |
|
| 1189 |
$top -> Unbusy(); |
| 1190 |
Echo("Running atoms ... done!"); |
| 1191 |
} |
| 1192 |
|
| 1193 |
## these cutoffs are a bit arbitrary |
| 1194 |
sub odd_edge_absorber { |
| 1195 |
my $this = $_[0]; |
| 1196 |
my $edge = $paths{$this}->get('atoms_edge'); |
| 1197 |
my $tag = $paths{$this}->get('atoms_core'); |
| 1198 |
# print "core=",$tag, $/; |
| 1199 |
my $absorber = ""; |
| 1200 |
foreach my $s (@{ $paths{$current}->get("atoms_atoms") }) { |
| 1201 |
my $this = lc($s->[4]) || lc($s->[0]); |
| 1202 |
($absorber = $s->[0]), last if (lc($tag) eq $this); |
| 1203 |
}; |
| 1204 |
my $z = get_Z($absorber); |
| 1205 |
# print "z=",$z, $/; |
| 1206 |
# print "absorber=",$absorber, $/; |
| 1207 |
|
| 1208 |
my $is_odd = 0; |
| 1209 |
($is_odd = 1) if (($z > 59) and ($edge =~ /k/i)); # K edge above praseodymium |
| 1210 |
($is_odd = 1) if (($z < 45) and ($edge =~ /l/i)); # L edge below rhodium |
| 1211 |
|
| 1212 |
#print "$edge $absorber $z\n"; |
| 1213 |
return ($edge, $absorber, $is_odd); |
| 1214 |
}; |
| 1215 |
|
| 1216 |
sub check_for_third { |
| 1217 |
my ($site, $row) = @_; |
| 1218 |
my @col = (q{}, qw(x y z)); |
| 1219 |
foreach my $coord (1, 2, 3) { |
| 1220 |
my $val = Xray::Atoms::number($site->[$coord], 1); # watch out for fractions |
| 1221 |
my $diff = abs($val - THIRD); |
| 1222 |
my $id = $site->[4] || $site->[0]; |
| 1223 |
if ( ($diff < DELTA) and ($diff > EPSILON) ) { |
| 1224 |
my $dialog = |
| 1225 |
$top -> Dialog(-bitmap => 'questhead', |
| 1226 |
-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?", |
| 1227 |
-title => 'Artemis: Question...', |
| 1228 |
-buttons => ["Use $site->[$coord]", 'Change to 1/3'], |
| 1229 |
-default_button => 'Change to 1/3', |
| 1230 |
-font => $config{fonts}{med},); |
| 1231 |
&posted_Dialog; |
| 1232 |
#$dialog->Subwidget("message")->configure(-width=>100); |
| 1233 |
my $answer = $dialog->Show(); |
| 1234 |
if ($answer eq "Change to 1/3") { |
| 1235 |
$widgets{atoms_list} -> itemConfigure($row, $coord+2, -text=>"1/3"); |
| 1236 |
$atoms[$row]->[$coord] = 0.33333; |
| 1237 |
}; |
| 1238 |
}; |
| 1239 |
$diff = abs($val - TWOTH); |
| 1240 |
if ( ($diff < DELTA) and ($diff > EPSILON) ) { |
| 1241 |
my $dialog = |
| 1242 |
$top -> Dialog(-bitmap => 'questhead', |
| 1243 |
-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?", |
| 1244 |
-title => 'Artemis: Question...', |
| 1245 |
-buttons => ["Use $site->[$coord]", 'Change to 2/3'], |
| 1246 |
-default_button => 'Change to 2/3', |
| 1247 |
-font => $config{fonts}{med},); |
| 1248 |
&posted_Dialog; |
| 1249 |
my $answer = $dialog->Show(); |
| 1250 |
if ($answer eq "Change to 2/3") { |
| 1251 |
$widgets{atoms_list} -> itemConfigure($row, $coord+2, -text=>"2/3"); |
| 1252 |
$atoms[$row]->[$coord] = 0.66667; |
| 1253 |
}; |
| 1254 |
}; |
| 1255 |
}; |
| 1256 |
}; |