sisl.geom.AtomNeighbors
- class sisl.geom.AtomNeighbors
Bases:
AtomCategoryClassify atoms based on number of neighbors
- Parameters:
min (
int, optional) – minimum number of neighborsmax (
int) – maximum number of neighborsneighbor (
Category, optional) – a category the neighbor must be in to be countedR (
tuple,float,callableorNone, optional) – Value passed to Geometry.close.tuple, directly passed and thus only neigbors within the tuple range are consideredfloat, this will pass(0.01, R)and thus not count the atom itself.callable, the return value of this will be directly passed. If the callable returns a single float it will count the atom itself.
Examples
>>> AtomNeighbors(4) # 4 neighbors within (0.01, Geometry.maxR()) >>> AtomNeighbors(4, R=1.44) # 4 neighbors within (0.01, 1.44) >>> AtomNeighbors(4, R=(1, 1.44)) # 4 neighbors within (1, Geometry.maxR()) >>> AtomNeighbors(4, R=lambda atom: (0.01, PeriodicTable().radius(atom.Z))) # 4 neighbors within (0.01, <>)
Methods
R(atom)categorize(geometry[, atoms])Check if geometry and atoms matches the neighbor criteria
is_class(name[, case])Query whether
nameis one of the keywords of this classkw(**kwargs)Create categories based on keywords
mask(*args, **kwargs)Boolean array which is true for the objects in this category
Attributes
Name of category
- classmethod is_class(name, case=True)
Query whether
nameis one of the keywords of this classThe keywords are the
keyandaliasesclass arguments. Sub-classes may override this method for other matching rules.
- classmethod kw(**kwargs)
Create categories based on keywords
This will search through the inherited classes and return and & category object for all keywords.
Since this is a class method one should use this on the base category class in the given section of the code.
Each keyword matches a sub-class through
is_class, first case-sensitive, then case-insensitive. The value is passed to the matched class:Truecreates it without arguments (odd=True),a dict is passed as keyword arguments (
odd={}),anything else is passed as the single argument (
Z="C").
- Raises:
TypeError – if no keywords are given
ValueError – if a keyword matches no, or more than one, sub-class
- categorize(geometry, atoms=None)[source]
Check if geometry and atoms matches the neighbor criteria
- Parameters:
geometry (Geometry)
atoms (AtomsIndex)
- mask(*args, **kwargs)
Boolean array which is true for the objects in this category
The arguments are the same as for
categorize. The parts of a composite category share their calculations, e.g. the neighbor search ofAtomNeighbors.- Returns:
1D boolean array, one value per categorized object.
- Return type:
- property name
Name of category