schrodinger.application.matsci.nano.plane module

Classes and functions for crystal planes.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.matsci.nano.plane.ext_gcd(a, b)

Solve ax + by = gcd(a, b) using the Extended Euclidean Algorithm. Return (1) the greatest common divisor (gcd) of integers a and b and (2) the integer Bezout coefficients x and y.

Parameters:
  • a (int) – the a coefficient
  • b (int) – the b coefficient
Return type:

int, int, int

Returns:

gcd(a, b), Bezout coefficient x, and Bezout coefficient y

class schrodinger.application.matsci.nano.plane.CrystalPlane(h_index, k_index, l_index, a_vec, b_vec, c_vec, origin=None, logger=None)

Bases: object

Manage a crystal plane object.

SQUARE = {1: array([-1., 1., 0.]), 2: array([-1., -1., 0.]), 3: array([ 1., -1., 0.]), 4: array([1., 1., 0.])}
DISTANCE_THRESH = -0.001
SAME_VECTOR_THRESH = 0.0001
SLAB_THRESHOLD = 1e-07
__init__(h_index, k_index, l_index, a_vec, b_vec, c_vec, origin=None, logger=None)

Create an instance.

Parameters:
  • h_index (int) – the h Miller index
  • k_index (int) – the k Miller index
  • l_index (int) – the l Miller index
  • a_vec (numpy.array) – the a lattice vector
  • b_vec (numpy.array) – the b lattice vector
  • c_vec (numpy.array) – the c lattice vector
  • origin (numpy.array) – the origin of the lattice vectors
  • logger (logging.getLogger) – output logger
checkMillerIndices()

Check the user provided Miller indices.

getReciprocals()

Return the reciprocal lattice vectors.

Return type:three numpy.array
Returns:the three reciprocal lattice vectors.
getNormal()

Return the normal vector.

Return type:numpy.array
Returns:the normal vector for this plane
getLinDepPlaneVectors()

Return three typically used plane vectors that are linearly dependent.

Return type:numpy.array, numpy.array, numpy.array
Returns:typically used plane vectors that are linearly dependent
transformVectors(a_vec, b_vec, c_vec)

Transform the given vectors using the basis transform.

Parameters:
  • a_vec (numpy.array) – the first vector
  • b_vec (numpy.array) – the second vector
  • c_vec (numpy.array) – the third vector
Return type:

numpy.array, numpy.array, numpy.array

Returns:

the three transformed vectors

getSimpleSlabVectors()

This sets the simple, i.e. two of the Miller indices are zero, transformation matrix into self.basis and sets the simple slab vectors.

getSlabVectors()

This sets the transformation matrix into self.basis. Basis vectors are chosen such that a and b axes are in the plane of the Miller plane, and c-axis is out of this plane (NOT necessarily normal to it). Also sets the slab vectors.

getSpanningVectors(ncella=1, ncellb=1, ncellc=1)

Return the spanning vectors of this bounding box.

Parameters:
  • ncella (int) – the number of cells along a
  • ncellb (int) – the number of cells along b
  • ncellc (int) – the number of cells along c
Return type:

list of numpy.array

Returns:

contains vectors spanning the parallelepiped and its sides

getNumPlanes(ncella=1, ncellb=1, ncellc=1)

Return the number of planes that will fit inside the bounding box.

Parameters:
  • ncella (int) – the number of cells along a
  • ncellb (int) – the number of cells along b
  • ncellc (int) – the number of cells along c
Return type:

int

Returns:

the number of planes that will fit inside the bounding box

getInterPlanarSeparation()

Return the inter-planar separation in Angstrom.

Return type:float
Returns:the inter-planar separation in Angstrom
getRotationToZ()

Return the rotation matrix needed to rotate this plane to the XY-plane as well as its inverse.

Return type:two numpy.array
Returns:the rotation matrix that rotates this plane to the XY-plane and its inverse.
getSquareVertices()

Return the vertices of a square that lies in this plane. The square has and edge-length of 2 Angstrom. It is rotated from the XY-plane, centered on origin, into this plane.

Return type:list of numpy.array
Returns:the vertices of the squre that lies in this plane
getParallelepipedLineSegments(ncella=1, ncellb=1, ncellc=1)

Return the line segments that make this bounding box.

Parameters:
  • ncella (int) – the number of cells along a
  • ncellb (int) – the number of cells along b
  • ncellc (int) – the number of cells along c
Return type:

list of tuples of heads and tails of 12 line segments.

Returns:

the line segments that make this bounding box

getPlaneBoxIntersections(vertices, ncella=1, ncellb=1, ncellc=1)

Return the points where the plane containing the specified vertices intersects the parallelepiped.

Parameters:
  • vertices (list of numpy.array) – the vertices of the square that lies in this plane
  • ncella (int) – the number of cells along a
  • ncellb (int) – the number of cells along b
  • ncellc (int) – the number of cells along c
Return type:

list of numpy.array

Returns:

the points of intersection

getOrderedIntersections(intersections)

Return the provided list of planar points in counter-clockwise order.

Parameters:intersections (list of numpy.array) – some intersection points in a plane
Return type:list of numpy.array
Returns:those planar intersections in counter-clockwise order
getVerticesOfAllPlanes(ncella=1, ncellb=1, ncellc=1, nplanes=None)

Return a list of lists of points where the set of planes intersect the parallelepiped.

Parameters:
  • ncella (int) – the number of cells along a
  • ncellb (int) – the number of cells along b
  • ncellc (int) – the number of cells along c
  • nplanes (int) – the number of planes to generate in the backwards and forwards direction
Return type:

list of list of numpy.array

Returns:

where the planes intersect the parallelepiped

__class__

alias of builtins.type

__delattr__

Implement delattr(self, name).

__dict__ = mappingproxy({'__module__': 'schrodinger.application.matsci.nano.plane', '__doc__': '\n Manage a crystal plane object.\n ', 'SQUARE': OrderedDict([(1, array([-1., 1., 0.])), (2, array([-1., -1., 0.])), (3, array([ 1., -1., 0.])), (4, array([1., 1., 0.]))]), 'DISTANCE_THRESH': -0.001, 'SAME_VECTOR_THRESH': 0.0001, 'SLAB_THRESHOLD': 1e-07, '__init__': <function CrystalPlane.__init__>, 'checkMillerIndices': <function CrystalPlane.checkMillerIndices>, 'getReciprocals': <function CrystalPlane.getReciprocals>, 'getNormal': <function CrystalPlane.getNormal>, 'getLinDepPlaneVectors': <function CrystalPlane.getLinDepPlaneVectors>, 'transformVectors': <function CrystalPlane.transformVectors>, 'getSimpleSlabVectors': <function CrystalPlane.getSimpleSlabVectors>, 'getSlabVectors': <function CrystalPlane.getSlabVectors>, 'getSpanningVectors': <function CrystalPlane.getSpanningVectors>, 'getNumPlanes': <function CrystalPlane.getNumPlanes>, 'getInterPlanarSeparation': <function CrystalPlane.getInterPlanarSeparation>, 'getRotationToZ': <function CrystalPlane.getRotationToZ>, 'getSquareVertices': <function CrystalPlane.getSquareVertices>, 'getParallelepipedLineSegments': <function CrystalPlane.getParallelepipedLineSegments>, 'getPlaneBoxIntersections': <function CrystalPlane.getPlaneBoxIntersections>, 'getOrderedIntersections': <function CrystalPlane.getOrderedIntersections>, 'getVerticesOfAllPlanes': <function CrystalPlane.getVerticesOfAllPlanes>, '__dict__': <attribute '__dict__' of 'CrystalPlane' objects>, '__weakref__': <attribute '__weakref__' of 'CrystalPlane' objects>})
__dir__() → list

default dir() implementation

__eq__

Return self==value.

__format__()

default object formatter

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__gt__

Return self>value.

__hash__

Return hash(self).

__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__

Return self<=value.

__lt__

Return self<value.

__module__ = 'schrodinger.application.matsci.nano.plane'
__ne__

Return self!=value.

__new__()

Create and return a new object. See help(type) for accurate signature.

__reduce__()

helper for pickle

__reduce_ex__()

helper for pickle

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__() → int

size of object in memory, in bytes

__str__

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__weakref__

list of weak references to the object (if defined)