viperleed.calc.classes.slab.surface_slab.SurfaceSlab
- class viperleed.calc.classes.slab.surface_slab.SurfaceSlab[source]
A class representing a semi-infinite solid.
Contains unit cell, element information and atom coordinates. Also has a variety of convenience functions for manipulating and updating the atoms. Slabs can be created from an ase.Atoms object using the from_ase class method. Another common way is using viperleed.calc.files.poscar.read.
- 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}
- 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:
- linklists
List of lists of atoms which are linked by a symmetry operation
- Type:
list of list of Atom
- displists
List of lists of atoms which are displaced together. This differs from linklists in that while linklists stores the linking based on the current symmetry, the displists store actual displacement linking based on the symmetry set at the time the displacement is assigned.
- Type:
list of list of Atom
- deltas_initialized
Set by Rparams.generateSearchPars
- Type:
bool
- preprocessed
True if the POSCAR that this slab was read from had the ‘Plane group = XY’ comment in the header, indicating that it was processed by viperleed.calc before.
- Type:
bool
- symbaseslab
Slab with the smallest in-plane unit-cell area that shows the full symmetry of the slab.
- Type:
Slab or None
- bulkslab
Slab object containing only bulk layers
- Type:
Slab or None
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.
check_atom_collisions
([eps])Raise if any pairs of Atoms are too close to one another.
check_vacuum_gap
()Complain if there's not enough vacuum or it is not at the top.
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.
detect_bulk
(rpars[, second_cut_min_spacing])Determine the minimal bulk repeat vector from BULK_LIKE_BELOW.
ensure_minimal_bulk_ab_cell
(rpars[, ...])Make sure the bulkslab has the smallest possible in-plane cell.
from_ase
(ase_atoms[, sort_elements])Return a slab initialized from an ase.Atoms object.
from_slab
(other)Return a cls instance with attributes deep-copied from other.
full_update
(rpars)Update atoms and layers from rpars.
getSurfaceAtoms
(rp)Checks which atoms are 'at the surface', returns them as a set.
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.
get_nearest_neighbours
()Return the nearest-neighbour distance for all atoms.
has_atoms_in_multiple_c_cells
()Return whether atoms appear in multiple cells along c.
identify_bulk_repeat
(eps[, epsz])Find a repeat vector for which the bulk matches the slab above.
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.
make_bulk_slab
(rpars[, recenter])Return a copy of this slab with only bulk layers.
make_subcell
(rpars, transform)Return a subcell of this slab.
make_supercell
(transform)Return a copy of the slab replicated according to transform.
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.
restoreOriState
([keepDisp])Resets the atom positions and site vibrational amplitudes to the original state, and stores the deviations as offset instead.
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.
with_extra_bulk_units
(rpars, n_cells)Return a copy with extra bulk unit cells added at the bottom.
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.
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.
thickness
Return the thickness of this slab along z.
top_atom
Return the atom currently at the bottom of this slab.
vacuum_gap
Return the z distance that does not not contain atoms.