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

Class Surface

object --+
         |
        Surface

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
Mmvol colors.
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.
 
name(self, value)
 
rename(self, value)
Set the surface name.
 
surface_type(self, val)
 
visible(self, val)
 
show(self)
Sets the surface to be visible.
 
hide(self)
Hides the surface.
 
front_transparency(self, val)
 
back_transparency(self, val)
 
setTransparency(self, val)
Set both the front and the back transparency.
 
style(self, val)
 
darken_colors_by_cavity_depth(self, val)
 
color_source(self, val)
 
color_scheme(self, val)
 
color(self, val)
 
setColoring(self, coloring)
Set the surface coloring.
ColorBy, Color, numpy.ndarray, or NoneType
coloring(self)
Return the current surface coloring.
 
surface_area(self)
The reported surface area of the surface
 
vertex_coords(self)
A list of all vertex coordinates
 
vertex_count(self)
 
vertex_normals(self)
The normal for each vertex
 
patch_count(self)
The number of surface patches (i.e.
 
patch_vertices(self)
A patch_count x 3 array containing vertex indices for each surface patch.
 
nearest_atom_indices(self)
A list of the atom indices closest to each vertex coordinate.
 
_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.
 
vertex_colors(self, val)
 
has_vertex_colors(self)
Does this surface contain manually specified per-vertex 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)
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: "van der Waals", MolSurf...
Properties [hide private]

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)
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.

name(self, value)

 
Decorators:
  • @name.setter

rename(self, value)

 

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

surface_type(self, val)

 
Decorators:
  • @surface_type.setter

visible(self, val)

 
Decorators:
  • @visible.setter
  • @_requires_update

front_transparency(self, val)

 
Decorators:
  • @front_transparency.setter
  • @_requires_update

back_transparency(self, val)

 
Decorators:
  • @back_transparency.setter
  • @_requires_update

setTransparency(self, val)

 

Set both the front and the back transparency.

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

style(self, val)

 
Decorators:
  • @style.setter
  • @_requires_update

darken_colors_by_cavity_depth(self, val)

 
Decorators:
  • @darken_colors_by_cavity_depth.setter
  • @_requires_update

color_source(self, val)

 
Decorators:
  • @color_source.setter
  • @_requires_update

color_scheme(self, val)

 
Decorators:
  • @color_scheme.setter
  • @_requires_update

color(self, val)

 
Decorators:
  • @color.setter
  • @_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

surface_area(self)

 

The reported surface area of the surface

Decorators:
  • @property

vertex_coords(self)

 

A list of all vertex coordinates

Decorators:
  • @property

vertex_count(self)

 
Decorators:
  • @property

vertex_normals(self)

 

The normal for each vertex

Decorators:
  • @property

patch_count(self)

 

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

Decorators:
  • @property

patch_vertices(self)

 

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

Decorators:
  • @property

nearest_atom_indices(self)

 

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

Decorators:
  • @property

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.

vertex_colors(self, val)

 
Decorators:
  • @vertex_colors.setter
  • @_requires_update

has_vertex_colors(self)

 

Does this surface contain manually specified per-vertex colors?

Decorators:
  • @property

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: "van der Waals", MolSurfType.extended: "extended rad\
ius", MolSurfType.molecular: "molecular surface"}