Module: Mddb
- Defined in:
- lib/mddb.rb,
lib/mddb/cli.rb,
lib/mddb/atom.rb,
lib/mddb/frame.rb,
lib/mddb/config.rb,
lib/mddb/parser.rb,
lib/mddb/runner.rb,
lib/mddb/version.rb,
lib/mddb/molecule.rb,
lib/mddb/generators.rb,
lib/mddb/calculations.rb
Defined Under Namespace
Modules: Calculations, Commands, Config, Generators, Parser
Classes: Atom, CLI, FrameBase, Molecule, Runner
Constant Summary
collapse
- TEMPLATES =
File.expand_path('mddb/templates', __FILE__)
- VERSION =
"0.0.27"
Class Method Summary
collapse
Class Method Details
.a2bohr ⇒ Object
21
22
23
|
# File 'lib/mddb.rb', line 21
def Mddb.a2bohr
0.5291772086**-1
end
|
.run(opts = {}) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/mddb.rb', line 26
def Mddb.run opts = {}
if opts[:all]
frames = Frame.all
else
frames = Frame.where(:fid.gte => opts[:from], :fid.lte => opts[:to], :pid => opts[:pid]).all
end
if frames.empty?
puts "There were no frames in in this range"
else
klasses = Frame.associations.keys.map {|k| k.to_s.classify}
if klasses.empty?
puts "There are no objects associated with frame"
else
puts "#{klasses.count} models found"
frames.each do |f|
klasses.each do |k|
begin
puts "attempting to run #{k}"
m = Object.const_get(k).where(:fid => f.fid).all
m.each {|m| m.run}
rescue
puts "couldn't run calculation on #{k}"
end
end
f.run
end
end
end
end
|