molsurf: Compute molecular surfaces

class MolecularSurface(session, enclose_atoms, show_atoms, probe_radius, grid_spacing, resolution, level, name, color, visible_patches, sharp_boundaries)

Bases: chimerax.core.models.Model

A molecular surface computed from a set of atoms. This can be a solvent excluded surface which is the boundary of the region where a sphere of radius probe_radius cannot reach. Or it can be a contour surface of a density map created by placing Gaussian shapes at the center of each atom position where the resolution parameter controls the width of the Gaussian. Part of a surface can be undisplayed, leaving only the patch associated with show_atoms Atoms.


session : Session

The session the surface model will belong to

enclose_atoms : Atoms

Surface bounds these atoms.

show_atoms : Atoms

Show only the portion of the surface near these atoms.

probe_radius : float

The probe sphere radius for a solvent excluded surface.

grid_spacing : float

Spacing of 3-dimensional grid used in surface calculations. Typical value os 0.5 Angstroms. Finer values give smoother surfaces but take more memory and longer computation times.

resolution : float

Used only for Gaussian surfaces, specifies a nominal density map resolution. See the molmap() for details.

level : float or None

Threshold level for Gaussian surfaces. The density map used to compute these surface uses Gaussian heights equal to atomic number so the level is in atomic number units. If None is specified then the level chosen is the minimum density at the atom positions.

name : string

Surface name.

color : numpy uint8 length 4 array

RGBA color for surface.

visible_patches : int or None

Number of connected surface components to show. Only the largest area N components will be shown. For value None all components are shown.

sharp_boundaries : bool

Whether to subdivide triangles composing the surface so that triangle edges lie exactly between atoms. This creates less jagged edges when showing or coloring patches of surfaces for a subset of atoms.


Number of atoms for calculating the surface. Read only.


Recalculate the surface if parameters have been changed.


Hide the surface patch near these Atoms.

new_parameters(show_atoms, probe_radius=None, grid_spacing=None, resolution=None, level=None, visible_patches=None, sharp_boundaries=None, color=None, transparency=None)

Change the surface parameters. Parameter definitions are the same as for the contructor.

show(atoms, only=False)

Show the surface patch near these Atoms in addition to any already shown surface patch.


Returns a numpy array of integer values with length equal to the number of surface vertices and value is the atom index for the atom closest to each vertex. Can return None if atoms are not associated with vertices. Supplying vertices argument computes new vertex to atom map.

remove_solvent_ligands_ions(atoms, keep=None)

Remove solvent, ligands and ions unless that removes all atoms in which case don’t remove any.