Neighbour analysis

Coordination polyhedra that share vertex atoms are neighbours. The type of sharing – corner, edge, or face – is determined by the number of shared vertices.

All examples assume you have a Configuration with polyhedra already constructed:

poly = config.polyhedra[0]

Finding neighbours

The neighbours() method returns all neighbouring polyhedra (those sharing at least one vertex):

poly.neighbours()  # tuple of CoordinationPolyhedron objects

Shared vertices

To see which vertices are shared with each neighbour, use neighbours_by_index_and_shared_vertices():

poly.neighbours_by_index_and_shared_vertices()
# {3: (8, 12), 5: (8,), 7: (12, 14, 16), ...}

The keys are neighbouring polyhedron indices and the values are tuples of shared vertex atom indices.

Corner-sharing neighbours

Polyhedra that share exactly one vertex:

poly.corner_sharing_neighbour_list()
# (5, 9, ...)

Returns a tuple of indices for corner-sharing neighbours.

Edge-sharing neighbours

Polyhedra that share exactly two vertices:

poly.edge_sharing_neighbour_list()
# (3, ...)

Returns a tuple of indices for edge-sharing neighbours.

Face-sharing neighbours

Polyhedra that share three or more vertices:

poly.face_sharing_neighbour_list()
# (7, ...)

Returns a tuple of indices for face-sharing neighbours.

Configuration-level neighbour lists

The Configuration class provides a convenience method to compute face-sharing neighbours for all polyhedra at once:

config.face_sharing_neighbour_list(labels=['Ti'])
# {0: (7,), 1: (), 3: (7,), ...}

This returns a dictionary mapping each polyhedron index to a tuple of its face-sharing neighbour indices.