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
@@ -0,0 +1,81 @@
|
|
1
|
+
---
|
2
|
+
'ABE':
|
3
|
+
sites:
|
4
|
+
0:
|
5
|
+
- A
|
6
|
+
- B
|
7
|
+
1:
|
8
|
+
- E
|
9
|
+
toten: 0.0
|
10
|
+
'ACE':
|
11
|
+
sites:
|
12
|
+
0:
|
13
|
+
- A
|
14
|
+
- C
|
15
|
+
1:
|
16
|
+
- E
|
17
|
+
toten: 1.0
|
18
|
+
'ADE':
|
19
|
+
sites:
|
20
|
+
0:
|
21
|
+
- A
|
22
|
+
- D
|
23
|
+
1:
|
24
|
+
- E
|
25
|
+
toten: 2.0
|
26
|
+
'BCE':
|
27
|
+
sites:
|
28
|
+
0:
|
29
|
+
- B
|
30
|
+
- C
|
31
|
+
1:
|
32
|
+
- E
|
33
|
+
toten: 3.0
|
34
|
+
'BDE':
|
35
|
+
sites:
|
36
|
+
0:
|
37
|
+
- B
|
38
|
+
- D
|
39
|
+
1:
|
40
|
+
- E
|
41
|
+
toten: 4.0
|
42
|
+
'CDE':
|
43
|
+
sites:
|
44
|
+
0:
|
45
|
+
- C
|
46
|
+
- D
|
47
|
+
1:
|
48
|
+
- E
|
49
|
+
toten: 5.0
|
50
|
+
'ABF':
|
51
|
+
sites:
|
52
|
+
0:
|
53
|
+
- A
|
54
|
+
- B
|
55
|
+
1:
|
56
|
+
- F
|
57
|
+
toten: 6.0
|
58
|
+
'ACF':
|
59
|
+
sites:
|
60
|
+
0:
|
61
|
+
- A
|
62
|
+
- C
|
63
|
+
1:
|
64
|
+
- F
|
65
|
+
toten: 7.0
|
66
|
+
'ADF':
|
67
|
+
sites:
|
68
|
+
0:
|
69
|
+
- A
|
70
|
+
- D
|
71
|
+
1:
|
72
|
+
- F
|
73
|
+
toten: 8.0
|
74
|
+
'BCF':
|
75
|
+
sites:
|
76
|
+
0:
|
77
|
+
- B
|
78
|
+
- C
|
79
|
+
1:
|
80
|
+
- F
|
81
|
+
toten: 9.0
|
@@ -0,0 +1,33 @@
|
|
1
|
+
---
|
2
|
+
A:
|
3
|
+
- - D
|
4
|
+
- [ -1, 0, 0 ]
|
5
|
+
- - B
|
6
|
+
- [ 0, 0, 0 ]
|
7
|
+
B:
|
8
|
+
- - A
|
9
|
+
- [ 0, 0, 0 ]
|
10
|
+
- - C
|
11
|
+
- [ 0, 0, 0 ]
|
12
|
+
C:
|
13
|
+
- - B
|
14
|
+
- [ 0, 0, 0 ]
|
15
|
+
- - D
|
16
|
+
- [ 0, 0, 0 ]
|
17
|
+
D:
|
18
|
+
- - C
|
19
|
+
- [ 1, 0, 0 ]
|
20
|
+
- - A
|
21
|
+
- [ 0, 0, 0 ]
|
22
|
+
E:
|
23
|
+
- - F
|
24
|
+
- [ 0, 0, 0 ]
|
25
|
+
F:
|
26
|
+
- - E
|
27
|
+
- [ 0, 0, 0 ]
|
28
|
+
- - F
|
29
|
+
- [ 0, 0, 0 ]
|
30
|
+
G:
|
31
|
+
- - F
|
32
|
+
- [ 0, 0, 0 ]
|
33
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
- A: ["A", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
3
|
+
B: ["B", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
4
|
+
C: ["C", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
5
|
+
D: ["D", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
6
|
+
E: ["E", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
7
|
+
F: ["F", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
8
|
+
G: ["G", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
9
|
+
- A: ["D", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
10
|
+
B: ["C", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
11
|
+
C: ["B", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
12
|
+
D: ["A", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
13
|
+
E: ["G", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
14
|
+
F: ["F", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
15
|
+
G: ["E", [0, 0, 0], [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]
|
16
|
+
|
@@ -0,0 +1,287 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require "helper"
|
5
|
+
#require "test/unit"
|
6
|
+
#require "pkg/klass.rb"
|
7
|
+
|
8
|
+
class Crysna::Cell
|
9
|
+
attr_accessor :atoms
|
10
|
+
attr_accessor :reach_flag
|
11
|
+
attr_accessor :from_edges
|
12
|
+
end
|
13
|
+
|
14
|
+
class TC_TFCell < Test::Unit::TestCase
|
15
|
+
def setup
|
16
|
+
@cell00 = Crysna::TransitionFinder::Cell.new(
|
17
|
+
{ 0 => ["A", "B"], 1 => ["E"]}, -10.0)
|
18
|
+
|
19
|
+
atoms = [
|
20
|
+
Crysna::Atom.new(0, "A", [1, 0, 0]),
|
21
|
+
Crysna::Atom.new(0, "B", [1, 0, 0]),
|
22
|
+
Crysna::Atom.new(1, "F", [1, 0, 0]),
|
23
|
+
]
|
24
|
+
@cell01 = Crysna::TransitionFinder::Cell.new({}, -11.0)
|
25
|
+
@cell01.atoms = atoms
|
26
|
+
@cell02 = Crysna::TransitionFinder::Cell.new({}, -11.0, "abc")
|
27
|
+
@cell02.atoms = atoms
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_equal
|
31
|
+
assert_equal(true , @cell00 == @cell00)
|
32
|
+
assert_equal(true , @cell01 == @cell01)
|
33
|
+
assert_equal(true , @cell02 == @cell02)
|
34
|
+
assert_equal(false, @cell00 == @cell01)
|
35
|
+
assert_equal(false, @cell01 == @cell02)
|
36
|
+
assert_equal(false, @cell02 == @cell00)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_same_atoms?
|
40
|
+
cell = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
41
|
+
cell.atoms = [
|
42
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
43
|
+
Crysna::Atom.new(0, "B", [0, 0, 0]),
|
44
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
45
|
+
]
|
46
|
+
assert_equal(true, @cell00.same_atoms?(cell))
|
47
|
+
|
48
|
+
cell = Crysna::TransitionFinder::Cell.new({}, -11.0)
|
49
|
+
cell.atoms = [
|
50
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
51
|
+
Crysna::Atom.new(0, "B", [0, 0, 0]),
|
52
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
53
|
+
]
|
54
|
+
assert_equal(true, @cell00.same_atoms?(cell))
|
55
|
+
|
56
|
+
cell = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
57
|
+
cell.atoms = [
|
58
|
+
Crysna::Atom.new(0, "A", [1, 0, 0]),
|
59
|
+
Crysna::Atom.new(0, "B", [0, 0, 0]),
|
60
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
61
|
+
]
|
62
|
+
assert_equal(false, @cell00.same_atoms?(cell))
|
63
|
+
|
64
|
+
cell = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
65
|
+
cell.atoms = [
|
66
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
67
|
+
Crysna::Atom.new(0, "C", [0, 0, 0]),
|
68
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
69
|
+
]
|
70
|
+
assert_equal(false, @cell00.same_atoms?(cell))
|
71
|
+
|
72
|
+
cell = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
73
|
+
cell.atoms = [
|
74
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
75
|
+
Crysna::Atom.new(0, "B", [0, 0, 0]),
|
76
|
+
Crysna::Atom.new(0, "E", [0, 0, 0]),
|
77
|
+
]
|
78
|
+
assert_equal(false, @cell00.same_atoms?(cell))
|
79
|
+
|
80
|
+
cell = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
81
|
+
cell.atoms = [
|
82
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
83
|
+
Crysna::Atom.new(0, "B", [0, 0, 0]),
|
84
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
85
|
+
]
|
86
|
+
cell.reach_flag = true
|
87
|
+
assert_equal(true, @cell00.same_atoms?(cell))
|
88
|
+
|
89
|
+
cell = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
90
|
+
cell.atoms = [
|
91
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
92
|
+
Crysna::Atom.new(0, "B", [0, 0, 0]),
|
93
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
94
|
+
]
|
95
|
+
cell.from_edges = [nil]
|
96
|
+
assert_equal(true, @cell00.same_atoms?(cell))
|
97
|
+
|
98
|
+
cell = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
99
|
+
cell.atoms = [
|
100
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
101
|
+
Crysna::Atom.new(0, "B", [0, 0, 0]),
|
102
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
103
|
+
]
|
104
|
+
cell.name = "something"
|
105
|
+
assert_equal(true, @cell00.same_atoms?(cell))
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_same_sites?
|
109
|
+
assert_equal(true , @cell00.same_sites?(@cell00))
|
110
|
+
assert_equal(true , @cell01.same_sites?(@cell01))
|
111
|
+
assert_equal(true , @cell02.same_sites?(@cell02))
|
112
|
+
assert_equal(false, @cell00.same_sites?(@cell01))
|
113
|
+
assert_equal(true , @cell01.same_sites?(@cell02))
|
114
|
+
assert_equal(false, @cell02.same_sites?(@cell00))
|
115
|
+
|
116
|
+
atoms = [
|
117
|
+
Crysna::Atom.new(0, "A", [1, 0, 0]),
|
118
|
+
Crysna::Atom.new(0, "B", [0, 0, 0]),
|
119
|
+
Crysna::Atom.new(1, "F", [1, 0, 0]),
|
120
|
+
]
|
121
|
+
cell = Crysna::TransitionFinder::Cell.new({}, -11.0)
|
122
|
+
cell.atoms = atoms
|
123
|
+
assert_equal(true , @cell01.same_sites?(cell))
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_name
|
127
|
+
assert_equal("", @cell00.name)
|
128
|
+
assert_equal("", @cell01.name)
|
129
|
+
assert_equal("abc", @cell02.name)
|
130
|
+
|
131
|
+
cell = Crysna::TransitionFinder::Cell.new(
|
132
|
+
{ 0 => ["A", "B"], 1 => ["E"]}, -10.0, "abc")
|
133
|
+
assert_equal("abc", cell.name)
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_migrate!
|
137
|
+
@cell01.migrate!(0, "C", [-1, 1, -1])
|
138
|
+
atoms = @cell01.atoms
|
139
|
+
assert_equal(Crysna::Atom.new(0, "B", [1,0, 0]), atoms.shift)
|
140
|
+
assert_equal(Crysna::Atom.new(0, "C", [0,1,-1]), atoms.shift)
|
141
|
+
assert_equal(Crysna::Atom.new(1, "F", [1,0, 0]), atoms.shift)
|
142
|
+
assert_equal(nil , atoms.shift)
|
143
|
+
|
144
|
+
assert_raise(Crysna::TransitionFinder::Cell::RangeError){
|
145
|
+
@cell01.migrate!(3, "C", [-1, 1, -1])
|
146
|
+
}
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_migrate
|
150
|
+
result = @cell01.migrate(0, "C", [-1, 1, -1])
|
151
|
+
atoms = @cell01.atoms
|
152
|
+
assert_equal(Crysna::Atom.new(0, "A", [1,0, 0]), atoms.shift)
|
153
|
+
assert_equal(Crysna::Atom.new(0, "B", [1,0, 0]), atoms.shift)
|
154
|
+
assert_equal(Crysna::Atom.new(1, "F", [1,0, 0]), atoms.shift)
|
155
|
+
assert_equal(nil , atoms.shift)
|
156
|
+
|
157
|
+
atoms = result.atoms
|
158
|
+
assert_equal(Crysna::Atom.new(0, "B", [1,0, 0]), atoms.shift)
|
159
|
+
assert_equal(Crysna::Atom.new(0, "C", [0,1,-1]), atoms.shift)
|
160
|
+
assert_equal(Crysna::Atom.new(1, "F", [1,0, 0]), atoms.shift)
|
161
|
+
assert_equal(nil , atoms.shift)
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_reach
|
166
|
+
assert_equal(false, @cell00.reach?)
|
167
|
+
assert_equal([] , @cell00.from_edges)
|
168
|
+
@cell00.reach(nil)
|
169
|
+
assert_equal(true, @cell00.reach?)
|
170
|
+
assert_equal([nil], @cell00.from_edges)
|
171
|
+
|
172
|
+
setup
|
173
|
+
edge = Crysna::TransitionFinder::Edge.new([0,1], 0.0, "")
|
174
|
+
@cell00.reach(edge)
|
175
|
+
assert_equal(true, @cell00.reach?)
|
176
|
+
assert_equal([edge], @cell00.from_edges)
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_periodically_equal?
|
180
|
+
assert_equal(false, @cell00.periodically_equal?(@cell01))
|
181
|
+
assert_equal(false, @cell01.periodically_equal?(@cell00))
|
182
|
+
assert_equal(true , @cell00.periodically_equal?(@cell00))
|
183
|
+
assert_equal(true , @cell01.periodically_equal?(@cell01))
|
184
|
+
|
185
|
+
atoms = [
|
186
|
+
Crysna::Atom.new(0, "A", [1, 0, 0]),
|
187
|
+
Crysna::Atom.new(0, "B", [1, 1, 0]),
|
188
|
+
Crysna::Atom.new(1, "F", [1, 0, 0]),
|
189
|
+
]
|
190
|
+
tfc02 = Crysna::TransitionFinder::Cell.new({}, -11.0)
|
191
|
+
tfc02.atoms = atoms
|
192
|
+
assert_equal(true , @cell01.periodically_equal?(tfc02))
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
#def test_reset
|
197
|
+
# edge = Crysna::TransitionFinder::Edge.new([0,1], 0.0, "")
|
198
|
+
# @cell00.from_edges = [edge]
|
199
|
+
# @cell00.reach_flag = true
|
200
|
+
# assert_equal(true , @cell00.reach_flag)
|
201
|
+
# assert_equal([edge], @cell00.from_edges)
|
202
|
+
# @cell00.reset
|
203
|
+
# assert_equal(false , @cell00.reach_flag)
|
204
|
+
# assert_equal([], @cell00.from_edges)
|
205
|
+
#end
|
206
|
+
|
207
|
+
def test_occupied_sitename
|
208
|
+
assert_equal('A555-B555-E555', @cell00.occupied_sitename)
|
209
|
+
assert_equal('A655-B655-F655', @cell01.occupied_sitename)
|
210
|
+
assert_equal('A655-B655-F655', @cell02.occupied_sitename)
|
211
|
+
end
|
212
|
+
|
213
|
+
def test_inspect_short
|
214
|
+
assert_equal('Crysna::TransitionFinder::Cell: A555-B555-E555, @energy = -10.0, @reach_flag = false, @from_edges = [], @name = ""', @cell00.inspect_short)
|
215
|
+
assert_equal('Crysna::TransitionFinder::Cell: A655-B655-F655, @energy = -11.0, @reach_flag = false, @from_edges = [], @name = ""', @cell01.inspect_short)
|
216
|
+
assert_equal('Crysna::TransitionFinder::Cell: A655-B655-F655, @energy = -11.0, @reach_flag = false, @from_edges = [], @name = "abc"', @cell02.inspect_short)
|
217
|
+
end
|
218
|
+
|
219
|
+
def test_operate
|
220
|
+
rotation0 = [
|
221
|
+
[1, 0, 0],
|
222
|
+
[0, 1, 0],
|
223
|
+
[0, 0, 1],
|
224
|
+
]
|
225
|
+
rotation1 = [
|
226
|
+
[-1, 0, 0],
|
227
|
+
[0, 1, 0],
|
228
|
+
[0, 0, 1],
|
229
|
+
]
|
230
|
+
operations = [
|
231
|
+
{
|
232
|
+
"A" => ["A", [ 0, 0, 0], rotation0],
|
233
|
+
"B" => ["B", [ 0, 0, 0], rotation0],
|
234
|
+
"C" => ["C", [ 0, 0, 0], rotation0],
|
235
|
+
"D" => ["D", [ 0, 0, 0], rotation0],
|
236
|
+
"E" => ["E", [ 0, 0, 0], rotation0],
|
237
|
+
"F" => ["F", [ 0, 0, 0], rotation0],
|
238
|
+
"G" => ["G", [ 0, 0, 0], rotation0],
|
239
|
+
},
|
240
|
+
{
|
241
|
+
"A" => ["D", [ 0, 0, 0], rotation1],
|
242
|
+
"B" => ["C", [ 0, 0, 0], rotation1],
|
243
|
+
"C" => ["B", [ 0, 0, 0], rotation1],
|
244
|
+
"D" => ["A", [ 0, 0, 0], rotation1],
|
245
|
+
"E" => ["G", [ 0, 0, 0], rotation1],
|
246
|
+
"F" => ["F", [ 0, 0, 0], rotation1],
|
247
|
+
"G" => ["E", [ 0, 0, 0], rotation1],
|
248
|
+
}
|
249
|
+
]
|
250
|
+
cell0 = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
251
|
+
cell0.atoms = [
|
252
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
253
|
+
Crysna::Atom.new(0, "B", [0, 0, 0]),
|
254
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
255
|
+
]
|
256
|
+
cell1 = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
257
|
+
cell1.atoms = [
|
258
|
+
Crysna::Atom.new(0, "C", [0, 0, 0]),
|
259
|
+
Crysna::Atom.new(0, "D", [0, 0, 0]),
|
260
|
+
Crysna::Atom.new(1, "G", [0, 0, 0]),
|
261
|
+
]
|
262
|
+
assert_equal(cell0, cell0.operate(operations[0]))
|
263
|
+
assert_equal(cell1, cell0.operate(operations[1]))
|
264
|
+
assert_equal(cell1, cell1.operate(operations[0]))
|
265
|
+
assert_equal(cell0, cell1.operate(operations[1]))
|
266
|
+
|
267
|
+
|
268
|
+
cell0 = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
269
|
+
cell0.atoms = [
|
270
|
+
Crysna::Atom.new(0, "A", [1, 0, 0]),
|
271
|
+
Crysna::Atom.new(0, "B", [1, 0, 0]),
|
272
|
+
Crysna::Atom.new(1, "E", [1, 0, 0]),
|
273
|
+
]
|
274
|
+
cell1 = Crysna::TransitionFinder::Cell.new({}, -10.0)
|
275
|
+
cell1.atoms = [
|
276
|
+
Crysna::Atom.new(0, "C", [-1, 0, 0]),
|
277
|
+
Crysna::Atom.new(0, "D", [-1, 0, 0]),
|
278
|
+
Crysna::Atom.new(1, "G", [-1, 0, 0]),
|
279
|
+
]
|
280
|
+
assert_equal(cell0, cell0.operate(operations[0]))
|
281
|
+
assert_equal(cell1, cell0.operate(operations[1]))
|
282
|
+
assert_equal(cell1, cell1.operate(operations[0]))
|
283
|
+
assert_equal(cell0, cell1.operate(operations[1]))
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
287
|
+
|
@@ -0,0 +1,185 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require "helper"
|
5
|
+
#require "test/unit"
|
6
|
+
#require "pkg/klass.rb"
|
7
|
+
|
8
|
+
class Crysna::TransitionFinder::Cell
|
9
|
+
attr_accessor :atoms
|
10
|
+
attr_accessor :reach_flag
|
11
|
+
end
|
12
|
+
|
13
|
+
class Crysna::TransitionFinder::CellManager
|
14
|
+
attr_accessor :cells
|
15
|
+
end
|
16
|
+
|
17
|
+
class TC_CellManager < Test::Unit::TestCase
|
18
|
+
|
19
|
+
def setup
|
20
|
+
##Cell
|
21
|
+
@cell_ABE = Crysna::TransitionFinder::Cell.new({0 => ["A", "B"], 1 => ["E"]}, -10.0)
|
22
|
+
@cell_ABEr = Marshal.load(Marshal.dump(@cell_ABE))
|
23
|
+
@cell_ABEr.reach_flag = true
|
24
|
+
|
25
|
+
@cell_ACE = Crysna::TransitionFinder::Cell.new({0 => ["A", "C"], 1 => ["E"]}, -10.0)
|
26
|
+
@cell_ACEr = Marshal.load(Marshal.dump(@cell_ACE))
|
27
|
+
@cell_ACEr.reach_flag = true
|
28
|
+
|
29
|
+
@cell_ABEp = Crysna::TransitionFinder::Cell.new({}, -12.0)
|
30
|
+
@cell_ABEp.atoms = [
|
31
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
32
|
+
Crysna::Atom.new(0, "B", [1, 0, 0]),
|
33
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
34
|
+
]
|
35
|
+
@cell_ABEpr = Marshal.load(Marshal.dump(@cell_ABEp))
|
36
|
+
@cell_ABEpr.reach_flag = true
|
37
|
+
|
38
|
+
@cell_ACpE = Crysna::TransitionFinder::Cell.new({}, -12.0)
|
39
|
+
@cell_ACpE.atoms = [
|
40
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
41
|
+
Crysna::Atom.new(0, "C", [1, 0, 0]),
|
42
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
43
|
+
]
|
44
|
+
@cell_ACpEr = Marshal.load(Marshal.dump(@cell_ACpE))
|
45
|
+
@cell_ACpEr.reach_flag = true
|
46
|
+
|
47
|
+
@cell_ADpE = Crysna::TransitionFinder::Cell.new({}, -12.0)
|
48
|
+
@cell_ADpE.atoms = [
|
49
|
+
Crysna::Atom.new(0, "A", [0, 0, 0]),
|
50
|
+
Crysna::Atom.new(0, "D", [1, 0, 0]),
|
51
|
+
Crysna::Atom.new(1, "E", [0, 0, 0]),
|
52
|
+
]
|
53
|
+
@cell_ADpEr = Marshal.load(Marshal.dump(@cell_ADpE))
|
54
|
+
@cell_ADpEr.reach_flag = true
|
55
|
+
|
56
|
+
@cell_ACmE = Crysna::TransitionFinder::Cell.new({}, -12.0)
|
57
|
+
@cell_ACmE.atoms = [
|
58
|
+
Crysna::Atom.new(0, "A", [ 0, 0, 0]),
|
59
|
+
Crysna::Atom.new(0, "C", [-1, 0, 0]),
|
60
|
+
Crysna::Atom.new(1, "E", [ 0, 0, 0]),
|
61
|
+
]
|
62
|
+
@cell_ACmEr = Marshal.load(Marshal.dump(@cell_ACmE))
|
63
|
+
@cell_ACmEr.reach_flag = true
|
64
|
+
|
65
|
+
##CellManager
|
66
|
+
@cm00 = Crysna::TransitionFinder::CellManager.new
|
67
|
+
|
68
|
+
@cm01 = Crysna::TransitionFinder::CellManager.new
|
69
|
+
@cm01.cells = [
|
70
|
+
@cell_ABE,
|
71
|
+
@cell_ACE,
|
72
|
+
]
|
73
|
+
|
74
|
+
@cm02 = Crysna::TransitionFinder::CellManager.new
|
75
|
+
@cm02.cells = [
|
76
|
+
@cell_ABE,
|
77
|
+
@cell_ACE,
|
78
|
+
@cell_ABEp,
|
79
|
+
@cell_ACpE,
|
80
|
+
@cell_ADpE,
|
81
|
+
@cell_ACmE,
|
82
|
+
]
|
83
|
+
|
84
|
+
@cm03 = Crysna::TransitionFinder::CellManager.new
|
85
|
+
@cm03.cells = [
|
86
|
+
@cell_ABEr,
|
87
|
+
@cell_ACEr,
|
88
|
+
@cell_ABEpr,
|
89
|
+
@cell_ACpEr,
|
90
|
+
@cell_ADpEr,
|
91
|
+
@cell_ACmE,
|
92
|
+
]
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_add
|
96
|
+
result = @cm00.add(@cell_ABE)
|
97
|
+
assert_equal(0, result)
|
98
|
+
assert_equal(@cell_ABE, @cm00.cells[0])
|
99
|
+
assert_equal(1, @cm00.cells.size)
|
100
|
+
|
101
|
+
#already added
|
102
|
+
result = @cm00.add(@cell_ABE)
|
103
|
+
assert_equal(0, result)
|
104
|
+
assert_equal(@cell_ABE, @cm00.cells[0])
|
105
|
+
assert_equal(1, @cm00.cells.size)
|
106
|
+
|
107
|
+
#new
|
108
|
+
result = @cm00.add(@cell_ACE)
|
109
|
+
assert_equal(1, result)
|
110
|
+
assert_equal(@cell_ABE, @cm00.cells[0])
|
111
|
+
assert_equal(@cell_ACE, @cm00.cells[1])
|
112
|
+
assert_equal(2, @cm00.cells.size)
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_fetch
|
116
|
+
assert_equal(nil, @cm00[0])
|
117
|
+
assert_equal(@cell_ABE, @cm01[0])
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_index_same_atoms
|
121
|
+
assert_equal(0, @cm01.index_same_atoms(@cell_ABE))
|
122
|
+
assert_equal(1, @cm01.index_same_atoms(@cell_ACE))
|
123
|
+
assert_equal(nil, @cm01.index_same_atoms(@cell_ABEp))
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_index_same_sites
|
127
|
+
assert_equal(0, @cm01.index_same_sites(@cell_ABE))
|
128
|
+
assert_equal(1, @cm01.index_same_sites(@cell_ACE))
|
129
|
+
|
130
|
+
#pp @cm01
|
131
|
+
#pp @cell_ABEp
|
132
|
+
assert_equal(0, @cm01.index_same_sites(@cell_ABEp))
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_reach
|
136
|
+
#pp @cm01
|
137
|
+
assert_equal(false, @cm01.cells[0].reach?)
|
138
|
+
assert_equal(false, @cm01.cells[1].reach?)
|
139
|
+
assert_equal([], @cm01.cells[1].from_edges)
|
140
|
+
edge = Crysna::TransitionFinder::Edge.new([0,1], 0.0, "")
|
141
|
+
@cm01.reach(1, edge)
|
142
|
+
assert_equal(false, @cm01.cells[0].reach?)
|
143
|
+
assert_equal(true , @cm01.cells[1].reach?)
|
144
|
+
assert_equal([edge], @cm01.cells[1].from_edges)
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_periodically_shift_indices
|
148
|
+
assert_equal([], @cm00.periodically_shift_indices)
|
149
|
+
|
150
|
+
assert_equal([], @cm01.periodically_shift_indices)
|
151
|
+
|
152
|
+
results = @cm02.periodically_shift_indices
|
153
|
+
assert_equal( [], results
|
154
|
+
)
|
155
|
+
|
156
|
+
results = @cm03.periodically_shift_indices
|
157
|
+
assert_equal( [ [0, 2], [1, 3], [4]], results
|
158
|
+
)
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_contain_periodically_shift_cell?
|
162
|
+
assert_equal(false, @cm00.contain_periodically_shift_cells?)
|
163
|
+
assert_equal(false, @cm01.contain_periodically_shift_cells?)
|
164
|
+
assert_equal(false, @cm02.contain_periodically_shift_cells?)
|
165
|
+
assert_equal(true , @cm03.contain_periodically_shift_cells?)
|
166
|
+
end
|
167
|
+
|
168
|
+
def test_ascend
|
169
|
+
@cm02.reach(0, nil)
|
170
|
+
edge = Crysna::TransitionFinder::Edge.new([0,2], 0.0, "")
|
171
|
+
@cm02.reach(2, edge)
|
172
|
+
edge = Crysna::TransitionFinder::Edge.new([2,1], 0.0, "")
|
173
|
+
@cm02.reach(1, edge)
|
174
|
+
assert_equal([1,2,0], @cm02.ascend(1))
|
175
|
+
end
|
176
|
+
|
177
|
+
#def test_to_s
|
178
|
+
# #assert_equal("Crysna::TransitionFinder::CellManager: [ABE000000000, @energy = -10.0, @reach_flag = false, @previous_cell = ACE000000000, @energy = -10.0, @reach_flag = false, @previous_cell = ]", @cm01.to_s)
|
179
|
+
# #"ABE000000000
|
180
|
+
# #@cm01.add(@cell_ABE)
|
181
|
+
# #@cm01.add(@cell_ACE)
|
182
|
+
#end
|
183
|
+
|
184
|
+
end
|
185
|
+
|