schrodinger.ui.qt.structure2d module

2D structures drawing

schrodinger.ui.qt.structure2d.get_qpicture_protected(renderer, chmmol, gen_coord=True)

Generate a QPicture for the given molecule. If the picture couldn’t be generated (e.g. the molecule is too large), then a QPicture will contain the failure message text.

Parameters
  • renderer (Chm2DRenderer intance) – The renderer to use for generating the QPicture

  • chmmol (ChmMol instance.) – Structure to generate the picture for.

  • gen_coord (bool) – if True (default) generate new coordinates; if False, use existing 2D coordinates.

Return type

QPicture

Returns

The generated picture.

schrodinger.ui.qt.structure2d.generate_qimage_from_chmmol(chmmol, width, height, renderer=None, bg_color=None, max_scale=None, gen_coord=True)

“Generate a 2D image in QImage format of a ChmMol molecule.”

Parameters
  • chmmol (ChmMol instance.) – Structure to generate the picture for.

  • width (int) – width in pixels of the generated QImage.

  • height (int) – height in pixels of the generated QImage.

  • renderer (Chm2DRenderer intance or None) – The renderer to use for generating the QImage. If None, a new renderer will be created.

  • bg_color (PyQt5.QtGui.QColor or None) – background color filling the image around the scaled molecule.

  • max_scale (float or None) – maximum scaling of the structure image.

  • gen_coord (bool) – if True (default) generate new coordinates; if False, use existing 2D coordinates.

Return type

QImage

Returns

The generated QImage.

schrodinger.ui.qt.structure2d.generate_qimage_from_structure(st, width, height, renderer=None, bg_color=None, max_scale=None, stereo_mode=StereoType.StereoFromAnnotationAndGeometry_Safe, gen_coord=True)

Generate a 2D image in QImage format of a schrodinger.structure.Structure. An intermediate ChmMol will be generated with stereochemstry deduced according to the stereo_mode parameter.

Parameters
  • st (Structure instance.) – Structure to generate the picture for.

  • width (int) – width in pixels of the generated QImage.

  • height (int) – height in pixels of the generated QImage.

  • renderer (Chm2DRenderer intance or None) – The renderer to use for generating the QImage.

  • bg_color (PyQt5.QtGui.QColor or None) – background color filling the image around the scaled molecule.

  • max_scale (float or None) – maximum scaling of the structure image.

  • stereo_mode (schrodinger.infra._canvas2d.ChmMmctAdaptor.StereoType) – stereo source for internal transformation to ChmMol.

  • gen_coord (bool) – if True generate coordinates for chmmol.

Return type

QImage

Returns

The generated QImage.

schrodinger.ui.qt.structure2d.get_qpicture_highlight(renderer, chmmol, atoms, bonds, color, gen_coord=False)

Generate a QPicture for the given molecule and highlight given atoms and bonds. If the picture couldn’t be generated (e.g. the molecule is too large), then a QPicture will contain the failure message text.

Parameters
  • renderer (Chm2DRenderer intance) – The renderer to use for generating the QPicture

  • chmmol (ChmMol instance.) – Structure to generate the picture for.

  • atoms (list) – list of atoms that should be highlighted

  • bonds (list) – list of bonds that should be highlighted

  • color (QtGui.QColor) – color that is used to highlight atoms and bonds

  • gen_coord (bool) – if True generate coordinates.

Return type

QPicture

Returns

The generated picture.

schrodinger.ui.qt.structure2d.get_chmmol_bonds_from_atoms(chmmol, atoms)

This function returns a list of bonds that connect atoms in a given list.

Parameters
  • chmmol (canvas2d.ChmMol) – molecule structure

  • atoms (list) – list of atom indices

schrodinger.ui.qt.structure2d.get_aligned_pictures(sts, renderer=None, atomTyping=11, core_color=None)

Calculate the maximum common substructure (MCS) between the given ligands, and generate 2D images, aligned by the core. If no MCS was detected, the images will be unaligned.

NOTE: This function becomes exponentioally slow with larger number of structures. Recommened maximum around 30 structures.

Parameters
  • sts (Iterable of structure.Structure objects) – Structures to average

  • renderer (Chm2DRenderer intance) – The renderer to use for generating the QPicture (optional)

  • atomTyping (int) – Atom typing scheme to use. Default is 11. For list of available schemes, see $SCHRODINGER/utilities/canvasMCS -h

  • highlight_color – Optional Color to highlight the common substructure.

Return type

List of QPicture objects.

Returns

QPictures for the aligned 2D images.

schrodinger.ui.qt.structure2d.get_ligand(st)

Return a substructure that can be rendered in a 2D image (the first ligand in st, unless it’s also has too many atoms).

Parameters

st (structure.Structure) – the structure

Returns

the ligand structure or None if the structure has too many atoms

Return type

structure.Structure or None

class schrodinger.ui.qt.structure2d.StructurePicture(parent=None, layout=None, height=200, width=200, background='white', annotators=None)

Bases: PyQt6.QtWidgets.QLabel

This is the label that normally stores the picture of the molecule. It can also store a text message.

We make sure that this stays the same size, no matter what data (if any) is stored in it.

__init__(parent=None, layout=None, height=200, width=200, background='white', annotators=None)
Parameters
  • parent (QWidget) – the widget that owns this widget

  • layout (QLayout) – The layout that this widget should be placed in

  • height (int) – the height of this label in pixels

  • width (int) – the width of this label in pixels

  • annotators (list) – Each item of the list should be a canvas2d.ChemViewAnnotator object that will be applied to the canvas2d.ChmRender2DModel when generating the image

sizeHint(self) QSize
drawStructure(structure, StereoType=StereoType.StereoFromAnnotationAndGeometry_Safe, hydrogenTreatment=H.H_ExplicitOnly, wantProperties=True, wantMMStereoProps=True, readAtomBondProperties=True, allowRadicals=False)

Makes a 2-D rendering of the structure

Parameters
  • structure (schrodinger.structure.Structure class object) – structure to be drawn on the canvas

  • StereoType (canvas2d.ChmMmctAdaptor.StereoType) – Stereochemistry option to use. Available options: # Does not include stereochemistry info: canvas2d.ChmMmctAdaptor.NoStereo # Ignores mmstereo annotations: canvas2d.ChmMmctAdaptor.StereoFromGeometry # Silently ignores stereo information that Canvas doesn’t agree with: canvas2d.ChmMmctAdaptor.StereoFromGeometry_Safe # Ignores 3d geometry: canvas2d.ChmMmctAdaptor.StereoFromAnnotation # Silently ignores stereo information that Canvas doesn’t agree with: canvas2d.ChmMmctAdaptor.StereoFromAnnotation_Safe # Uses mmstereo annotaions with 3D geometry as a backup: canvas2d.ChmMmctAdaptor.StereoFromAnnotationAndGeometry # Silently ignores stereo information that Canvas doesn’t agree with: canvas2d.ChmMmctAdaptor.StereoFromAnnotationAndGeometry_Safe

  • hydrogenTreatment (canvas2d.ChmAtomOption.H) – Hydrogen treatment method. Available options: canvas2d.ChmAtomOption.H_Never canvas2d.ChmAtomOption.H_ExplicitOnly canvas2d.ChmAtomOption.H_Polar canvas2d.ChmAtomOption.H_ExplicitPolar canvas2d.ChmAtomOption.H_Chiral canvas2d.ChmAtomOption.H_ExplicitChiral canvas2d.ChmAtomOption.H_ExplicitPolarAndChiral canvas2d.ChmAtomOption.H_All

  • wantProperties (bool) – Whether properties should be copied.

  • wantMMStereoProps (bool) – Whether to copy mmstereo properties.

  • readAtomBondProperties (bool) – Whether to copy atom and bond-level properties.

  • allowRadicals (bool) – Whether to assume that valence deficiencies represent unpaired electrons.

drawChmmol(chmmol, atoms=[], bonds=[], color=<PyQt6.QtGui.QColor object>, gen_coord=False)

Makes a 2-D rendering of the chmmol object with optional atoms and bonds highlighting.

Parameters
  • chmmol (ChmMol instance.) – Structure to generate the picture for.

  • atoms (list) – list of atoms that should be highlighted

  • bonds (list) – list of bonds that should be highlighted

  • color (QtGui.QColor) – color that is used to highlight atoms and bonds

  • gen_coord (bool) – if True generate coordinates.

drawRDMol(mol)

Draws the given RDKit molecule.

Parameters

mol (Chem.rdchem.Mol) – structure to be drawn

setAnnotators(annotators)

This function allows to reset annotators between renderning 2-D structures.

Parameters

annotators (list) – Each item of the list should be a canvas2d.ChemViewAnnotator object that will be applied to the canvas2d.ChmRender2DModel when generating the image

class schrodinger.ui.qt.structure2d.StructureToolTip(structure=None, offset=(10, 10), global_position=None, height=200, width=200, **kwargs)

Bases: schrodinger.ui.qt.structure2d.StructurePicture

A tooltip that shows a chemical structure

__init__(structure=None, offset=(10, 10), global_position=None, height=200, width=200, **kwargs)
Parameters
  • structure (structure object that canvas2d.ChmMmctAdaptor.create() accepts.) – the structure to draw in the cell. This can be given at instantiation time if the structure will always be the same, or it can be given a show time if the structure will change dynamically.

  • offset (tuple(int, int)) – x and y pixel offset from the mouse pointer position to draw the upper left corner of the tooltip window

  • global_position (tuple(int, int)) – global position relative to the screen to to draw the upper left corner of the tooltip window. This parameter overrides the offset parameter.

  • height (int) – the height of this tooltip in pixels

  • width (int) – the width of this tooltip in pixels

This class is designed to be created once and shown/hidden as often as needed. However, there seems to be an issue with PyQt that eventually (in an unreproducible fashion) the tooltip window may simply showing up. It will claim to be visible with self.isVisible() and return the full window size using self.visibleRegion(), but it won’t be visible. Therefore it is probably best to create a new instance each time. Instances of this class are lightweight, quick to create, and garbage collect without any apparent memory leaks.

protein_present_image = None
paintEvent(event)

Reimplmented the paint event to draw text on top of the image, using the value of self.top_left_text

setOffset(offset)

Sets the x and y offset in pixels of the tooltip from the mouse pointer

Parameters

offset (tuple(int, int)) – x and y pixel offset from the mouse pointer position to draw the upper left corner of the tooltip window

setGlobalPosition(global_position)

Sets the x and y global position relative to the screen at which to draw the top left corner of the tooltip window.

Parameters

global_position (tuple(int, int)) – global position relative to the screen to draw the upper left corner of the tooltip window. This parameter overrides the offset parameter.

show(structure=None, pic=None, top_left_text=None)

Show the tooltip

Parameters

structure (structure object that canvas2d.ChmMmctAdaptor.create() accepts.) – the structure to draw in the cell. This can be given at instantiation time if the structure will always be the same, or it can be given a show time if the structure will change dynamically.

finish()

Hide ourselves. This slot should be connected to a signal that is emitted when the parent widget receives a leaveEvent, or called directly from the widget’s leaveEvent routine.

Don’t destroy ourselves here even if we are being used in one-time use mode, because bus errors can result if we are created/destroyed in too short a timeframe - as can happen with tooltips.

class schrodinger.ui.qt.structure2d.LabeledStructureToolTip(structure=None, offset=(2, 16), global_position=None, height=200, width=200, **kwargs)

Bases: PyQt6.QtWidgets.QFrame

Class that creates a tooltip with a 2d structure picture. An arbitrary number of labels can be added that will be displayed beneath the picture.

__init__(structure=None, offset=(2, 16), global_position=None, height=200, width=200, **kwargs)
Parameters
  • structure (structure.Structure, Chem.rdchem.Mol, or canvas2d.ChmMol) – the structure to draw in the cell. This can be given at instantiation time if the structure will always be the same, or it can be given a show time if the structure will change dynamically.

  • offset (tuple of 2 ints) – x and y pixel offset from the mouse pointer position to draw the upper left corner of the tooltip window

  • global_position (tuple of 2 ints) – global position relative to the screen to to draw the upper left corner of the tooltip window. This parameter overrides the offset parameter.

  • height (int) – the height of this tooltip in pixels

  • width (int) – the width of this tooltip in pixels

draw2DPicture(structure)

Draws 2D picture of the structure.

Parameters

structure (structure.Structure, Chem.rdchem.Mol, or canvas2d.ChmMol) – Structure to draw

setGlobalPosition(global_position)

Sets the x and y global position relative to the screen at which to draw the top left corner of the tooltip window.

Parameters

global_position (tuple(int, int)) – global position relative to the screen to draw the upper left corner of the tooltip window. This parameter overrides the offset parameter.

show(structure=None)

Show the tooltip

Parameters

structure (structure.Structure, Chem.rdchem.Mol, or canvas2d.ChmMol) – the structure to draw in the cell. This can be given at instantiation time if the structure will always be the same, or it can be given a show time if the structure will change dynamically.

addLabel(text)

Add a label containing the specified text underneath the structure picture.

Parameters

text (str) – Text to be included in the label

class schrodinger.ui.qt.structure2d.structure_scene

Bases: PyQt6.QtWidgets.QGraphicsScene

Scene which holds the structure_view object

class schrodinger.ui.qt.structure2d.structure_view(scene)

Bases: PyQt6.QtWidgets.QGraphicsView

View which holds a structure_item object

atom_clicked

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

bond_clicked

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

__init__(scene)
wheelEvent(self, event: QWheelEvent)
resizeEvent(self, event: QResizeEvent)
class schrodinger.ui.qt.structure2d.structure_item(rect=None)

Bases: PyQt6.QtWidgets.QGraphicsItem

__init__(rect=None)
Parameters

rect (QRectF) – Size of the rect of the bounding box.

boundingRect(self) QRectF
clear()

Clear picture from item.

generate_picture(gen_coord=True)

Generates a QPicture of the structure. This should be called after setting the structure and the accompaning annotators.

Parameters

gen_coord (bool) – if True generate coordinates.

paint(painter, option, widget=0)

Overrides the paint function to draw the picture that has already been generated. This should never be called manually.

set_colormap(colormap)

Sets the colormap for the atom and bond coloring. Otherwise, the coloring used will be that coming from the ct and/or chmmol.

set_structure(struct, StereoType=StereoType.StereoFromAnnotationAndGeometry_Safe, hydrogenTreatment=H.H_ExplicitOnly, wantProperties=True, wantMMStereoProps=True, readAtomBondProperties=True, allowRadicals=False)

Set the structure to the given Structure object.

Parameters
  • struct (schrodinger.structure.Structure class object) – structure to be drawn on the canvas

  • StereoType (ChmMmctAdaptor.StereoType) – Stereochemistry option to use. Avialable options: # Does not include stereochemistry info: canvas2d.ChmMmctAdaptor.NoStereo # Ignores mmstereo annotations: canvas2d.ChmMmctAdaptor.StereoFromGeometry # Silently ignores stereo information that Canvas doesn’t agree with: canvas2d.ChmMmctAdaptor.StereoFromGeometry_Safe # Ignores 3d geometry: canvas2d.ChmMmctAdaptor.StereoFromAnnotation # Silently ignores stereo information that Canvas doesn’t agree with: canvas2d.ChmMmctAdaptor.StereoFromAnnotation_Safe # Uses mmstereo annotaions with 3D geometry as a backup: canvas2d.ChmMmctAdaptor.StereoFromAnnotationAndGeometry # Silently ignores stereo information that Canvas doesn’t agree with: canvas2d.ChmMmctAdaptor.StereoFromAnnotationAndGeometry_Safe

  • hydrogenTreatment (canvas2d.ChmAtomOption.H) – Hydrogen treatment method. canvas2d.ChmAtomOption.H_Never canvas2d.ChmAtomOption.H_ExplicitOnly canvas2d.ChmAtomOption.H_Polar canvas2d.ChmAtomOption.H_ExplicitPolar canvas2d.ChmAtomOption.H_Chiral canvas2d.ChmAtomOption.H_ExplicitChiral canvas2d.ChmAtomOption.H_ExplicitPolarAndChiral canvas2d.ChmAtomOption.H_All

  • wantProperties (bool) – Whether properties should be copied.

  • wantMMStereoProps (bool) – Whether to copy mmstereo properties.

  • readAtomBondProperties (bool) – Whether to copy atom and bond-level properties.

  • allowRadicals (bool) – Whether to assume that valence deficiencies represent unpaired electrons.

set_rect(rect)
Parameters

rect (QRect) – size of bounding box

set_text(text, alignment=None)

Sets text in the view. This is useful if you display text in place of a structure, in places where no structure is available.

Parameters
  • text (string) – text to be displayed

  • alignment (Qt.AlignmentFlags) – alignment flags of text, defaults to QtCore.Qt.AlignVCenter|QtCore.Qt.AlignCenter

add_annotator(annotator)

Adds annotator to stack. The order that these functions get added is the order that they will be applied to the picture.

Parameters

annotator (schrodinger.infra.canvas2d.ChemViewAnnotator) – Annotator which draws on top an image

add_annotator_function_return(function)

Add functions that need to get returned after the structure is rendered on the screen. An example of this would be a function that returns drawmol coordinates.

clear_annotators()

Clears all annotators

mousePressEvent(event)

Emit a signal if the user left-clicked on an atom or a bond

getBondAtLocation(pos)

Return the bond at the specified coordinates

Parameters

pos (PyQt5.QtCore.QPoint) – The specified coordinates

Returns

If there is a bond at the specified coordinates, return a list of the chmmol atom indices for the two bound atoms. (Note that the chmmol atom indices are zero-indexed, so you should add one to each index if you want the schrodinger.structure.Structure atom indices). If there is no bond at the specified coordinates, return an empty list.

Return type

list

class schrodinger.ui.qt.structure2d.ColoredArrowAnnotator(mol, bond_info=None, draw_arrowhead=True)

Bases: schrodinger.infra._canvas2d.ChemViewAnnotator

This annotator allows you to add colored arrows to bonds in 2d renderings.

This is a slightly less terrible port from C++. Most of the logic still keeps C++-style syntax, simply because rewriting it is not worth the effort. The interface is now more pythonic, at least.

__init__(mol, bond_info=None, draw_arrowhead=True)
Parameters
  • mol – is a chmmol

  • bond_info – is a list containing individual lists of: (atom1, atom2, outlined, QColor)

These lists are composed of:

  • atom1 is a ct-atom index

  • atom2 is a ct-atom index

  • outlined (0/1) is whether you want the arrow to have a black outline

  • qc is a qcolor for the bond

add_bond_arrow(atom1, atom2, outlined, qc)

atom1 is a ct-atom index atom2 is a ct-atom index outlined (0/1) is whether you want the arrow to have a black outline qc is the qcolor of the bond

clear_bond_arrows()

Clear all bond markers in this annotator

annotate(view, dm)

This function annotates the specified arrows.

class schrodinger.ui.qt.structure2d.CgCoreAnnotator(bond_info, colors, atoms, atomColors, mol)

Bases: schrodinger.ui.qt.structure2d.ColoredArrowAnnotator

This is the original ColoredArrowAnnotator class name. When that class had the format of its input changed, it became incompatible with the original class.

This class will remain to preserve backwards compatability.

__init__(bond_info, colors, atoms, atomColors, mol)

bond_info is a list of size 3N, (atom1 idx, a2 idx, outline) colors is a list of size 3N (R, G, B) atoms/atomColors are deprecated mol is a chmmol

class schrodinger.ui.qt.structure2d.BaseSquareAnnotator

Bases: schrodinger.infra._canvas2d.ChemViewAnnotator

Base class for annotators that draw a square around atoms

annotate(view, dm)

Add this sphere to the list of things in the picture

Parameters
  • view (Chemview) – the View this item goes in

  • dm (ChmDrawMol) – object that contains the list of atom and bond graphics

class schrodinger.ui.qt.structure2d.RedSquareAnnotator(atom=None, size=100, color=GlobalColor.red)

Bases: schrodinger.ui.qt.structure2d.BaseSquareAnnotator

Create a square around the specified atom.

__init__(atom=None, size=100, color=GlobalColor.red)

Instantiate a RedSquareAnnotator instance.

Parameters
  • atom (int) – the atom number to which square applies. Note that this expects the first atom to be atom 1, not 0.

  • size (float) – the size of one side of the square in pixels.

  • color (QColor) – the color used to draw annotator. Default is red.

setAtom(atom, color=None)

Set the atom number to which the square applies

Parameters
  • atom (int) – the atom number to which square applies. Note that this expects the first atom to be atom 1, not 0. If 0 is passed in, no atom will be annotated.

  • color (QColor) – the color used to draw annotator. If not given, the previously set color for this annotator will be used.

clearAtom()

Remove the current atom so no atoms are annotated

getAtom()

Return the atom index current annotated

Return type

int or None

Returns

The index (1-based) of the atom annotated, or None if no atoms are annotated

setColor(color)

Set the color of the square

Parameters

color (QColor) – the color used to draw annotator.

class schrodinger.ui.qt.structure2d.MultiSquareAnnotator(atom_dict, size=100)

Bases: schrodinger.ui.qt.structure2d.BaseSquareAnnotator

Create a square around each specified atom.

__init__(atom_dict, size=100)

Instantiate a MultiSquareAnnotator instance.

Parameters
  • atom_dict (dict) – A dictionary of {atom number: QColor} specifying the appropriate color for each atom

  • size (float) – The size of one side of the square in pixels. Defaults to 100 pixels.

class schrodinger.ui.qt.structure2d.AtomNumberAnnotator

Bases: schrodinger.infra._canvas2d.ChemViewAnnotator

Show the atom number of each atom rather than a vertex or atomic symbol

annotate(view, dm)

Add atom number to each atom

Parameters
  • view (Chemview) – the View this item goes in

  • dm (ChmDrawMol) – object that contains the list of atom and bond graphics

class schrodinger.ui.qt.structure2d.AtomLabelAnnotator(atom_labels)

Bases: schrodinger.infra._canvas2d.ChemViewAnnotator

Changes the label displayed for an atom. The label can have subscripts.

__init__(atom_labels)

Instantiate a AtomLabelAnnotator instance.

Parameters

atom_labels (dict) – A dictionary of {atom number: label} specifying the label for each atom to be custom labeled. Each label may either be a string or a (str, str) tuple. In the latter case, the first string is the main label and the second string is the subscript. Note the atom numbers used here should be 1-based (first atom number = 1)

annotate(view, drawmol)

Add a label to each atom specified in the atom_labels property

Parameters
  • view (Chemview) – the View this item goes in

  • drawmol (ChmDrawMol) – object that contains the list of atom and bond graphics

class schrodinger.ui.qt.structure2d.CircleAnnotator(atom=None, radius=75.0, color=GlobalColor.green, gradient=False, fill=False, width=4)

Bases: schrodinger.infra._canvas2d.ChemViewAnnotator

Creates a circle behind one or more atoms.

__init__(atom=None, radius=75.0, color=GlobalColor.green, gradient=False, fill=False, width=4)

Instantiate a ColorCircleAnnotator instance.

Parameters
  • atom (int) – the atom number to which radius applies. Note that this expects the first atom to be atom 1, not 0.

  • radius (float) – the radius of the sphere in pixels. Default is 75.

  • color (QColor) – The color of the circle fill

  • gradient (bool) – If True, the circle is filled with a gradient that goes from white at the center to the defined color. gradient is exclusive with fill.

  • fill (bool) – If True, the circle is given a constant fill. fill is exclusive with gradient.

  • width (int) – The width of the pen if fill and gradient are both False. Default is 4.

addAtom(atom_num, radius=None, color=None)

Add another sphere to this annotator

Parameters
  • atom_num (int) – the atom number to which radius applies. Note that this expects the first atom to be atom 1, not 0.

  • radius (float) – the radius of the sphere in pixels. If not given, the radius given at the time of instance creation is used.

  • color (QColor) – The color of the circle fill. If not given, the color given at the time of instance creation is used.

removeAtom(atom_num)

Remove an atom from the annotator

Parameters

atom_num (int) – the atom number to which radius applies. Note that this expects the first atom to be atom 1, not 0.

clearAtoms()

Remove all atoms from the annotator

setColor(color, reset_colors=False)

Set the default color for this annotator

Parameters
  • color (QColor) – The color of the circle fill.

  • reset_colors (bool) – If True, all existing circles will have their color reset to this value

setRadius(radius, reset_radii=False)

Set the default radius for this annotator

Parameters
  • radius (float) – The radius of the circle

  • reset_radii (bool) – If True, all existing circles will have their radius reset to this value

annotate(view, dm)

Add this sphere to the list of things in the picture

Parameters
  • view (Chemview) – the View this item goes in

  • dm (ChmDrawMol) – object that contains the list of atom and bond graphics