ase_notebook.backend.gui module

A module for visualising structures.

The module subclasses ase (v3.18.0) classes, to add additional functionality.

class ase_notebook.backend.gui.AtomGui(config, images=None, element_colors=None)[source]

Bases: ase.gui.gui.GUI

A subclass of the ase GUI, but with additional functionality.

draw(status=True)[source]

Draw all required objects on the canvas.

This is overridden from View, in order to:

  • set bond colors, specific to the atom types at each end of the bond.

  • add a cross to ‘ghost’ atoms (specified by an array on the atoms)

  • add a dash pattern to the unit cell lines

  • allow miller index planes to be drawn

move(event)[source]

Handle move event.

release(event)[source]

Handle release event.

set_atoms(atoms)[source]

Set the atoms, unit cell(s) and bonds to draw.

This is overridden from View, in order to

  • set bond colors, specific to the atom types at each end of the bond.

  • use a modified get_cell_coordinates function, which returns cartesian coordinates, rather than fractional (since they were just converted to cartesian anyway) and can create multiple cells (for each repeat)

  • compute miller index planes, by points that intercept with the unit cell

showing_millers()[source]

Return whether to display planes.

class ase_notebook.backend.gui.AtomImages(atoms_list, element_radii=None, radii_scale=0.89)[source]

Bases: ase.gui.images.Images

A subclass of the ase Images, but with additional functionality, for setting radii.

ase_notebook.backend.gui.draw_arc(lbound, diameter, canvas, color, selected, start, extent)[source]

Draw an arc element.

ase_notebook.backend.gui.draw_arrow(canvas, coords, width, scale)[source]

Draw an arrow element.

ase_notebook.backend.gui.draw_axes(canvas, axes, window_size, *, length=15, line_color='black', line_width=1, font_size=14)[source]

Draw the axes element.

ase_notebook.backend.gui.draw_circle(lbound, diameter, canvas, color, selected, tags=(), stroke_width=1)[source]

Draw a circle element, given a lower bound and diameter.

ase_notebook.backend.gui.draw_elements(element_groups, canvas, celldisp, vector_arrays, scale, element_colors, ghost_cross_out=False, movecolor=None, background_color='#ffffff')[source]

Draw elements on a tkinter.Canvas.

Parameters
  • element_groups (ase_notebook.draw_elements.DrawGroup) –

  • canvas (tkinter.Canvas) –

  • celldisp (numpy.array) – cell displacement

  • vector_arrays (list) –

  • scale (float) – canvas scale (used for drawing vector arrows)

  • element_colors (dict) – mapping of element colors (used for partial occupancies)

  • ghost_cross_out (bool) – whether to cross out ghost atoms

  • movecolor (str or None) – color for moving atom

  • background_color (str or None) – color used for coloring partial atom occupancies