Types
Index
CrystalBase.Mat3CrystalBase.StringVec3CrystalBase.Vec3CrystalBase.mat3CrystalBase.stringvec3CrystalBase.vec3
Documentation
CrystalBase.Mat3 — Type
3 x 3 matrix type.
For lattice and reciprocal lattice.
CrystalBase.StringVec3 — Type
Pair type associating a String with a Vec3.
E.g., for pair of atom name -> position, kpoint label -> coordinates, etc.
CrystalBase.Vec3 — Type
Length-3 vector type.
For atom positions, kpoints, etc.
CrystalBase.mat3 — Function
mat3(A)
mat3(v1, v2, v3)
mat3(cols)Convert input to Mat3.
- For a matrix input
A, convert directly toMat3. - For separate
v1,v2,v3vector inputs, treat each as a column of the matrix. - For a vector-of-vectors input
cols, each inner vector is treated as one column.
Examples
A = [1.0 2.0 3.0; 4.0 5.0 6.0; 7.0 8.0 9.0];
mat3(A)
# output
3×3 SMatrix{3, 3, Float64, 9} with indices SOneTo(3)×SOneTo(3):
1.0 2.0 3.0
4.0 5.0 6.0
7.0 8.0 9.0cols = SMatrix{3,3}(A);
mat3(cols)
# output
3×3 SMatrix{3, 3, Float64, 9} with indices SOneTo(3)×SOneTo(3):
1.0 2.0 3.0
4.0 5.0 6.0
7.0 8.0 9.0v1, v2, v3 = [1.0, 4.0, 7.0], [2.0, 5.0, 8.0], [3.0, 6.0, 9.0];
mat3(v1, v2, v3)
# output
3×3 SMatrix{3, 3, Float64, 9} with indices SOneTo(3)×SOneTo(3):
1.0 2.0 3.0
4.0 5.0 6.0
7.0 8.0 9.0cols = [v1, v2, v3];
mat3(cols)
# output
3×3 SMatrix{3, 3, Float64, 9} with indices SOneTo(3)×SOneTo(3):
1.0 2.0 3.0
4.0 5.0 6.0
7.0 8.0 9.0CrystalBase.stringvec3 — Function
stringvec3(s, v)
stringvec3(p)
stringvec3(d)Build a StringVec3 pair from label/name and coordinates.
Stringlabels are stored asString.Symbollabels are accepted and converted toString.Pairand one-entryDictinputs are also supported.
Examples
stringvec3("Si", [0.0, 0.5, 0.5])
# output
"Si" => [0.0, 0.5, 0.5]stringvec3(:Γ, [0.0, 0.0, 0.0])
# output
"Γ" => [0.0, 0.0, 0.0]stringvec3("K" => [0.25, 0.25, 0.25])
# output
"K" => [0.25, 0.25, 0.25]stringvec3(Dict("K" => [0.25, 0.25, 0.25]))
# output
"K" => [0.25, 0.25, 0.25]CrystalBase.vec3 — Function
vec3(v)
vec3(x, y, z)
vec3(A)Convert input to Vec3-compatible representation.
- For a vector input
v, convert toVec3. - For separate
x,y,zinputs, convert toVec3. - For a matrix input
A, return aVec3of column vectors.
Examples
v = [1.0, 2.0, 3.0];
vec3(v)
# output
3-element SVector{3, Float64} with indices SOneTo(3):
1.0
2.0
3.0v = SVector(1.0, 2.0, 3.0);
vec3(v)
# output
3-element SVector{3, Float64} with indices SOneTo(3):
1.0
2.0
3.0vec3(1.0, 2.0, 3.0)
# output
3-element SVector{3, Float64} with indices SOneTo(3):
1.0
2.0
3.0A = [1.0 2.0 3.0; 4.0 5.0 6.0; 7.0 8.0 9.0];
vec3(A)
# output
3-element SVector{3, SVector{3, Float64}} with indices SOneTo(3):
[1.0, 4.0, 7.0]
[2.0, 5.0, 8.0]
[3.0, 6.0, 9.0]