site_analysis.site

class Site(label: Optional[str] = None)[source]

Bases: abc.ABC

Parent class for defining sites.

A Site is a bounded volume that can contain none, one, or more atoms. This class defines the attributes and methods expected for specific Site subclasses.

index

Numerical ID, intended to be unique to each site.

Type:int
label (`str`

optional): Optional string given as a label for this site. Default is None.

contains_atoms

List of the atoms contained by this site in the structure last processed.

Type:list
trajectory

Nested list of atoms that have visited this site at each timestep.

Type:list(list(int))
points

List of fractional coordinates for atoms assigned as occupying this site.

Type:list
transitions

Stores observed transitions from this site to other sites. Format is {index: count} with index giving the index of each destination site, and count giving the number of observed transitions to this site.

Type:collections.Counter
as_dict() → Dict[KT, VT][source]

Json-serializable dict representation of this Site.

Parameters:None
Returns:(dict)
centre() → numpy.ndarray[source]

Returns the centre point of this site.

This method should be implemented in the derived subclass.

Parameters:None
Returns:None
contains_atom(atom: site_analysis.atom.Atom, *args, **kwargs) → bool[source]

Test whether this site contains a specific atom.

Parameters:atom (Atom) – The atom to test.
Returns:(bool)
contains_point(x: numpy.ndarray, *args, **kwargs) → bool[source]

Test whether the fractional coordinate x is contained by this site.

This method should be implemented in the derived subclass

Parameters:x (np.array) – Fractional coordinate.
Returns:(bool)

Note

Specific Site subclasses may require additional arguments to be passed.

coordination_number() → int[source]

Returns the coordination number of this site.

This method should be implemented in the derived subclass.

Parameters:None
Returns:int
classmethod from_dict(d: Dict[KT, VT]) → site_analysis.site.Site[source]

Create a Site object from a dict representation.

Parameters:d (dict) – The dict representation of this Site.
Returns:(Site)
reset() → None[source]

Reset the trajectory for this site.

Returns the contains_atoms and trajectory attributes to empty lists.

Parameters:None
Returns:None
classmethod reset_index(newid: int = 0) → None[source]

Reset the site index counter.

Parameters:(int (newid) – optional): New starting index. Default is 1.
Returns:None