Types

Index

Documentation

CrystalBase.StringVec3Type

Pair type associating a String with a Vec3.

E.g., for pair of atom name -> position, kpoint label -> coordinates, etc.

source
CrystalBase.mat3Function
mat3(A)
mat3(v1, v2, v3)
mat3(cols)

Convert input to Mat3.

  • For a matrix input A, convert directly to Mat3.
  • For separate v1, v2, v3 vector inputs, treat each as a column of the matrix.
  • For a vector-of-vectors input cols, each inner vector is treated as one column.
Note

This is not defined as a constructor of Mat3 to avoid type piracy.

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.0
cols = 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.0
v1, 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.0
cols = [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.0
source
CrystalBase.stringvec3Function
stringvec3(s, v)
stringvec3(p)
stringvec3(d)

Build a StringVec3 pair from label/name and coordinates.

  • String labels are stored as String.
  • Symbol labels are accepted and converted to String.
  • Pair and one-entry Dict inputs 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]
source
CrystalBase.vec3Function
vec3(v)
vec3(x, y, z)
vec3(A)

Convert input to Vec3-compatible representation.

  • For a vector input v, convert to Vec3.
  • For separate x, y, z inputs, convert to Vec3.
  • For a matrix input A, return a Vec3 of column vectors.
Note

This is not defined as a constructor of Vec3 to avoid type piracy.

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.0
v = SVector(1.0, 2.0, 3.0);
vec3(v)
# output
3-element SVector{3, Float64} with indices SOneTo(3):
 1.0
 2.0
 3.0
vec3(1.0, 2.0, 3.0)
# output
3-element SVector{3, Float64} with indices SOneTo(3):
 1.0
 2.0
 3.0
A = [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]
source