Class: VaspUtils::Potcar

Inherits:
Object
  • Object
show all
Defined in:
lib/vasputils/potcar.rb

Overview

Class for dealing with POTCAR.

Defined Under Namespace

Classes: Concatenater

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePotcar

Returns a new instance of Potcar.



10
11
12
13
# File 'lib/vasputils/potcar.rb', line 10

def initialize
  @elements = []
  @enmaxes = []
end

Instance Attribute Details

#elementsObject (readonly)

Returns the value of attribute elements.



8
9
10
# File 'lib/vasputils/potcar.rb', line 8

def elements
  @elements
end

#enmaxesObject (readonly)

Returns the value of attribute enmaxes.



8
9
10
# File 'lib/vasputils/potcar.rb', line 8

def enmaxes
  @enmaxes
end

Class Method Details

.load_file(path) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/vasputils/potcar.rb', line 16

def self.load_file(path)
  result = self.new
  #elements = Array.new
  File.open( path, "r" ).each do |line|
    if line =~ /VRHFIN\s*=\s*([A-Za-z]*)/
      result.elements << $1
    elsif line =~ /ENMAX\s*=\s*(\d+\.\d+)/
      result.enmaxes << $1.to_f
    end
  end
  result
end