-
Notifications
You must be signed in to change notification settings - Fork 2
/
2D_bravais.jl
82 lines (67 loc) · 3.08 KB
/
2D_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
export
Oblique,
Rectangular, RectangularCentered,
Square,
Hexagonal
function Oblique(a::T, b::T, θ::T, atomic_symbol::Symbol, N::SVector{2}; charge = 0.0u"C") where T
lattice = BravaisLattice(ObliqueLattice(a, b, θ), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(b)], charge = charge)]
return Crystal(lattice,basis,N)
end
function Oblique(a::T, b::T, θ::T, atomic_mass::Number, N::SVector{2}; charge = 0.0u"C") where T
lattice = BravaisLattice(ObliqueLattice(a, b, θ), Primitive())
basis = [Atom([zero(a),zero(b)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
#####
function Rectangular(a::T, b::T, atomic_symbol::Symbol, N::SVector{2}; charge = 0.0u"C") where T
lattice = BravaisLattice(RectangularLattice(a, b), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(b)], charge = charge)]
return Crystal(lattice,basis,N)
end
function Rectangular(a::T, b::T, atomic_mass::Number, N::SVector{2}; charge = 0.0u"C") where T
lattice = BravaisLattice(RectangularLattice(a, b), Primitive())
basis = [Atom([zero(a),zero(b)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
#####
function RectangularCentered(a::T, b::T, atomic_symbol::Symbol, N::SVector{2}; 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(RectangularLattice(a, b), Primitive())
basis = [Atom(atomic_symbol, [zero(a), zero(b)], charge = charge),
Atom(atomic_symbol, [half_a, half_b], charge = charge)]
return Crystal(lattice,basis,N)
end
function RectangularCentered(a::T, b::T, atomic_mass::Number, N::SVector{2}; 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(RectangularLattice(a, b), Primitive())
basis = [Atom([zero(a), zero(b)], atomic_mass, charge = charge),
Atom([half_a, half_b], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
#####
function Square(a::T, atomic_symbol::Symbol, N::SVector{2}; charge = 0.0u"C") where T
lattice = BravaisLattice(SquareLattice(a), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a)], charge = charge)]
return Crystal(lattice,basis,N)
end
function Square(a::T, atomic_mass::Number, N::SVector{2}; charge = 0.0u"C") where T
lattice = BravaisLattice(SquareLattice(a), Primitive())
basis = [Atom([zero(a),zero(a)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end
#####
function Hexagonal(a::T, atomic_symbol::Symbol, N::SVector{2}; charge = 0.0u"C") where T
lattice = BravaisLattice(Hexagonal2DLattice(a), Primitive())
basis = [Atom(atomic_symbol, [zero(a),zero(a)], charge = charge)]
return Crystal(lattice,basis,N)
end
function Hexagonal(a::T, atomic_mass::Number, N::SVector{2}; charge = 0.0u"C") where T
lattice = BravaisLattice(Hexagonal2DLattice(a), Primitive())
basis = [Atom([zero(a),zero(a)], atomic_mass, charge = charge)]
return Crystal(lattice,basis,N)
end