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

Class Surface

object --+
         |
        Surface

A Pythonic wrapping for mmsurf surfaces retrieved from a project. Surface objects are typically accessed via the schrodinger.project.ProjectRow.surface SurfaceDict object or created via schrodinger.project.ProjectRow.newMolecularSurface.

Nested Classes [hide private]
  Style
Surface representation styles.
  ColorBy
Values for surface color schemes.
  ColorFrom
Values for surface color sources.
  Color
Mmvol colors.
Instance Methods [hide private]
 
__init__(self, proj_handle, eid, name)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__del__(self)
 
_checkHandle(self)
Make sure that our mmsurf handle is still valid.
 
delete(self)
Delete this surface.
 
rename(self, new_name, overwrite=True)
Rename this surface
 
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, or NoneType
coloring(self)
Return the current surface coloring.
 
_updateMaestro(self)
Tell Maestro to update the workspace surface representation.

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

Class Methods [hide private]
Surface
newMolecularSurface(cls, proj, row, name, asl=None, atoms=None, resolution=0.5, probe_radius=None, vdw_scaling=1.0, mol_surf_type=<MolSurfType.molecular: 2>, overwrite=True)
Create a new molecular surface for the specified project row
Static Methods [hide private]
 
_checkName(proj, row, name)
Make sure that no surface of the specified name exists.
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]
int _handle
The mmsurf handle for this surface.
str name
The name of the 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
list nearest_atom_indexes
A list of the atom indices closest to each vertex coordinate.

Inherited from object: __class__

Method Details [hide private]

__init__(self, proj_handle, eid, name)
(Constructor)

 

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

Parameters:
  • proj_handle (int) - The project handle
  • eid (str) - The entry ID of the entry containing the surface
  • name (str) - The name of the surface
Overrides: object.__init__

Note: This method does not confirm that the specified surface exists. (This check is done in SurfaceDict.__getitem__.) Attempting to get or set values on a non-existent surface will lead to a RuntimeError.

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

 

Create a new molecular surface for the specified project row

Parameters:
  • proj (schrodinger.project.Project) - The project that this surface will be part of
  • row (schrodinger.project.ProjectRow) - The project row that this surface will belong to. This is the structure that the surface will be created around.
  • name (str) - The name of the surface. Note that project rows require all surfaces to be named uniquely. See overwrite.
  • 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.
  • overwrite (bool) - What to do if the new surface has the same name as an existing surface for this project row. If True, the existing surface will be overwritten. In False, a ValueError will be raised.
Returns: Surface
The new surface

_checkName(proj, row, name)
Static Method

 

Make sure that no surface of the specified name exists. Raise a ValueError if one does.

Parameters:

_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

_checkHandle(self)

 

Make sure that our mmsurf handle is still valid. Raise a RuntimeError if it isn't.

delete(self)

 

Delete this surface. After the surface is deleted, any further attempt to interact with this object will result in a RuntimeError.

Decorators:
  • @_requires_update

rename(self, new_name, overwrite=True)

 

Rename this surface

Parameters:
  • new_name (str) - The new surface name
  • overwrite (bool) - What to do if the new name is the same as an existing surface for this project row. If True, the existing surface will be overwritten. In False, a ValueError will be raised.

show(self)

 

Sets the surface to be visible. Note that this does not guarantee that the appropriate entry is included in the workspace.

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 or Color) - 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
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, or NoneType
The current surface coloring

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]

_handle

The mmsurf handle for this surface. Note that mmproj may change the mmsurf handle whenever the entry leaves the workspace, so we fetch the mmsurf handle using the surface name. This ensures that we're not using a stale handle.

Get Method:
unreachable._handle(self) - The mmsurf handle for this surface.
Type:
int

name

The name of the surface. Note that all surfaces for a given project entry have unique names.

Get Method:
unreachable.name(self) - The name of the surface.
Type:
str

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. Note that this does not guarantee that the appropriate entry is included in the workspace.

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

nearest_atom_indexes

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_indexes(self) - A list of the atom indices closest to each vertex coordinate.
Type:
list