Class: AimsProject::AimsProjectGeometry

Inherits:
Object
  • Object
show all
Defined in:
lib/aims_project/aims_project_geometry.rb

Overview

A class that encapsulates the Aims::Geometry and other state information important for AimsProject

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ AimsProjectGeometry

Returns a new instance of AimsProjectGeometry.



14
15
16
17
# File 'lib/aims_project/aims_project_geometry.rb', line 14

def initialize(file)
  @filename = file
  @geometry_original = Aims::GeometryParser.parse(@filename)
end

Instance Attribute Details

#correct_geometryObject

Boolean flag indicating whether the atoms should be displaced to all lie within the unit cell



9
10
11
# File 'lib/aims_project/aims_project_geometry.rb', line 9

def correct_geometry
  @correct_geometry
end

#filenameObject (readonly)

The filename defining this geometry



12
13
14
# File 'lib/aims_project/aims_project_geometry.rb', line 12

def filename
  @filename
end

Instance Method Details

#geometryObject



19
20
21
22
23
24
25
# File 'lib/aims_project/aims_project_geometry.rb', line 19

def geometry
  if self.correct_geometry
    geometry_corrected
  else
    geometry_original
  end
end

#geometry_correctedObject



27
28
29
30
31
32
# File 'lib/aims_project/aims_project_geometry.rb', line 27

def geometry_corrected
  if @geometry_corrected.nil?
    @geometry_corrected = @geometry_original.correct
  end
  @geometry_corrected
end

#geometry_originalObject



34
35
36
# File 'lib/aims_project/aims_project_geometry.rb', line 34

def geometry_original
  @geometry_original
end

#saveObject



43
44
45
46
47
48
# File 'lib/aims_project/aims_project_geometry.rb', line 43

def save
  unless @filename
    raise InvalidFilenameException
  end
  raise "AimsProjectGeometry.save is not yet implemented"
end

#to_sObject



38
39
40
# File 'lib/aims_project/aims_project_geometry.rb', line 38

def to_s
  @filename
end