# -*- coding: utf-8 -*-
# -------------------------------------------------------------
# Bulk Configuration
# -------------------------------------------------------------

# Set up lattice
lattice = SimpleOrthorhombic(5.269162331934044*Angstrom, 5.057527116128465*Angstrom, 5.083292204650474*Angstrom)

# Define elements
elements = [Hafnium, Hafnium, Hafnium, Hafnium, Oxygen, Oxygen, Oxygen, Oxygen,
            Oxygen, Oxygen, Oxygen, Oxygen]

# Define coordinates
fractional_coordinates = [[ 0.032141296794,  0.266677735038,  0.122903538851],
                          [ 0.467858703206,  0.266677735038,  0.622903538851],
                          [ 0.532141296794,  0.733322264962,  0.122903538851],
                          [ 0.967858703206,  0.733322264962,  0.622903538851],
                          [ 0.366566054823,  0.069808791673,  0.26340113046 ],
                          [ 0.133433945177,  0.069808791673,  0.76340113046 ],
                          [ 0.731445675951,  0.461860108686,  0.372465830689],
                          [ 0.768554324049,  0.461860108686,  0.872465830689],
                          [ 0.268554324049,  0.538139891314,  0.872465830689],
                          [ 0.231445675951,  0.538139891314,  0.372465830689],
                          [ 0.866566054823,  0.930191208327,  0.26340113046 ],
                          [ 0.633433945177,  0.930191208327,  0.76340113046 ]]

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

# create randomly displaced geometries of the loaded BulkConfiguration and store them in a trainingSet object

parameters = crystalTrainingRandomDisplacements(
    bulk_configuration,
    supercell_repetitions_list=[(1, 1, 1), (2, 2, 1)],
    sample_size_per_stage=7,
    max_atomic_rattling_amplitude=0.4*Angstrom,
    max_cell_rattling_amplitude=0.05,
    log_filename_prefix='random_displacements_crystal_',
)

nlsave('initial_training_sets.hdf5',parameters)
