cifkit.models.cif module

class cifkit.models.cif.Cif(file_path: str, is_formatted=False, logging_enabled=False, supercell_size=3, compute_CN=False)[source]

Bases: object

property CN_avg_by_best_methods
property CN_avg_by_min_dist_method
property CN_best_methods

Determines the optimal coordination method for each atomic site.

For each atomic site, the coordination polyhedron is generated for each method in self.CN_max_gap_per_site. The method with the smallest value of polyhedron_metrics[“distance_from_avg_point_to_center”], indicating the highest symmetry of the polyhedron, is selected as the “best method” among the four methods used to determine the CN gap in self.CN_max_gap_per_site.

Returns:

Dictionary where each key represents an atomic site, and the corresponding value is a dictionary containing:

  • volume_of_polyhedron (float): The volume of the polyhedron surrounding

the atomic site. - distance_from_avg_point_to_center (float): The average distance from the polyhedron’s vertices to its geometric center, used as a measure of symmetry. - number_of_vertices (int): The number of vertices in the coordination polyhedron. - number_of_edges (int): The number of edges connecting vertices in the polyhedron. - number_of_faces (int): The number of faces in the coordination polyhedron. - shortest_distance_to_face (float): The shortest distance between the atomic site and the nearest face. - shortest_distance_to_edge (float): The shortest distance between the atomic site and the nearest edge. - volume_of_inscribed_sphere (float): Volume of the largest sphere that can it inside the polyhedron. - packing_efficiency (float): A measure of how efficiently the polyhedron is packed around the atomic site. - method_used (str): The name of the chosen method (e.g., dist_by_shortest_dist) providing the highest symmetry based on distance_from_avg_point_to_center.

Return type:

dict[str, dict[str, float | int | str]]]

Examples

>>> CN_best_methods = cif_URhIn.CN_best_methods
>>> CN_best_methods["In1"]["number_of_vertices"] == 14
>>> CN_best_methods["Rh2"]["number_of_vertices"] == 9
>>> CN_best_methods["In1"]["method_used"] == "dist_by_shortest_dist"
>>> CN_best_methods["Rh2"]["method_used"] == "dist_by_shortest_dist"
property CN_bond_count_by_best_methods
property CN_bond_count_by_best_methods_sorted_by_mendeleev
property CN_bond_count_by_min_dist_method
property CN_bond_count_by_min_dist_method_sorted_by_mendeleev
property CN_bond_fractions_by_best_methods
property CN_bond_fractions_by_best_methods_sorted_by_mendeleev
property CN_bond_fractions_by_min_dist_method
property CN_bond_fractions_by_min_dist_method_sorted_by_mendeleev
property CN_connections_by_best_methods
property CN_connections_by_min_dist_method
property CN_max_by_best_methods
property CN_max_by_min_dist_method
property CN_max_gap_per_site

Determines the maximum gap in coordination number (CN) for each atomic site.

For each atomic site, considers the first 20 nearest neighbors. The distances to these neighbors are normalized based on four methods:

  • dist_by_shortest_dist: Normalization by the shortest distance from the site.

  • dist_by_CIF_radius_sum: Normalization by the sum of CIF radii.

  • dist_by_CIF_radius_refined_sum: Normalization by the sum of refined CIF radii.

  • dist_by_Pauling_radius_sum: Normalization by the sum of Pauling radii.

The radius sums are calculated for each element pair involved. For each normalization method, the maximum gap is determined as the largest difference between consecutive normalized distances (i.e., the difference between the nth and (n-1)th neighbors).

This CN gap provides insight into the bonding relevance for each site.

Returns:

A dictionary where each key represents an atomic site, mapping to another dictionary with normalization methods as keys. Each normalization method contains a dictionary with:

  • max_gap (float): The maximum gap in the normalized distances.

  • CN (int): Coordination number based on the normalization method.

Return type:

dict of dict of dict

Examples

>>> cif.CN_max_gap_per_site
{
    "In1": {
        "dist_by_shortest_dist": {"max_gap": 0.306, "CN": 14},
        "dist_by_CIF_radius_sum": {"max_gap": 0.39, "CN": 14},
        "dist_by_CIF_radius_refined_sum": {"max_gap": 0.341, "CN": 12},
        "dist_by_Pauling_radius_sum": {"max_gap": 0.398, "CN": 14},
    },
    "U1": {
        "dist_by_shortest_dist": {"max_gap": 0.197, "CN": 11},
        "dist_by_CIF_radius_sum": {"max_gap": 0.312, "CN": 11},
        "dist_by_CIF_radius_refined_sum": {"max_gap": 0.27, "CN": 17},
        "dist_by_Pauling_radius_sum": {"max_gap": 0.256, "CN": 17},
    },
    "Rh1": {
        "dist_by_shortest_dist": {"max_gap": 0.315, "CN": 9},
        "dist_by_CIF_radius_sum": {"max_gap": 0.347, "CN": 9},
        "dist_by_CIF_radius_refined_sum": {"max_gap": 0.418, "CN": 9},
        "dist_by_Pauling_radius_sum": {"max_gap": 0.402, "CN": 9},
    },
    "Rh2": {
        "dist_by_shortest_dist": {"max_gap": 0.31, "CN": 9},
        "dist_by_CIF_radius_sum": {"max_gap": 0.324, "CN": 9},
        "dist_by_CIF_radius_refined_sum": {"max_gap": 0.397, "CN": 9},
        "dist_by_Pauling_radius_sum": {"max_gap": 0.380, "CN": 9},
    },
}
property CN_min_by_best_methods
property CN_min_by_min_dist_method
property CN_unique_values_by_best_methods
property CN_unique_values_by_min_dist_method
compute_CN() None[source]

Compute onnection network, shortest distances, bond counts, and coordination numbers (CN). These prperties are lazily loaded to avoid unnecessary computation during the initialization and pre-processing step.

Parameters:

cutoff_radius (float, default=10.0) – The distance threshold in Angstroms used to consider two atoms as connected.

compute_connections(cutoff_radius=10.0) None[source]

Compute onnection network, shortest distances, bond counts, and coordination numbers (CN). These prperties are lazily loaded to avoid unnecessary computation during the initialization and pre-processing step.

Parameters:

cutoff_radius (float, default=10.0) – The distance threshold in Angstroms used to consider two atoms as connected.

property connections_flattened
get_polyhedron_labels_by_CN_best_methods(label: str) tuple[list[list[float]], list[str]][source]
get_polyhedron_labels_by_CN_min_dist_method(label: str) tuple[list[list[float]], list[str]][source]
plot_polyhedron(site_label: str, show_labels=True, is_displayed=False, output_dir=None) None[source]

Function to plot a polyhedron structure and optionally saves it.

Parameters:
  • site_label (str) – Central site label for the polyhedron

  • show_labels (bool, optional) – Whether to display vertex labels, by default True

  • is_displayed (bool, optional) – Display plot interactively, by default False

  • output_dir (str, optional) – Directory to save the plot, by default None

property radius_sum
property radius_values
property shortest_bond_pair_distance
property shortest_distance
property shortest_site_pair_distance
cifkit.models.cif.ensure_connections(func)[source]

For accessing lazy properties and methods, compute connections.