schrodinger.project.surface module

Pythonic wrappings for mmsurf surfaces retrieved from a project

class schrodinger.project.surface.ProjectSurface(proj_handle, eid, name, proj_row)

Bases: schrodinger.surface.Surface

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

__init__(proj_handle, eid, name, proj_row)
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

Note

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

delete()

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

setColoring(coloring)

Set the 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

property name

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

rename(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.

classmethod newMolecularSurface(proj, row, name, asl=None, atoms=None, resolution=0.5, probe_radius=None, vdw_scaling=1.0, mol_surf_type=MolSurfType.molecular, overwrite=True)

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

The new surface

Return type

ProjectSurface

classmethod addSurfaceToProject(surf, proj, row, overwrite=True, copy=False)

Add an existing Surface object to a project. Note that, by default, this method will invalidate the input Surface object, as the mmsurf handle will be managed by the project.

Parameters
  • surf (Surface) – The surface to add.

  • proj (schrodinger.project.Project) – The project to add the surface to.

  • row (schrodinger.project.ProjectRow) – The project row to add the surface to.

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

  • copy (bool) – If True, a copy of the surface will be added to the project and the input surface will not be invalidated.

classmethod read(filename)

Read surface data from a file.

Parameters

filename (str) – The file to read from.

Returns

The read surface.

Return type

Surface

class schrodinger.project.surface.SurfaceDict(proj, row)

Bases: collections.abc.MutableMapping

A dictionary of {surface name: ProjectSurface object} for the specified project row. Note that surfaces may not be created by assignment to a dictionary value. Use add, {addFromFile}, or schrodinger.project.ProjectRow.newMolecularSurface instead. SurfaceDict objects are typically accessed via schrodinger.project.ProjectRow.surface.

__init__(proj, row)
Parameters
  • proj (schrodinger.project.Project) – The project

  • row (L{schrodinger.project.ProjectRow) – The project row

__len__()
add(surf, overwrite=True, copy=False)

Add an existing Surface object to the project row. Note that if copy is False (the default), this method will invalidate the input Surface object, as the mmsurf handle will be managed by the project.

Parameters
  • surf (Surface) – The surface to add.

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

  • copy (bool) – If True, a copy of the surface will be added to the project and the input surface will not be invalidated.

Returns

A ProjectSurface object for the added surface.

Return type

ProjectSurface

addFromFile(filename, name=None, overwrite=True)

Read a surface from a file and add it to the project row.

Parameters
  • filename (str) – The file to read

  • name (str) – If given, the surface will be renamed to this before being loaded into the project.

  • 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

A ProjectSurface object for the added surface.

Return type

ProjectSurface