pymatgen.analysis.interface module¶
This module provides classes to store, generate, and manipulate material interfaces.
-
class
Interface
(lattice, species, coords, sub_plane, film_plane, sub_init_cell, film_init_cell, modified_sub_structure, modified_film_structure, strained_sub_structure, strained_film_structure, validate_proximity=False, coords_are_cartesian=False, init_inplane_shift=None, charge=None, site_properties=None, to_unit_cell=False)[source]¶ Bases:
pymatgen.core.structure.Structure
This class stores data for defining an interface between two structures. It is a subclass of pymatgen.core.structure.Structure.
Makes an interface structure, a Structure object with additional information and methods pertaining to interfaces.
- Parameters
lattice (Lattice/3x3 array) – The lattice, either as a
pymatgen.core.lattice.Lattice
or simply as any 2D array. Each row should correspond to a lattice vector. E.g., [[10,0,0], [20,10,0], [0,0,30]] specifies a lattice with lattice vectors [10,0,0], [20,10,0] and [0,0,30].species ([Species]) –
Sequence of species on each site. Can take in flexible input, including: i. A sequence of element / species specified either as string
symbols, e.g. [“Li”, “Fe2+”, “P”, …] or atomic numbers, e.g., (3, 56, …) or actual Element or Species objects.
List of dict of elements/species and occupancies, e.g., [{“Fe” : 0.5, “Mn”:0.5}, …]. This allows the setup of disordered structures.
coords (Nx3 array) – list of fractional/cartesian coordinates of each species.
sub_plane (list) – Substrate plane in the form of a list of integers (based on the sub_init_cell), e.g.: [1, 2, 3].
film_plane (list) – Film plane in the form of a list of integers (based on the film_init_cell), e.g. [1, 2, 3].
sub_init_cell (Structure) – initial bulk substrate structure
film_init_cell (Structure) – initial bulk film structure
site_properties (dict) – Properties associated with the sites as a dict of sequences. The sequences have to be the same length as the atomic species and fractional_coords. For an interface, you should have the ‘interface_label’ properties to classify the sites as ‘substrate’ and ‘film’.
modified_sub_structure (Slab) – substrate supercell slab.
modified_film_structure (Slab) – film supercell slab.
strained_sub_structure (Slab) – strained substrate supercell slab
strained_film_structure (Slab) – strained film supercell slab
validate_proximity (bool) – Whether to check if there are sites that are less than 0.01 Ang apart. Defaults to False.
coords_are_cartesian (bool) – Set to True if you are providing coordinates in cartesian coordinates. Defaults to False.
init_inplane_shift (length-2 list of float, in Cartesian coordinates) – The initial shift of the film relative to the substrate in the plane of the interface.
charge (float, optional) – overal charge of the structure
-
property
ab_shift
¶ The 2D component of offset_vector along the interface plane in fractional coordinates. I.e. if ab_shift = [a, b], the Cartesian coordinate shift in the interface plane is a * (first lattice vector) + b * (second lattice vector).
-
change_z_shift
(dz)[source]¶ Adjust the spacing between the substrate and film layers by dz Angstroms
- Parameters
dz (float) – shift perpendicular to the plane (in Angstroms)
-
copy
(site_properties=None)[source]¶ Convenience method to get a copy of the structure, with options to add site properties.
- Returns
A copy of the Interface.
-
property
film
¶ Return the film (Structure) of the interface.
-
property
film_sites
¶ Return the film sites of the interface.
-
get_sorted_structure
(key=None, reverse=False)[source]¶ Get a sorted copy of the structure. The parameters have the same meaning as in list.sort. By default, sites are sorted by the electronegativity of the species.
- Parameters
key – Specifies a function of one argument that is used to extract a comparison key from each list element: key=str.lower. The default value is None (compare the elements directly).
reverse (bool) – If set to True, then the list elements are sorted as if each comparison were reversed.
-
property
offset_vector
¶ Displacement of the origin of the film structure relative to that of the substrate structure in Cartesian coordinates.
-
shift_film
(delta)[source]¶ Shift the film’s position relative to the substrate.
- Parameters
delta (length-3 list of float or numpy array) – Cartesian coordinate vector by which to shift the film. After this operation self.offset_vector -> self.offset_vector + delta.
-
shift_film_along_surface_lattice
(da, db)[source]¶ Given two floats da and db, adjust the shift vector by da * (first lattice vector) + db * (second lattice vector). This shift is in the plane of the interface. I.e. da and db are fractional coordinates.
- Parameters
da (float) – shift in the first lattice vector
db (float) – shift in the second lattice vector
-
property
substrate
¶ Return the substrate (Structure) of the interface.
-
property
substrate_sites
¶ Return the substrate sites of the interface.
-
property
vacuum_thickness
¶ Vacuum buffer above the film.
-
property
z_shift
¶ The 1D component of offset_vector along the interface plane in fractional coordinates. I.e. if z_shift = z, the distance between the substrate and film planes is z.
-
class
InterfaceBuilder
(substrate_structure, film_structure)[source]¶ Bases:
object
This class constructs the epitaxially matched interfaces between two crystalline slabs
- Parameters
-
static
apply_transformation
(structure, matrix)[source]¶ Make a supercell of structure using matrix
- Parameters
structure (Slab) – Slab to make supercell of
matrix (3x3 np.ndarray) – supercell matrix
- Returns
(Slab) The supercell of structure
-
apply_transformations
(match)[source]¶ Using ZSL match, transform all of the film_structures by the ZSL supercell transformation.
- Parameters
match (dict) – ZSL match returned by ZSLGenerator.__call__
-
generate_interfaces
(film_millers=None, substrate_millers=None, film_layers=3, substrate_layers=3, **kwargs)[source]¶ Generate a list of Interface (Structure) objects and store them to self.interfaces.
- Parameters
film_millers (list of [int]) – list of film surfaces
substrate_millers (list of [int]) – list of substrate surfaces
film_layers (int) – number of layers of film to include in Interface structures.
substrate_layers (int) – number of layers of substrate to include in Interface structures.
-
get_oriented_slabs
(film_layers=3, substrate_layers=3, match_index=0, **kwargs)[source]¶ Get a list of oriented slabs for constructing interfaces and put them in self.film_structures, self.substrate_structures, self.modified_film_structures, and self.modified_substrate_structures. Currently only uses first match (lowest SA) in the list of matches
- Parameters
film_layers (int) – number of layers of film to include in Interface structures.
substrate_layers (int) – number of layers of substrate to include in Interface structures.
match_index (int) – ZSL match from which to construct slabs.
-
get_summary_dict
()[source]¶ Return dictionary with information about the InterfaceBuilder, with currently generated structures included.
-
make_interface
(slab_substrate, slab_film, offset=None)[source]¶ Strain a film to fit a substrate and generate an interface.
-
visualize_interface
(interface_index=0, show_atoms=False, n_uc=2)[source]¶ Plot the film-substrate superlattice match, the film superlattice, and the substrate superlattice in three separate plots and show them.
- Parameters
interface_index (int, 0) – Choice of interface to plot
show_atoms (bool, False) – Whether to plot atomic sites
n_uc (int, 2) – Number of 2D unit cells of the interface in each direction. (The unit cell of the interface is the supercell of th substrate that matches a supercel of the film.)
-
align_x
(slab, orthogonal_basis=[[1, 0, 0], [0, 1, 0], [0, 0, 1]])[source]¶ Align the a lattice vector of slab with the x axis. Optionally specify an orthogonal_basis to align according to a different set of axes
- Parameters
slab (Slab) – input structure
basis (orthogonal) – If specified, align with orthogonal_basis[0] rather than [1,0,0]
- Returns
The slab, which has been aligned with the specified axis in place.
-
get_ortho_axes
(structure)[source]¶ Get an orthonormal set of axes for the structure with the first axis pointing along the a lattice vector.
- Parameters
structure (Structure) –
- Returns
3x3 numpy matrix with the axes
-
get_shear_reduced_slab
(slab)[source]¶ Reduce the vectors of the slab plane according to the algorithm in substrate_analyzer, then make a new Slab with a Lattice with those reduced vectors.
- Parameters
slab (Slab) – Slab to reduce
- Returns
Slab object of identical structure to the input slab but rduced in-plane lattice vectors
-
merge_slabs
(substrate, film, slab_offset, x_offset, y_offset, vacuum=20, **kwargs)[source]¶ Given substrate and film supercells (oriented to match as closely as possible), strain the film to match the substrate lattice and combine the slabs.
- Parameters
slab_offset – spacing between the substrate and film
y_offset (x_offset) – in-plane displacement of the film in Cartesian coordinates
vacuum – vacuum buffer above the film
- Returns
- A structure with the strained film and substrate
combined into one structure
- Return type
combined_structure (Slab)
-
strain_slabs
(sub_slab, film_slab)[source]¶ Strain the film_slab to match the sub_slab, orient the structures to match each other, and return the new matching structures.
-
third_vect
(a, b)[source]¶ Get a unit vector proportional to cross(a, b).
- Parameters
a (numpy arrays) – 3D vectors.
b (numpy arrays) – 3D vectors.
- Returns
unit vector proportional to cross(a, b).
-
transf_mat
(A, B)[source]¶ Get the matrix to transform from the set of axes A to the set of axes B.
- Parameters
A (3x3 numpy array) – original axis basis
B (3x3 numpy array) – new axis basis
- Returns
3x3 numpy array transformation between the bases
-
visualize_interface
(interface, show_atoms=False, n_uc=2)[source]¶ Plot the match of the substrate and film superlattices.
- Parameters
interface (Interface) – Interface object
show_atoms (bool, False) – Whether to plot atomic sites
n_uc (int, 2) – Number of 2D unit cells of the interface in each direction. (The unit cell of the interface is the supercell of th substrate that matches a supercel of the film.)
-
visualize_superlattice
(struct, modified_struct, film=True, show_atoms=False, n_uc=2)[source]¶ Visualize the unit cell-supercell match for either the film or substrate (specified by film boolean tag).
- Parameters
struct (Slab) – unit cell slab
modified_struct (Slab) – supercell slab
film (bool, True) – True=label plot as film, False=label plot as substrate
show_atoms (bool, False) – Whether to plot atomic sites
n_uc (int, 2) – Number of 2D unit cells of the interface in each direction. (The unit cell of the interface is the supercell of th substrate that matches a supercel of the film.)