-
Notifications
You must be signed in to change notification settings - Fork 2
/
3D_bravais.jl
265 lines (234 loc) · 11.5 KB
/
3D_bravais.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
export
SC, FCC, BCC,
Triclinic,
Monoclinic, MonoclinicBaseCentered,
Orthorhombic,OrthorhombicBaseCentered, OrthorhombicBodyCentered, OrthorhombicFaceCentered,
Tetragonal, TetragonalBodyCentered,
Rhombohedral, Hexagonal
#############
### Cubic ###
#############
# Monoatomic SC -- 1 Atom Basis with SC Lattice Points
function SC(a::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(CubicLattice(a), Primitive())
basis = [Atom(atomic_symbol, [zero(a), zero(a), zero(a)], charge = charge)]
return Crystal(lattice,basis,N)
end
function SC(a::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(CubicLattice(a), Primitive())
basis = [Atom([zero(a), zero(a), zero(a)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
# Monoatomic FCC -- 4 Atom Basis with SC Lattice Points
function FCC(a::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
lattice = BravaisLattice(CubicLattice(a), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(a)], charge = charge),
Atom(atomic_symbol, [half_a, half_a, zero(a)], charge = charge),
Atom(atomic_symbol, [half_a, zero(a), half_a], charge = charge),
Atom(atomic_symbol, [zero(a), half_a, half_a], charge = charge)]
return Crystal(lattice, basis, N)
end
function FCC(a::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
lattice = BravaisLattice(CubicLattice(a), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge),
Atom([half_a, half_a, zero(a)], atomic_mass, charge = charge),
Atom([half_a, zero(a), half_a], atomic_mass, charge = charge),
Atom([zero(a), half_a, half_a], atomic_mass, charge = charge)]
return Crystal(lattice, basis, N)
end
# Monoatomic BCC -- 2 Atom Basis with SC Lattice Points
function BCC(a::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
lattice = BravaisLattice(CubicLattice(a), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(a)], charge = charge),
Atom(atomic_symbol, [half_a, half_a, half_a], charge = charge)]
return Crystal(lattice,basis,N)
end
function BCC(a::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
lattice = BravaisLattice(CubicLattice(a), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge),
Atom([half_a, half_a, half_a], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
#################
### Triclinic ###
#################
function Triclinic(a::T, b::T, c::T, α::T, β::T, γ::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(TriclinicLattice(a,b,c,α,β,γ), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(a)], charge = charge)]
return Crystal(lattice,basis,N)
end
function Triclinic(a::T, b::T, c::T, α::T, β::T, γ::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(TriclinicLattice(a,b,c,α,β,γ), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
##################
### Monoclinic ###
##################
# Monoclinic Primitive
function Monoclinic(a::T, b::T, c::T, β::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(MonoclinicLattice(a,b,c,β), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(a)], charge = charge)]
return Crystal(lattice,basis,N)
end
function Monoclinic(a::T, b::T, c::T, β::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(MonoclinicLattice(a,b,c,β), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
# Monoclinic Primitive w/ 2 Atom Basis
function MonoclinicBaseCentered(a::T, b::T, c::T, β::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
half_b = float_type(0.5)*b
lattice = BravaisLattice(MonoclinicLattice(a,b,c,β), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(a)], charge = charge),
Atom(atomic_symbol, [half_a, half_b, zero(c)], charge = charge)]
return Crystal(lattice,basis,N)
end
function MonoclinicBaseCentered(a::T, b::T, c::T, β::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
half_b = float_type(0.5)*b
lattice = BravaisLattice(MonoclinicLattice(a,b,c,β), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge),
Atom([half_a, half_b, zero(c)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
####################
### Orthorhombic ###
####################
function Orthorhombic(a::T, b::T, c::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(OrthorhombicLattice(a,b,c), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(b),zero(c)], charge = charge)]
return Crystal(lattice,basis,N)
end
function Orthorhombic(a::T, b::T, c::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(OrthorhombicLattice(a,b,c), Primitive())
basis = [Atom([zero(a),zero(b),zero(c)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
# Ortho Primitive w/ 2 Atom Basis
function OrthorhombicBaseCentered(a::T, b::T, c::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
half_b = float_type(0.5)*b
lattice = BravaisLattice(OrthorhombicLattice(a,b,c), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(a)], charge = charge),
Atom(atomic_symbol, [half_a, half_b, zero(c)], charge = charge)]
return Crystal(lattice,basis,N)
end
function OrthorhombicBaseCentered(a::T, b::T, c::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
half_b = float_type(0.5)*b
lattice = BravaisLattice(OrthorhombicLattice(a,b,c), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge),
Atom([half_a, half_b, zero(c)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
# Ortho Primitive w/ 2 Atom Basis
function OrthorhombicBodyCentered(a::T, b::T, c::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
half_b = float_type(0.5)*b
half_c = float_type(0.5)*c
lattice = BravaisLattice(OrthorhombicLattice(a,b,c), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(a)], charge = charge),
Atom(atomic_symbol, [half_a, half_b, half_c], charge = charge)]
return Crystal(lattice,basis,N)
end
function OrthorhombicBodyCentered(a::T, b::T, c::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
half_b = float_type(0.5)*b
half_c = float_type(0.5)*c
lattice = BravaisLattice(OrthorhombicLattice(a,b,c), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge),
Atom([half_a, half_b, half_c], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
# Ortho Primitive w/ 4 Atom Basis
function OrthorhombicFaceCentered(a::T, b::T, c::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
half_b = float_type(0.5)*b
half_c = float_type(0.5)*c
lattice = BravaisLattice(OrthorhombicLattice(a,b,c), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(a)], charge = charge),
Atom(atomic_symbol, [half_a, half_b, zero(c)], charge = charge),
Atom(atomic_symbol, [half_a, zero(b), half_c], charge = charge),
Atom(atomic_symbol, [zero(a), half_b, half_c], charge = charge)]
return Crystal(lattice,basis,N)
end
function OrthorhombicFaceCentered(a::T, b::T, c::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
half_b = float_type(0.5)*b
half_c = float_type(0.5)*c
lattice = BravaisLattice(OrthorhombicLattice(a,b,c), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge),
Atom([half_a, half_b, zero(c)], atomic_mass, charge = charge),
Atom([half_a, zero(b), half_c], atomic_mass, charge = charge),
Atom([zero(a), half_b, half_c], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
##################
### Tetragonal ###
##################
# Tetragonal Primitive
function Tetragonal(a::T, c::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(TetragonalLattice(a,c), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(c)], charge = charge)]
return Crystal(lattice,basis,N)
end
function Tetragonal(a::T, c::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(TetragonalLattice(a,c), Primitive())
basis = [Atom([zero(a),zero(a),zero(c)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
# Tetragonal Primitive w/ 2 Atom Basis
function TetragonalBodyCentered(a::T, c::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
half_c = float_type(0.5)*c
lattice = BravaisLattice(TetragonalLattice(a,c), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(a)], charge = charge),
Atom(atomic_symbol, [half_a, half_a, half_c], charge = charge)]
return Crystal(lattice,basis,N)
end
function TetragonalBodyCentered(a::T, c::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
float_type = typeof(ustrip(a))
half_a = float_type(0.5)*a
half_c = float_type(0.5)*c
lattice = BravaisLattice(TetragonalLattice(a,c), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge),
Atom([half_a, half_a, half_c], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
#################
### Hexagonal ###
#################
function Rhombohedral(a::T, α::T, atomic_symbol::Symbol, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(RhombohedralLattice(a, α), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a),zero(a)], charge = charge)]
return Crystal(lattice,basis,N)
end
function Rhombohedral(a::T, α::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(RhombohedralLattice(a, α), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
function Hexagonal(a::T, c::T, atomic_mass::Number, N::SVector{3}; charge = 0.0u"C") where T
lattice = BravaisLattice(HexagonalLattice(a, c), Primitive())
basis = [Atom([zero(a),zero(a),zero(a)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end