viperleed.calc.classes.slab.base_slab.BaseSlab

class viperleed.calc.classes.slab.base_slab.BaseSlab[source]

An abstract base class representing a solid.

Contains unit cell, element information and atom coordinates. Also has a variety of convenience functions for manipulating and updating the atoms.

ucell

The unit cell as vectors a, b, c (columns)

Type:

np.array

poscar_scaling

The original scaling factor from POSCAR

Type:

float

elements

Element labels as read from POSCAR

Type:

tuple of str

chemelem

Chemical elements in the slab, including from ELEMENT_MIX

Type:

set of str

n_per_elem

The number of atoms per POSCAR element.

Type:

dict {str: int}

atlist

List of all atoms in the slab.

Type:

AtomList

layers

Each layer is a composite of sublayers, as in TensErLEED

Type:

tuple of Layer

sublayers

Each SubLayer contains atoms of equal element and Z coordinate

Type:

tuple of SubLayer

sitelist

List of distinct sites as Sitetype, storing information on vibration and concentration

Type:

list of Sitetype

ucell_mod

Stored modifications made to the unit cell; each is a tuple of (type, array), where type is ‘lmul’, ‘rmul’, ‘add’, or ‘c_shift’.

Type:

list of tuples (str, numpy.ndarray)

topat_ori_z

Stores the original position of the topmost atom in Cartesian coordinates

Type:

float

celltype

Unit-cell shape as string. Values: ‘oblique’, ‘rhombic’, ‘rectangular’, ‘square’, ‘hexagonal’

Type:

str # TODO: would be nicer with an Enum

planegroup

Symmetry group of the slab. May be reduced by the user relative to foundplanegroup.

Type:

str

foundplanegroup

Highest symmetry found. Doesn’t get modified when user reduces symmetry manually.

Type:

str

orisymplane

Only stored if the planegroup is ambiguous as to which unit vector the symmetry plane at the origin is parallel to

Type:

SymPlane

linklists

List of lists of atoms which are linked by a symmetry operation

Type:

list of list of Atom

__init__()[source]

Initialize instance.

Methods

__init__()

Initialize instance.

apply_matrix_transformation(trafo_matrix)

Apply an orthogonal transformation to the unit cell and all atoms.

apply_scaling(*scaling)

Rescale the unit-cell vectors.

check_a_b_in_plane()

Raise InvalidUnitCellError if a, b have out-of-plane components.

clear_symmetry_and_ucell_history()

Set all symmetry information back to default values.

collapse_cartesian_coordinates([update_origin])

Ensure all atoms are inside the unit cell.

collapse_fractional_coordinates([releps])

Ensure all atoms are inside the unit cell.

create_layers(rpars[, bulk_cuts])

Create a list of Layer objects based on rpars.

create_sublayers([eps])

Assign the atoms in the slab to sublayers.

from_slab(other)

Return a cls instance with attributes deep-copied from other.

full_update(rpars)

Update atoms and layers from rpars.

get_bulk_repeat(rpars[, only_z_distance])

Return the bulk repeat vector (with positive z).

get_minimal_ab_cell(eps[, epsz, warn_convention])

Check if there is a 2D unit cell smaller than the current one.

initSites(rp)

Goes through the atom list and supplies them with appropriate SiteType objects, based on the SITE_DEF parameters from the supplied Rparams.

is_equivalent(other[, eps])

Return whether this slab is equivalent to another.

is_mirror_symmetric(symplane, eps[, glide])

Return if this slab is unchanged when applying a 2D mirror/glide.

is_rotation_symmetric(axis, order, eps)

Return if this slab is unchanged when applying a 2D rotation.

is_translation_symmetric(translation, eps[, ...])

Return if this slab is unchanged when translated.

mirror_atoms(symplane[, glide])

Apply a mirror or glide transform across symplane.

project_c_to_z()

Make the c vector of the unit cell perpendicular to the surface.

remove_duplicate_atoms([eps, epsz, other_slab])

Remove atoms with same positions and chemical element.

remove_vacuum_at_bottom(rpars)

Move all atoms along c to remove any vacuum at the bottom.

revert_unit_cell([restore_to])

Revert unit-cell and coordinate modifications.

rotate_atoms(order[, axis])

Apply an order-fold 2D rotation around axis.

rotate_unit_cell(order[, append_ucell_mod])

Rotate the unit cell around the origin.

sort_by_element()

Sort slab.atlist by element, preserving the element order.

sort_by_z([bottom_to_top])

Sort slab.atlist by z coordinate.

sort_original()

Sort slab.atlist by original atom order from POSCAR.

transform_unit_cell_2d(transform[, ...])

Apply a 2D-transformation matrix to the unit cell.

translate_atoms_2d(shift)

Add a 2D Cartesian shift to all atomic coordinates.

translate_atoms_c(c_fraction)

Move all atoms up by c_fraction along the c vector.

update_atom_numbers()

Assign new incremental numbers to atoms in the slab.

update_cartesian_from_fractional([update_origin])

Assign absolute Cartesian coordinates to all atoms.

update_element_count()

Update the number of atoms per element.

update_fractional_from_cartesian()

Calculate atoms' fractional coordinates from Cartesian ones.

update_layer_coordinates()

Update the Cartesian position of all layers.

Attributes

ab_cell

Return the 2D portion of the unit cell.

angle_between_ucell_and_coord_sys

Return angle between first unit-cell vector and coordinate system.

bottom_atom

Return the atom currently at the bottom of this slab.

bulk_atoms

Return atoms in this Slab that belong to its bulk.

bulk_layers

Return the layers of self that are bulk.

c_vector

Return the out-of-plane unit-cell vector.

elements

Return a tuple of elements in this slab, as originally read.

fewest_atoms_sublayer

Return the sublayer with fewest atoms.

interlayer_gaps

Return the z distances between pairs of adjacent layers.

is_bulk

Return whether this is a bulk slab.

n_atoms

Return the number of atoms in this slab.

n_layers

Return the number of composite layers of this slab.

n_sublayers

Return the number of sublayers in this slab.

non_bulk_layers

Return a tuple of the non-bulk layers in this slab.

smallest_interlayer_gap

Return the smallest z gap between two adjacent layers.

top_atom

Return the atom currently at the bottom of this slab.