Class: Mddb::Atom
- Inherits:
-
Object
show all
- Includes:
- Calculations, MongoMapper::EmbeddedDocument
- Defined in:
- lib/mddb/atom.rb
Instance Method Summary
collapse
included, #list_calculations, #run
Instance Method Details
#charge ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/mddb/atom.rb', line 35
def charge
begin
self.class::CHARGE
rescue
raise "Please define a CHARGE constant in #{self.class} class"
end
end
|
#distance_to(a) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/mddb/atom.rb', line 11
def distance_to a
if a.is_a? Point
self.position.distance_to a
elsif a.is_a? Mddb::Atom
self.position.distance_to a.position
end
end
|
#mass ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/mddb/atom.rb', line 27
def mass
begin
self.class::MASS
rescue
raise "Please define a MASS constant in #{self.class} class"
end
end
|
#vector_to(a) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/mddb/atom.rb', line 19
def vector_to a
if a.is_a? Point
self.position.vector_to a
elsif a.is_a? Mddb::Atom
self.position.vector_to a.position
end
end
|