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.

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 self

within_index(other, *args, **kwargs)

Always returns a zero length array

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

volume

The volume of a null shape is exactly 0.

__init__(*args, **kwargs)[source]

Initialize a null-shape

property center

The geometric center of the shape

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

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 class

  • dispatchs (dict, optional) – dictionary of dispatch methods

  • obj_getattr (callable, optional) – method with 2 arguments, an obj and the attr 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.

toCuboid(*args, **kwargs)[source]

Return a cuboid with side-lengths 1e-64

toEllipsoid(*args, **kwargs)[source]

Return an ellipsoid with radius of size 1e-64

toSphere(*args, **kwargs)[source]

Return a sphere with radius of size 1e-64

translate(xyz: Sequence[float])

Translate the center of the shape by xyz.

Parameters:

xyz (Sequence[float])

property volume

The volume of a null shape is exactly 0.

within(other, *args, **kwargs)

Return True if other is fully within self

If 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

within_index(other, *args, **kwargs)[source]

Always returns a zero length array