crysna 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/CHANGES +24 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +91 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/bin/checkmodel +66 -0
- data/bin/collectcell +92 -0
- data/bin/fitframe +68 -0
- data/bin/occupiedpolyhedralsite +96 -0
- data/bin/occupiedscattersite +77 -0
- data/bin/site2poscar +66 -0
- data/bin/site2pov +30 -0
- data/bin/sitecombination +69 -0
- data/bin/sitemigration +80 -0
- data/bin/sitemigrationdistance +87 -0
- data/bin/siteoperation +109 -0
- data/bin/sitesingle +36 -0
- data/bin/siteuniq +32 -0
- data/bin/symidsite +65 -0
- data/bin/transitcell +46 -0
- data/crysna.gemspec +219 -0
- data/lib/crysna.rb +26 -0
- data/lib/crysna/atom.rb +97 -0
- data/lib/crysna/cell.rb +314 -0
- data/lib/crysna/frameatom.rb +13 -0
- data/lib/crysna/frameinterstitialcell.rb +309 -0
- data/lib/crysna/interstitialatom.rb +13 -0
- data/lib/crysna/modelstructure.rb +333 -0
- data/lib/crysna/optionmanager.rb +177 -0
- data/lib/crysna/site.rb +35 -0
- data/lib/crysna/siteconfiguration.rb +26 -0
- data/lib/crysna/sitenamelabeledcell.rb +220 -0
- data/lib/crysna/siteoperation.rb +56 -0
- data/lib/crysna/sitewithposition.rb +24 -0
- data/lib/crysna/transitionfinder.rb +448 -0
- data/lib/crysna/transitionfinder/cell.rb +144 -0
- data/lib/crysna/transitionfinder/cellmanager.rb +129 -0
- data/lib/crysna/transitionfinder/edge.rb +54 -0
- data/test/.gitignore +1 -0
- data/test/cell_orig/POSCAR +17 -0
- data/test/cell_orig/model.yaml +122 -0
- data/test/collectcells/.gitignore +2 -0
- data/test/collectcells/model.yaml +154 -0
- data/test/collectcells/nooutcar/minexpconfiguration.yaml +22 -0
- data/test/collectcells/normal-higher/OUTCAR +2406 -0
- data/test/collectcells/normal-higher/minexpconfiguration.yaml +22 -0
- data/test/collectcells/normal-lower/OUTCAR +2406 -0
- data/test/collectcells/normal-lower/minexpconfiguration.yaml +22 -0
- data/test/collectcells/normal/OUTCAR +2406 -0
- data/test/collectcells/normal/minexpconfiguration.yaml +22 -0
- data/test/collectcells/normalB/OUTCAR +2406 -0
- data/test/collectcells/normalB/minexpconfiguration.yaml +22 -0
- data/test/collectcells/unfinished/OUTCAR +40702 -0
- data/test/collectcells/unfinished/minexpconfiguration.yaml +22 -0
- data/test/collectcells/unidentified/OUTCAR +3541 -0
- data/test/collectcells/unidentified/minexpconfiguration.yaml +2 -0
- data/test/fitmodelstructure/.gitignore +1 -0
- data/test/fitmodelstructure/AgI/CONTCAR +17 -0
- data/test/fitmodelstructure/AgI/fitmodelstructure.log +1161 -0
- data/test/fitmodelstructure/AgI/model.yaml +45 -0
- data/test/fitmodelstructure/normal/CONTCAR +17 -0
- data/test/fitmodelstructure/normal/fitmodelstructure.log +5063 -0
- data/test/fitmodelstructure/normal/model.yaml +122 -0
- data/test/fitmodelstructure/unidentified/CONTCAR +44 -0
- data/test/fitmodelstructure/unidentified/fitmodelstructure.log +8833 -0
- data/test/fitmodelstructure/unidentified/model.yaml +154 -0
- data/test/helper.rb +17 -0
- data/test/identifypolyhedralsites/.gitignore +1 -0
- data/test/identifypolyhedralsites/identifyatomsites.log +333 -0
- data/test/identifypolyhedralsites/normal/fitmodelstructure.yaml +60 -0
- data/test/identifypolyhedralsites/normal/model.yaml +122 -0
- data/test/identifypolyhedralsites/unidentified/fitmodelstructure.yaml +2 -0
- data/test/identifypolyhedralsites/unidentified/model.yaml +154 -0
- data/test/identifypolyhedralsites/volumemismatch/fitmodelstructure.yaml +101 -0
- data/test/identifypolyhedralsites/volumemismatch/model.yaml +154 -0
- data/test/identifyscattersites/CONTCAR +17 -0
- data/test/identifyscattersites/POSCAR +12 -0
- data/test/identifyscattersites/fitmodelstructure.log +1 -0
- data/test/identifyscattersites/fitmodelstructure.yaml +0 -0
- data/test/identifyscattersites/identifyscattersites.yaml +5 -0
- data/test/identifyscattersites/model.yaml +45 -0
- data/test/minexpconfiguration/.gitignore +1 -0
- data/test/minexpconfiguration/collective/AgI/.gitignore +2 -0
- data/test/minexpconfiguration/collective/AgI/siteoperations.yaml +51265 -0
- data/test/minexpconfiguration/collective/AgI/sitesingle.yaml +15 -0
- data/test/minexpconfiguration/collective/AgI/test.sh +2 -0
- data/test/minexpconfiguration/normal/identifysites.yaml +22 -0
- data/test/minexpconfiguration/normal/minexpconfiguration.log +0 -0
- data/test/minexpconfiguration/normal/siteoperations.yaml +1793 -0
- data/test/minexpconfiguration/unidentified/identifysites.yaml +2 -0
- data/test/minexpconfiguration/unidentified/siteoperations.yaml +1793 -0
- data/test/sitecombination/initsites.yaml +7 -0
- data/test/sitecombination/initsites_test2.yaml +8 -0
- data/test/sitecombination/sitecombination.yaml +29 -0
- data/test/siteconfiguration/elements-sitenames.yaml +2 -0
- data/test/siteconfiguration/latticeaxes.yaml +3 -0
- data/test/siteconfiguration/sitenames-coordinates.yaml +4 -0
- data/test/sitemigrationsdistance/model.yaml +45 -0
- data/test/siteoperations/.gitignore +2 -0
- data/test/siteoperations/model.yaml +43 -0
- data/test/siteoperations/symmetryoperations.yaml +1441 -0
- data/test/sitesingle/.gitignore +1 -0
- data/test/sitesingle/sitecombination.yaml +29 -0
- data/test/siteuniq/minexpconfiguration.yaml +15 -0
- data/test/siteuniq/siteuniq.yaml +8 -0
- data/test/test_atom.rb +206 -0
- data/test/test_cell.rb +604 -0
- data/test/test_commands.rb +340 -0
- data/test/test_crystana.rb +7 -0
- data/test/test_frameatom.rb +22 -0
- data/test/test_frameinterstitialcell.rb +939 -0
- data/test/test_interstitialatom.rb +22 -0
- data/test/test_modelstructure.rb +807 -0
- data/test/test_optionmanager.rb +172 -0
- data/test/test_site.rb +40 -0
- data/test/test_siteconfiguration.rb +29 -0
- data/test/test_sitenamelabeledcell.rb +528 -0
- data/test/test_siteoperation.rb +79 -0
- data/test/test_sitewithposition.rb +20 -0
- data/test/test_transitionfinder.rb +432 -0
- data/test/transitcell/.gitignore +2 -0
- data/test/transitcell/collectcells.yaml +51 -0
- data/test/transitcell/sitemigrations.yaml +8 -0
- data/test/transitcell/siteoperations.yaml +17 -0
- data/test/transitcell/transitcell.log +1342 -0
- data/test/transitionfinder/collectcells.yaml +81 -0
- data/test/transitionfinder/sitemigrations.yaml +33 -0
- data/test/transitionfinder/siteoperations.yaml +16 -0
- data/test/transitionfinder/test_cell.rb +287 -0
- data/test/transitionfinder/test_cellmanager.rb +185 -0
- data/test/transitionfinder/test_edge.rb +49 -0
- data/test/uniquesitesgenerator/elements-sitenames.yaml +1 -0
- data/test/uniquesitesgenerator/siteoperations.yaml +9 -0
- metadata +406 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8eb6bd07de7841af18fdd25c65642ce00fdeaf04
|
4
|
+
data.tar.gz: c265ebd19faf7ac90faa713875a371211ea9f641
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3c624d26cb19800ab87354637f5bd8f47dd872acc68bff4b22e5031dac2e1884e01d15f333f31ca15869d7900b2e779a78d4d847432456b91675411d387e361c
|
7
|
+
data.tar.gz: d8b123393e64a7aea2278a48169d2aed574d6e9970c96f40aed3ece592c89da7c47e678417345b4084617f91cae1fcfa24346fa2bd8e4289437bf91341dea227
|
data/.document
ADDED
data/CHANGES
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
= crystana Changelog
|
2
|
+
|
3
|
+
== Master (for 0.0.5)
|
4
|
+
|
5
|
+
== Version 0.0.4 [2016-04-20] released
|
6
|
+
* Change command line specification
|
7
|
+
* rename bin/
|
8
|
+
identifyscattersite occupiedscattersite
|
9
|
+
identifypolyhedralsite occupiedpolyhedralsite
|
10
|
+
minexpconfiguration symidsite
|
11
|
+
* Adjust to crystalcell-0.0.4 and vasputils-0.1.0
|
12
|
+
|
13
|
+
== Version 0.0.3
|
14
|
+
* Bugfix
|
15
|
+
|
16
|
+
== Version 0.0.2
|
17
|
+
* Bugfix Cell::minimize and bin/minexpconfiguration
|
18
|
+
* Bugfix Cell::<=>
|
19
|
+
|
20
|
+
== Version 0.0.1
|
21
|
+
* site2poscar; output error message when a cell cannot be generated.
|
22
|
+
|
23
|
+
== Version 0.0.0
|
24
|
+
* Adjust to mageo-0.0.3 .
|
data/Gemfile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
#gemspec
|
3
|
+
|
4
|
+
# Add dependencies required to use your gem here.
|
5
|
+
# Example:
|
6
|
+
# gem "activesupport", ">= 2.3.5"
|
7
|
+
|
8
|
+
# Add dependencies to develop your gem here.
|
9
|
+
# Include everything needed to run rake, tests, features, etc.
|
10
|
+
group :development do
|
11
|
+
gem "test-unit", "~> 3.1"
|
12
|
+
gem "rdoc", "~> 4.2"
|
13
|
+
gem "bundler", "~> 1.11"
|
14
|
+
gem "jeweler", "~> 2.0"
|
15
|
+
gem "simplecov", "~> 0.11"
|
16
|
+
gem "progressbar", "~> 0.21"
|
17
|
+
gem "ruby-graphviz", "~> 1.2"
|
18
|
+
gem "mageo", "~> 0.0"
|
19
|
+
gem "malge", "~> 0.0"
|
20
|
+
gem "crystalcell", "~> 0.0"
|
21
|
+
gem "builtinextension", "~> 0.1"
|
22
|
+
gem "maset", "~> 0.0"
|
23
|
+
gem "comana", "~> 0.0"
|
24
|
+
gem "gnuplot", "~> 2.6"
|
25
|
+
gem "vasputils", "~> 0.1"
|
26
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.4.0)
|
5
|
+
builder (3.2.2)
|
6
|
+
builtinextension (0.1.4)
|
7
|
+
comana (0.1.1)
|
8
|
+
crystalcell (0.0.4)
|
9
|
+
descendants_tracker (0.0.4)
|
10
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
11
|
+
docile (1.1.5)
|
12
|
+
faraday (0.9.2)
|
13
|
+
multipart-post (>= 1.2, < 3)
|
14
|
+
git (1.3.0)
|
15
|
+
github_api (0.13.1)
|
16
|
+
addressable (~> 2.4.0)
|
17
|
+
descendants_tracker (~> 0.0.4)
|
18
|
+
faraday (~> 0.8, < 0.10)
|
19
|
+
hashie (>= 3.4)
|
20
|
+
multi_json (>= 1.7.5, < 2.0)
|
21
|
+
oauth2
|
22
|
+
gnuplot (2.6.2)
|
23
|
+
hashie (3.4.3)
|
24
|
+
highline (1.7.8)
|
25
|
+
jeweler (2.1.1)
|
26
|
+
builder
|
27
|
+
bundler (>= 1.0)
|
28
|
+
git (>= 1.2.5)
|
29
|
+
github_api
|
30
|
+
highline (>= 1.6.15)
|
31
|
+
nokogiri (>= 1.5.10)
|
32
|
+
rake
|
33
|
+
rdoc
|
34
|
+
semver
|
35
|
+
json (1.8.3)
|
36
|
+
jwt (1.5.1)
|
37
|
+
mageo (0.0.4)
|
38
|
+
malge (0.0.9)
|
39
|
+
maset (0.0.0)
|
40
|
+
mini_portile2 (2.0.0)
|
41
|
+
multi_json (1.11.2)
|
42
|
+
multi_xml (0.5.5)
|
43
|
+
multipart-post (2.0.0)
|
44
|
+
nokogiri (1.6.7.2)
|
45
|
+
mini_portile2 (~> 2.0.0.rc2)
|
46
|
+
oauth2 (1.1.0)
|
47
|
+
faraday (>= 0.8, < 0.10)
|
48
|
+
jwt (~> 1.0, < 1.5.2)
|
49
|
+
multi_json (~> 1.3)
|
50
|
+
multi_xml (~> 0.5)
|
51
|
+
rack (>= 1.2, < 3)
|
52
|
+
power_assert (0.2.7)
|
53
|
+
progressbar (0.21.0)
|
54
|
+
rack (1.6.4)
|
55
|
+
rake (11.1.2)
|
56
|
+
rdoc (4.2.2)
|
57
|
+
json (~> 1.4)
|
58
|
+
ruby-graphviz (1.2.2)
|
59
|
+
semver (1.0.1)
|
60
|
+
simplecov (0.11.2)
|
61
|
+
docile (~> 1.1.0)
|
62
|
+
json (~> 1.8)
|
63
|
+
simplecov-html (~> 0.10.0)
|
64
|
+
simplecov-html (0.10.0)
|
65
|
+
test-unit (3.1.8)
|
66
|
+
power_assert
|
67
|
+
thread_safe (0.3.5)
|
68
|
+
vasputils (0.1.3)
|
69
|
+
|
70
|
+
PLATFORMS
|
71
|
+
ruby
|
72
|
+
|
73
|
+
DEPENDENCIES
|
74
|
+
builtinextension (~> 0.1)
|
75
|
+
bundler (~> 1.11)
|
76
|
+
comana (~> 0.0)
|
77
|
+
crystalcell (~> 0.0)
|
78
|
+
gnuplot (~> 2.6)
|
79
|
+
jeweler (~> 2.0)
|
80
|
+
mageo (~> 0.0)
|
81
|
+
malge (~> 0.0)
|
82
|
+
maset (~> 0.0)
|
83
|
+
progressbar (~> 0.21)
|
84
|
+
rdoc (~> 4.2)
|
85
|
+
ruby-graphviz (~> 1.2)
|
86
|
+
simplecov (~> 0.11)
|
87
|
+
test-unit (~> 3.1)
|
88
|
+
vasputils (~> 0.1)
|
89
|
+
|
90
|
+
BUNDLED WITH
|
91
|
+
1.11.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 ippei94da
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= crystana
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to crystana
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2013 ippei94da. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "crysna"
|
18
|
+
gem.homepage = "http://github.com/ippei94da/crysna"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{CRYstal Site aNAlyzser.}
|
21
|
+
gem.description = %Q{This gem provide a site analysis for crystal cell.}
|
22
|
+
gem.email = "ippei94da@gmail.com"
|
23
|
+
gem.authors = ["ippei94da"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
#require 'rcov/rcovtask'
|
36
|
+
#Rcov::RcovTask.new do |test|
|
37
|
+
# test.libs << 'test'
|
38
|
+
# test.pattern = 'test/**/test_*.rb'
|
39
|
+
# test.verbose = true
|
40
|
+
# test.rcov_opts << '--exclude "gems/*"'
|
41
|
+
#end
|
42
|
+
|
43
|
+
task :default => :test
|
44
|
+
|
45
|
+
require 'rdoc/task'
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
48
|
+
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "crysna #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.4
|
data/bin/checkmodel
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
# model.yaml の整合性を確認する。
|
5
|
+
#
|
6
|
+
# TODO:
|
7
|
+
# 各要素の数をカウント
|
8
|
+
# 体積分率を表示
|
9
|
+
# FS が使われている Octahedral site、 tetrahedral site をカウント、表示
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
require "progressbar"
|
13
|
+
require "crysna"
|
14
|
+
require "optparse"
|
15
|
+
gem "crystalcell"
|
16
|
+
require "crystalcell"
|
17
|
+
require "pp"
|
18
|
+
|
19
|
+
TOLERANCE = 1E-10
|
20
|
+
|
21
|
+
a = 1.0
|
22
|
+
b = 1.0
|
23
|
+
c = 1.0
|
24
|
+
alpha = 90.0
|
25
|
+
beta = 90.0
|
26
|
+
gamma = 90.0
|
27
|
+
frame_element = "F"
|
28
|
+
interstitial_element = "H"
|
29
|
+
|
30
|
+
## option analysis
|
31
|
+
om = Crysna::OptionManager.new([:model])
|
32
|
+
om.parser.banner += "\n Check sanity of model file."
|
33
|
+
om.parser.on("-a val", "--a=val" , "Lattice parameter a"){|v| a = v.to_f}
|
34
|
+
om.parser.on("-b val", "--b=val" , "Lattice parameter b"){|v| b = v.to_f}
|
35
|
+
om.parser.on("-c val", "--c=val" , "Lattice parameter c"){|v| c = v.to_f}
|
36
|
+
om.parser.on("-A val", "--alpha=val", "Lattice parameter alpha"){|v| alpha = v.to_f}
|
37
|
+
om.parser.on("-B val", "--beta=val" , "Lattice parameter beta") {|v| beta = v.to_f}
|
38
|
+
om.parser.on("-C val", "--gamma=val", "Lattice parameter gamma"){|v| gamma = v.to_f}
|
39
|
+
om.parser.on("-i val", "--frame=val" , "Frame element ") {|v| frame_element = v}
|
40
|
+
om.parser.on("-f val", "--interstitial=val", "Interstitial element"){|v| interstitial_element = v}
|
41
|
+
|
42
|
+
om.parser.parse!(ARGV)
|
43
|
+
options = om.options
|
44
|
+
|
45
|
+
unless ARGV.size == 0
|
46
|
+
puts om.parser.banner, "Exit."
|
47
|
+
exit
|
48
|
+
end
|
49
|
+
|
50
|
+
mcell = Crysna::ModelStructure.load_file(options[:model])
|
51
|
+
f_sites = mcell.frame_sites
|
52
|
+
i_sites = mcell.ideal_interstitial_sites
|
53
|
+
|
54
|
+
axes = CrystalCell::LatticeAxes.lc_to_axes([a,b,c,alpha,beta,gamma])
|
55
|
+
cell = CrystalCell::Cell.new(axes)
|
56
|
+
|
57
|
+
f_sites.each do |site|
|
58
|
+
atom = CrystalCell::Atom.new( frame_element, site[1], site[0])
|
59
|
+
cell.add_atom(atom)
|
60
|
+
end
|
61
|
+
i_sites.each do |site|
|
62
|
+
atom = CrystalCell::Atom.new( interstitial_element, site[1], site[0])
|
63
|
+
cell.add_atom(atom)
|
64
|
+
end
|
65
|
+
cell.dump_poscar([frame_element, interstitial_element], STDOUT)
|
66
|
+
|
data/bin/collectcell
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require "yaml"
|
5
|
+
require "pp"
|
6
|
+
require "rubygems"
|
7
|
+
require "crysna"
|
8
|
+
|
9
|
+
#Return key of 'site_hash' of an item which has the same structure of 'site'.
|
10
|
+
#Return nil if not found.
|
11
|
+
def find_equal_site(site, site_hash)
|
12
|
+
result = nil
|
13
|
+
site_hash.each do |key, val|
|
14
|
+
if val["sites"] == site
|
15
|
+
result = key
|
16
|
+
break
|
17
|
+
end
|
18
|
+
end
|
19
|
+
return result
|
20
|
+
end
|
21
|
+
|
22
|
+
## option analysis
|
23
|
+
om = Crysna::OptionManager.new([:model, :symid, :cells])
|
24
|
+
om.parser.banner += " dir0 [dir1...]" + <<HERE
|
25
|
+
Default output #{Crysna::OptionManager::DEFAULT_CELLS_FILE}.}
|
26
|
+
HERE
|
27
|
+
om.parser.on("-s", '--sort', "sort by energy") { om.options[:sort]}
|
28
|
+
om.parser.on("-u", '--unique', "show unique symid") { om.options[:unique]}
|
29
|
+
om.parser.parse!(ARGV)
|
30
|
+
options = om.options
|
31
|
+
|
32
|
+
log_io = File.open("collectcell.log", "w")
|
33
|
+
model = Crysna::ModelStructure.load_file(options[:model])
|
34
|
+
results = {}
|
35
|
+
ARGV.each do |dir|
|
36
|
+
tmp = {}
|
37
|
+
sites = YAML.load_file("#{dir}/#{options[:symid]}")["."]
|
38
|
+
|
39
|
+
if sites.class != Hash
|
40
|
+
log_io.puts "#{dir}/#{options[:symid]} is not Hash, '#{sites.to_s}'. pass."
|
41
|
+
next
|
42
|
+
end
|
43
|
+
|
44
|
+
model.frame_elements.each do |fe|
|
45
|
+
sites.delete fe
|
46
|
+
end
|
47
|
+
tmp["sites"] = sites
|
48
|
+
|
49
|
+
begin
|
50
|
+
outcar = VaspUtils::Outcar.load_file("#{dir}/OUTCAR")
|
51
|
+
if outcar[:normal_ended]
|
52
|
+
tmp["toten"] = outcar[:totens][-1]
|
53
|
+
else
|
54
|
+
log_io.puts "#{dir}: OUTCAR is not normally ended. pass."
|
55
|
+
next
|
56
|
+
end
|
57
|
+
rescue Errno::ENOENT
|
58
|
+
log_io.puts "#{dir}: OUTCAR cannot be found. pass."
|
59
|
+
next
|
60
|
+
end
|
61
|
+
|
62
|
+
#The same structure
|
63
|
+
same_dir = find_equal_site(tmp["sites"], results)
|
64
|
+
if options[:unique] && same_dir
|
65
|
+
if tmp["toten"] < results[same_dir]["toten"]
|
66
|
+
log_io.puts "#{dir}: the same as #{same_dir}, replace due to TOTEN, #{tmp["toten"]}(#{dir}) < #{results[same_dir]["toten"]}(#{same_dir})."
|
67
|
+
results.delete(same_dir)
|
68
|
+
results[dir] = tmp
|
69
|
+
else
|
70
|
+
log_io.puts "#{dir}: the same as #{same_dir}, pass due to TOTEN, #{tmp["toten"]}(#{dir}) >= #{results[same_dir]["toten"]}(#{same_dir})."
|
71
|
+
end
|
72
|
+
else
|
73
|
+
results[dir] = tmp
|
74
|
+
end
|
75
|
+
end
|
76
|
+
log_io.close
|
77
|
+
|
78
|
+
##Order sorted by TOTEN
|
79
|
+
if options[:sort]
|
80
|
+
tmp = {}
|
81
|
+
results.sort_by { |key, val| val["toten"] }.reverse.each do |key,val|
|
82
|
+
tmp[key] = val
|
83
|
+
end
|
84
|
+
results = tmp
|
85
|
+
end
|
86
|
+
|
87
|
+
##Output
|
88
|
+
pp results unless options[:quiet]
|
89
|
+
File.open(options[:cells], "w") do |io|
|
90
|
+
YAML.dump(results, io)
|
91
|
+
end
|
92
|
+
|
data/bin/fitframe
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
|
5
|
+
require "rubygems"
|
6
|
+
require "crysna"
|
7
|
+
require "yaml"
|
8
|
+
require "pp"
|
9
|
+
require "optparse"
|
10
|
+
|
11
|
+
PROGRAM_NAME = File.basename(__FILE__)
|
12
|
+
|
13
|
+
## option analysis
|
14
|
+
om = Crysna::OptionManager.new([:model, :fitted])
|
15
|
+
om.parser.banner += "\n Execute in VASP directory which includes CONTCAR."
|
16
|
+
om.parser.parse!(ARGV)
|
17
|
+
options = om.options
|
18
|
+
|
19
|
+
unless ARGV.size == 0
|
20
|
+
puts om.parser.banner
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
|
24
|
+
log_io = File.open("#{PROGRAM_NAME}.log", "w")
|
25
|
+
result_io = File.open(options[:fitted], "w")
|
26
|
+
|
27
|
+
|
28
|
+
model_cell = Crysna::ModelStructure.load_file(options[:model])
|
29
|
+
cell = VaspUtils::Poscar.load_file("CONTCAR").to_cell
|
30
|
+
|
31
|
+
log_io.puts("==== Detecting frame structure ====")
|
32
|
+
frame_indices = cell.atoms.select_indices { |atom|
|
33
|
+
model_cell.frame_elements.include?(atom.element)
|
34
|
+
}
|
35
|
+
ficell = cell.to_ficell(frame_indices)
|
36
|
+
|
37
|
+
puts PROGRAM_NAME
|
38
|
+
begin
|
39
|
+
ficell = ficell.optimized_cell(model_cell.frame_sites, log_io)
|
40
|
+
rescue FrameInterstitialCell::NoMatchError
|
41
|
+
result = "Structure cannot be fitted."
|
42
|
+
puts result
|
43
|
+
YAML.dump(result, result_io)
|
44
|
+
result_io.close
|
45
|
+
log_io.close
|
46
|
+
exit
|
47
|
+
end
|
48
|
+
|
49
|
+
result = {}
|
50
|
+
result["frame_atoms"] = {}
|
51
|
+
ficell.frame_atoms.each do |atom|
|
52
|
+
result["frame_atoms"][atom.name] = {
|
53
|
+
"element" => atom.element,
|
54
|
+
"coordinates" => atom.position.to_a
|
55
|
+
}
|
56
|
+
end
|
57
|
+
result["interstitials"] = []
|
58
|
+
ficell.interstitial_atoms.each do |atom|
|
59
|
+
result["interstitials"] << {
|
60
|
+
"element" => atom.element,
|
61
|
+
"coordinates" => atom.position.to_a
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
YAML.dump(result, result_io)
|
66
|
+
|
67
|
+
result_io.close
|
68
|
+
log_io.close
|