Coordination#

Low-level coordination helpers behind Cif.compute_CN(). Prefer the Cif attributes (CN_max_gap_per_site, CN_best_methods, …) unless you need these functions directly.

CN method keys (exact): dist_by_shortest_dist, dist_by_CIF_radius_sum, dist_by_CIF_radius_refined_sum, dist_by_Pauling_radius_sum.

Quick reference · Physical features tutorial · llms.txt

CN determination methods#

cifkit.coordination.method.get_rad_sum_value(rad_sum_data, method_name: str, ref_label: str, other_label: str) float#

Return the sum of radii value for a given pair of elements, ensuring the pair is alphabetically sorted.

Best-method selection#

cifkit.coordination.filter.find_best_polyhedron(max_gaps_per_label, connections)#

Find the best polyhedron for each label based on the minimum distance between the reference atom to the average position of connected atoms.

Polyhedron geometry#

cifkit.coordination.geometry.get_polyhedron_coordinates_labels(connections: dict, label: str) tuple[list[list[float]], list[str]]#

Return a list of Cartesian coordinates and labels.

The central atom is the last index.

cifkit.coordination.geometry.compute_polyhedron_metrics(polyhedron_points, hull)#

Compute various metrics related to a given polyhedron.

Bond composition#

cifkit.coordination.composition.get_bond_counts(elements: list[str], connections: dict[str, list], sorted_by_mendeleev=False) dict[str, dict[tuple[str, str], int]]#

Return a dictionary containing bond pairs and counts per label site.

cifkit.coordination.composition.get_bond_fractions(bond_pair_data: dict) dict[tuple[str, str], float]#

Calculate the fraction of each bond type across all labels.

cifkit.coordination.composition.count_connections_per_site(connections: dict) dict[str, int]#

Calculate the coordination number for each atom site.

cifkit.coordination.composition.compute_avg_CN(connections: dict[str, int]) float#

Calculate the average coordination number across all sites.

cifkit.coordination.composition.get_unique_CN_values(connections: dict) set[int]#

Return unique coordination numbers from all sites.

Connections and sites#

cifkit.coordination.connection.get_CN_connections_by_best_methods(best_methods, connections: dict) dict#

Retrieve connections limited by the number of vertices (CN) for each label.

cifkit.coordination.site.get_min_distance_pair(connections: dict) tuple[tuple[str, str], float]#

Return an alphabetically sorted element pair with the global minimum distance in the entire supercell.

cifkit.coordination.site.get_min_distance_pair_per_site_label(connections: dict) list[tuple[tuple[str, str], float]]#

Return a list of tuples containing element pairs and the minimum distance from each site label in the loop.

cifkit.coordination.site_distance.get_shortest_distance(connections: dict) float#

Return the shortest distance in the supercell.

cifkit.coordination.site_distance.get_shortest_distance_per_site(connections: dict) dict[str, tuple[str, float]]#

Calculate the shortest distance for each label.

cifkit.coordination.bond_distance.get_shortest_distance_per_bond_pair(flattened_connections: list[tuple[tuple[str, str], float]]) dict[tuple[str, str], float]#

Determine the min distance for all possible unique pair of elements.