# -------------------------------------------------------------
# Bulk Configuration
# -------------------------------------------------------------

# Set up lattice
vector_a = [11.2906, 0.0, 0.0]*Angstrom
vector_b = [0.0, 11.2906, 0.0]*Angstrom
vector_c = [0.0, 0.0, 11.2906]*Angstrom
lattice = UnitCell(vector_a, vector_b, vector_c)

# Define elements
elements = [Gallium, Gallium, Gallium, Gallium, Gallium, Gallium, Gallium,
            Gallium, Arsenic, Arsenic, Arsenic, Arsenic, Arsenic, Arsenic,
            Arsenic, Arsenic, Gallium, Gallium, Gallium, Gallium, Gallium,
            Gallium, Gallium, Gallium, Arsenic, Arsenic, Arsenic, Arsenic,
            Arsenic, Arsenic, Arsenic, Arsenic, Gallium, Gallium, Gallium,
            Gallium, Gallium, Gallium, Gallium, Gallium, Arsenic, Arsenic,
            Arsenic, Arsenic, Arsenic, Arsenic, Arsenic, Arsenic, Gallium,
            Gallium, Gallium, Gallium, Gallium, Gallium, Gallium, Gallium,
            Arsenic, Arsenic, Arsenic, Arsenic, Arsenic, Arsenic, Arsenic,
            Arsenic]

# Define coordinates
fractional_coordinates = [[ 0.            ,  0.            ,  0.            ],
                          [ 0.            ,  0.            ,  0.500743981719],
                          [ 0.            ,  0.500743981719,  0.            ],
                          [ 0.            ,  0.500743981719,  0.500743981719],
                          [ 0.500743981719,  0.            ,  0.            ],
                          [ 0.500743981719,  0.            ,  0.500743981719],
                          [ 0.500743981719,  0.500743981719,  0.            ],
                          [ 0.500743981719,  0.500743981719,  0.500743981719],
                          [ 0.12518599543 ,  0.12518599543 ,  0.12518599543 ],
                          [ 0.12518599543 ,  0.12518599543 ,  0.625929977149],
                          [ 0.12518599543 ,  0.625929977149,  0.12518599543 ],
                          [ 0.12518599543 ,  0.625929977149,  0.625929977149],
                          [ 0.625929977149,  0.12518599543 ,  0.12518599543 ],
                          [ 0.625929977149,  0.12518599543 ,  0.625929977149],
                          [ 0.625929977149,  0.625929977149,  0.12518599543 ],
                          [ 0.625929977149,  0.625929977149,  0.625929977149],
                          [ 0.25037199086 ,  0.25037199086 ,  0.            ],
                          [ 0.25037199086 ,  0.25037199086 ,  0.500743981719],
                          [ 0.25037199086 ,  0.751115972579,  0.            ],
                          [ 0.25037199086 ,  0.751115972579,  0.500743981719],
                          [ 0.751115972579,  0.25037199086 ,  0.            ],
                          [ 0.751115972579,  0.25037199086 ,  0.500743981719],
                          [ 0.751115972579,  0.751115972579,  0.            ],
                          [ 0.751115972579,  0.751115972579,  0.500743981719],
                          [ 0.375557986289,  0.375557986289,  0.12518599543 ],
                          [ 0.375557986289,  0.375557986289,  0.625929977149],
                          [ 0.375557986289,  0.876301968009,  0.12518599543 ],
                          [ 0.375557986289,  0.876301968009,  0.625929977149],
                          [ 0.876301968009,  0.375557986289,  0.12518599543 ],
                          [ 0.876301968009,  0.375557986289,  0.625929977149],
                          [ 0.876301968009,  0.876301968009,  0.12518599543 ],
                          [ 0.876301968009,  0.876301968009,  0.625929977149],
                          [ 0.25037199086 ,  0.            ,  0.25037199086 ],
                          [ 0.25037199086 ,  0.            ,  0.751115972579],
                          [ 0.25037199086 ,  0.500743981719,  0.25037199086 ],
                          [ 0.25037199086 ,  0.500743981719,  0.751115972579],
                          [ 0.751115972579,  0.            ,  0.25037199086 ],
                          [ 0.751115972579,  0.            ,  0.751115972579],
                          [ 0.751115972579,  0.500743981719,  0.25037199086 ],
                          [ 0.751115972579,  0.500743981719,  0.751115972579],
                          [ 0.375557986289,  0.12518599543 ,  0.375557986289],
                          [ 0.375557986289,  0.12518599543 ,  0.876301968009],
                          [ 0.375557986289,  0.625929977149,  0.375557986289],
                          [ 0.375557986289,  0.625929977149,  0.876301968009],
                          [ 0.876301968009,  0.12518599543 ,  0.375557986289],
                          [ 0.876301968009,  0.12518599543 ,  0.876301968009],
                          [ 0.876301968009,  0.625929977149,  0.375557986289],
                          [ 0.876301968009,  0.625929977149,  0.876301968009],
                          [ 0.            ,  0.25037199086 ,  0.25037199086 ],
                          [ 0.            ,  0.25037199086 ,  0.751115972579],
                          [ 0.            ,  0.751115972579,  0.25037199086 ],
                          [ 0.            ,  0.751115972579,  0.751115972579],
                          [ 0.500743981719,  0.25037199086 ,  0.25037199086 ],
                          [ 0.500743981719,  0.25037199086 ,  0.751115972579],
                          [ 0.500743981719,  0.751115972579,  0.25037199086 ],
                          [ 0.500743981719,  0.751115972579,  0.751115972579],
                          [ 0.12518599543 ,  0.375557986289,  0.375557986289],
                          [ 0.12518599543 ,  0.375557986289,  0.876301968009],
                          [ 0.12518599543 ,  0.876301968009,  0.375557986289],
                          [ 0.12518599543 ,  0.876301968009,  0.876301968009],
                          [ 0.625929977149,  0.375557986289,  0.375557986289],
                          [ 0.625929977149,  0.375557986289,  0.876301968009],
                          [ 0.625929977149,  0.876301968009,  0.375557986289],
                          [ 0.625929977149,  0.876301968009,  0.876301968009]]

# Set up configuration
bulk_configuration = BulkConfiguration(
    bravais_lattice=lattice,
    elements=elements,
    fractional_coordinates=fractional_coordinates
    )

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#----------------------------------------
# Basis Set
#----------------------------------------
basis_set = [
    GGABasis.Gallium_DoubleZetaPolarized,
    GGABasis.Arsenic_DoubleZetaPolarized,
    ]

#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = GGA.PBES

k_point_sampling = MonkhorstPackGrid(
    na=4,
    nb=4,
    nc=4,
    )
numerical_accuracy_parameters = NumericalAccuracyParameters(
    k_point_sampling=k_point_sampling,
    )

calculator = LCAOCalculator(
    basis_set=basis_set,
    exchange_correlation=exchange_correlation,
    numerical_accuracy_parameters=numerical_accuracy_parameters,
    )

bulk_configuration.setCalculator(calculator)
nlprint(bulk_configuration)
bulk_configuration.update()
nlsave('big-bulk-GaAs.nc', bulk_configuration)

# -------------------------------------------------------------
# Density Of States
# -------------------------------------------------------------
density_of_states = DensityOfStates(
    configuration=bulk_configuration,
    kpoints=MonkhorstPackGrid(8,8,8),
    energy_zero_parameter=FermiLevel,
    bands_above_fermi_level=None,
    )
nlsave('big-bulk-GaAs.nc', density_of_states)
nlprint(density_of_states)

# -------------------------------------------------------------
# Total Energy
# -------------------------------------------------------------
total_energy = TotalEnergy(bulk_configuration)
nlsave('big-bulk-GaAs.nc', total_energy)
nlprint(total_energy)
