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
-
schrodinger.application.matsci.nano.plane.
reduce_hkl
(hkl)¶ Reduce hkl to the smallest set of indices
param list hkl: Miller indices
- Retype
list, int
- Returns
Reduced Miller indices, divisor
-
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 in Angstrom
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
(st)¶ Return the spanning vectors of this bounding box.
- Parameters
st (schrodinger.structure.Structure) – the structure
- Return type
list of numpy.array
- Returns
contains vectors spanning the parallelepiped and its sides
-
getBestSpanningVector
(st)¶ Return the spanning vector with the largest projection onto the plane normal vector.
- Parameters
st (schrodinger.structure.Structure) – the structure
- Return type
numpy.array
- Returns
the best spanning vector
-
getNumPlanes
(st)¶ Return the number of planes that will fit inside the bounding box.
- Parameters
st (schrodinger.structure.Structure) – the structure
- 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
(st)¶ Return the line segments that make this bounding box.
- Parameters
st (schrodinger.structure.Structure) – the structure
- Return type
list of tuples of heads and tails of 12 line segments.
- Returns
the line segments that make this bounding box
-
getPlaneBoxIntersections
(st, vertices)¶ Return the points where the plane containing the specified vertices intersects the parallelepiped.
- Parameters
st (schrodinger.structure.Structure) – the structure
vertices (list of numpy.array) – the vertices of the square that lies in this plane
- 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
-
getVertices
(normal_vec, idx, draw_location=0, thickness=1)¶ Return a list of numpy.array containing vertices of a plane with the given index.
- Parameters
normal_vec (numpy.array) – the normal vector
idx (int) – the plane index, the sign of the index controls whether behind or ahead of the normal vector origin
draw_location (float) – specifies the starting location at which planes will be drawn in terms of a fraction of the normal vector which has a length of one inter-planar spacing
thickness (float) – specifies the thickness or distance between consecutive planes in terms of a fraction of the normal vector which has a length of one inter-planar spacing
- Return type
list of numpy.array
- Returns
the plane vertices
-
getVerticesOfAllPlanes
(st, draw_location=0, thickness=1, also_draw_planes_behind=True)¶ Return a list of lists of points where the set of planes intersect the parallelepiped.
- Parameters
st (schrodinger.structure.Structure) – the structure
draw_location (float) – specifies the starting location at which planes will be drawn in terms of a fraction of the normal vector which has a length of one inter-planar spacing
thickness (float) – specifies the thickness or distance between consecutive planes in terms of a fraction of the normal vector which has a length of one inter-planar spacing
also_draw_planes_behind (bool) – whether to also draw planes behind the specified draw location, this is in addition to always drawing planes ahead of the draw location
- Return type
list of list of numpy.array
- Returns
where the planes intersect the parallelepiped
-