sisl.shape.EllipticalCylinder

class sisl.shape.EllipticalCylinder(v, h, axes=(0, 1), center=None)

Bases: PureShape

3D elliptical cylinder

Parameters
  • v (float or (2,) or (2, 3)) – radius/vectors defining the elliptical base. For 1 value the xy plane will be the elliptical base. For 2 values it corresponds to a Cartesian oriented ellipsoid base. 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.

  • h (float) – the height of the cylinder, this is a right cylinder (not oblique).

  • axes ((2,), optional) – the axes where the elliptical base is defined, will not be used when v is of shape (2, 3). Defaults to the \(xy\) plane.

  • center ((3,), optional) – the center of the cylinder, defaults to the origin.

Examples

>>> shape = EllipticalCylinder(2, 3, axes=(1, 2))
>>> shape.within([1.4, 0, 0])
True
>>> shape.within([1.4, 1.1, 0])
False
>>> shape.within([1.4, 0, 1.1])
False

Methods

copy()

expand(radius)

Expand elliptical cylinder by a constant value along each vector and height

scale(scale)

Create a new shape with all dimensions scaled according to scale

toCuboid()

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

toEllipsoid(*args, **kwargs)

Create an ellipsoid which is surely encompassing the full shape

toSphere()

Convert to a sphere

volume()

Return the volume of the shape

within(other, *args, **kwargs)

Return True if other is fully within self

within_index(other[, tol])

Return indices of the points that are within the shape

center

The geometric center of the shape

height

Height of the cylinder

height_vector

The height vector

radial_vector

The radial vectors

radius

Radius of the ellipse base vectors

to

A dispatcher for classes, using __get__ it converts into ObjectDispatcher upon invocation from an object, or a TypeDispatcher when invoked from a class

__init__(v, h, axes=(0, 1), center=None)[source]
property center

The geometric center of the shape

copy()[source]
expand(radius)[source]

Expand elliptical cylinder by a constant value along each vector and height

Parameters

radius (float or (3,)) – the extension in Ang per elliptical vector and height

property height

Height of the cylinder

property height_vector

The height vector

property radial_vector

The radial vectors

property radius

Radius of the ellipse base vectors

scale(scale)[source]

Create a new shape with all dimensions scaled according to scale

Parameters

scale (float or (3,)) – scale parameter for each of the ellipse vectors (first two), and for the height of the cylinder (last element).

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()[source]

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

toEllipsoid(*args, **kwargs)

Create an ellipsoid which is surely encompassing the full shape

toSphere()[source]

Convert to a sphere

volume()[source]

Return the volume of the shape

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, tol=1e-08)[source]

Return indices of the points that are within the shape

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

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