sisl.shape.Ellipsoid

class sisl.shape.Ellipsoid(v, center=None)

Bases: PureShape

3D Ellipsoid shape

Parameters:
  • v (float or (3,) or (3, 3)) – radius/vectors defining the ellipsoid. For 3 values it corresponds to a Cartesian oriented ellipsoid. If the vectors are non-orthogonal they will be orthogonalized. I.e. the first vector is considered a principal axis, then the second vector will be orthogonalized onto the first, and this is the second principal axis. And so on.

  • center ((3,), optional) – the center of the ellipsoid. Defaults to the origin.

Examples

>>> shape = Ellipsoid([2, 2.2, 2])
>>> shape.within([0, 2, 0])
True

Conversion

to

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, **kwargs)

to.Ellipsoid(*args, **kwargs)

to.Sphere(*args, **kwargs)

Methods

copy()

Create a new copy of this object.

expand(radius)

Expand ellipsoid by a constant value along each radial vector

scale(scale)

Return a new shape with a larger corresponding to scale

toCuboid()

Return a cuboid with side lengths equal to the diameter of each ellipsoid vectors

toEllipsoid()

Return an ellipsoid that encompass this shape (a copy)

toSphere()

Return a sphere with a radius equal to the largest radial vector

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[, rtol])

Return indices of the points that are within the shape

Attributes

center

The geometric center of the shape

radial_vector

The radial vectors

radius

Return the radius of the Ellipsoid

volume

Return the volume of the shape

copy()[source]

Create a new copy of this object.

expand(radius)[source]

Expand ellipsoid by a constant value along each radial vector

Parameters:

radius (float or (3,)) – the extension in Ang per ellipsoid radial vector

scale(scale)[source]

Return a new shape with a larger corresponding to scale

Parameters:

scale (float or (3,)) – the scale parameter for each of the vectors defining the Ellipsoid

to.Cuboid(*args, **kwargs)
to.Ellipsoid(*args, **kwargs)
to.Sphere(*args, **kwargs)
toCuboid()[source]

Return a cuboid with side lengths equal to the diameter of each ellipsoid vectors

toEllipsoid()[source]

Return an ellipsoid that encompass this shape (a copy)

toSphere()[source]

Return a sphere with a radius equal to the largest radial vector

translate(xyz: Sequence[float])

Translate the center of the shape by xyz.

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, rtol: float = 1.0e-8)[source]

Return indices of the points that are within the shape

Parameters:
  • other (array_like) – the object that is checked for containment

  • rtol (float, optional) – absolute tolerance for boundaries

property center

The geometric center of the shape

property radial_vector

The radial vectors

property radius

Return the radius of the Ellipsoid

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.

property volume: float

Return the volume of the shape