Shape¶
-
class
sisl.shape.Shape(center)[source]¶ Baseclass for shapes
This class should always be sub-classed.
There are a few routines that are always necessary to implement in a inherited class:
center- return the geometric center of the shape
- origo
- return the lowest left point in the shape
- volume
- return the volume of the shape.
- displacement
- return a vector that is the largest displacement vector such that a grid of the Shape will fully contian all space
- within
- Enables to check if coordinates, or other things are contained in this shape
- iwithin
- Returns only the indices of elements that are within
- enlarge
- Creates a new shape with a only the indices of elements that are within
A
Shapeallows interaction with outside elements to check if geometric points are within the shapes. For instance to assert that a given point x, y, z is within a sphere of radius r with center cx, cy, cz on may do:This makes it very efficient to enable arbitrary shapes to be passed and used as determinations of regions of space.
Attributes
centerThe geometric center of the shape displacementReturn a displacement vector for full containment origoThe geometric origo of the shape volumeMethods
__init__(center)Initialize the Shape with a center enlarge(length)Return a new Shape with an increased size length iwithin(other)Returns indices of the elements of other that are within the shape within(other)Returns True if other is fully within self -
center¶ The geometric center of the shape
-
displacement¶ Return a displacement vector for full containment
-
origo¶ The geometric origo of the shape
An origo should always be the lowest left coordinate of the shape.
Notes
Not all shapes have an origo. For instance a sphere only have a center, but an origo cannot be defined.
-
volume¶