sisl.geom.AtomNeighbors

class sisl.geom.AtomNeighbors

Bases: AtomCategory

Classify atoms based on number of neighbors

Parameters:
  • min (int, optional) – minimum number of neighbors

  • max (int) – maximum number of neighbors

  • neighbor (Category, optional) – a category the neighbor must be in to be counted

  • R (tuple, float, callable or None, optional) – Value passed to Geometry.close. tuple, directly passed and thus only neigbors within the tuple range are considered float, 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 name matches the class name by removing a prefix kw

kw(**kwargs)

Create categories based on keywords

Attributes

name

Name of category

R(atom)[source]
categorize(geometry, atoms=None)[source]

Check if geometry and atoms matches the neighbor criteria

Parameters:
classmethod is_class(name, case=True)

Query whether name matches the class name by removing a prefix kw

This is important to ensure that users match the full class name by omitting the prefix returned from this method.

This is an abstract method to ensure sub-classes of Category implements it.

For instance:

class MyCategory(Category):

    @classmethod
    def is_class(cls, name):
         # strip "My" and do comparison
         return cl.__name__.lower()[2:] == name.lower()

would enable one to compare against the base category scheme.

This has the option to search case-sensitivity or not.

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.

property name

Name of category