ncomps = mol.get_mo_info(:ncomps)
mo_index = 1
mo_ao = nil
- coltable = [[0,0,1], [1,0,0], [0,1,0], [1,1,0], [0,1,1], [1,0,1], [0,0,0]]
+ coltable = [[0,0,1], [1,0,0], [0,1,0], [1,1,0], [0,1,1], [1,0,1], [0,0,0], [1,1,1]]
mo_ao_items = ["Molecular Orbitals", "Atomic Orbitals"]
mo_ao_keys = ["MO", "AO"]
if (nbo = mol.instance_eval { @nbo }) != nil
end
else
mo_index = mo
- occ_new = occ
+ occ_new = occ
+ if mo_menu[mo]
+ if mo_menu[mo] =~ /(\(ryd?)|(\(NB)|(\*)/
+ occ_new = 0
+ else
+ occ_new = 1
+ end
+ end
end
coeffs = nil
if occ_new != occ
end
it0 = item_with_tag("mo")
it0[:subitems] = mo_menu
- it0[:value] = 0
+ #it0[:value] = 0 # Keep the mo number invariant
h["mo"] = nil # "Update" button is forced to be enabled
on_mo_action.call(it0)
end
item(:popup, :tag=>"mo", :subitems=>mo_menu, :action=>on_mo_action)),
layout(4,
item(:text, :title=>"Color"),
- item(:popup, :tag=>"color", :subitems=>["blue", "red", "green", "yellow", "cyan", "magenta", "black"], :action=>on_action),
+ item(:popup, :tag=>"color", :subitems=>["blue", "red", "green", "yellow", "cyan", "magenta", "black", "white"], :action=>on_action),
item(:text, :title=>"Opacity"),
item(:textfield, :tag=>"opacity", :width=>80, :value=>"0.8", :action=>on_action),
item(:text, :title=>"Threshold"),
dfttype_desc = ["B3LYP"]
runtype_desc = ["Energy", "Optimize"]
scftype_desc = ["RHF", "ROHF", "UHF"]
- nbo_desc = ["nao", "pnao", "aho", "lho", "lpo", "clpo"] # JANPA
+ nbo_desc = ["nao", "pnao", "aho", "lho", "plho", "lpo", "clpo"] # JANPA
user_input = Hash.new
defaults = {"scftype"=>0, "runtype"=>0, "move_to_com"=>0, "do_reorient"=>0,
"use_symmetry"=>0, "charge"=>"0", "mult"=>"1",
while line = getline.call
if line =~ /^ *Sym= *(\w+)/
sym = $1
- elsif line =~ /^ *Ene= *([-+.0-9e]+)/
+ elsif line =~ /^ *Ene= *([-+.0-9eE]+)/
ene = Float($1)
elsif line =~ /^ *Spin= *(\w+)/
spin = $1
- elsif line =~ /^ *Occup= *([-+.0-9e]+)/
+ elsif line =~ /^ *Occup= *([-+.0-9eE]+)/
occ = Float($1)
if occ > 0.0
if spin == "Alpha"
if label
hash[:moinfo].push([sym, ene, (spin == "Alpha" ? 0 : 1), occ])
end
- elsif line =~ /^ *([0-9]+) +([-+.0-9e]+)/
+ elsif line =~ /^ *([0-9]+) +([-+.0-9eE]+)/
m[i] = Float($2)
i += 1
if i >= ncomps
idx = idx_beta
idx_beta += 1
end
- set_mo_coefficients(idx, ene, m)
if label
hash[:mo].push(m.dup)
+ else
+ set_mo_coefficients(idx, ene, m)
end
break
end
# Copy labels from LHO
@nbo["AHO_L"] = @nbo["LHO_L"].dup
end
+ if @nbo["AO/NAO"] && @nbo["NAO_L"]
+ # Make distinction between "LP" and "core" orbitals
+ ["AHO", "LHO", "LPO", "CLPO"].each { |key|
+ next if !@nbo["AO/" + key] || !@nbo[key + "_L"]
+ nao2key = @nbo["AO/NAO"].inverse * @nbo["AO/" + key]
+ @nbo[key + "_L"].each_with_index { |label, index|
+ if label =~ /\(((LP)|(lp)),/
+ max_val = -1
+ max_idx = nil
+ nao_num.times { |idx|
+ w = nao2key[index, idx] ** 2
+ if w > max_val
+ max_val = w
+ max_idx = idx
+ end
+ }
+ nao_label = @nbo["NAO_L"][max_idx]
+ if nao_label =~ /\(core,/
+ label.gsub!(/\(((LP)|(lp)),/, "(core,")
+ @nbo[key + "_L"][index] = label
+ end
+ end
+ }
+ }
+ end
return true
rescue => e
$stderr.write(e.message + "\n")
MoleculeLock(mview->mol);
MainView_rotateBySlider(mview, angle * 3.1415927 * 2, mode, mouseStatus, MainViewCallback_modifierFlags(NULL));
+
+ // We do not use here MainViewCallback_drawInfoText(), because the character
+ // "°" here is written in UTF-8 encoding, whereas MainViewCallback_drawInfoText()
+ // accepts a C string in native encoding (shift-JIS in Windows)
snprintf(buf, sizeof buf, "%.1f°", angledeg);
- MainViewCallback_drawInfoText(mview, buf);
+ wxString labelstr(buf, wxConvUTF8); // force UTF-8 encoding here
+ infotext->SetLabel(labelstr);
+
MainViewCallback_updateCanvas(mview);
MoleculeUnlock(mview->mol);
}