ase_notebook.draw_utils module

Implementation agnostics visualisation functions.

ase_notebook.draw_utils.compute_bonds(atoms, atom_radii, scale_radii=1.5)[source]

Compute bonds for atoms.

ase_notebook.draw_utils.compute_projection(element_group, wsize, rotation, whitespace=1.3)[source]

Compute the center and scale of the projection.

ase_notebook.draw_utils.filter_bond_indices(bonds, to_keep: List[bool])[source]

Filter bonds by required indices.

ase_notebook.draw_utils.get_cell_coordinates(cell, origin=(0.0, 0.0, 0.0), show_repeats=None, dash_pattern=None)[source]

Get start and end points of lines segments used to draw unit cells.

We also add an origin option, to allow for different cells to be created.

ase_notebook.draw_utils.get_miller_coordinates(cell, miller)[source]

Compute the points at which a miller index intercepts with a unit cell boundary.

ase_notebook.draw_utils.get_rotation_matrix(rotations, init_rotation=None)[source]

Convert string of format ‘50x,-10y,120z’ to a rotation matrix.

Note that the order of rotation matters, i.e. ‘50x,40z’ is different from ‘40z,50x’.

ase_notebook.draw_utils.initialise_element_groups(atoms, atom_radii, show_unit_cell=True, uc_dash_pattern=None, show_bonds=False, bond_radii_scale=1.5, bond_array_name=None, bond_pairs_filter=None, bond_supercell=(1, 1, 1), miller_planes=None, miller_planes_as_lines=False)[source]

Compute (untransformed) coordinates, for elements in the visualisation.

Parameters
  • atoms (ase.Atoms) –

  • atom_radii (list or None) – mapping of atom index to atomic radii

  • show_unit_cell (bool) – show the unit cell

  • uc_dash_pattern (tuple or None) – split unit cell lines into dash pattern (line_length, gap_length)

  • show_bonds (bool) – show the atomic bonds

  • bond_radii_scale (float) – Factor to scale atomic radii by, when computing bonds (via overlapping radii)

  • bond_array_name (str) – The name of a boolean array on the Atoms, specifying which atoms that bonds should be drawn for (if None, then all bonds are drawn).

  • bond_pairs_filter (list) – A list of bond element pairs to filter by, e.g. [(“Fe”, “O”), (“Fe”, “Fe”)]

  • bond_supercell (tuple) – the supercell of unit cell used for computing bonds

  • miller_planes (list[dict] or None) – list of miller planes to project onto the unit cell

  • miller_planes_as_lines (bool) – whether to create miller planes as a group of lines or a solid plane

Returns

  • elements (dict)

  • all_coordinates (numpy.array)

ase_notebook.draw_utils.triangle_normal(a, b, c)[source]

Compute the normal of three points.