# Path: mpinterfaces/transformations.py
# def reduced_supercell_vectors(ab, n):
#     """
#     Returns all possible reduced in-plane lattice vectors and
#     transition matrices for the given starting unit cell lattice
#     vectors(ab) and the supercell size n
#     """
#     uv_list = []
#     tm_list = []
#     for r_tm in get_trans_matrices(n):
#         uv = get_uv(ab, r_tm)
#         uv_r, tm0 = get_reduced_uv(uv, r_tm)
#         uv_list.append(uv_r)
#         tm_list.append(tm0)
#     return uv_list, tm_list
# 
# Path: mpinterfaces/utils.py
# def get_ase_slab(pmg_struct, hkl=(1, 1, 1), min_thick=10, min_vac=10):
#     """
#     takes in the intial structure as pymatgen Structure object
#     uses ase to generate the slab
#     returns pymatgen Slab object
# 
#     Args:
#         pmg_struct: pymatgen structure object
#         hkl: hkl index of surface of slab to be created
#         min_thick: minimum thickness of slab in Angstroms
#         min_vac: minimum vacuum spacing
#     """
#     ase_atoms = AseAtomsAdaptor().get_atoms(pmg_struct)
#     pmg_slab_gen = SlabGenerator(pmg_struct, hkl, min_thick, min_vac)
#     h = pmg_slab_gen._proj_height
#     nlayers = int(math.ceil(pmg_slab_gen.min_slab_size / h))
#     ase_slab = surface(ase_atoms, hkl, nlayers)
#     ase_slab.center(vacuum=min_vac / 2, axis=2)
#     pmg_slab_structure = AseAtomsAdaptor().get_structure(ase_slab)
#     return Slab(lattice=pmg_slab_structure.lattice,
#                 species=pmg_slab_structure.species_and_occu,
#                 coords=pmg_slab_structure.frac_coords,
#                 site_properties=pmg_slab_structure.site_properties,
#                 miller_index=hkl, oriented_unit_cell=pmg_slab_structure,
#                 shift=0., scale_factor=None, energy=None)
# 
# Path: mpinterfaces/default_logger.py
# def get_default_logger(name, output_stream=sys.stdout):
#     logger = logging.getLogger(name)
#     logger.setLevel(logging.DEBUG)
#     logger.propagate = False
#     formatter = logging.Formatter('%(levelname)s:%(name)s:%(message)s')
#     sh = logging.StreamHandler(stream=output_stream)
#     sh.setFormatter(formatter)
#     logger.addHandler(sh)
#     return logger


from six.moves import range
from pymatgen.core.structure import Structure, Molecule
from pymatgen.core.lattice import Lattice
from pymatgen.core.surface import Slab, SlabGenerator
from pymatgen.core.operations import SymmOp
from pymatgen.util.coord import get_angle
from mpinterfaces.transformations import reduced_supercell_vectors
from mpinterfaces.utils import get_ase_slab
from mpinterfaces.default_logger import get_default_logger
import sys
import math
import copy
import numpy as np
    import os
        to_unit_cell: Pymatgen Slab routine to find unit cell
        coords_are_cartesian: Whether the input coordinates are in
                              cartesian
        from_ase: Whether to create Slab using python-ase for producing
                  slabs that have orthogonal lattice vectors

        NOTE:
        if starting from the bulk structure, create slab
        note: if the starting structure is a slab, the vaccum extension
        is not possible
    """

    def __init__(self, strt, hkl=[1, 1, 1], min_thick=10, min_vac=10,
                 supercell=[1, 1, 1], name=None, adsorb_on_species=None,
                 adatom_on_lig=None, ligand=None, displacement=1.0,
                 surface_coverage=None, scell_nmax=10,
                 coverage_tol=0.25, solvent=None,
                 start_from_slab=False, validate_proximity=False,
                 to_unit_cell=False, coords_are_cartesian=False,
                 primitive=True, from_ase=False,
                 lll_reduce=False, center_slab=True,
                 max_normal_search=None, force_normalize=False,
                 x_shift=0, y_shift=0, rot=[0, 0, 0]):
        self.from_ase = from_ase
        vac_extension = 0
        if ligand is not None:
            vac_extension = ligand.max_dist
        if isinstance(strt, Structure) and not isinstance(strt, Slab):
            self.min_vac = min_vac + vac_extension
            if self.from_ase:

# Path: mpinterfaces/transformations.py
# def reduced_supercell_vectors(ab, n):
#     """
#     Returns all possible reduced in-plane lattice vectors and
#     transition matrices for the given starting unit cell lattice
#     vectors(ab) and the supercell size n
#     """
#     uv_list = []
#     tm_list = []
#     for r_tm in get_trans_matrices(n):
#         uv = get_uv(ab, r_tm)
#         uv_r, tm0 = get_reduced_uv(uv, r_tm)
#         uv_list.append(uv_r)
#         tm_list.append(tm0)
#     return uv_list, tm_list
# 
# Path: mpinterfaces/utils.py
# def get_ase_slab(pmg_struct, hkl=(1, 1, 1), min_thick=10, min_vac=10):
#     """
#     takes in the intial structure as pymatgen Structure object
#     uses ase to generate the slab
#     returns pymatgen Slab object
# 
#     Args:
#         pmg_struct: pymatgen structure object
#         hkl: hkl index of surface of slab to be created
#         min_thick: minimum thickness of slab in Angstroms
#         min_vac: minimum vacuum spacing
#     """
#     ase_atoms = AseAtomsAdaptor().get_atoms(pmg_struct)
#     pmg_slab_gen = SlabGenerator(pmg_struct, hkl, min_thick, min_vac)
#     h = pmg_slab_gen._proj_height
#     nlayers = int(math.ceil(pmg_slab_gen.min_slab_size / h))
#     ase_slab = surface(ase_atoms, hkl, nlayers)
#     ase_slab.center(vacuum=min_vac / 2, axis=2)
#     pmg_slab_structure = AseAtomsAdaptor().get_structure(ase_slab)
#     return Slab(lattice=pmg_slab_structure.lattice,
#                 species=pmg_slab_structure.species_and_occu,
#                 coords=pmg_slab_structure.frac_coords,
#                 site_properties=pmg_slab_structure.site_properties,
#                 miller_index=hkl, oriented_unit_cell=pmg_slab_structure,
#                 shift=0., scale_factor=None, energy=None)
# 
# Path: mpinterfaces/default_logger.py
# def get_default_logger(name, output_stream=sys.stdout):
#     logger = logging.getLogger(name)
#     logger.setLevel(logging.DEBUG)
#     logger.propagate = False
#     formatter = logging.Formatter('%(levelname)s:%(name)s:%(message)s')
#     sh = logging.StreamHandler(stream=output_stream)
#     sh.setFormatter(formatter)
#     logger.addHandler(sh)
#     return logger


# Path: mpinterfaces/interface.py
from six.moves import range
from pymatgen.core.structure import Structure, Molecule
from pymatgen.core.lattice import Lattice
from pymatgen.core.surface import Slab, SlabGenerator
from pymatgen.core.operations import SymmOp
from pymatgen.util.coord import get_angle
from mpinterfaces.transformations import reduced_supercell_vectors
from mpinterfaces.utils import get_ase_slab
from mpinterfaces.default_logger import get_default_logger
import sys
import math
import copy
import numpy as np
    import os

        to_unit_cell: Pymatgen Slab routine to find unit cell
        coords_are_cartesian: Whether the input coordinates are in
                              cartesian
        from_ase: Whether to create Slab using python-ase for producing
                  slabs that have orthogonal lattice vectors

        NOTE:
        if starting from the bulk structure, create slab
        note: if the starting structure is a slab, the vaccum extension
        is not possible
    """

    def __init__(self, strt, hkl=[1, 1, 1], min_thick=10, min_vac=10,
                 supercell=[1, 1, 1], name=None, adsorb_on_species=None,
                 adatom_on_lig=None, ligand=None, displacement=1.0,
                 surface_coverage=None, scell_nmax=10,
                 coverage_tol=0.25, solvent=None,
                 start_from_slab=False, validate_proximity=False,
                 to_unit_cell=False, coords_are_cartesian=False,
                 primitive=True, from_ase=False,
                 lll_reduce=False, center_slab=True,
                 max_normal_search=None, force_normalize=False,
                 x_shift=0, y_shift=0, rot=[0, 0, 0]):
        self.from_ase = from_ase
        vac_extension = 0
        if ligand is not None:
            vac_extension = ligand.max_dist
        if isinstance(strt, Structure) and not isinstance(strt, Slab):
            self.min_vac = min_vac + vac_extension
            if self.from_ase:

                strt = get_ase_slab(strt,