Simulation Domains

Overview

hoobas.SimulationDomain.Domain Class to manage the simulation domain managed by the Builder class.
hoobas.SimulationDomain.Lattice provides a class for building lattices of hoobas.Composite.CompositeObject.
hoobas.SimulationDomain.EmptyBox Creates an empty domain.

Details

class hoobas.SimulationDomain.Domain(units=None)[source]

Class to manage the simulation domain managed by the Builder class. Handles box coordinates. This should not be called directly but inherited

Args:
units (Units.SimulationUnits): units used for dimensions
Attributes:
table: stores a list of tuples (position, CompositeObject)
add_random_positions(composite, number=0, size=None)[source]

Adds composite objects at random positions inside the volume

Parameters:
  • composite (Composite.CompositeObject) – object to add inside the volume
  • number (int) – number of objects to add
  • size (float or None) – excluded volume of the appended object. None avoids calculation of excluded volumes
Returns:

None

change_units(new_units)[source]

changes the unit system

Parameters:new_units (Units.SimulationUnits) – units to change this object to
Returns:None
direct_lattice_vectors

returns crystal lattice vectors as a tuple :return: crystal vectors :rtype: tuple(np.ndarray)

static parse_input_lattice(lattice)[source]

try to parse the supplied lattice, which can be a constant for cubic lattices, three numbers for orthorhombic or nine for other symmetries

Parameters:lattice (np.ndarray, float, list[float] or list[list[float]]) – lattice to parse
Returns:parsed lattice
Return type:np.ndarray
class hoobas.SimulationDomain.EmptyBox(system_size, units=None)[source]

Creates an empty domain. The system_size used defines symmetry. A single values defines a cube, a 1x3 iterable defines an orthorhombic box while a 3x3 iterable defines a triclinic symmetry.

Args:
system_size (float, 1x3 iterable, 3x3 iterable): defines the box dimensions
class hoobas.SimulationDomain.EmptyCube(size, units=None)[source]

Creates an empty cube

Args:
size: cube side length
class hoobas.SimulationDomain.EmptyHexagonalPrism(a, c, units=None)[source]

Creates an empty hexagonal prism, aligned along z

Args:
a: length of the hexagon side c: height of the prism
class hoobas.SimulationDomain.Lattice(lattice, units=None)[source]

provides a class for building lattices of hoobas.Composite.CompositeObject. Class provides methods to add particles inside the unit cell by use of an offset, a rotation method and a cut method

Args:
lattice (float, 1 x 3 iterable, 3 x 3 iterable): crystal unit cell
add_layer(hkl, composite, displacement=None)[source]

Adds a 2D composite object laying on a crystal plane

Parameters:
  • hkl (list[int]) – miller indices of the plane
  • composite (Layers.Multilayer) – 2D object to add
  • displacement (float) – fractional distance between the origin and the plane
Returns:

None

add_line(hkl, composite, displacement=None)[source]

Adds a 1D composite object laying on a crystal direction

Parameters:
  • hkl (list[int]) – crystal direction
  • composite (Layers.LineLayer) – 1D object to add
  • displacement (list[float]) – displacement to apply on the line object
Returns:

None

add_particles_on_lattice(fractional_coordinates, composite, wrap=True, size=None)[source]

Adds particles at given lattice points. Objects will be built in every unit cell

Parameters:
  • fractional_coordinates (list(float)) – iterable describing the fractional crystal coordinates of the object to add
  • composite (Composite.CompositeObject) – object to add in every unit cell given by the coordinates
  • wrap (bool) – whether fractional coordinates are wrapped into the first unit cell
  • size (float or None) – excluded volume size if other objects are added
Returns:

None

change_units(new_units)[source]

changes the unit system

Parameters:new_units (Units.SimulationUnits) – units to change this object to
Returns:None
cut_to_dimensions(bounds)[source]

rotates the crystal system so that the surface plane face supplied faces the Z direction. The lattice is cut to match the integer dimensions supplied in bounds.

Parameters:bounds (list[int]) – bounds of the cell
Returns:none
static d_hkl(lattice, hkl)[source]

Calculates the distance between planes

Parameters:
  • lattice (np.ndarray) – crystal lattice
  • hkl (list[int]) – miller indices defining the plane
Returns:

distance

Return type:

float

generate_crystal_slab(hkl, inplane_basis, bounds, make_at=None)[source]

rotates the crystal system so that the surface plane face supplied faces the Z direction. The new crystal axes are generally trigonal in nature and the crystallinity in Z is not guaranteed unless the rotated axes point along Z. Decomposition in XY plane is made along plane_vectors which are defined as integer sums of b1, b2, b3.

Parameters:
  • hkl (list[int]) – surface plane to expose, note that this is reduced so that hlk=[0,0,2] is equivalent to hkl=[0,0,1]
  • inplane_basis (list[list[int]]) – lattice vectors to use as basis in XY plane. For (111), a good choice is (101) and (110)
  • bounds (list[int]) – lattice size in terms of inplane_basis + dhkl
  • make_at (int or list[float] or None) – Specify where to cut the plane, either lattice point, arbitrary point or origin
Returns:

None

static normal_to(lattice, hkl)[source]

Calculates the normal vector to a crystal plane

Parameters:
  • lattice (np.ndarray) – crystal lattice
  • hkl (list[int]) – miller indices defining the plane
Returns:

normal vector

Return type:

np.ndarray