aims_project_windows 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,145 @@
1
+ require 'stringio'
2
+
3
+ # ====================================================
4
+ # These are capistrano tasks to help with queueing calculations
5
+ # on a remote computing-cluster, tracking their status
6
+ # and retreiving calculation outputs.
7
+ # ====================================================
8
+
9
+ def _cset(name, *args, &block)
10
+ unless exists?(name)
11
+ set(name, *args, &block)
12
+ end
13
+ end
14
+
15
+ # logs the command then executes it locally.
16
+ # returns the command output as a string
17
+ def run_locally(cmd)
18
+ logger.trace "executing locally: #{cmd.inspect}" if logger
19
+ output_on_stdout = nil
20
+ elapsed = Benchmark.realtime do
21
+ output_on_stdout = `#{cmd}`
22
+ end
23
+ if $?.to_i > 0 # $? is command exit code (posix style)
24
+ raise Capistrano::LocalArgumentError, "Command #{cmd} returned status code #{$?}"
25
+ end
26
+ logger.trace "command finished in #{(elapsed * 1000).round}ms" if logger
27
+ output_on_stdout
28
+ end
29
+
30
+ # =========================================================================
31
+ # These variables must be set in the client Capfile. Failure to set them
32
+ # will result in an error.
33
+ # =========================================================================
34
+ _cset(:project_name) {abort "Please specify the project name, set :project_name, 'foo'"}
35
+ _cset(:remote_project_dir) {abort "Please specify the name of the remote directory for this project, set :remote_project_dir, 'foo'"}
36
+ # _cset(:staging_dir) {}
37
+ # _cset(:qsub) {abort "Please specify the queue submission script to use for each calculation, set :qsub, 'foo'"}
38
+
39
+ # =========================================================================
40
+ # These variables may be set in the client capfile if their default values
41
+ # are not sufficient.
42
+ # =========================================================================
43
+ _cset :aims_script, "aims.sh"
44
+
45
+ # =========================================================================
46
+ # These variables should NOT be changed unless you are very confident in
47
+ # what you are doing. Make sure you understand all the implications of your
48
+ # changes if you do decide to muck with these!
49
+ # =========================================================================
50
+
51
+ namespace :aims do
52
+
53
+ desc <<-DESC
54
+ Up-sync project with data transfer server
55
+ DESC
56
+ task :upsync, :roles => :data_transfer do
57
+ # Verify this AimsProject can be loaded
58
+ project = AimsProject::Project.load(project_name)
59
+ find_servers(:roles => :data_transfer).each do |s|
60
+ # Upsync to remote directory
61
+ puts "Upsyncing project to #{s}..."
62
+ run_locally "rsync -auvz #{project.full_path} #{s}:#{remote_project_dir}/"
63
+ end
64
+ end
65
+
66
+ desc <<-DESC
67
+ Down-sync project with data transfer server
68
+ DESC
69
+ task :downsync, :roles => :data_transfer do
70
+ # Verify this AimsProject can be loaded
71
+ project = AimsProject::Project.load(project_name)
72
+
73
+ find_servers(:roles => :data_transfer).each do |s|
74
+ # Downsync from remote directory
75
+ puts "Retreiving new data from #{s}"
76
+ run_locally "rsync -auvz #{s}:#{remote_project_dir}/#{project.relative_path}/ #{project.full_path}/"
77
+ end
78
+ end
79
+
80
+ desc <<-DESC
81
+ Synchronize with the remote computation cluster.
82
+ DESC
83
+ task :synchronize, :roles => :data_transfer do
84
+ # Verify this AimsProject can be loaded
85
+ project = AimsProject::Project.load(project_name)
86
+ upsync
87
+ downsync
88
+ end
89
+
90
+ task :env, :roles => :queue_submission do
91
+ run "env"
92
+ end
93
+
94
+ task :qstat, :roles => :queue_submission do
95
+ find_servers(:roles => :queue_submission).each do |s|
96
+ # Upsync to remote directory
97
+ stream qstat_cmd
98
+ end
99
+
100
+ end
101
+
102
+ # Trigger a synchronize before enqueue
103
+ before "aims:enqueue", "aims:synchronize"
104
+
105
+ desc <<-DESC
106
+ Enqueue all staged calculations.
107
+ This task will:
108
+ 1) Customize and upload the script aims.sh to the remote server
109
+ 2) cd to the calculation directory on the remote host
110
+ 3) execute the "qsub" command as defined in Capfile
111
+
112
+ Example usage:
113
+ cap aims:enqueue
114
+ DESC
115
+ task :enqueue, :roles => :queue_submission do
116
+
117
+ # Load the project
118
+ project = AimsProject::Project.load(project_name)
119
+
120
+ # Enqueue all staged calculations
121
+ project.calculations.find_all{|calc|
122
+ calc.status == AimsProject::STAGED
123
+ }.each do |calc|
124
+
125
+ # Define the remote calculation directory
126
+ remote_calc_dir = "#{remote_project_dir}/#{project.relative_path}/#{calc.relative_path}"
127
+
128
+ # Upload the aims.sh script to the calculation directory
129
+ upload File.join(AimsProject::CONFIG_DIR, aims_script), File.join(remote_calc_dir, aims_script)
130
+
131
+
132
+ run <<-CMD
133
+ cd #{remote_calc_dir};
134
+ #{qsub}
135
+ CMD
136
+
137
+ # TODO, do this first, and then revert inside rollback
138
+ calc.status = AimsProject::QUEUED
139
+ calc.save
140
+
141
+ end
142
+ end
143
+
144
+
145
+ end
@@ -0,0 +1,37 @@
1
+
2
+ #
3
+ # Put user defined variables here
4
+ # These variables will be evaulated and used when
5
+ # generating geometry.in and control.in for calculations.
6
+ #
7
+ #
8
+ #
9
+ # An example usage is
10
+ #
11
+ # @lattice_const = 5.9
12
+ # @k_grid = "2 2 2"
13
+ #
14
+ #
15
+ # Then include these in any geometry file using embedded ruby
16
+ #
17
+ # lattice_vector <%= [@lattice_const/2, @lattice_const/2, 0].join(" ") %>
18
+ # lattice_vector <%= [@lattice_const/2, 0, @lattice_const/2].join(" ") %>
19
+ # lattice_vector <%= [0, @lattice_const/2, @lattice_const/2].join(" ") %>
20
+ #
21
+ # And in any control.in file
22
+ #
23
+ # k_grid <%= @k_grid %>
24
+ #
25
+ # The <%= %> start and end tags can contain any ruby code
26
+ # Use <% %> start and end tags for ruby code whose output should be suppressed
27
+ # Note the '@' at the front of all variables. This is necessary in the user_variables file
28
+ #
29
+ # Parameters can be specified on the command line of AimsCalc as follows:
30
+ #
31
+ # AimsCalc create some_geometry_file some_control_file lattice_const=5.7 k_grid="2 2 2"
32
+ #
33
+ # The root calculation directory will then have a sub directory with the calculation named
34
+ # lattice_const=5.7,k_grid=2_2_2
35
+ # Notice that variables are concatenated with a comma and spaces are replaced with underscores.
36
+ # Only variables specified on the command line generate calculation sub-directories. This
37
+ # is to enable
@@ -0,0 +1,41 @@
1
+ #
2
+ # This is an example control file
3
+ #
4
+
5
+ # Keywords understood by aims can be specified like normal
6
+ <% control_defaults %>
7
+ xc pbe
8
+ spin none
9
+ relativistic atomic_zora scalar
10
+ charge 0.
11
+
12
+ #
13
+ # Mixing Parameters
14
+ #
15
+ occupation_type gaussian 0.1
16
+ mixer pulay
17
+ preconditioner kerker 1.0
18
+ n_max_pulay 10
19
+ charge_mix_param 0.2
20
+
21
+ #
22
+ # Convergence Accuracy
23
+ #
24
+ sc_accuracy_rho 1E-4
25
+ sc_accuracy_eev 1E-2
26
+ sc_accuracy_etot 1E-5
27
+ sc_accuracy_forces 1E-3
28
+ sc_iter_limit 100
29
+
30
+
31
+ #
32
+ # Relaxation
33
+ #
34
+ #
35
+ relax_geometry bfgs 2.e-2
36
+ restart_relaxations .true.
37
+ <%= relax_geometry true %>
38
+
39
+ # Include species like this
40
+ <%= species 15, "light" %>
41
+ <%= species 49, "light" %>
@@ -0,0 +1 @@
1
+ atom 0 0 0 Si
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aims_project_windows
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Joshua Shapiro
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-30 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: wxruby-ruby19
16
+ requirement: &5625090 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.0.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *5625090
25
+ - !ruby/object:Gem::Dependency
26
+ name: ruby-opengl
27
+ requirement: &5624860 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 0.60.3
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *5624860
36
+ - !ruby/object:Gem::Dependency
37
+ name: aims
38
+ requirement: &5624630 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.3.0
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *5624630
47
+ - !ruby/object:Gem::Dependency
48
+ name: highline
49
+ requirement: &5624400 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.6.11
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *5624400
58
+ - !ruby/object:Gem::Dependency
59
+ name: capistrano
60
+ requirement: &5624170 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 2.11.2
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *5624170
69
+ description: This gem simplifies and streamlines the calculation pipeline for FHI-AIMS.
70
+ email: joshua.shapiro@gmail.com
71
+ executables:
72
+ - AimsProjectManager
73
+ - AimsCalc
74
+ - AimsProject
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - lib/aims_project/aims_project_exception.rb
79
+ - lib/aims_project/aims_project_geometry.rb
80
+ - lib/aims_project/app_controller.rb
81
+ - lib/aims_project/atom.rb
82
+ - lib/aims_project/calculation.rb
83
+ - lib/aims_project/calculation_tree.rb
84
+ - lib/aims_project/calculation_window.rb
85
+ - lib/aims_project/crystal_viewer.rb
86
+ - lib/aims_project/crystal_viewer_options.rb
87
+ - lib/aims_project/geometry_console.rb
88
+ - lib/aims_project/geometry_editor.rb
89
+ - lib/aims_project/geometry_file.rb
90
+ - lib/aims_project/geometry_window.rb
91
+ - lib/aims_project/inspector.rb
92
+ - lib/aims_project/material.rb
93
+ - lib/aims_project/octree.rb
94
+ - lib/aims_project/project.rb
95
+ - lib/aims_project/project_tree.rb
96
+ - lib/aims_project/thread_callback_event.rb
97
+ - lib/aims_project.rb
98
+ - lib/aims_project/pan.gif
99
+ - lib/aims_project/rotate.gif
100
+ - lib/aims_project/zoom.gif
101
+ - lib/aims_project/green_arrow.jpg
102
+ - skeleton/Capfile
103
+ - skeleton/config/aims.sh
104
+ - skeleton/config/tasks.rb
105
+ - skeleton/config/user_variables.rb
106
+ - skeleton/control/example.erb
107
+ - skeleton/geometry/example
108
+ - README
109
+ - bin/AimsProjectManager
110
+ - bin/AimsCalc
111
+ - bin/AimsProject
112
+ homepage: https://github.com/jns/AimsProject
113
+ licenses: []
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ~>
122
+ - !ruby/object:Gem::Version
123
+ version: 1.9.2
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 1.8.17
133
+ signing_key:
134
+ specification_version: 3
135
+ summary: This gem simplifies and streamlines the calculation pipeline for FHI-AIMS.
136
+ test_files: []
137
+ has_rdoc: