sisl.geom.AtomFracSite

class sisl.geom.AtomFracSite

Bases: AtomCategory

Classify atoms based on fractional sites for a given supercell

Match atomic coordinates based on the fractional positions.

Parameters:
  • lattice – an object that defines the lattice vectors.

  • atol – the absolute tolerance (in Ang) to check whether the site is an integer site.

  • offset – an offset made to the geometry coordinates before calculating the fractional coordinates according to lattice

  • foffset – fractional offset of the fractional coordinates, this allows to select sub-regions in the lattice lattice vectors.

Examples

>>> gr = graphene() * (4, 5, 1)
>>> A_site = AtomFracSite(graphene())
>>> B_site = AtomFracSite(graphene(), foffset=(-1/3, -1/3, 0))
>>> cat = (A_site | B_site).categorize(gr)
>>> for ia, c in enumerate(cat):
...    if ia % 2 == 0:
...        assert c == A_site
...    else:
...        assert c == B_site

Methods

categorize(geometry[, atoms])

Do categorization

is_class(name[, case])

Query whether name is one of the keywords of this class

kw(**kwargs)

Create categories based on keywords

mask(*args, **kwargs)

Boolean array which is true for the objects in this category

Attributes

name

Name of category

classmethod is_class(name, case=True)

Query whether name is one of the keywords of this class

The keywords are the key and aliases class arguments. Sub-classes may override this method for other matching rules.

Parameters:
  • name (str) – the keyword to match

  • case (bool) – whether the match is case-sensitive

Return type:

bool

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:

  • True creates 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]

Do categorization

Parameters:
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 of AtomNeighbors.

Returns:

1D boolean array, one value per categorized object.

Return type:

numpy.ndarray

property name

Name of category