schrodinger.application.matsci.shapes module

Classes and functions to handle various shapes.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.application.matsci.shapes.Vertex(index, coordinates)

Bases: object

Class to manage vertices.

__init__(index, coordinates)

Create a vertex instance.

Parameters
  • index (int) – the index of this vertex

  • coordinates (numpy.array) – the coordinates of this vertex

class schrodinger.application.matsci.shapes.Edge(index, vertex_1, vertex_2)

Bases: object

Class to manage edges.

__init__(index, vertex_1, vertex_2)

Create an edge instance.

Parameters
  • index (int) – the index of this edge

  • vertex_1 (Vertex) – the first vertex in this edge

  • vertex_2 (Vertex) – the second vertex in this edge

getLength()

Return the edge length.

Return type

float

Returns

the edge length in Ang.

class schrodinger.application.matsci.shapes.Face(index, indices, points, num_unique)

Bases: object

Class to manage faces.

__init__(index, indices, points, num_unique)

Create a face instance.

Parameters
  • index (int) – the index of this face

  • indices (list) – the indices of points making up this face

  • points (list of numpy.array) – the points making up this face

  • num_unique (int) – the number of symmetry unique edges per face

getEdges()

Return a list of Edge.

Return type

list

Returns

contains all Edge for this face

setNormal()

Set the normal to this face.

setArea()

Set the area of this face.

getReferenceEdges(edges, num_unique)

Return a list containing the num_unique number of unique edges. These will be the reference edges used to orient the reference face of the polyhedron.

Parameters
  • edges (list) – all Edge objects for this face

  • num_unique (int) – the number of symmetry unique edges per face

Return type

list

Returns

unique Edge objects to serve as references

intersectSegmentAndPlane(line_start, line_end, inf_nan_thresh=1e-12, distance_thresh=0.0001)

Return the intersection point of the specified line segment and the plane in which this face resides or return None if there is no intersection.

Parameters
  • line_start (numpy.array) – the starting point of the line segment

  • line_end (numpy.array) – the ending point of the line segment

  • inf_nan_thresh (float) – this parameter handles numerical precision for inf and nan cases

  • distance_thresh (float) – this parameter controls how the intersection of line segment end-points and a plane are handled for cases where one of the end-points lies in (or near) the plane (see the comment near the module level constant DISTANCE_THRESH)

Return type

numpy.array or None

Returns

the single point of intersection along the line segment or None if there is no intersection

insideFace(point)

Return true if the query point lies on or inside the boundaries of this face, false otherwise.

Parameters

point (numpy.array) – a query point

Return type

bool

Returns

true if the query point lies on or inside the face boundaries, false otherwise

class schrodinger.application.matsci.shapes.ConvexPolyhedron(params, center, ref_face_idx, ref_face_normal_along, ref_edge_idx, ref_edge_along)

Bases: object

Class to manage a convex polyhedron.

__init__(params, center, ref_face_idx, ref_face_normal_along, ref_edge_idx, ref_edge_along)

Create an instance.

Parameters
  • params (list) – list of floating point parameters defining the polyhedron

  • center (numpy.array) – the center of the polyhedron

  • ref_face_idx (int) – specifies which of this polyhedron’s available reference faces (symmetry unique faces sorted by decreasing area) to use in the alignment

  • ref_face_normal_along (numpy.array triple) – specifies the vector along which the reference face normal will be aligned

  • ref_edge_idx (int) – specifies which of the reference faces available reference edges (symmetry unique edges sorted by decreasing length) to use in the alignment

  • ref_edge_along (numpy.array triple) – specifies the vector along which the reference edge will be aligned

updateShape(vertices)

Update the shape object using the provided vertices.

Parameters

vertices (list) – list of Vertex with new coordinates

getVertices(vertices, scale=1.0)

Create vertex data for the polyhedron, including an option to scale all vertices using a multiplicative factor.

Parameters
  • vertices (list) – list of numpy.array triples specifying the vertices of this polyhedron

  • scale (float) – multiplicative factor used to scale all vertices

Return type

list

Returns

a list of scaled Vertex

getFaces(vertices, all_indices, num_unique)

Create face data for the polyhedron.

Parameters
  • vertices (list) – list of scaled Vertex

  • all_indices (list) – contains sub-lists specifying the vertex indices for each face

  • num_unique (int) – the number of symmetry unique edges per face

Return type

list

Returns

a list of Face

translateVertices(vertices, vector)

Translate the vertices by adding the specified vector.

Parameters
  • vertices (list) – list of scaled Vertex

  • vector (numpy.array triple) – the vector used to translate the vertices

getSurfaceArea(faces)

Return the surface area of the polyhedron.

Parameters

faces (list) – all Face objects for this polyhedron

Return type

float

Returns

the surface area in Ang.^2

getReferenceFaces(faces, num_unique)

Return a list containing the num_unique number of unique faces. These will be the reference faces used to orient the polyhedron.

Parameters
  • faces (list) – all Face objects for this polyhedron

  • num_unique (int) – the number of symmetry unique faces per polyhedron

Return type

list

Returns

unique Face objects to serve as references

alignPolyhedron(vertices, face_vector, face_along, edge_vector, edge_along)

Return the polyhedron vertices rotated so as to align the face and edge vectors.

Parameters
  • vertices (list) – list of Vertex

  • face_vector (numpy.array triple) – the normal of the reference face to be rotated

  • face_along (numpy.array triple) – the vector onto which the face normal will be rotated

  • edge_vector (numpy.array triple) – the vector of the reference edge to be rotated

  • edge_along (numpy.array triple) – the vector onto which the edge vector will be rotated, it is actually this vector’s component that is perpendicular to face_along that is used in the alignment, this is to safeguard against the case where edge_along and face_along are not perpendicular, if they are the same an exception is raised

Return type

list

Returns

list of rotated Vertex

makeTemplate()

Create a template, i.e. structure object, for this convex polyhedron.

Return type

schrodinger.structure.Structure

Returns

the template structure

addPointsToTemplate(points)

Add the specified points to this convex polyhedron’s template.

Parameters

points (list of numpy.array) – contains the points to be added to the template for this convex polyhedron

addAlignmentAxesToTemplate()

Add unit vectors that mark the primary and secondary alignment axes to the template.

addNormalsToTemplate()

Add the normals of this convex polyhedron to its template.

getSegmentPlaneIntersections(line_start, line_end)

Return a two lists (1) of points where the given line segment intersects the planes containing this polyhedron’s faces and (2) the centers of the faces whose planes are being intersected.

Parameters
  • line_start (numpy.array) – the start of the line segment

  • line_end (numpy.array) – the end of the line segment

Return type

two lists of numpy.array

Returns

the intersection points and the centers of faces whose planes are being intersected

addSegmentPlaneIntersectionsToTemplate(line_start, line_end)

Add to this polyhedron’s template the intersection points of the specified line segment and the planes containing the faces. Also draw connections between these points and the centers of the faces containing the planes that are being intersected.

Parameters
  • line_start (numpy.array) – the start of the line segment

  • line_end (numpy.array) – the end of the line segment

pointInside(point)

Return True if the query point is either on or inside of this convex polyhedron.

Parameters

point (numpy.array) – the point in question

Return type

bool

Returns

True if the point in question is either on or inside this polyhedron, False otherwise

allFacesIntersected()

Return True if all faces, not the planes containing those faces but the actual faces, of this convex polyhedron have been intersected at least once given all pointInside queries performed thus far.

Return type

bool

Returns

True if all faces have been intersected, False otherwise

class schrodinger.application.matsci.shapes.Cube(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Bases: schrodinger.application.matsci.shapes.ConvexPolyhedron

Class to manage a cube.

NAME = 'cube'
DEFAULT = [5.0]
DESCRIPTION = ['edge length']
TYPE = 'platonic'
VERTICES = [array([0.5, 0.5, 0.5]), array([ 0.5,  0.5, -0.5]), array([ 0.5, -0.5,  0.5]), array([ 0.5, -0.5, -0.5]), array([-0.5,  0.5,  0.5]), array([-0.5,  0.5, -0.5]), array([-0.5, -0.5,  0.5]), array([-0.5, -0.5, -0.5])]
INDICES = [[1, 3, 4, 2], [5, 1, 2, 6], [7, 5, 6, 8], [3, 7, 8, 4], [1, 5, 7, 3], [4, 8, 6, 2]]
NUM_UNIQUE_EDGES = 1
NUM_UNIQUE_FACES = 1
__init__(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Create an instance.

Parameters
  • scale (float) – multiplicative scaling factor

  • center (numpy.array) – the center of the polyhedron

  • ref_face_idx (int) – specifies which of this polyhedron’s available reference faces (symmetry unique faces sorted by decreasing area) to use in the alignment

  • ref_face_normal_along (numpy.array triple) – specifies the vector along which the reference face normal will be aligned

  • ref_edge_idx (int) – specifies which of the reference faces available reference edges (symmetry unique edges sorted by decreasing length) to use in the alignment

  • ref_edge_along (numpy.array triple) – specifies the vector along which the reference edge will be aligned

getEdgeLength(circumradius)

Return the edge length.

Parameters

circumradius (float) – circumradius in Angstrom

Return type

float

Returns

edge length in Angstrom

getCircumRadius(length)

Return the circumradius.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

circumradius in Angstrom

getVolume(length)

Return the volume.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

volume in cubic Angstrom

class schrodinger.application.matsci.shapes.Tetrahedron(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Bases: schrodinger.application.matsci.shapes.ConvexPolyhedron

Class to manage a tetrahedron.

NAME = 'tetrahedron'
DEFAULT = [10.0]
DESCRIPTION = ['edge length']
TYPE = 'platonic'
VERTICES = [array([ 0.5       ,  0.        , -0.35355339]), array([-0.5       ,  0.        , -0.35355339]), array([0.        , 0.5       , 0.35355339]), array([ 0.        , -0.5       ,  0.35355339])]
INDICES = [[1, 4, 2], [3, 4, 1], [2, 4, 3], [1, 2, 3]]
NUM_UNIQUE_EDGES = 1
NUM_UNIQUE_FACES = 1
__init__(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Create an instance.

Parameters
  • scale (float) – multiplicative scaling factor

  • center (numpy.array) – the center of the polyhedron

  • ref_face_idx (int) – specifies which of this polyhedron’s available reference faces (symmetry unique faces sorted by decreasing area) to use in the alignment

  • ref_face_normal_along (numpy.array triple) – specifies the vector along which the reference face normal will be aligned

  • ref_edge_idx (int) – specifies which of the reference faces available reference edges (symmetry unique edges sorted by decreasing length) to use in the alignment

  • ref_edge_along (numpy.array triple) – specifies the vector along which the reference edge will be aligned

getEdgeLength(circumradius)

Return the edge length.

Parameters

circumradius (float) – circumradius in Angstrom

Return type

float

Returns

edge length in Angstrom

getCircumRadius(length)

Return the circumradius.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

circumradius in Angstrom

getVolume(length)

Return the volume.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

volume in cubic Angstrom

class schrodinger.application.matsci.shapes.Octahedron(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Bases: schrodinger.application.matsci.shapes.ConvexPolyhedron

Class to manage an octahedron.

NAME = 'octahedron'
DEFAULT = [8.0]
DESCRIPTION = ['edge length']
TYPE = 'platonic'
VERTICES = [array([0.70710678, 0.        , 0.        ]), array([-0.70710678,  0.        ,  0.        ]), array([0.        , 0.70710678, 0.        ]), array([ 0.        , -0.70710678,  0.        ]), array([0.        , 0.        , 0.70710678]), array([ 0.        ,  0.        , -0.70710678])]
INDICES = [[6, 2, 3], [4, 2, 6], [5, 2, 4], [3, 2, 5], [6, 3, 1], [4, 6, 1], [5, 4, 1], [3, 5, 1]]
NUM_UNIQUE_EDGES = 1
NUM_UNIQUE_FACES = 1
__init__(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Create an instance.

Parameters
  • scale (float) – multiplicative scaling factor

  • center (numpy.array) – the center of the polyhedron

  • ref_face_idx (int) – specifies which of this polyhedron’s available reference faces (symmetry unique faces sorted by decreasing area) to use in the alignment

  • ref_face_normal_along (numpy.array triple) – specifies the vector along which the reference face normal will be aligned

  • ref_edge_idx (int) – specifies which of the reference faces available reference edges (symmetry unique edges sorted by decreasing length) to use in the alignment

  • ref_edge_along (numpy.array triple) – specifies the vector along which the reference edge will be aligned

getEdgeLength(circumradius)

Return the edge length.

Parameters

circumradius (float) – circumradius in Angstrom

Return type

float

Returns

edge length in Angstrom

getCircumRadius(length)

Return the circumradius.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

circumradius in Angstrom

getVolume(length)

Return the volume.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

volume in cubic Angstrom

class schrodinger.application.matsci.shapes.Dodecahedron(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Bases: schrodinger.application.matsci.shapes.ConvexPolyhedron

Class to manage a dodecahedron.

NAME = 'dodecahedron'
DEFAULT = [3.0]
DESCRIPTION = ['edge length']
TYPE = 'platonic'
VERTICES = [array([0.80901699, 0.80901699, 0.80901699]), array([ 0.80901699,  0.80901699, -0.80901699]), array([ 0.80901699, -0.80901699,  0.80901699]), array([ 0.80901699, -0.80901699, -0.80901699]), array([-0.80901699,  0.80901699,  0.80901699]), array([-0.80901699,  0.80901699, -0.80901699]), array([-0.80901699, -0.80901699,  0.80901699]), array([-0.80901699, -0.80901699, -0.80901699]), array([0.        , 0.5       , 1.30901699]), array([ 0.        ,  0.5       , -1.30901699]), array([ 0.        , -0.5       ,  1.30901699]), array([ 0.        , -0.5       , -1.30901699]), array([0.5       , 1.30901699, 0.        ]), array([ 0.5       , -1.30901699,  0.        ]), array([-0.5       ,  1.30901699,  0.        ]), array([-0.5       , -1.30901699,  0.        ]), array([1.30901699, 0.        , 0.5       ]), array([ 1.30901699,  0.        , -0.5       ]), array([-1.30901699,  0.        ,  0.5       ]), array([-1.30901699,  0.        , -0.5       ])]
INDICES = [[6, 15, 13, 2, 10], [20, 6, 10, 12, 8], [19, 20, 8, 16, 7], [5, 19, 7, 11, 9], [15, 5, 9, 1, 13], [20, 19, 5, 15, 6], [10, 2, 18, 4, 12], [8, 12, 4, 14, 16], [7, 16, 14, 3, 11], [9, 11, 3, 17, 1], [13, 1, 17, 18, 2], [4, 18, 17, 3, 14]]
NUM_UNIQUE_EDGES = 1
NUM_UNIQUE_FACES = 1
__init__(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Create an instance.

Parameters
  • scale (float) – multiplicative scaling factor

  • center (numpy.array) – the center of the polyhedron

  • ref_face_idx (int) – specifies which of this polyhedron’s available reference faces (symmetry unique faces sorted by decreasing area) to use in the alignment

  • ref_face_normal_along (numpy.array triple) – specifies the vector along which the reference face normal will be aligned

  • ref_edge_idx (int) – specifies which of the reference faces available reference edges (symmetry unique edges sorted by decreasing length) to use in the alignment

  • ref_edge_along (numpy.array triple) – specifies the vector along which the reference edge will be aligned

getEdgeLength(circumradius)

Return the edge length.

Parameters

circumradius (float) – circumradius in Angstrom

Return type

float

Returns

edge length in Angstrom

getCircumRadius(length)

Return the circumradius.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

circumradius in Angstrom

getVolume(length)

Return the volume.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

volume in cubic Angstrom

class schrodinger.application.matsci.shapes.Icosahedron(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Bases: schrodinger.application.matsci.shapes.ConvexPolyhedron

Class to manage an icosahedron.

NAME = 'icosahedron'
DEFAULT = [5.0]
DESCRIPTION = ['edge length']
TYPE = 'platonic'
VERTICES = [array([0.        , 0.5       , 0.80901699]), array([ 0.        ,  0.5       , -0.80901699]), array([ 0.        , -0.5       ,  0.80901699]), array([ 0.        , -0.5       , -0.80901699]), array([0.5       , 0.80901699, 0.        ]), array([ 0.5       , -0.80901699,  0.        ]), array([-0.5       ,  0.80901699,  0.        ]), array([-0.5       , -0.80901699,  0.        ]), array([0.80901699, 0.        , 0.5       ]), array([ 0.80901699,  0.        , -0.5       ]), array([-0.80901699,  0.        ,  0.5       ]), array([-0.80901699,  0.        , -0.5       ])]
INDICES = [[2, 4, 12], [2, 12, 7], [2, 7, 5], [2, 5, 10], [2, 10, 4], [4, 10, 6], [4, 6, 8], [12, 4, 8], [12, 8, 11], [7, 12, 11], [7, 11, 1], [5, 7, 1], [5, 1, 9], [10, 5, 9], [10, 9, 6], [8, 6, 3], [11, 8, 3], [1, 11, 3], [9, 1, 3], [6, 9, 3]]
NUM_UNIQUE_EDGES = 1
NUM_UNIQUE_FACES = 1
__init__(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Create an instance.

Parameters
  • scale (float) – multiplicative scaling factor

  • center (numpy.array) – the center of the polyhedron

  • ref_face_idx (int) – specifies which of this polyhedron’s available reference faces (symmetry unique faces sorted by decreasing area) to use in the alignment

  • ref_face_normal_along (numpy.array triple) – specifies the vector along which the reference face normal will be aligned

  • ref_edge_idx (int) – specifies which of the reference faces available reference edges (symmetry unique edges sorted by decreasing length) to use in the alignment

  • ref_edge_along (numpy.array triple) – specifies the vector along which the reference edge will be aligned

getEdgeLength(circumradius)

Return the edge length.

Parameters

circumradius (float) – circumradius in Angstrom

Return type

float

Returns

edge length in Angstrom

getCircumRadius(length)

Return the circumradius.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

circumradius in Angstrom

getVolume(length)

Return the volume.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

volume in cubic Angstrom

class schrodinger.application.matsci.shapes.Cubeoctahedron(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Bases: schrodinger.application.matsci.shapes.ConvexPolyhedron

Class to manage a cubeoctahedron.

NAME = 'cubeoctahedron'
DEFAULT = [5.0]
DESCRIPTION = ['edge length']
TYPE = 'archimedean'
VERTICES = [array([0.70710678, 0.70710678, 0.        ]), array([ 0.70710678, -0.70710678,  0.        ]), array([-0.70710678,  0.70710678,  0.        ]), array([-0.70710678, -0.70710678,  0.        ]), array([0.70710678, 0.        , 0.70710678]), array([ 0.70710678,  0.        , -0.70710678]), array([-0.70710678,  0.        ,  0.70710678]), array([-0.70710678,  0.        , -0.70710678]), array([0.        , 0.70710678, 0.70710678]), array([ 0.        ,  0.70710678, -0.70710678]), array([ 0.        , -0.70710678,  0.70710678]), array([ 0.        , -0.70710678, -0.70710678])]
INDICES = [[2, 5, 11], [1, 9, 5], [5, 9, 7, 11], [11, 7, 4], [11, 4, 12, 2], [2, 12, 6], [2, 6, 1, 5], [1, 10, 3, 9], [9, 3, 7], [7, 3, 8, 4], [4, 8, 12], [12, 8, 10, 6], [6, 10, 1], [10, 8, 3]]
NUM_UNIQUE_EDGES = 1
NUM_UNIQUE_FACES = 2
__init__(scale, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Create an instance.

Parameters
  • scale (float) – multiplicative scaling factor

  • center (numpy.array) – the center of the polyhedron

  • ref_face_idx (int) – specifies which of this polyhedron’s available reference faces (symmetry unique faces sorted by decreasing area) to use in the alignment

  • ref_face_normal_along (numpy.array triple) – specifies the vector along which the reference face normal will be aligned

  • ref_edge_idx (int) – specifies which of the reference faces available reference edges (symmetry unique edges sorted by decreasing length) to use in the alignment

  • ref_edge_along (numpy.array triple) – specifies the vector along which the reference edge will be aligned

getEdgeLength(circumradius)

Return the edge length.

Parameters

circumradius (float) – circumradius in Angstrom

Return type

float

Returns

edge length in Angstrom

getCircumRadius(length)

Return the circumradius.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

circumradius in Angstrom

getVolume(length)

Return the volume.

Parameters

length (float) – length in Angstrom

Return type

float

Returns

volume in cubic Angstrom

class schrodinger.application.matsci.shapes.Parallelepiped(a_param, b_param, c_param, alpha_param, beta_param, gamma_param, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Bases: schrodinger.application.matsci.shapes.ConvexPolyhedron

Class to manage a parallelepiped.

NAME = 'parallelepiped'
DEFAULT = [5.0, 10.0, 12.0, 60.0, 45.0, 80.0]
DESCRIPTION = ['edge a length', 'edge b length', 'edge c length', 'edge-edge b-c angle', 'edge-edge a-c angle', 'edge-edge a-b angle']
TYPE = 'prism'
INDICES = [[1, 4, 3, 2], [5, 1, 2, 6], [4, 8, 7, 3], [8, 5, 6, 7], [8, 4, 1, 5], [6, 2, 3, 7]]
NUM_UNIQUE_EDGES = 2
NUM_UNIQUE_FACES = 3
__init__(a_param, b_param, c_param, alpha_param, beta_param, gamma_param, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Create an instance.

Parameters
  • a_param (float) – the length of the parallelepiped along edge a

  • b_param (float) – the length of the parallelepiped along edge b

  • c_param (float) – the length of the parallelepiped along edge c

  • alpha_param (float) – the angle between edges b and c

  • beta_param (float) – the angle between edges a and c

  • gamma_param (float) – the angle between edges a and b

  • center (numpy.array) – the center of the polyhedron

  • ref_face_idx (int) – specifies which of this polyhedron’s available reference faces (symmetry unique faces sorted by decreasing area) to use in the alignment

  • ref_face_normal_along (numpy.array triple) – specifies the vector along which the reference face normal will be aligned

  • ref_edge_idx (int) – specifies which of the reference faces available reference edges (symmetry unique edges sorted by decreasing length) to use in the alignment

  • ref_edge_along (numpy.array triple) – specifies the vector along which the reference edge will be aligned

getParallelepipedVertices(origin, a_vec, b_vec, c_vec)

Get the vertices of the specified parallelepiped.

Parameters
  • origin (numpy.array) – the point of origin of the lattic vectors

  • a_vec (numpy.array) – the a lattice vector

  • b_vec (numpy.array) – the b lattice vector

  • c_vec (numpy.array) – the c lattice vector

Return type

list of numpy.array

Returns

the vertices of the parallelepiped

getVolume(a_vec, b_vec, c_vec)

Return the volume.

Parameters
  • a_vec (numpy.array) – the a lattice vector

  • b_vec (numpy.array) – the b lattice vector

  • c_vec (numpy.array) – the c lattice vector

Return type

float

Returns

volume in cubic Angstrom

class schrodinger.application.matsci.shapes.Slab(a_param, b_param, c_param, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Bases: schrodinger.application.matsci.shapes.Parallelepiped, schrodinger.application.matsci.shapes.ConvexPolyhedron

Class to manage a slab.

NAME = 'slab'
DEFAULT = [5.0, 10.0, 12.0]
DESCRIPTION = ['edge a length', 'edge b length', 'edge c length']
__init__(a_param, b_param, c_param, center=[0.0, 0.0, 0.0], ref_face_idx=1, ref_face_normal_along=array([0., 0., 1.]), ref_edge_idx=1, ref_edge_along=array([1., 0., 0.]))

Create an instance.

Parameters
  • a_param (float) – the length of the parallelepiped along edge a

  • b_param (float) – the length of the parallelepiped along edge b

  • c_param (float) – the length of the parallelepiped along edge c

  • center (numpy.array) – the center of the polyhedron

  • ref_face_idx (int) – specifies which of this polyhedron’s available reference faces (symmetry unique faces sorted by decreasing area) to use in the alignment

  • ref_face_normal_along (numpy.array triple) – specifies the vector along which the reference face normal will be aligned

  • ref_edge_idx (int) – specifies which of the reference faces available reference edges (symmetry unique edges sorted by decreasing length) to use in the alignment

  • ref_edge_along (numpy.array triple) – specifies the vector along which the reference edge will be aligned

class schrodinger.application.matsci.shapes.Sphere(radius, center=[0.0, 0.0, 0.0])

Bases: object

Class to manage a sphere.

NAME = 'sphere'
DEFAULT = [5.0]
DESCRIPTION = ['radius']
TYPE = 'basic'
NUM_UNIQUE_EDGES = 0
NUM_UNIQUE_FACES = 0
__init__(radius, center=[0.0, 0.0, 0.0])

Create an instance.

Parameters
  • radius (float) – the radius of the sphere

  • center (numpy.array) – the center of the sphere

getVolume(radius)

Return the volume.

Parameters

radius (float) – radius in Angstrom

Return type

float

Returns

volume in cubic Angstrom

getSurfaceArea(radius)

Return the surface area.

Parameters

radius (float) – radius in Angstrom

Return type

float

Returns

surface area in square Angstrom

pointInside(point)

Return True if the query point is either on or inside of this sphere.

Parameters

point (numpy.array) – the point in question

Return type

bool

Returns

True if the point in question is either on or inside this sphere, False otherwise

class schrodinger.application.matsci.shapes.Cylinder(radius, length, center=[0.0, 0.0, 0.0])

Bases: object

Class to manage a cylinder.

NAME = 'cylinder'
DEFAULT = [5.0, 25.0]
DESCRIPTION = ['radius', 'length']
TYPE = 'basic'
NUM_UNIQUE_EDGES = 0
NUM_UNIQUE_FACES = 1
__init__(radius, length, center=[0.0, 0.0, 0.0])

Create an instance.

Parameters
  • radius (float) – the radius of the cylinder

  • length (float) – the length of the cylinder

  • center (numpy.array) – the center of the cylinder

getVolume(radius, length)

Return the volume.

Parameters
  • radius (float) – radius in Angstrom

  • length (float) – length in Angstrom

Return type

float

Returns

volume in cubic Angstrom

getSurfaceArea(radius, length)

Return the surface area.

Parameters
  • radius (float) – radius in Angstrom

  • length (float) – length in Angstrom

Return type

float

Returns

surface area in square Angstrom

pointInside(point)

Return True if the query point is either on or inside of this cylinder.

Parameters

point (numpy.array) – the point in question

Return type

bool

Returns

True if the point in question is either on or inside this cylinder, False otherwise

schrodinger.application.matsci.shapes.get_shape_object_by_name(name)

Return a shape object by name.

Parameters

name (str) – the name of the object wanted

Return type

object

Returns

the shape object

schrodinger.application.matsci.shapes.get_polygon_area(vertices)

Return the area of the specified polygon using the shoelace formula.

Parameters

vertices (list) – contains all vertices of the polygon, each of which is a two dimensional numpy.array, i.e. x and y

Return type

float

Returns

the area of the polygon

schrodinger.application.matsci.shapes.get_reference_data(data, attr, num_unique, threshold)

Return a list containing the num_unique number of unique data. The data will be either a list of Face or a list of Edge characterized using the attr AREA or LENGTH, respectively. These will be the reference data used to orient the polyhedron.

Parameters
  • data (list) – either all Face objects for a given polyhedron or all Edge objects for a given face

  • attr (str) – the attribute on which to characterize the data, either AREA or LENGTH

  • num_unique (int) – the number of symmetry unique data

  • threshold (float) – the threshold used to consider if two data are equivalent by attr (either Ang. or Ang.^2)

Return type

list

Returns

unique data to serve as references

schrodinger.application.matsci.shapes.get_parallelepiped_vertices(origin, a_vec, b_vec, c_vec, center=True)

Get the vertices of the specified parallelepiped.

Parameters
  • origin (numpy.array) – the point of origin of the lattic vectors

  • a_vec (numpy.array) – the a lattice vector

  • b_vec (numpy.array) – the b lattice vector

  • c_vec (numpy.array) – the c lattice vector

  • center (bool) – specifies whether or not to translate the final vertices so that the centroid is at (0, 0, 0)

Return type

list of numpy.array

Returns

the vertices of the parallelepiped

schrodinger.application.matsci.shapes.get_centroid(vertices)

Return the centroid of the provided vertices.

Parameters

vertices (list) – numpy.array array of points

Return type

numpy.array

Returns

the centroid