structures.structure#

Classes:

Structure(name)

Structure representation which holds various sub_structures.

class udkm1Dsim.structures.structure.Structure(name)[source]#

Bases: object

Structure representation which holds various sub_structures.

Each sub_structure can be either a layer of \(N\) UnitCell or AmorphousLayer instances or a structure by itself. It is possible to recursively build up 1D structures.

Parameters:

name (str) – name of the sample.

Attributes:
  • name (str) – name of sample.

  • sub_structures (list[AmorphousLayer, UnitCell, Structure]) – list of structures in sample.

  • substrate (Structure) – structure of the substrate.

  • num_sub_systems (int) – number of subsystems for heat and phonons (electronic, lattice, spins, …).

Methods:

visualize([unit, fig_size, cmap, linewidth, ...])

Simple visualization of the structure.

get_hash(**kwargs)

Create an unique hash from all layer IDs in the correct order in the structure as well as the corresponding material properties which are given by the kwargs.

add_sub_structure(sub_structure[, N])

Add a sub_structure of \(N\) layers or sub-structures to the structure.

add_substrate(sub_structure)

Add a structure as static substrate to the structure.

get_number_of_sub_structures()

This methods does not return the number of all layers in the structure, see get_number_of_layers().

get_number_of_layers()

Determines the number of all layers in the structure.

get_number_of_unique_layers()

Determines the number of unique layers in the structure.

get_thickness([units])

Determines the thickness of the structure.

get_unique_layers()

The uniqueness is determined by the handle of each layer instance.

get_layer_vectors(*args)

Returns three lists with the numeric index of all layers in a structure given by the get_unique_layers() method and additionally vectors with the ids and Handles of the corresponding layer instances.

get_all_positions_per_unique_layer()

Determines the position indices for each unique layer in the structure.

get_distances_of_layers([units])

Returns a vector of the distance from the surface for each layer starting at 0 (dStart) and starting at the end of the first layer (dEnd) and from the center of each layer (dMid).

get_distances_of_interfaces([units])

Calculates the distances of the interafaces of the structure.

interp_distance_at_interfaces(N[, units])

Interpolates the distances at the layer interfaces by an odd number \(N\).

get_layer_property_vector(property_name)

Returns a vector for a property of all layers in the structure.

get_layer_handle(i)

Returns the handle to a layer at a given position index.

reverse()

Returns a reversed structure also reversing all nested sub_structure.

reverse_sub_structures(structure)

Reverse a Structure and recursively call itself if a sub_structure is a Structure itself.

visualize(unit='nm', fig_size=[20, 1], cmap='Set1', linewidth=0.1, show=True)[source]#

Simple visualization of the structure.

Parameters:
  • unit (str) – SI unit of the distance of the Structure. Defaults to ‘nm’.

  • fig_size (list[float]) – figure size of the visualization plot. Defaults to [20, 1].

  • cmap (str) – Matplotlib colormap for colors of layers.

  • linewidth (float) – line width of the patches.

  • show (boolean) – show visualization plot at the end.

get_hash(**kwargs)[source]#

Create an unique hash from all layer IDs in the correct order in the structure as well as the corresponding material properties which are given by the kwargs.

Parameters:

**kwargs (list[str]) – types of requested properties..

Returns:

hash (str) – unique hash.

add_sub_structure(sub_structure, N=1)[source]#

Add a sub_structure of \(N\) layers or sub-structures to the structure.

Parameters:
  • sub_structure (AmorphousLayer, UnitCell, Structure) – amorphous layer, unit cell, or structure to add as sub-structure.

  • N (int) – number or repetitions.

add_substrate(sub_structure)[source]#

Add a structure as static substrate to the structure.

Parameters:

sub_structure (Structure) – substrate structure.

get_number_of_sub_structures()[source]#

This methods does not return the number of all layers in the structure, see get_number_of_layers().

Returns:

N (int) – number of all sub structures.

get_number_of_layers()[source]#

Determines the number of all layers in the structure.

Returns:

L (int) – number of all layers in the structure.

get_number_of_unique_layers()[source]#

Determines the number of unique layers in the structure.

Returns:

N (int) – number of unique layers in the structure.

get_thickness(units=True)[source]#

Determines the thickness of the structure.

Parameters:

units (boolean, optional) – whether units should be returned or not. Defaults to True.

Returns:

thickness (float, Quantity) – the thickness from surface to bottom of the structure.

get_unique_layers()[source]#

The uniqueness is determined by the handle of each layer instance.

Returns:

(tuple)

  • layer_ids (list[str]) - ids of all unique layers instances in the structure.

  • layer_handles (list[AmorphousLayer, UnitCell, Structure]) - handles of all unique layers instances in the structure.

get_layer_vectors(*args)[source]#

Returns three lists with the numeric index of all layers in a structure given by the get_unique_layers() method and additionally vectors with the ids and Handles of the corresponding layer instances. The list and order of the unique layers can be either handed as an input parameter or is requested at the beginning.

Parameters:

layers (Optional[list]) – list of unique layers including ids and handles

Returns:

(tuple)

  • indices (list[int]) - numeric index of all layers in a structure.

  • layer_ids (list[str]) - ids of all unique layers instances in the structure.

  • layer_handles (list[AmorphousLayer, UnitCell, Structure]) - handles of all unique layers instances in the structure.

get_all_positions_per_unique_layer()[source]#

Determines the position indices for each unique layer in the structure.

Returns:

pos (dict{ndarray[int]}) – position indices for each unique layer in the structure.

get_distances_of_layers(units=True)[source]#

Returns a vector of the distance from the surface for each layer starting at 0 (dStart) and starting at the end of the first layer (dEnd) and from the center of each layer (dMid).

Parameters:

units (boolean, optional) – whether units should be returned or not. Defaults to True.

Returns:

(tuple)

  • d_start (ndarray[float, Quantity]) - distances from the surface of each layer starting at 0.

  • d_end (ndarray[float, Quantity]) - distances from the bottom of each layer.

  • d_mid (ndarray[float, Quantity]): distance from the middle of each layer.

get_distances_of_interfaces(units=True)[source]#

Calculates the distances of the interafaces of the structure.

Parameters:

units (boolean, optional) – whether units should be returned or not. Defaults to True.

Returns:

res (ndarray[float, Quantity]) – distances from the surface of each interface of the structure.

interp_distance_at_interfaces(N, units=True)[source]#

Interpolates the distances at the layer interfaces by an odd number \(N\).

Parameters:
  • N (int) – number of point of interpolation at interface

  • units (boolean, optional) – whether units should be returned or not. Defaults to True.

Returns:

(tuple)

  • dist_interp (ndarray[float, Quantity]) - distance array of the middle of each layer interpolated by an odd number \(N\) at the interfaces

  • original_indicies (ndarray[int]) - indicies of the original distances in the interpolated array

get_layer_property_vector(property_name)[source]#

Returns a vector for a property of all layers in the structure. The property is determined by the propertyName and returns a scalar value or a function handle.

Parameters:

property_name (str) – name of property to return as array

Returns:

prop (ndarray[float, @lambda]) – array of a property for all layers in the structure.

get_layer_handle(i)[source]#

Returns the handle to a layer at a given position index.

Parameters:

i (int) – index of the layer to return.

Returns:

handle (AmorphousLayer, UnitCell) – handle to the layer at position i in the structure.

reverse()[source]#

Returns a reversed structure also reversing all nested sub_structure.

Returns:

reversed (Structure) – reversed structure.

reverse_sub_structures(structure)[source]#

Reverse a Structure and recursively call itself if a sub_structure is a Structure itself.

Parameters:

structure (Structure) – structure to be reversed.

Returns:

structure (Structure) – reversed structure.