schrodinger.graphics3d.torus module

Maestro 3D toruses.

The torus module allows creation and drawing of toruses. Clients draw using Group instances not through Torus instances.

Control over the center, radius, color, resolution and opacity of a torus are provided. See the Torus class for more info.

To draw any number of toruses, create the Torus instance and add it to a Group instance. Then invoke the Group’s draw() method.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.graphics3d.torus.vector_cross(X, Y)

Returns the cross product of the len 3 vectors X and Y

class schrodinger.graphics3d.torus.TorusCore(x0=None, y0=None, z0=None, x1=None, y1=None, z1=None, color=None, r=None, g=None, b=None, radius=None, tube_radius=None, transparency=None, opacity=1.0, resolution_u=5, resolution_v=3)

Bases: schrodinger.graphics3d.common.Primitive

Base class for MaestroTorus.

See doc string for __init__ for details on instantiation.

Toruses should be added to a TorusGroup and drawing done via TorusGroup. See TorusGroup documentation.

__init__(x0=None, y0=None, z0=None, x1=None, y1=None, z1=None, color=None, r=None, g=None, b=None, radius=None, tube_radius=None, transparency=None, opacity=1.0, resolution_u=5, resolution_v=3)

Constructor requires:

x0, y0, z0: coordinate specifying center of torus in Angstroms.

x1, y1, z1: coordinate specifying projected center of torus

in Angstroms.

color: One of:

Color object Color name (string) Tuble of (R, G, B) (each 0.0-1.0)

radius: radius of the torus in Angstroms

tube_radius: radius of the tube of the torus in Angstroms

Optional arguments:

opacity: 0.0 (transparent) through 1.0 (opaque)

Defaults to 1.0

resolution_u: 2 to 30, resolution in the U direction of the surface

Defaults to 5

resolution_v: 2 to 30, resolution in the V direction of the surface

Defaults to 3

groupHidden()

Called when the group of this object is hidden. Hide the Maestro object(s).

groupShown()

Called when the group of this object is shown. Show the Maestro object, if we are being shown.

hide()

Hide the object. It will not be drawn when the group is drawn.

isGroupShown()

Returns True if this object’s group is shown. False otherwise.

isShown()

Returns True if this object shown. False otherwise.

setEntryID(entry_id)

Sets entry ID for Maestro object (necessary to render in tile-by-entry mode.

Parameters

entry_id (str) – Object’s entry ID.

setGlowColor(r, g, b)

Sets glow color for the object.

Parameters
  • r (float) – Red component of glow color [0.0 .. 1.0]

  • g (float) – Green component of glow color [0.0 .. 1.0]

  • b (float) – Blue component of glow color [0.0 .. 1.0]

setIsGlowing(is_glowing)

Enables or disables glow effect for the object.

Parameters

is_glowing (bool) – Whether the object is glowing.

setRightClickOnGObject(pymodule, pyfunc)

Sets the python callback which should be called whenever given graphics object is right clicked.

Parameters
  • pymodule (str) – Python module

  • pyfunc (str) – Python function

show()

Display this object, if it was hidden

class schrodinger.graphics3d.torus.MaestroTorus(x0=None, y0=None, z0=None, x1=None, y1=None, z1=None, color=None, r=None, g=None, b=None, radius=None, tube_radius=None, transparency=None, opacity=1.0, resolution_u=5, resolution_v=3)

Bases: schrodinger.graphics3d.common._MaestroPrimitiveMixin, schrodinger.graphics3d.torus.TorusCore

Class to create a 3D torus in Maestro. This torus will be drawn at the appropriate time in Maestro to interact properly with transparent objects.

Toruses should be added to a Group and drawing done via the Group. See Group documentation.

API Example:

import schrodinger.maestro.maestro as maestro
import schrodinger.graphics3d.common as common
import schrodinger.graphics3d.torus as torus

torus_grp = common.Group()
st = maestro.workspace_get()
for bond in st.bond:
    trs = torus.MaestroTorus(
        x0=bond.atom1.x,
        y0=bond.atom1.y,
        z0=bond.atom1.z,
        x1=bond.atom2.x,
        y1=bond.atom2.y,
        z1=bond.atom2.z,
        radius=0.1,
        tube_radius=0.5,
        resolution_u=7,
        resolution_v=5,
        opacity=0.8,
        color='red'
    )
    # Add the primative to the container.
    torus_grp.add(trs)

# MaestroTorus needs to be drawn.
# No special callback like there is for Toruses is needed.
torus_grp.show()

# Hide the markers.
torus_grp.hide()

# Remove the markers and the callback.
torus_grp.clear()
maestro.workspace_draw_function_remove(torus_grp.draw)
__init__(x0=None, y0=None, z0=None, x1=None, y1=None, z1=None, color=None, r=None, g=None, b=None, radius=None, tube_radius=None, transparency=None, opacity=1.0, resolution_u=5, resolution_v=3)

Constructor requires:

x0, y0, z0: coordinate specifying center of torus in Angstroms.

x1, y1, z1: coordinate specifying projected center of torus

in Angstroms.

color: One of:

Color object Color name (string) Tuble of (R, G, B) (each 0.0-1.0)

radius: radius of the torus in Angstroms

tube_radius: radius of the tube of the torus in Angstroms

Optional arguments:

opacity: 0.0 (transparent) through 1.0 (opaque)

Defaults to 1.0

resolution_u: 2 to 30, resolution in the U direction of the surface

Defaults to 5

resolution_v: 2 to 30, resolution in the V direction of the surface

Defaults to 3

setCoords()
property b
property g
groupHidden()

Called when the group of this object is hidden. Hide the Maestro object(s).

groupShown()

Called when the group of this object is shown. Show the Maestro object, if we are being shown.

hide()

Hide the object. It will not be drawn when the group is drawn.

isGroupShown()

Returns True if this object’s group is shown. False otherwise.

isShown()

Returns True if this object shown. False otherwise.

property material
property opacity
property persistent_name
property pick_category
property pick_id
property r
setColors()
setEntryID(entry_id)

Sets entry ID for Maestro object (necessary to render in tile-by-entry mode.

Parameters

entry_id (str) – Object’s entry ID.

setGlowColor(r, g, b)

Sets glow color for the object.

Parameters
  • r (float) – Red component of glow color [0.0 .. 1.0]

  • g (float) – Green component of glow color [0.0 .. 1.0]

  • b (float) – Blue component of glow color [0.0 .. 1.0]

setIsGlowing(is_glowing)

Enables or disables glow effect for the object.

Parameters

is_glowing (bool) – Whether the object is glowing.

setRGBColors(r, g, b, a=None)
setRightClickOnGObject(pymodule, pyfunc)

Sets the python callback which should be called whenever given graphics object is right clicked.

Parameters
  • pymodule (str) – Python module

  • pyfunc (str) – Python function

show()

Display this object, if it was hidden

property x0

X0 coordinate

property y0

Y0 coordinate

property z0

Z0 coordinate

property x1

X1 coordinate

property y1

Y1 coordinate

property z1

Z1 coordinate

property radius

Torus’s radius

property tube_radius

Torus’s tube_radius