# pymatgen.analysis.interfaces.zsl module

This module implements the Zur and McGill lattice matching algorithm

class ZSLGenerator(max_area_ratio_tol=0.09, max_area=400, max_length_tol=0.03, max_angle_tol=0.01, bidirectional=False)

  Bases: `monty.json.MSONable`

  This class generate matching interface super lattices based on the methodology of lattice vector matching for heterostructural interfaces proposed by Zur and McGill: Journal of Applied Physics 55 (1984), 378 ; doi: 10.1063/1.333084 The process of generating all possible matching super lattices is: 1.) Reduce the surface lattice vectors and calculate area for the surfaces 2.) Generate all super lattice transformations within a maximum allowed area

  > limit that give nearly equal area super-lattices for the two surfaces - generate_sl_transformation_sets

  3.) For each superlattice set:

    1.) Reduce super lattice vectors 2.) Check length and angle between film and substrate super lattice

    > vectors to determine if the super lattices are the nearly same and therefore coincident - get_equiv_transformations

  Intialize a Zur Super Lattice Generator for a specific film and

    substrate

  Parameters

    - max_area_ratio_tol (float) – Max tolerance on ratio of super-lattices to consider equal

    - max_area (float) – max super lattice area to generate in search

    - max_length_tol – maximum length tolerance in checking if two vectors are of nearly the same length

    - max_angle_tol – maximum angle tolerance in checking of two sets of vectors have nearly the same angle between them

  generate_sl_transformation_sets(film_area, substrate_area)

    Generates transformation sets for film/substrate pair given the area of the unit cell area for the film and substrate. The transformation sets map the film and substrate unit cells to super lattices with a maximum area :param film_area: the unit cell area for the film :type film_area: int :param substrate_area: the unit cell area for the substrate :type substrate_area: int

    Returns

      a set of transformation_sets defined as:

        1.) the transformation matricies for the film to create a super lattice of area i*film area 2.) the tranformation matricies for the substrate to create a super lattice of area j*film area

    Return type

      transformation_sets

  get_equiv_transformations(transformation_sets, film_vectors, substrate_vectors)

    Applies the transformation_sets to the film and substrate vectors to generate super-lattices and checks if they matches. Returns all matching vectors sets. :param transformation_sets: an array of transformation sets:

    > each transformation set is an array with the (i,j) indicating the area multipes of the film and subtrate it corresponds to, an array with all possible transformations for the film area multiple i and another array for the substrate area multiple j.

    Parameters

      - film_vectors (array) – film vectors to generate super lattices

      - substrate_vectors (array) – substrate vectors to generate super lattices

  is_same_vectors(vec_set1, vec_set2)

    Determine if two sets of vectors are the same within length and angle tolerances :param vec_set1: an array of two vectors :type vec_set1: array[array] :param vec_set2: second array of two vectors :type vec_set2: array[array]

class ZSLMatch(film_sl_vectors: List, substrate_sl_vectors: List, film_vectors: List, substrate_vectors: List, film_transformation: List, substrate_transformation: List)

  Bases: `monty.json.MSONable`

  A match from the Zur and McGill Algorithm. The super_lattice vectors are listed as _sl_vectors. These are reduced according to the algorithm in the paper which effectively a rotation in 3D space. Use the match_transformation property to get the appropriate transformation matrix

  film_sl_vectors: List
  film_transformation: List
  film_vectors: List
  property match_area

    The area of the match between the substrate and film super lattice vectors

  property match_transformation

    The tranformation matrix to conver the film super lattice vectors to the substrate

  substrate_sl_vectors: List
  substrate_transformation: List
  substrate_vectors: List

fast_norm(a)

  Much faster variant of numpy linalg norm

gen_sl_transform_matricies(area_multiple)

  Generates the transformation matricies that convert a set of 2D vectors into a super lattice of integer area multiple as proven in Cassels:

  Cassels, John William Scott. An introduction to the geometry of numbers. Springer Science & Business Media, 2012.

  Parameters

    - area_multiple (int) – integer multiple of unit cell area for super

    - area (lattice) –

  Returns

    transformation matricies to covert unit vectors to super lattice vectors

  Return type

    matrix_list

get_factors(n)

  Generate all factors of n

reduce_vectors(a, b)

  Generate independent and unique basis vectors based on the methodology of Zur and McGill

rel_angle(vec_set1, vec_set2)

  Calculate the relative angle between two vector sets

  Parameters

    - vec_set1 (array[array]) – an array of two vectors

    - vec_set2 (array[array]) – second array of two vectors

rel_strain(vec1, vec2)

  Calculate relative strain between two vectors

vec_angle(a, b)

  Calculate angle between two vectors

vec_area(a, b)

  Area of lattice plane defined by two vectors