# Path: smact/lattice.py
# class Lattice(object):
#       """A unique set of Sites.
# 
#       Lattice objects define a general crystal structure, with a space group and
#       a collection of Site objects. These Site objects have their own fractional
#       coordinates and a list of possible oxidation states (see the Site class).
# 
#       Specific crystal structures with elements assigned to sites are
#       "materials" and use the Atoms class from the Atomic Simulation
#       Environment.
# 
#       Attributes:
#           basis_sites: A list of Site objects [SiteA, SiteB, SiteC, ...]
#           comprising the basis sites in Cartesian coordinates
# 
#           space_group: Integer space group number according to the
#           International Tables for Crystallography.
# 
#           structurbericht:
#           Structurbericht identity, if applicable (e.g. 'B1')
# 
#       Methods:
#           lattice_vector_calc():
# 
#       """
# 
#       def __init__(self, sites, space_group=1, strukturbericht=False):
#             self.sites = sites
#             self.space_group = space_group
#             self.strukturbericht = strukturbericht
# 
# class Site(object):
#       """
#       A single lattice site with a list of possible oxidation states.
# 
#       The Site object is primarily used within Lattice objects.
# 
#       Attributes:
#           position: A list of fractional coordinates [x,y,z]
#           oxidation_states: A list of possible oxidation states e.g. [-1,0,1]
# 
#       """
# 
#       def __init__(self, position, oxidation_states=[0]):
#             self.position = position
#             self.oxidation_states = oxidation_states


from ase.spacegroup import crystal
from smact.lattice import Lattice, Site

    oxidation_states = [[2]] + [[4]] + [[-2]] * 3
    for site in zip(system.get_scaled_positions(), oxidation_states):
        sites_list.append(Site(site[0], site[1]))

    return Lattice(sites_list, oxidation_states), system


def wurtzite(species, cell_par=[2, 2, 6, 90, 90, 120], repetitions=[1, 1, 1]):
    """
    Build a wurzite cell using the crystal function in ASE.

    Args:
        species (str): Element symbols
        cell_par (list): Six floats/ints specifying 3 unit cell lengths and 3 unit cell angles.
        repetitions (list): Three floats specifying the expansion of the cell in x,y,z directions.
    Returns:
        SMACT Lattice object of the unit cell,
        ASE crystal system of the unit cell.

    """
    system = crystal((species),
                     basis=[(2. / 3., 1. / 3., 0), (2. / 3., 1. / 3., 5. / 8.)],
                     spacegroup=186,
                     size=repetitions,
                     cellpar=[3, 3, 6, 90, 90, 120])

    sites_list = []
    oxidation_states = [[1], [2], [3], [4]] + [[-1], [-2], [-3], [-4]]

    for site in zip(system.get_scaled_positions(), oxidation_states):

# Path: smact/lattice.py
# class Lattice(object):
#       """A unique set of Sites.
# 
#       Lattice objects define a general crystal structure, with a space group and
#       a collection of Site objects. These Site objects have their own fractional
#       coordinates and a list of possible oxidation states (see the Site class).
# 
#       Specific crystal structures with elements assigned to sites are
#       "materials" and use the Atoms class from the Atomic Simulation
#       Environment.
# 
#       Attributes:
#           basis_sites: A list of Site objects [SiteA, SiteB, SiteC, ...]
#           comprising the basis sites in Cartesian coordinates
# 
#           space_group: Integer space group number according to the
#           International Tables for Crystallography.
# 
#           structurbericht:
#           Structurbericht identity, if applicable (e.g. 'B1')
# 
#       Methods:
#           lattice_vector_calc():
# 
#       """
# 
#       def __init__(self, sites, space_group=1, strukturbericht=False):
#             self.sites = sites
#             self.space_group = space_group
#             self.strukturbericht = strukturbericht
# 
# class Site(object):
#       """
#       A single lattice site with a list of possible oxidation states.
# 
#       The Site object is primarily used within Lattice objects.
# 
#       Attributes:
#           position: A list of fractional coordinates [x,y,z]
#           oxidation_states: A list of possible oxidation states e.g. [-1,0,1]
# 
#       """
# 
#       def __init__(self, position, oxidation_states=[0]):
#             self.position = position
#             self.oxidation_states = oxidation_states


# Path: smact/builder.py
from ase.spacegroup import crystal
from smact.lattice import Lattice, Site

    oxidation_states = [[2]] + [[4]] + [[-2]] * 3
    for site in zip(system.get_scaled_positions(), oxidation_states):
        sites_list.append(Site(site[0], site[1]))

    return Lattice(sites_list, oxidation_states), system


def wurtzite(species, cell_par=[2, 2, 6, 90, 90, 120], repetitions=[1, 1, 1]):
    """
    Build a wurzite cell using the crystal function in ASE.

    Args:
        species (str): Element symbols
        cell_par (list): Six floats/ints specifying 3 unit cell lengths and 3 unit cell angles.
        repetitions (list): Three floats specifying the expansion of the cell in x,y,z directions.
    Returns:
        SMACT Lattice object of the unit cell,
        ASE crystal system of the unit cell.

    """
    system = crystal((species),
                     basis=[(2. / 3., 1. / 3., 0), (2. / 3., 1. / 3., 5. / 8.)],
                     spacegroup=186,
                     size=repetitions,
                     cellpar=[3, 3, 6, 90, 90, 120])

    sites_list = []
    oxidation_states = [[1], [2], [3], [4]] + [[-1], [-2], [-3], [-4]]

    for site in zip(system.get_scaled_positions(), oxidation_states):

        sites_list.append(Site(site[0], site[1]))
