Class: PotcarCommand

Inherits:
Thor
  • Object
show all
Defined in:
bin/potcar

Instance Method Summary collapse

Instance Method Details

#generate(*elements) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'bin/potcar', line 12

def generate(*elements)
  if options[:poscar] && (! elements.empty?)
    puts "Error. Duplicated indication of elements with argument and --poscar option."
    exit
  end

  if options[:poscar]
    elements = VaspUtils::Poscar.load_file(options[:poscar]).elements
  end

  setting = VaspUtils::Setting.new

  vpc = VaspUtils::Potcar::Concatenater.new(
    setting['potcar_dir'],
    setting['default_potcar']
  )
  vpc.dump(elements, STDOUT)
end

#showObject



33
34
35
36
37
38
39
40
41
42
43
# File 'bin/potcar', line 33

def show
  potcar = VaspUtils::Potcar.load_file(options[:potcar])
  printf("%7s %7s %4s\n", "element", "ENMAX", "ZVAL")
  potcar.elements.size.times do |i|
    printf("%7s %7.3f %4.1f\n", 
           potcar.elements[i],
           potcar.enmaxes[i],
           potcar.zvals[i]
          )
  end
end