mddb 0.0.12 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
File without changes
File without changes
@@ -4,14 +4,15 @@ require "mddb/cli"
4
4
  require "mongo_mapper"
5
5
  require "mddb/config"
6
6
  require "mddb/parser"
7
+ require "mddb/runner"
7
8
 
8
9
  if File.exists? "config.yml"
9
10
  Mddb::Config.config = "config.yml"
10
- require "mddb/point"
11
- require "mddb/vector"
12
- require "mddb/frame"
13
11
  require "mddb/atom"
14
12
  require "mddb/molecule"
13
+ require "mddb/frame"
14
+ require "mddb/point"
15
+ require "mddb/vector"
15
16
  require "require_all"
16
17
  require_all 'models' unless Dir.glob('models/**/*.rb').size == 0
17
18
  end
@@ -10,6 +10,7 @@ require 'mddb/version'
10
10
  puts " Leave blank for list of available "
11
11
  puts " models"
12
12
  puts " console Starts an interactice MDDB console"
13
+ puts " run Run calculation"
13
14
  elsif %w{-v --version --v}.include? ARGV.first
14
15
  puts Mddb::VERSION
15
16
  elsif ARGV.first == 'new'
@@ -17,6 +18,8 @@ require 'mddb/version'
17
18
  require 'mddb/commands/new'
18
19
  elsif ARGV.first == 'console'
19
20
  require 'mddb/commands/console'
21
+ elsif ARGV.first == 'run'
22
+ require 'mddb/commands/run'
20
23
  elsif ARGV.first == 'load'
21
24
  require 'mddb/commands/load'
22
25
  elsif %w{g generate}.include? ARGV.first
@@ -32,6 +32,7 @@ def start_console
32
32
  end
33
33
  end
34
34
  end
35
+ puts "parsing"
35
36
  p = Mddb::Parser::Parser.new file
36
37
  fid = 1 + last_frame
37
38
  p.each_frame do |f|
@@ -0,0 +1,34 @@
1
+ module Mddb::Commands
2
+ class Run
3
+ def initialize
4
+ puts "Started Runner"
5
+ end
6
+
7
+ def resque
8
+ puts "Running Jobs Using Resque"
9
+ puts "Booting up workers..."
10
+ end
11
+
12
+ def qsub
13
+ puts "Submitting multiple QSUB jobs"
14
+ end
15
+
16
+ def local
17
+ puts "Running locally..."
18
+ x = Mddb::Runner.new
19
+ x.run(1,2)
20
+ end
21
+ end
22
+ ARGV.shift
23
+ options = ['local', 'qsub','resque']
24
+ unless options.include? ARGV.first
25
+ puts "Please specify an option for run"
26
+ options.each do |o|
27
+ puts o
28
+ end
29
+ else
30
+ Run.new.send(ARGV.first)
31
+ end
32
+ end
33
+
34
+
@@ -13,6 +13,7 @@ module Mddb
13
13
  config['database']['host'] = 'localhost' if config['database']['host'].nil?
14
14
  config['database']['port'] = 27017 if config['database']['port'].nil?
15
15
  raise "bad config file: database name needs to be defined" if config['database']['name'].nil?
16
+ raise "bad config file: rcut needs to be defined" if config['simulation']['rcut'].nil?
16
17
  config['simulation']['dimensions'] = config['simulation']['dimensions'].split(',').collect {|a| a.to_f}
17
18
  @@config = config
18
19
  self.connect
@@ -0,0 +1,53 @@
1
+ module Mddb
2
+ class Runner
3
+ def initialize
4
+ begin
5
+ @klasses = Frame.associations.keys.map {|k| t.to_s.classify}
6
+ rescue
7
+ @klasses = []
8
+ end
9
+ end
10
+
11
+ def fine?
12
+ if @klasses.empty?
13
+ puts "No models belong to frame, aborting."
14
+ false
15
+ else
16
+ true
17
+ end
18
+ end
19
+
20
+ def run (start, finish)
21
+ if self.fine?
22
+ (start..finish).each do |f|
23
+ puts "Running => Frame 1"
24
+ self.calculations(f)
25
+ end
26
+ end
27
+ end
28
+
29
+ def calculations(frame)
30
+ @klasses.each_with_index do |k,i|
31
+ objects = Object.const_get(k).where(:fid => frame).all
32
+ object_count = objects.count
33
+ complete = 0
34
+ failed = 0
35
+ objects.each do |o|
36
+ begin
37
+ o.run
38
+ complete += 1
39
+ rescue
40
+ failed += 1
41
+ puts " Models (#{i}/#{model_count}) => #{k} #{complete}/#{object_count} Failed: #{failed}"
42
+ end
43
+ end
44
+ end
45
+ begin
46
+ puts " Running Frame Calculations"
47
+ frame.run
48
+ rescue
49
+ " Failed"
50
+ end
51
+ end
52
+ end
53
+ end
@@ -1,3 +1,3 @@
1
1
  module Mddb
2
- VERSION = "0.0.12"
2
+ VERSION = "0.0.14"
3
3
  end
metadata CHANGED
@@ -1,93 +1,100 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mddb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
5
- prerelease:
4
+ prerelease:
5
+ version: 0.0.14
6
6
  platform: ruby
7
7
  authors:
8
8
  - Thomas Mulvaney
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-09 00:00:00.000000000Z
12
+ date: 2012-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70251383669620 !ruby/object:Gem::Requirement
17
- none: false
16
+ version_requirements: &2056 !ruby/object:Gem::Requirement
18
17
  requirements:
19
18
  - - ! '>='
20
19
  - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
20
+ version: !binary |-
21
+ MA==
22
+ none: false
23
+ requirement: *2056
23
24
  prerelease: false
24
- version_requirements: *70251383669620
25
+ type: :development
25
26
  - !ruby/object:Gem::Dependency
26
27
  name: mongo_mapper
27
- requirement: &70251383668980 !ruby/object:Gem::Requirement
28
- none: false
28
+ version_requirements: &2074 !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
32
+ version: !binary |-
33
+ MA==
34
+ none: false
35
+ requirement: *2074
34
36
  prerelease: false
35
- version_requirements: *70251383668980
37
+ type: :runtime
36
38
  - !ruby/object:Gem::Dependency
37
39
  name: hirb
38
- requirement: &70251383668360 !ruby/object:Gem::Requirement
39
- none: false
40
+ version_requirements: &2092 !ruby/object:Gem::Requirement
40
41
  requirements:
41
42
  - - ! '>='
42
43
  - !ruby/object:Gem::Version
43
- version: '0'
44
- type: :runtime
44
+ version: !binary |-
45
+ MA==
46
+ none: false
47
+ requirement: *2092
45
48
  prerelease: false
46
- version_requirements: *70251383668360
49
+ type: :runtime
47
50
  - !ruby/object:Gem::Dependency
48
51
  name: thor
49
- requirement: &70251383667680 !ruby/object:Gem::Requirement
50
- none: false
52
+ version_requirements: &2108 !ruby/object:Gem::Requirement
51
53
  requirements:
52
54
  - - ! '>='
53
55
  - !ruby/object:Gem::Version
54
- version: '0'
55
- type: :runtime
56
+ version: !binary |-
57
+ MA==
58
+ none: false
59
+ requirement: *2108
56
60
  prerelease: false
57
- version_requirements: *70251383667680
61
+ type: :runtime
58
62
  - !ruby/object:Gem::Dependency
59
63
  name: micro-optparse
60
- requirement: &70251383666960 !ruby/object:Gem::Requirement
61
- none: false
64
+ version_requirements: &2124 !ruby/object:Gem::Requirement
62
65
  requirements:
63
66
  - - ! '>='
64
67
  - !ruby/object:Gem::Version
65
- version: '0'
66
- type: :runtime
68
+ version: !binary |-
69
+ MA==
70
+ none: false
71
+ requirement: *2124
67
72
  prerelease: false
68
- version_requirements: *70251383666960
73
+ type: :runtime
69
74
  - !ruby/object:Gem::Dependency
70
75
  name: resque
71
- requirement: &70251383666240 !ruby/object:Gem::Requirement
72
- none: false
76
+ version_requirements: &2140 !ruby/object:Gem::Requirement
73
77
  requirements:
74
78
  - - ! '>='
75
79
  - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :runtime
80
+ version: !binary |-
81
+ MA==
82
+ none: false
83
+ requirement: *2140
78
84
  prerelease: false
79
- version_requirements: *70251383666240
85
+ type: :runtime
80
86
  - !ruby/object:Gem::Dependency
81
87
  name: require_all
82
- requirement: &70251383665540 !ruby/object:Gem::Requirement
83
- none: false
88
+ version_requirements: &2156 !ruby/object:Gem::Requirement
84
89
  requirements:
85
90
  - - ! '>='
86
91
  - !ruby/object:Gem::Version
87
- version: '0'
88
- type: :runtime
92
+ version: !binary |-
93
+ MA==
94
+ none: false
95
+ requirement: *2156
89
96
  prerelease: false
90
- version_requirements: *70251383665540
97
+ type: :runtime
91
98
  description: MDDB makes analysing molecular dynamics simulations easy
92
99
  email:
93
100
  - thom.mulvaney@gmail.com
@@ -100,70 +107,119 @@ executables:
100
107
  extensions: []
101
108
  extra_rdoc_files: []
102
109
  files:
103
- - .gitignore
104
- - Gemfile
105
- - Rakefile
106
- - bin/aggregater
107
- - bin/average
108
- - bin/binner
109
- - bin/mddb
110
- - bin/stat.rb
111
- - config.yml
112
- - lib/mddb.rb
113
- - lib/mddb/atom.rb
114
- - lib/mddb/calculations.rb
115
- - lib/mddb/cli.rb
116
- - lib/mddb/commands/console.rb
117
- - lib/mddb/commands/load.rb
118
- - lib/mddb/commands/new.rb
119
- - lib/mddb/config.rb
120
- - lib/mddb/frame.rb
121
- - lib/mddb/generators.rb
122
- - lib/mddb/generators/atom.rb
123
- - lib/mddb/generators/molecule.rb
124
- - lib/mddb/molecule.rb
125
- - lib/mddb/parser.rb
126
- - lib/mddb/point.rb
127
- - lib/mddb/sphere.rb
128
- - lib/mddb/templates/README.tt
129
- - lib/mddb/templates/atom.rb.tt
130
- - lib/mddb/templates/config.yml.tt
131
- - lib/mddb/templates/frame.rb.tt
132
- - lib/mddb/templates/molecule.rb.tt
133
- - lib/mddb/templates/spec/atom_spec.rb.tt
134
- - lib/mddb/templates/spec/molecule_spec.rb.tt
135
- - lib/mddb/vector.rb
136
- - lib/mddb/version.rb
137
- - mddb.gemspec
138
- - quick.xyz
139
- - spec/atom_spec.rb
140
- - spec/oxygen_spec.rb
141
- - spec/spec_helper.rb
110
+ - !binary |-
111
+ LmdpdGlnbm9yZQ==
112
+ - !binary |-
113
+ R2VtZmlsZQ==
114
+ - !binary |-
115
+ UmFrZWZpbGU=
116
+ - !binary |-
117
+ YmluL2FnZ3JlZ2F0ZXI=
118
+ - !binary |-
119
+ YmluL2F2ZXJhZ2U=
120
+ - !binary |-
121
+ YmluL2Jpbm5lcg==
122
+ - !binary |-
123
+ YmluL21kZGI=
124
+ - !binary |-
125
+ YmluL3N0YXQucmI=
126
+ - !binary |-
127
+ Y29uZmlnLnltbC5iYWs=
128
+ - !binary |-
129
+ bGliL21kZGIucmI=
130
+ - !binary |-
131
+ bGliL21kZGIvYXRvbS5yYg==
132
+ - !binary |-
133
+ bGliL21kZGIvY2FsY3VsYXRpb25zLnJi
134
+ - !binary |-
135
+ bGliL21kZGIvY2xpLnJi
136
+ - !binary |-
137
+ bGliL21kZGIvY29tbWFuZHMvY29uc29sZS5yYg==
138
+ - !binary |-
139
+ bGliL21kZGIvY29tbWFuZHMvbG9hZC5yYg==
140
+ - !binary |-
141
+ bGliL21kZGIvY29tbWFuZHMvbmV3LnJi
142
+ - !binary |-
143
+ bGliL21kZGIvY29tbWFuZHMvcnVuLnJi
144
+ - !binary |-
145
+ bGliL21kZGIvY29uZmlnLnJi
146
+ - !binary |-
147
+ bGliL21kZGIvZnJhbWUucmI=
148
+ - !binary |-
149
+ bGliL21kZGIvZ2VuZXJhdG9ycy5yYg==
150
+ - !binary |-
151
+ bGliL21kZGIvZ2VuZXJhdG9ycy9hdG9tLnJi
152
+ - !binary |-
153
+ bGliL21kZGIvZ2VuZXJhdG9ycy9tb2xlY3VsZS5yYg==
154
+ - !binary |-
155
+ bGliL21kZGIvbW9sZWN1bGUucmI=
156
+ - !binary |-
157
+ bGliL21kZGIvcGFyc2VyLnJi
158
+ - !binary |-
159
+ bGliL21kZGIvcG9pbnQucmI=
160
+ - !binary |-
161
+ bGliL21kZGIvcnVubmVyLnJi
162
+ - !binary |-
163
+ bGliL21kZGIvc3BoZXJlLnJi
164
+ - !binary |-
165
+ bGliL21kZGIvdGVtcGxhdGVzL1JFQURNRS50dA==
166
+ - !binary |-
167
+ bGliL21kZGIvdGVtcGxhdGVzL2F0b20ucmIudHQ=
168
+ - !binary |-
169
+ bGliL21kZGIvdGVtcGxhdGVzL2NvbmZpZy55bWwudHQ=
170
+ - !binary |-
171
+ bGliL21kZGIvdGVtcGxhdGVzL2ZyYW1lLnJiLnR0
172
+ - !binary |-
173
+ bGliL21kZGIvdGVtcGxhdGVzL21vbGVjdWxlLnJiLnR0
174
+ - !binary |-
175
+ bGliL21kZGIvdGVtcGxhdGVzL3NwZWMvYXRvbV9zcGVjLnJiLnR0
176
+ - !binary |-
177
+ bGliL21kZGIvdGVtcGxhdGVzL3NwZWMvbW9sZWN1bGVfc3BlYy5yYi50dA==
178
+ - !binary |-
179
+ bGliL21kZGIvdmVjdG9yLnJi
180
+ - !binary |-
181
+ bGliL21kZGIvdmVyc2lvbi5yYg==
182
+ - !binary |-
183
+ bWRkYi5nZW1zcGVj
184
+ - !binary |-
185
+ cXVpY2sueHl6
186
+ - !binary |-
187
+ c3BlYy9hdG9tX3NwZWMucmI=
188
+ - !binary |-
189
+ c3BlYy9veHlnZW5fc3BlYy5yYg==
190
+ - !binary |-
191
+ c3BlYy9zcGVjX2hlbHBlci5yYg==
142
192
  homepage: ''
143
193
  licenses: []
144
- post_install_message:
194
+ post_install_message:
145
195
  rdoc_options: []
146
196
  require_paths:
147
197
  - lib
148
198
  required_ruby_version: !ruby/object:Gem::Requirement
149
- none: false
150
199
  requirements:
151
200
  - - ! '>='
152
201
  - !ruby/object:Gem::Version
153
- version: '0'
154
- required_rubygems_version: !ruby/object:Gem::Requirement
202
+ version: !binary |-
203
+ MA==
155
204
  none: false
205
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
206
  requirements:
157
207
  - - ! '>='
158
208
  - !ruby/object:Gem::Version
159
- version: '0'
209
+ version: !binary |-
210
+ MA==
211
+ none: false
160
212
  requirements: []
161
213
  rubyforge_project: mddb
162
- rubygems_version: 1.8.10
163
- signing_key:
214
+ rubygems_version: 1.8.15
215
+ signing_key:
164
216
  specification_version: 3
165
217
  summary: MDDB molecular database and framework
166
218
  test_files:
167
- - spec/atom_spec.rb
168
- - spec/oxygen_spec.rb
169
- - spec/spec_helper.rb
219
+ - !binary |-
220
+ c3BlYy9hdG9tX3NwZWMucmI=
221
+ - !binary |-
222
+ c3BlYy9veHlnZW5fc3BlYy5yYg==
223
+ - !binary |-
224
+ c3BlYy9zcGVjX2hlbHBlci5yYg==
225
+ ...