cifkit.utils.cif_parser module

Parses attributes from a .cif file.

cifkit.utils.cif_parser.check_unique_atom_site_labels(file_path: str)[source]

Check whether all parsed atom site labels are unique.

cifkit.utils.cif_parser.get_cif_block(file_path: str) Block[source]

Return CIF block from file path.

cifkit.utils.cif_parser.get_formula_structure_weight_s_group(block: Block) tuple[str, str, float, int, str][source]

Return the unit cell lengths.

cifkit.utils.cif_parser.get_label_occupancy_coordinates(loop_values: list, i) tuple[str, float, tuple[float, float, float]][source]

Return atom information (label, occupancy, coordinates) for the i-th atom.

cifkit.utils.cif_parser.get_line_content_from_tag(file_path: str, start_keyword: str) list[str][source]

Returns a list containing file content with starting keyword.

This function only appropriate for PCD format for removing the author section.

cifkit.utils.cif_parser.get_loop_tags() list[str][source]

Return tags commonly used for atomic description.

cifkit.utils.cif_parser.get_loop_value_dict(loop_values: list) dict[str, dict[str, Any]][source]

Create a dictionary containing CIF loop values for each label.

cifkit.utils.cif_parser.get_loop_values(block: Block) list[Column][source]

Retrieve a list of predefined loop tags for atomic site description.

If a tag is not found, None is inserted in its place in the list.

cifkit.utils.cif_parser.get_start_end_line_indexes(file_path: str, start_keyword: str) tuple[int, int][source]

Find the starting and ending indexes of the lines in atom_site_loop.

cifkit.utils.cif_parser.get_tag_from_third_line(file_path: str, db_source='PCD') str[source]

Extract the tag from the provided CIF file path appropriate for PCD db source only.

cifkit.utils.cif_parser.get_unique_elements_from_loop(loop_values: list) set[str][source]

Return a list of alphabetically sorted unique elements from loop values.

cifkit.utils.cif_parser.get_unique_formulas_structures_weights_s_groups(file_path_list: list[str]) tuple[set[str], set[str], set[float], set[int], set[str]][source]

Find all unique structures, formulas, weights, space groups.

This function requires no initialization and should be more efficient in analyzing and filtering a dataset.

cifkit.utils.cif_parser.get_unique_label_count(loop_values: list) int[source]

Count the number of labels in the loop.

cifkit.utils.cif_parser.get_unique_site_labels(loop_values: list) list[str][source]

Return a list of atom labels from loop values.

cifkit.utils.cif_parser.get_unitcell_angles_rad(block: Block) list[float][source]

Return the unit cell angles.

cifkit.utils.cif_parser.get_unitcell_lengths(block: Block) list[float][source]

Return the unit cell lengths.

cifkit.utils.cif_parser.parse_atom_site_occupancy_info(file_path: str) dict[source]

Parse atom site loop information including element, occupancy, fractional coordinates, multiplicity, and wyckoff symbol.