using DFTK: Mat3, Vec3
using LinearAlgebra: Diagonal

silicon = (
    lattice = [0.0  5.131570667152971 5.131570667152971;
               5.131570667152971 0.0 5.131570667152971;
               5.131570667152971 5.131570667152971  0.0],
    atnum = 14,
    n_electrons = 8,
    Tsmear = nothing,
    psp = "hgh/lda/si-q4",
    positions = [ones(3)/8, -ones(3)/8],  # in fractional coordinates
    kcoords = [[   0,   0, 0],  # in fractional coordinates
               [ 1/3,   0, 0],
               [ 1/3, 1/3, 0],
               [-1/3, 1/3, 0]],
    ksymops = Vector{Vector{Tuple{Mat3{Int},Vec3{Float64}}}}([
        [([ 1  0  0;  0  1  0;  0  0  1], [ 0.0,  0.0,  0.0])],
        [([ 1  0  0;  0  1  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([-1  0  1;  0 -1  1;  0  0  1], [ 0.0,  0.0, -0.5]),
         ([ 0  1 -1;  1  0 -1;  0  0 -1], [ 0.0,  0.0,  0.5]),
         ([ 0 -1  0; -1  0  0;  0  0 -1], [ 0.0,  0.0,  0.0]),
         ([ 0 -1  1;  0 -1  0;  1 -1  0], [ 0.0,  0.5,  0.0]),
         ([ 1  0 -1;  1  0  0;  1 -1  0], [ 0.0, -0.5,  0.0]),
         ([ 0  1  0;  0  1 -1; -1  1  0], [-0.5,  0.0,  0.0]),
         ([-1  0  0; -1  0  1; -1  1  0], [ 0.5,  0.0,  0.0])],
        [([ 1  0  0;  0  1  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([-1  0  0; -1  0  1; -1  1  0], [ 0.5,  0.0,  0.0]),
         ([ 0  1  0;  0  0  1;  1  0  0], [ 0.0,  0.0,  0.0]),
         ([-1  1  0;  0  1  0;  0  1 -1], [ 0.0, -0.5,  0.0]),
         ([-1  0  1; -1  1  0; -1  0  0], [ 0.0,  0.0,  0.5]),
         ([ 0  0  1; -1  0  1;  0 -1  1], [-0.5,  0.0,  0.0])],
        [([ 1  0  0;  0  1  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([ 0  1 -1;  1  0 -1;  0  0 -1], [ 0.0,  0.0,  0.5]),
         ([ 1  0 -1;  0  0 -1;  0  1 -1], [ 0.0,  0.5,  0.0]),
         ([-1  1  0;  0  1  0;  0  1 -1], [ 0.0, -0.5,  0.0]),
         ([ 0  0 -1;  0 -1  0; -1  0  0], [ 0.0,  0.0,  0.0]),
         ([-1  0  1; -1  1  0; -1  0  0], [ 0.0,  0.0,  0.5]),
         ([ 1  0 -1;  1  0  0;  1 -1  0], [ 0.0, -0.5,  0.0]),
         ([ 0  1  0;  0  0  1;  1  0  0], [ 0.0,  0.0,  0.0]),
         ([ 0  0  1; -1  0  1;  0 -1  1], [-0.5,  0.0,  0.0]),
         ([ 0  1  0;  0  1 -1; -1  1  0], [-0.5,  0.0,  0.0]),
         ([ 0 -1  0;  1 -1  0;  0 -1  1], [ 0.5,  0.0,  0.0]),
         ([ 1 -1  0;  1  0 -1;  1  0  0], [ 0.0,  0.0, -0.5])]
       ]),
)

magnesium = (
    lattice = [-3.0179389205999998 -3.0179389205999998 0.0000000000000000;
               -5.2272235447000002 5.2272235447000002 0.0000000000000000;
               0.0000000000000000 0.0000000000000000 -9.7736219469000005],
    atnum = 12,
    n_electrons = 4,
    psp = "hgh/lda/mg-q2",
    positions = [[2/3, 1/3, 1/4], [1/3, 2/3, 3/4]],
    kcoords =  [[0,   0,   0],
                [1/3, 0,   0],
                [1/3, 1/3, 0],
                [0,   0,   1/3],
                [1/3, 0,   1/3],
                [1/3, 1/3, 1/3]],
    Tsmear = 0.01,
    ksymops = Vector{Vector{Tuple{Mat3{Int},Vec3{Float64}}}}([
        [([ 1  0  0;  0  1  0;  0  0  1], [ 0.0,  0.0,  0.0])],
        [([ 1  0  0;  0  1  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([-1  0  0;  0 -1  0;  0  0 -1], [ 0.0,  0.0,  0.0]),
         ([ 0 -1  0;  1  1  0;  0  0  1], [ 0.0,  0.0, -0.5]),
         ([-1 -1  0;  1  0  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([ 0  1  0; -1 -1  0;  0  0 -1], [ 0.0,  0.0,  0.5]),
         ([ 1  1  0; -1  0  0;  0  0 -1], [ 0.0,  0.0,  0.0])],
        [([ 1  0  0;  0  1  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([-1  0  0;  0 -1  0;  0  0 -1], [ 0.0,  0.0,  0.0])],
        [([ 1  0  0;  0  1  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([-1  0  0;  0 -1  0;  0  0 -1], [ 0.0,  0.0,  0.0])],
        [([ 1  0  0;  0  1  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([-1  0  0;  0 -1  0;  0  0  1], [ 0.0,  0.0, -0.5]),
         ([ 0 -1  0;  1  1  0;  0  0  1], [ 0.0,  0.0, -0.5]),
         ([-1 -1  0;  1  0  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([ 0  1  0; -1 -1  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([ 1  1  0; -1  0  0;  0  0  1], [ 0.0,  0.0, -0.5]),
         ([ 1  0  0;  0  1  0;  0  0 -1], [ 0.0,  0.0,  0.5]),
         ([-1  0  0;  0 -1  0;  0  0 -1], [ 0.0,  0.0,  0.0]),
         ([ 0 -1  0;  1  1  0;  0  0 -1], [ 0.0,  0.0,  0.0]),
         ([-1 -1  0;  1  0  0;  0  0 -1], [ 0.0,  0.0,  0.5]),
         ([ 0  1  0; -1 -1  0;  0  0 -1], [ 0.0,  0.0,  0.5]),
         ([ 1  1  0; -1  0  0;  0  0 -1], [ 0.0,  0.0,  0.0])],
        [([ 1  0  0;  0  1  0;  0  0  1], [ 0.0,  0.0,  0.0]),
         ([ 0 -1  0;  1  1  0;  0  0  1], [ 0.0,  0.0, -0.5]),
         ([ 0  1  0; -1 -1  0;  0  0 -1], [ 0.0,  0.0,  0.5]),
         ([-1  0  0;  0 -1  0;  0  0 -1], [ 0.0,  0.0,  0.0])],
    ]),
)


aluminium = (
    lattice = Matrix(Diagonal([4 * 7.6324708938577865, 7.6324708938577865,
                               7.6324708938577865])),
    atnum = 13,
    n_electrons = 12,
    psp = "hgh/lda/al-q3",
    positions = [[0, 0, 0], [0, 1/2, 1/2], [1/8, 0, 1/2], [1/8, 1/2, 0]],
    Tsmear = 0.0009500431544769484,
)


aluminium_primitive = (
    lattice = [5.39697192863632 2.69848596431816 2.69848596431816;
               0.00000000000000 4.67391479368660 1.55797159787754;
               0.00000000000000 0.00000000000000 4.40660912710674],
    atnum = 13,
    n_electrons = 3,
    psp = "hgh/lda/al-q3",
    positions = [[0, 0, 0]],
    Tsmear = 0.0009500431544769484,
)
