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

# Set up lattice
lattice = SimpleMonoclinic(5.143975842349902*Angstrom, 5.203856511854966*Angstrom, 5.325201925616304*Angstrom, 99.53959142099255*Degrees)

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

# Define coordinates
fractional_coordinates = [[ 0.275987802358,  0.542681833638,  0.709143756122],
                          [ 0.724012197642,  0.042681833638,  0.790856243878],
                          [ 0.724012197642,  0.457318166362,  0.290856243878],
                          [ 0.275987802358,  0.957318166362,  0.209143756122],
                          [ 0.449499936549,  0.25730173725 ,  0.977401940369],
                          [ 0.550500063451,  0.75730173725 ,  0.522598059631],
                          [ 0.550500063451,  0.74269826275 ,  0.022598059631],
                          [ 0.449499936549,  0.24269826275 ,  0.477401940369],
                          [ 0.06825124084 ,  0.669006873862,  0.346872992176],
                          [ 0.93174875916 ,  0.169006873862,  0.153127007824],
                          [ 0.93174875916 ,  0.330993126138,  0.653127007824],
                          [ 0.06825124084 ,  0.830993126138,  0.846872992176]]

# 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)
