Class: CAtom
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(arg) ⇒ CAtom
Returns a new instance of CAtom.
3
4
5
6
7
8
9
|
# File 'lib/lib/crystal/catom.rb', line 3
def initialize arg
if arg.is_a? Atom
@atom = arg
else
@atom = Atom.new(arg)
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
38
39
40
|
# File 'lib/lib/crystal/catom.rb', line 38
def method_missing *args
@atom.send(*args)
end
|
Instance Attribute Details
Returns the value of attribute atom.
2
3
4
|
# File 'lib/lib/crystal/catom.rb', line 2
def atom
@atom
end
|
Instance Method Details
#move(v, n) ⇒ Object
31
32
33
|
# File 'lib/lib/crystal/catom.rb', line 31
def move(v, n)
@atom.move @atom.crystal.real(v), n
end
|
#move!(v, n = 1) ⇒ Object
28
29
30
|
# File 'lib/lib/crystal/catom.rb', line 28
def move!(v, n = 1)
@atom.move! @atom.crystal.real(v), n
end
|
13
14
15
|
# File 'lib/lib/crystal/catom.rb', line 13
def pos
@atom.crystal.frac(@atom.pos)
end
|
#pos=(arg) ⇒ Object
10
11
12
|
# File 'lib/lib/crystal/catom.rb', line 10
def pos= arg
@atom.pos = @atom.crystal.real(arg)
end
|
#to_s(f = '%8.4f') ⇒ Object
34
35
36
|
# File 'lib/lib/crystal/catom.rb', line 34
def to_s f = '%8.4f'
("%-6s" + "#{f} " * 3) % ([@atom.name] + pos.to_a) + (fixed.nil? ? "" : fixed.map{|v| v ? 0 : 1}.join(" "))
end
|
16
|
# File 'lib/lib/crystal/catom.rb', line 16
def x() pos[0] end
|
19
20
21
|
# File 'lib/lib/crystal/catom.rb', line 19
def x=(p)
@atom.pos = @atom.crystal.real([p,y,z])
end
|
17
|
# File 'lib/lib/crystal/catom.rb', line 17
def y() pos[0] end
|
22
23
24
|
# File 'lib/lib/crystal/catom.rb', line 22
def y=(p)
@atom.pos = @atom.crystal.real([x,p,z])
end
|
18
|
# File 'lib/lib/crystal/catom.rb', line 18
def z() pos[0] end
|
25
26
27
|
# File 'lib/lib/crystal/catom.rb', line 25
def z=(p)
@atom.pos = @atom.crystal.real([x,y,p])
end
|