sisl.geom.AtomSeq
- class sisl.geom.AtomSeq
Bases:
AtomIndexClassify atoms based on their indices using a sequence string.
- Parameters:
seq – sequence indicating the indices that you want to match (see examples)
Examples
>>> seq = AtomSeq("1-3") >>> geom.sub(seq) == geom.sub([1,2,3]) >>> seq = AtomSeq("1-3,7") >>> geom.sub(seq) == geom.sub([1,2,3,7]) >>> seq = AtomSeq("1-3,7:") >>> geom.sub(seq) == geom.sub([1,2,3,*range(7, len(geom))]) >>> seq = AtomSeq("1-3,6,9:2:") >>> geom.sub(seq) == geom.sub([1,2,3,6,*range(9, len(geom), 2)])
See also
strmap,lstrangesMethods
categorize(geometry, *args, **kwargs)Do categorization
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
- 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