sisl.shape.NullShape
- class sisl.shape.NullShape(*args, **kwargs)
Bases:
PureShape
A unique shape which has no well-defined spatial volume or center
This special shape is used when composite shapes turns out to have a null space.
The center will be equivalent to the maximum floating point value divided by 100.
Initialization of the NullShape takes no (or any) arguments. Since it has no volume of point in space, none of the arguments has any meaning.
Conversion
A dispatcher for classes, using __get__ it converts into ObjectDispatcher upon invocation from an object, or a TypeDispatcher when invoked from a class
to.Cuboid
(*args[, center, origin])to.Ellipsoid
(*args[, center])to.Sphere
(*args[, center])Methods
copy
()Create a new copy of this object.
expand
(_)Expand the shape by a constant value
scale
(scale)Return a new Shape with scaled size
toCuboid
(*args, **kwargs)Return a cuboid with side-lengths 1e-64
toEllipsoid
(*args, **kwargs)Return an ellipsoid with radius of size 1e-64
toSphere
(*args, **kwargs)Return a sphere with radius of size 1e-64
translate
(xyz)Translate the center of the shape by xyz.
within
(other, *args, **kwargs)Return
True
if other is fully within selfwithin_index
(other, *args, **kwargs)Always returns a zero length array
Attributes
The geometric center of the shape
The volume of a null shape is exactly 0.
- copy()
Create a new copy of this object.
- expand(_)
Expand the shape by a constant value
- scale(scale)
Return a new Shape with scaled size
- to.Cuboid(*args, center=None, origin=None, **kwargs)
- to.Ellipsoid(*args, center=None, **kwargs)
- to.Sphere(*args, center=None, **kwargs)
- within(other, *args, **kwargs)
Return
True
if other is fully within selfIf other is an array, an array will be returned for each of these.
- Parameters:
other (
array_like
) – the array/object that is checked for containment*args – passed directly to
within_index
**kwargs – passed directly to
within_index
- property center
The geometric center of the shape
- to
A dispatcher for classes, using __get__ it converts into ObjectDispatcher upon invocation from an object, or a TypeDispatcher when invoked from a class
This is a class-placeholder allowing a dispatcher to be a class attribute and converted into an ObjectDispatcher when invoked from an object.
If it is called on the class, it will return a TypeDispatcher.
This class should be an attribute of a class. It heavily relies on the __get__ special method.
- Parameters:
name (
str
) – name of the attribute in the classdispatchs (
dict
, optional) – dictionary of dispatch methodsobj_getattr (
callable
, optional) – method with 2 arguments, anobj
and theattr
which may be used to control how the attribute is called.instance_dispatcher (
AbstractDispatcher
, optional) – control how instance dispatchers are handled through __get__ method. This controls the dispatcher used if called from an instance.type_dispatcher (
AbstractDispatcher
, optional) – control how class dispatchers are handled through __get__ method. This controls the dispatcher used if called from a class.
Examples
>>> class A: ... new = ClassDispatcher("new", obj_getattr=lambda obj, attr: getattr(obj.sub, attr))
The above defers any attributes to the contained A.sub attribute.
- property volume
The volume of a null shape is exactly 0.