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

# Set up lattice
lattice = FaceCenteredCubic(5.6537*Angstrom)

# Define elements
elements = [Gallium, Arsenic]

# Define coordinates
fractional_coordinates = [[ 0.  ,  0.  ,  0.  ],
                          [ 0.25,  0.25,  0.25]]

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

# -------------------------------------------------------------
# Calculator
# -------------------------------------------------------------
#----------------------------------------
# Exchange-Correlation
#----------------------------------------
exchange_correlation = LDA.PZ

k_point_sampling = MonkhorstPackGrid(
    na=14,
    nb=14,
    nc=14,
    )
numerical_accuracy_parameters = NumericalAccuracyParameters(
    density_mesh_cutoff=30.0*Hartree,
    k_point_sampling=k_point_sampling,
    occupation_method=FermiDirac(100.0*Kelvin*boltzmann_constant),
    )

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

bulk_configuration.setCalculator(calculator)
nlprint(bulk_configuration)
bulk_configuration.update()
nlsave('GaAs.hdf5', bulk_configuration)

# -------------------------------------------------------------
# Born Effective Charge
# -------------------------------------------------------------
born_effective_charge = BornEffectiveCharge(
    configuration=bulk_configuration,
    kpoints_a=MonkhorstPackGrid(21, 5, 5),
    kpoints_b=MonkhorstPackGrid(5, 21, 5),
    kpoints_c=MonkhorstPackGrid(5, 5, 21),
    atomic_displacement=0.01*Angstrom,
    )
nlsave('GaAs.hdf5', born_effective_charge)
