Class: VasprunXmlCommand
- Inherits:
-
Thor
- Object
- Thor
- VasprunXmlCommand
- Defined in:
- bin/vasprunxml
Overview
Command template
Constant Summary collapse
- DEFAULT_XML =
'vasprun.xml'- DOS_BASENAME =
'dos'- PDOS_PREFIX =
'pdos'
Instance Method Summary collapse
-
#dos ⇒ Object
:type => :numeric で負数を指定できなかった。.
- #pdos(*ion_indices) ⇒ Object
Instance Method Details
#dos ⇒ Object
:type => :numeric で負数を指定できなかった。
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'bin/vasprunxml', line 31 def dos = @xml = VaspUtils::VasprunXml.load_file( [:xml] || DEFAULT_XML ) dos_data1 = @xml.total_dos(1) dos_data2 = @xml.total_dos(2) if @xml.num_spins == 2 ## remove integrated dos_data1.map!{|i| [i[0], i[1]]} dos_data2.map!{|i| [i[0], i[1]]} if @xml.num_spins == 2 plot_dos(dos_data1, dos_data2, DOS_BASENAME, dos_labels) end |
#pdos(*ion_indices) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'bin/vasprunxml', line 63 def pdos(* ion_indices) = if ion_indices.empty? puts "'pdos' subcommand needs at least one atom index. Exit." exit end @xml = VaspUtils::VasprunXml.load_file( [:xml] || DEFAULT_XML ) pdos1_for_ions = [] pdos2_for_ions = [] ion_indices.size.times do |i| ion_index = ion_indices[i].to_i tmp_pdos = @xml.partial_dos(ion_index, 1) tmp_pdos = sum_azimuthal(tmp_pdos) if [:azimuthal] pdos1_for_ions << tmp_pdos if @xml.num_spins == 2 tmp_pdos = @xml.partial_dos(ion_index, 2) tmp_pdos = sum_azimuthal(tmp_pdos) if [:azimuthal] pdos2_for_ions << tmp_pdos end end if [:sum] sum_pdos1 = sum_ions(pdos1_for_ions) sum_pdos2 = sum_ions(pdos2_for_ions) plot_dos(sum_pdos1, sum_pdos2, "#{PDOS_PREFIX}-sum", pdos_labels) else pdos1_for_ions.size.times do |i| plot_dos(pdos1_for_ions[i], pdos2_for_ions[i], "#{PDOS_PREFIX}-#{ion_indices[i]}", pdos_labels) end end end |