Package schrodinger :: Module surface :: Class Surface
[hide private]
[frames] | no frames]

Class Surface

object --+
         |
        Surface
Known Subclasses:

A Pythonic wrapping for mmsurf surfaces that are not associated with a project entry. (For surfaces that are associated with a project entry, see ProjectSurface below.) Surface objects can be created from an existing mmsurf handle via __init__, can be read from disk via read, or new surfaces can be created via newMolecularSurface.

Nested Classes [hide private]
  Style
Surface representation styles.
  ColorBy
Values for surface color schemes.
  ColorFrom
Values for surface color sources.
  Color
Represent a color as either an integer (colormap index), string (color name), or an RGB value (tuple/list of 3 ints, values 0-255).
Instance Methods [hide private]
 
__init__(self, handle, manage=True)
x.__init__(...) initializes x; see help(type(x)) for signature
 
_initializeMmlibs(self)
Initialize all mmlib libraries used by this class.
 
_terminateMmlibs(self)
Terminate all mmlib libraries used by this class.
 
__del__(self)
When this object is garbage collected, terminate the mmlib libraries and delete the mmsurf handle if it's managed by this object.
 
delete(self)
Immediately delete the mmsurf handle.
 
write(self, filename)
Write this surface to a file.
 
rename(self, value)
Set the surface name.
 
show(self)
Sets the surface to be visible.
 
hide(self)
Hides the surface.
 
setTransparency(self, val)
Set both the front and the back transparency.
 
setColoring(self, coloring)
Set the surface coloring.
ColorBy, Color, numpy.ndarray, or NoneType
coloring(self)
Return the current surface coloring.
 
_updateMaestro(self)
This method is used in ProjectSurface and is present here for compatibility with the _requires_update decorator.
numpy.array
smoothColors(self, colors, iterations)
Given a list of vertex colors, return a list of smoothed colors.
Surface
copy(self)
Create a copy of this surface.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
Surface
newMolecularSurface(cls, struc, name, asl=None, atoms=None, resolution=0.5, probe_radius=None, vdw_scaling=1.0, mol_surf_type=<MolSurfType.molecular: 2>)
Create a new molecular surface for the specified surface
int
_createMolecularSurface(cls, struc, name, asl, atoms, resolution, probe_radius, vdw_scaling, mol_surf_type)
Create a new molecular surface for the specified structure.
Surface
read(cls, filename)
Read surface data from a file.
Static Methods [hide private]
mmbitset.Bitset
_generateBitset(struc, asl, atoms)
Generate a bitself that indicates which atoms to create the surface for.
Class Variables [hide private]
  SURFACE_TYPE_NAME = {<MolSurfType.vdw: 0>: 'van der Waals', <M...
Properties [hide private]
str name
The surface name.
float isovalue
The isovalue for the given surface
str surface_type
A textual description of the type of surface.
bool visible
Whether the surface is currently visible.
int front_transparency
The transparency of the front of the surface (relative to the workspace camera position).
int back_transparency
The transparency of the back of the surface (relative to the workspace camera position).
Style style
The visual style of the surface representation (solid, mesh, or dot).
bool darken_colors_by_cavity_depth
Whether the colors on the surface should be darkened based on the cavity depth.
ColorFrom color_source
The source of the surface colors.
ColorBy color_scheme
The color scheme used to determine surface colors.
Color color
The constant surface color.
float surface_area
The reported surface area of the surface
list vertex_coords
A list of all vertex coordinates
  vertex_count
numpy.ndarray vertex_normals
The normal for each vertex
int patch_count
The number of surface patches (i.e.
numpy.array patch_vertices
A patch_count x 3 array containing vertex indices for each surface patch.
list nearest_atom_indices
A list of the atom indices closest to each vertex coordinate.
numpy.ndarray vertex_colors
An array of manually specified per-vertex colors.
bool has_vertex_colors
Does this surface contain manually specified per-vertex colors?

Inherited from object: __class__

Method Details [hide private]

__init__(self, handle, manage=True)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • handle (int) - An mmsurf handle to an existing surface
  • manage (bool) - If True, the mmsurf handle will be deleted when this object is garbage collected.
Overrides: object.__init__

delete(self)

 

Immediately delete the mmsurf handle. After this method has been called, any further attempts to interact with this object will result in an MmException.

newMolecularSurface(cls, struc, name, asl=None, atoms=None, resolution=0.5, probe_radius=None, vdw_scaling=1.0, mol_surf_type=<MolSurfType.molecular: 2>)
Class Method

 

Create a new molecular surface for the specified surface

Parameters:
  • struc - The structure to create the surface for
  • name (str) - The name of the surface.
  • asl (str or NoneType) - If given, the surface will only be created for atoms in the structure that match the provided ASL. Note that only one of asl and atoms may be given. If neither are given, then the surface will be created for all atoms in the structure.
  • atoms (list or NoneType) - An optional list of atom numbers. If given, the surface will only be created for the specified atoms. Note that only one of asl and atoms may be given. If neither are given, then the surface will be created for all atoms in the structure.
  • resolution (float) - The resolution of the surface, generally between 0 and 1. Smaller numbers lead to a more highly detailed surface.
  • probe_radius (float) - The radius of the rolling sphere used to calculate the surface. Defaults to 1.4 if mol_surf_type is MolSurfType.Molecular or MolSurfType.Extended. May not be given if mol_surf_type is MolSurfType.vdw.
  • vdw_scaling (float) - If given, all atomic radii will be scaled by the provided value before the surface is calculated.
  • mol_surf_type (MolSurfType) - The type of surface to create.
  • proj (schrodinger.structure.Structure)
Returns: Surface
The new surface

_createMolecularSurface(cls, struc, name, asl, atoms, resolution, probe_radius, vdw_scaling, mol_surf_type)
Class Method

 

Create a new molecular surface for the specified structure. Arguments are the same as newMolecularSurface above.

Returns: int
An mmsurf handle for the new surface

_generateBitset(struc, asl, atoms)
Static Method

 

Generate a bitself that indicates which atoms to create the surface for. Note that either asl or atoms (or neither) may be provided, but not both. If neither are provided, the bitset will cover all atoms in structure.

Parameters:
  • struc (schrodinger.structure.Structure) - The structure to generate the bitset for
  • asl (str or NoneType) - If not None, the bitset will contain only atoms that match this ASL.
  • atoms (list or NoneType) - If not None, a list of atom numbers. The bitset will contain only the listed atoms.
Returns: mmbitset.Bitset
The newly generated bitset

read(cls, filename)
Class Method

 

Read surface data from a file.

Parameters:
  • filename (str) - The file to read from.
Returns: Surface
The read surface.

write(self, filename)

 

Write this surface to a file. Note that existing files will be overwritten.

Parameters:
  • filename (str) - The file to write to.

rename(self, value)

 

Set the surface name. This method is provided for compatibility with ProjectSurface.

setTransparency(self, val)

 

Set both the front and the back transparency.

Parameters:
  • val (int) - The value to set the transparency to
Decorators:
  • @_requires_update

setColoring(self, coloring)

 

Set the surface coloring.

Parameters:
  • coloring (ColorBy, Color, list, numpy.ndarray) - The desired surface coloring. Must be one of:
    • A ColorBy value other than ColorBy.SourceColor to color based on the nearest atom
    • A Color value for constant coloring
    • A list or numpy array containing a color for each vertex
Decorators:
  • @_requires_update

coloring(self)

 

Return the current surface coloring. Is only guaranteed to return a non-None value if the surface coloring was set via setColoring. If the surface coloring cannot be determined, will return None.

Returns: ColorBy, Color, numpy.ndarray, or NoneType
The current surface coloring

smoothColors(self, colors, iterations)

 

Given a list of vertex colors, return a list of smoothed colors. Does not modify the surface in any way.

Parameters:
  • colors (list or numpy.array) - A list or numpy array of the colors to smooth, where colors are represented as either RGB or RGBA values. Note that if this value is a numpy array, the input array will be modified in place.
  • iterations (int) - The number of smoothing iterations to carry out.
Returns: numpy.array
The smoothed colors as a numpy array. If colors was a numpy array, the return value will be a reference to the (modified) input array.

copy(self)

 

Create a copy of this surface. Note that this method will always return a Surface object, even when a ProjectSurface object is copied.

Returns: Surface
The copied surface

Class Variable Details [hide private]

SURFACE_TYPE_NAME

Value:
{<MolSurfType.vdw: 0>: 'van der Waals',
 <MolSurfType.extended: 1>: 'extended radius',
 <MolSurfType.molecular: 2>: 'molecular surface'}

Property Details [hide private]

name

The surface name.

Get Method:
unreachable.name(self) - The surface name.
Set Method:
unreachable.name(self, value)
Type:
str

isovalue

The isovalue for the given surface

Get Method:
unreachable.isovalue(self) - The isovalue for the given surface
Set Method:
unreachable.isovalue(self, value)
Type:
float

surface_type

A textual description of the type of surface.

Get Method:
unreachable.surface_type(self) - A textual description of the type of surface.
Set Method:
unreachable.surface_type(self, val)
Type:
str

visible

Whether the surface is currently visible. This setting will be remembered, but it will not have any effect until the surface is added to a project and loaded into Maestro.

Get Method:
unreachable.visible(self) - Whether the surface is currently visible.
Set Method:
unreachable.visible(self, val)
Type:
bool

front_transparency

The transparency of the front of the surface (relative to the workspace camera position). Measured on a scale from 0 (fully opaque) to 100 (fully transparent).

Get Method:
unreachable.front_transparency(self) - The transparency of the front of the surface (relative to the workspace camera position).
Set Method:
unreachable.front_transparency(self, val)
Type:
int

back_transparency

The transparency of the back of the surface (relative to the workspace camera position). Measured on a scale from 0 (fully opaque) to 100 (fully transparent).

Get Method:
unreachable.back_transparency(self) - The transparency of the back of the surface (relative to the workspace camera position).
Set Method:
unreachable.back_transparency(self, val)
Type:
int

style

The visual style of the surface representation (solid, mesh, or dot).

Get Method:
unreachable.style(self) - The visual style of the surface representation (solid, mesh, or dot).
Set Method:
unreachable.style(self, val)
Type:
Style

darken_colors_by_cavity_depth

Whether the colors on the surface should be darkened based on the cavity depth.

Get Method:
unreachable.darken_colors_by_cavity_depth(self) - Whether the colors on the surface should be darkened based on the cavity depth.
Set Method:
unreachable.darken_colors_by_cavity_depth(self, val)
Type:
bool

color_source

The source of the surface colors. Note that coloring()/setColoring() are recommended over directly manipulating color_source, as this will ensure that color_source is set correctly.

Get Method:
unreachable.color_source(self) - The source of the surface colors.
Set Method:
unreachable.color_source(self, val)
Type:
ColorFrom

color_scheme

The color scheme used to determine surface colors. This value may be ignored unless color_source is set to ColorFrom.NearestAslAtom. Note that coloring()/setColoring() are recommended over directly manipulating color_scheme, as this will ensure that color_source is set correctly.

Get Method:
unreachable.color_scheme(self) - The color scheme used to determine surface colors.
Set Method:
unreachable.color_scheme(self, val)
Type:
ColorBy

color

The constant surface color. This value may be ignored unless color_source is set to ColorFrom.Surface and color_scheme is set to ColorBy.SourceColor. Note that coloring()/setColoring() are recommended over directly manipulating color, as this will ensure that color_source and color_scheme are set correctly.

Get Method:
unreachable.color(self) - The constant surface color.
Set Method:
unreachable.color(self, val)
Type:
Color

surface_area

The reported surface area of the surface

Get Method:
unreachable.surface_area(self) - The reported surface area of the surface
Type:
float

vertex_coords

A list of all vertex coordinates

Get Method:
unreachable.vertex_coords(self) - A list of all vertex coordinates
Type:
list

vertex_count

Get Method:
unreachable.vertex_count(self)

vertex_normals

The normal for each vertex

Get Method:
unreachable.vertex_normals(self) - The normal for each vertex
Type:
numpy.ndarray

patch_count

The number of surface patches (i.e. triangles connecting three adjacent vertices).

Get Method:
unreachable.patch_count(self) - The number of surface patches (i.e.
Type:
int

patch_vertices

A patch_count x 3 array containing vertex indices for each surface patch.

Get Method:
unreachable.patch_vertices(self) - A patch_count x 3 array containing vertex indices for each surface patch.
Type:
numpy.array

nearest_atom_indices

A list of the atom indices closest to each vertex coordinate. Atom indices are listed in a corresponding order to vertex_coords.

Get Method:
unreachable.nearest_atom_indices(self) - A list of the atom indices closest to each vertex coordinate.
Type:
list

vertex_colors

An array of manually specified per-vertex colors.

Get Method:
unreachable.vertex_colors(self) - An array of manually specified per-vertex colors.
Set Method:
unreachable.vertex_colors(self, val)
Type:
numpy.ndarray

has_vertex_colors

Does this surface contain manually specified per-vertex colors?

Get Method:
unreachable.has_vertex_colors(self) - Does this surface contain manually specified per-vertex colors?
Type:
bool