sisl.shape.Sphere
- class sisl.shape.Sphere(radius, center=None)
Bases:
Ellipsoid
3D Sphere
- Parameters:
r (float) – radius of the sphere
Methods
copy
()Create a new copy of this object.
expand
(radius)Expand sphere by a constant radius
scale
(scale)Return a new sphere with a larger radius
toCuboid
()Return a cuboid with side lengths equal to the diameter of each ellipsoid vectors
Convert this sphere into an ellipsoid
toSphere
()Return a copy of it-self
translate
(xyz)Translate the center of the shape by xyz.
within
(other, *args, **kwargs)Return
True
if other is fully within selfwithin_index
(other[, tol])Return indices of the points that are within the shape
The geometric center of the shape
The radial vectors
Return the radius of the Sphere
A dispatcher for classes, using __get__ it converts into ObjectDispatcher upon invocation from an object, or a TypeDispatcher when invoked from a class
Return the volume of the sphere
- property center
The geometric center of the shape
- expand(radius)[source]
Expand sphere by a constant radius
- Parameters:
radius (float) – the extension in Ang per ellipsoid radial vector
- property radial_vector
The radial vectors
- property radius
Return the radius of the Sphere
- scale(scale)[source]
Return a new sphere with a larger radius
- Parameters:
scale (float) – the scale parameter for the radius
- 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 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.
- toCuboid()
Return a cuboid with side lengths equal to the diameter of each ellipsoid vectors
- property volume
Return the volume of the sphere
- 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