diff --git a/notebooks/00_Intro/index.html b/notebooks/00_Intro/index.html index efa20de..3309d97 100644 --- a/notebooks/00_Intro/index.html +++ b/notebooks/00_Intro/index.html @@ -377,6 +377,17 @@ + + @@ -387,6 +398,43 @@ + + + + @@ -970,6 +1018,21 @@
You can also run the examples using Google Codelab by clicking the link below:
+ +If you find cifkit
beneficial for your research, or if you are considering its usage, please do not hesitate to contact me. You can reach out via the email provided on my GitHub profile.
Unique formulas: {'ErCoIn5', 'Er5In3', 'Er10Co9In20'} +Unique formulas: {'Er5In3', 'ErCoIn5', 'Er10Co9In20'} Unique elements: {'In', 'Er', 'Co'} Unique structures: {'Ho10Ni9In20', 'HoCoGa5', 'Mn5Si3'} Unique atomic mixing types: {'full_occupancy'} @@ -1438,7 +1438,7 @@Get overall stats by attribute
{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif'}@@ -1655,7 +1655,7 @@
File paths containing Er or Co or In: -{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif'} +{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'} File paths containing Er and In: {'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'} @@ -1744,7 +1744,7 @@Filter by range
File paths with min distance between 1.0 Å and 3.0 Å: - {'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif'} + {'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif'} File paths with supercell atom count above 500 and below 3000: - {'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif'} + {'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}
The purpose of this guide is to illustrate some of the main features that cifkit
provides. It assumes a very basic knowledge of Python.
cifkit
is an open source CIF library that supports supercell generation and provide tools for high-throuhgput analysis. It also provides various tools for determining coordination numbers, plotting polyhedrons from each site based on the coordination numbers, bond fractions, move and copy .cif
files based on a set of attributes, and determine atomic mixing information in 2-3 lines of code.
Install cifkit
via:
pip install cifkit\n
You may need to download other dependencies:
pip install cifkit pyvista gemmi\n
gemmi
is used for parsing .cif
files. pyvista
is used for plotting polyhedrons.
cifkit
offers a class called CifEnsemble
which handles many .cif
files in a high-throuhgput way. You can initialize the object using the folder path containing .cif
files shown below.
from cifkit import CifEnsemble\n\n# Initialize\nensemble = CifEnsemble(\"tests/data/cif/ensemble_test\")\n\n# Initialize including nested files\nensemble = CifEnsemble(\"tests/data/cif/ensemble_test\", add_nested_files=True)\n\n# Folder path\nensemble.cif_folder_path\n# \"tests/data/cif/ensemble_test\"\n
If you do not have .cif
files for testing, cifkit
also provides a set of .cif
files accessible.
from cifkit import CifEnsemble, Example\nfrom cifkit import Example\n\n# Initalize with the file path\nensemble = CifEnsemble(Example.ErCoIn_big_folder_path)\n
"},{"location":"#get-unique-attributes","title":"Get unique attributes","text":"Use the ensemble
object to get unique attributes such as elements, formulas, etc.
# Unique formulas\nensemble.unique_formulas\n# {\"EuIr2Ge2\", \"CeRu2Ge2\", \"LaRu2Ge2\", \"Mo\"}\n\n# Unique structures\nensemble.unique_structures\n# {\"CeAl2Ga2\", \"W\"}\n\n# Unique elements\nensemble.unique_elements\n# {\"La\", \"Ru\", \"Ge\", \"Ir\", \"Eu\", \"Ce\", \"Mo\"}\n\n# Unique space group names\nensemble.unique_space_group_names\n# {\"I4/mmm\", \"Im-3m\"}\n\n# Unique space group numbers\nensemble.unique_space_group_numbers\n# {139, 229}\n\n# Unique tags\nensemble.unique_tags\n# {\"hex\", \"rt\", \"rt_hex\", \"\"}\n
"},{"location":"#get-distances-and-supercell-size-per-file","title":"Get distances and supercell size per file","text":"The following computes the size of each supercell and the minimum distance per file.
# Get min distance per file\nensemble.minimum_distances\n# [(\"tests/data/cif/ensemble_test/250709.cif\", 2.725),\n# (\"tests/data/cif/ensemble_test/300171.cif\", 2.383),\n# (\"tests/data/cif/ensemble_test/300170.cif\", 2.28)]\n\n# Get supercell size per file\nensemble_test.supercell_atom_counts\n# [(\"tests/data/cif/ensemble_test/250709.cif\", 54),\n# (\"tests/data/cif/ensemble_test/300171.cif\", 360),\n# (\"tests/data/cif/ensemble_test/300170.cif\", 360)]\n
"},{"location":"#filter-files-by-attributes","title":"Filter files by attributes","text":"The following returns a set of file paths to each .cif
file.
# By formulas\nensemble_test.filter_by_formulas([\"LaRu2Ge2\"])\nensemble_test.filter_by_formulas([\"LaRu2Ge2\", \"Mo\"])\n\n# By structures\nensemble_test.filter_by_structures([\"W\"])\nensemble_test.filter_by_structures(\"CeAl2Ga2\")\n\n# By space group\nensemble_test.filter_by_space_group_names(\"Im-3m\")\n\n# By space group numbers\nensemble_test.filter_by_space_group_numbers([139])\n
"},{"location":"#move-and-copy-files","title":"Move and copy files","text":"Now you have a set of file paths with example below, you can copy and move files to a specific directroy. For high-throuhgout analysis, you might be interested in separating files based on tags, elements, coordination numbers, etc.
file_paths = {\n \"tests/data/cif/ensemble_test/300169.cif\",\n \"tests/data/cif/ensemble_test/300171.cif\",\n \"tests/data/cif/ensemble_test/300170.cif\",\n}\n\n# To move files\nensemble.move_cif_files(file_paths, dest_dir_path)\n\n# To copy files\nensemble.copy_cif_files(file_paths, dest_dir_path)\n
"},{"location":"#are-you-ready","title":"Are you ready?","text":"Now, if you are interested in working with individual .cif
files and learn more about all features in cifkit
, let's visit the Example notebooks
section here!
cifkit
","text":"pip install cifkit\npip install cifkit
In Google Codelab, pyvista
and gemmi
need to be installed.
pip install cifkit pyvista gemmi\npip install cifkit pyvista gemmi"},{"location":"notebooks/00_Intro/#installation","title":"Installation\u00b6","text":"
cifkit
supports Python versions 3.10, 3.11, and 3.12.
You can initialize Cif
object using a file path to the .cif
file. Or you can simply use the example .cif
provided in cifkit
below.
from cifkit import Example\nfrom cifkit import Cif\n\n# Initalize with the example file provided\ncif = Cif(Example.Er10Co9In20_file_path)\n\n# Print attributes\nprint(\"File name:\", cif.file_name)\nprint(\"Formula:\", cif.formula)\nprint(\"Unique element:\", cif.unique_elements)\nfrom cifkit import Example from cifkit import Cif # Initalize with the example file provided cif = Cif(Example.Er10Co9In20_file_path) # Print attributes print(\"File name:\", cif.file_name) print(\"Formula:\", cif.formula) print(\"Unique element:\", cif.unique_elements)
File name: Er10Co9In20.cif\nFormula: Er10Co9In20\nUnique element: {'Co', 'In', 'Er'}\nIn\u00a0[2]: Copied!
from cifkit import Cif, Example\nimport json\n\n# Utility function for printing dictionary\ndef prettify_dict(dict_data):\n return json.dumps(dict_data, indent=4)\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\n# Print instantly available properties\nprint(\"Formula:\", cif.formula)\nprint(\"Structure:\", cif.structure)\nprint(\"Unique elements:\", cif.unique_elements)\nprint(\"Unitcell lenghts:\", cif.unitcell_lengths)\nprint(\"Unitcell angles:\", cif.unitcell_angles)\nprint(\"Site labels:\", cif.site_labels)\nprint(\"Weight:\", cif.weight)\nprint(\"Atomic mixing type:\", cif.site_mixing_type)\nprint(\"Space group number:\", cif.space_group_number)\nprint(\"Space group number:\", cif.space_group_name)\nprint(\"Composition type:\", cif.composition_type) # 3 -> Ternary\nprint(\"Tag:\", cif.tag)\nprint(\"Atom_site_info:\", prettify_dict(cif.atom_site_info))\nprint(\"Wyckoff_symbol of Er1:\", cif.atom_site_info[\"Er\"][\"wyckoff_symbol\"])\nfrom cifkit import Cif, Example import json # Utility function for printing dictionary def prettify_dict(dict_data): return json.dumps(dict_data, indent=4) # Initialize cif = Cif(Example.ErCoIn5_file_path) # Print instantly available properties print(\"Formula:\", cif.formula) print(\"Structure:\", cif.structure) print(\"Unique elements:\", cif.unique_elements) print(\"Unitcell lenghts:\", cif.unitcell_lengths) print(\"Unitcell angles:\", cif.unitcell_angles) print(\"Site labels:\", cif.site_labels) print(\"Weight:\", cif.weight) print(\"Atomic mixing type:\", cif.site_mixing_type) print(\"Space group number:\", cif.space_group_number) print(\"Space group number:\", cif.space_group_name) print(\"Composition type:\", cif.composition_type) # 3 -> Ternary print(\"Tag:\", cif.tag) print(\"Atom_site_info:\", prettify_dict(cif.atom_site_info)) print(\"Wyckoff_symbol of Er1:\", cif.atom_site_info[\"Er\"][\"wyckoff_symbol\"])
Formula: ErCoIn5\nStructure: HoCoGa5\nUnique elements: {'Co', 'In', 'Er'}\nUnitcell lenghts: [4.54, 4.54, 7.397]\nUnitcell angles: [1.5708, 1.5708, 1.5708]\nSite labels: ['In2', 'In1', 'Co', 'Er']\nWeight: 800.3\nAtomic mixing type: full_occupancy\nSpace group number: 123\nSpace group number: P4/mmm\nComposition type: 3\nTag: rt\nAtom_site_info: {\n \"In2\": {\n \"element\": \"In\",\n \"site_occupancy\": 1.0,\n \"x_frac_coord\": 0.0,\n \"y_frac_coord\": 0.5,\n \"z_frac_coord\": 0.30474,\n \"symmetry_multiplicity\": 4,\n \"wyckoff_symbol\": \"i\"\n },\n \"In1\": {\n \"element\": \"In\",\n \"site_occupancy\": 1.0,\n \"x_frac_coord\": 0.5,\n \"y_frac_coord\": 0.5,\n \"z_frac_coord\": 0.0,\n \"symmetry_multiplicity\": 1,\n \"wyckoff_symbol\": \"c\"\n },\n \"Co\": {\n \"element\": \"Co\",\n \"site_occupancy\": 1.0,\n \"x_frac_coord\": 0.0,\n \"y_frac_coord\": 0.0,\n \"z_frac_coord\": 0.5,\n \"symmetry_multiplicity\": 1,\n \"wyckoff_symbol\": \"b\"\n },\n \"Er\": {\n \"element\": \"Er\",\n \"site_occupancy\": 1.0,\n \"x_frac_coord\": 0.0,\n \"y_frac_coord\": 0.0,\n \"z_frac_coord\": 0.0,\n \"symmetry_multiplicity\": 1,\n \"wyckoff_symbol\": \"a\"\n }\n}\nWyckoff_symbol of Er1: a\nIn\u00a0[3]: Copied!
from cifkit import Cif, Example\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\n# Utility function for printing a set of tuples\ndef print_tuples(tuples):\n for pair in tuples:\n print(f\"({pair[0]}, {pair[1]})\")\n\n# All bond pairs\nprint(\"\\nAll possible bond pairs:\")\nprint_tuples(cif.bond_pairs)\n\nprint(\"\\nAll possible bond pairs sorted by Mendeleev:\")\nprint_tuples(cif.bond_pairs_sorted_by_mendeleev)\n\n# All label pairs\nprint(\"\\nAll possible label pairs from the formula:\")\nprint_tuples(cif.site_label_pairs)\n\nprint(\"\\nAll possible label pairs sorted by Mendeleev:\")\nprint_tuples(cif.site_label_pairs_sorted_by_mendeleev)\n\n# Atomic mixing per pair\nprint(\"\\nAtomic mixing per label pair:\")\nprint((cif.mixing_info_per_label_pair))\n\nprint(\"\\nAtomic mixing per label pair sorted by Mendeleev:\")\nprint(cif.mixing_info_per_label_pair_sorted_by_mendeleev)\nfrom cifkit import Cif, Example # Initialize cif = Cif(Example.ErCoIn5_file_path) # Utility function for printing a set of tuples def print_tuples(tuples): for pair in tuples: print(f\"({pair[0]}, {pair[1]})\") # All bond pairs print(\"\\nAll possible bond pairs:\") print_tuples(cif.bond_pairs) print(\"\\nAll possible bond pairs sorted by Mendeleev:\") print_tuples(cif.bond_pairs_sorted_by_mendeleev) # All label pairs print(\"\\nAll possible label pairs from the formula:\") print_tuples(cif.site_label_pairs) print(\"\\nAll possible label pairs sorted by Mendeleev:\") print_tuples(cif.site_label_pairs_sorted_by_mendeleev) # Atomic mixing per pair print(\"\\nAtomic mixing per label pair:\") print((cif.mixing_info_per_label_pair)) print(\"\\nAtomic mixing per label pair sorted by Mendeleev:\") print(cif.mixing_info_per_label_pair_sorted_by_mendeleev)
\nAll possible bond pairs:\n(Er, Er)\n(Co, Co)\n(Er, In)\n(Co, Er)\n(In, In)\n(Co, In)\n\nAll possible bond pairs sorted by Mendeleev:\n(Er, Er)\n(Co, Co)\n(Er, In)\n(In, In)\n(Co, In)\n(Er, Co)\n\nAll possible label pairs from the formula:\n(Er, Er)\n(Er, In2)\n(In1, In2)\n(Co, Co)\n(Co, Er)\n(Er, In1)\n(In1, In1)\n(Co, In2)\n(Co, In1)\n(In2, In2)\n\nAll possible label pairs sorted by Mendeleev:\n(Er, Er)\n(Co, Co)\n(Er, In2)\n(In1, In2)\n(Er, In1)\n(In1, In1)\n(Co, In2)\n(Co, In1)\n(Er, Co)\n(In2, In2)\n\nAtomic mixing per label pair:\n{('Er', 'Er'): 'full_occupancy', ('Er', 'In2'): 'full_occupancy', ('In1', 'In2'): 'full_occupancy', ('Co', 'Co'): 'full_occupancy', ('Co', 'Er'): 'full_occupancy', ('Er', 'In1'): 'full_occupancy', ('In1', 'In1'): 'full_occupancy', ('Co', 'In2'): 'full_occupancy', ('Co', 'In1'): 'full_occupancy', ('In2', 'In2'): 'full_occupancy'}\n\nAtomic mixing per label pair sorted by Mendeleev:\n{('Er', 'Er'): 'full_occupancy', ('Co', 'Co'): 'full_occupancy', ('Er', 'In2'): 'full_occupancy', ('In1', 'In2'): 'full_occupancy', ('Er', 'In1'): 'full_occupancy', ('In1', 'In1'): 'full_occupancy', ('Co', 'In2'): 'full_occupancy', ('Co', 'In1'): 'full_occupancy', ('Er', 'Co'): 'full_occupancy', ('In2', 'In2'): 'full_occupancy'}\nIn\u00a0[4]: Copied!
from cifkit import Cif, Example\n\ndef print_connected_points(all_labels_connections):\n \"\"\"\n Utility function for printing connections per site label\n \"\"\"\n for label, connections in all_labels_connections.items():\n print(f\"\\nAtom site {label}:\")\n for (\n connected_label,\n dist,\n coords_1,\n coords_2,\n ) in connections:\n print(f\"{connected_label} {dist} {coords_1}, {coords_2}\")\n\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\n# Print CN Connections\nprint(\"\\nFind CN_connections_by_min_dist_method:\")\nprint_connected_points(cif.CN_connections_by_min_dist_method)\n\nprint(\"\\nFind CN_connections_by_best_methods:\")\nprint_connected_points(cif.CN_connections_by_best_methods)\nfrom cifkit import Cif, Example def print_connected_points(all_labels_connections): \"\"\" Utility function for printing connections per site label \"\"\" for label, connections in all_labels_connections.items(): print(f\"\\nAtom site {label}:\") for ( connected_label, dist, coords_1, coords_2, ) in connections: print(f\"{connected_label} {dist} {coords_1}, {coords_2}\") # Initialize cif = Cif(Example.ErCoIn5_file_path) # Print CN Connections print(\"\\nFind CN_connections_by_min_dist_method:\") print_connected_points(cif.CN_connections_by_min_dist_method) print(\"\\nFind CN_connections_by_best_methods:\") print_connected_points(cif.CN_connections_by_best_methods)
\nFind CN_connections_by_min_dist_method:\n\nAtom site In2:\nCo 2.691 [0.0, -2.27, -2.254], [0.0, -4.54, -3.698]\nCo 2.691 [0.0, -2.27, -2.254], [0.0, 0.0, -3.698]\nIn2 2.889 [0.0, -2.27, -2.254], [0.0, -2.27, -5.143]\nIn1 3.199 [0.0, -2.27, -2.254], [-2.27, -2.27, 0.0]\nEr 3.199 [0.0, -2.27, -2.254], [0.0, 0.0, 0.0]\nEr 3.199 [0.0, -2.27, -2.254], [0.0, -4.54, 0.0]\nIn1 3.199 [0.0, -2.27, -2.254], [2.27, -2.27, 0.0]\nIn2 3.21 [0.0, -2.27, -2.254], [2.27, -4.54, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [-2.27, 0.0, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [2.27, 0.0, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [-2.27, -4.54, -2.254]\n\nAtom site In1:\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 4.54, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, -0.0, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 4.54, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [-0.0, 2.27, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [4.54, 2.27, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 0.0, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [-0.0, 2.27, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [4.54, 2.27, 2.254]\nEr 3.21 [2.27, 2.27, 0.0], [-0.0, 4.54, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [0.0, 0.0, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [4.54, 4.54, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [4.54, 0.0, 0.0]\n\nAtom site Co:\nIn2 2.691 [-0.0, -0.0, 3.698], [-2.27, -0.0, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, -2.27, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [2.27, -0.0, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, 2.27, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, 2.27, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [2.27, -0.0, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-2.27, -0.0, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [0.0, -2.27, 2.254]\n\nAtom site Er:\nIn2 3.199 [0.0, 0.0, 0.0], [2.27, -0.0, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-0.0, 2.27, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-2.27, 0.0, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [0.0, -2.27, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [2.27, 0.0, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-0.0, 2.27, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-2.27, -0.0, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [0.0, -2.27, 2.254]\nIn1 3.21 [0.0, 0.0, 0.0], [2.27, 2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [-2.27, -2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [2.27, -2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [-2.27, 2.27, 0.0]\nCo 3.698 [0.0, 0.0, 0.0], [-0.0, -0.0, 3.698]\nCo 3.698 [0.0, 0.0, 0.0], [0.0, 0.0, -3.698]\nEr 4.54 [0.0, 0.0, 0.0], [-0.0, 4.54, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [0.0, -4.54, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [4.54, 0.0, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [-4.54, 0.0, 0.0]\n\nFind CN_connections_by_best_methods:\n\nAtom site In2:\nCo 2.691 [0.0, -2.27, -2.254], [0.0, -4.54, -3.698]\nCo 2.691 [0.0, -2.27, -2.254], [0.0, 0.0, -3.698]\nIn2 2.889 [0.0, -2.27, -2.254], [0.0, -2.27, -5.143]\nIn1 3.199 [0.0, -2.27, -2.254], [-2.27, -2.27, 0.0]\nEr 3.199 [0.0, -2.27, -2.254], [0.0, 0.0, 0.0]\nEr 3.199 [0.0, -2.27, -2.254], [0.0, -4.54, 0.0]\nIn1 3.199 [0.0, -2.27, -2.254], [2.27, -2.27, 0.0]\nIn2 3.21 [0.0, -2.27, -2.254], [2.27, -4.54, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [-2.27, 0.0, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [2.27, 0.0, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [-2.27, -4.54, -2.254]\n\nAtom site In1:\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 4.54, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, -0.0, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 4.54, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [-0.0, 2.27, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [4.54, 2.27, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 0.0, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [-0.0, 2.27, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [4.54, 2.27, 2.254]\nEr 3.21 [2.27, 2.27, 0.0], [-0.0, 4.54, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [0.0, 0.0, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [4.54, 4.54, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [4.54, 0.0, 0.0]\n\nAtom site Co:\nIn2 2.691 [-0.0, -0.0, 3.698], [-2.27, -0.0, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, -2.27, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [2.27, -0.0, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, 2.27, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, 2.27, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [2.27, -0.0, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-2.27, -0.0, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [0.0, -2.27, 2.254]\nEr 3.698 [-0.0, -0.0, 3.698], [0.0, 0.0, 0.0]\nEr 3.698 [-0.0, -0.0, 3.698], [-0.0, -0.0, 7.397]\nCo 4.54 [-0.0, -0.0, 3.698], [4.54, -0.0, 3.698]\nCo 4.54 [-0.0, -0.0, 3.698], [-4.54, -0.0, 3.698]\nCo 4.54 [-0.0, -0.0, 3.698], [-0.0, 4.54, 3.698]\nCo 4.54 [-0.0, -0.0, 3.698], [0.0, -4.54, 3.698]\n\nAtom site Er:\nIn2 3.199 [0.0, 0.0, 0.0], [2.27, -0.0, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-0.0, 2.27, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-2.27, 0.0, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [0.0, -2.27, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [2.27, 0.0, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-0.0, 2.27, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-2.27, -0.0, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [0.0, -2.27, 2.254]\nIn1 3.21 [0.0, 0.0, 0.0], [2.27, 2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [-2.27, -2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [2.27, -2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [-2.27, 2.27, 0.0]\nCo 3.698 [0.0, 0.0, 0.0], [-0.0, -0.0, 3.698]\nCo 3.698 [0.0, 0.0, 0.0], [0.0, 0.0, -3.698]\nEr 4.54 [0.0, 0.0, 0.0], [-0.0, 4.54, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [0.0, -4.54, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [4.54, 0.0, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [-4.54, 0.0, 0.0]\nIn\u00a0[5]: Copied!
from cifkit import Cif, Example\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\nprint(\"Shortest distance:\", cif.shortest_distance)\nprint(\"Shortest bond pair distances:\", cif.shortest_bond_pair_distance)\nprint(\"Shortest site pair distances:\", cif.shortest_site_pair_distance)\nfrom cifkit import Cif, Example # Initialize cif = Cif(Example.ErCoIn5_file_path) print(\"Shortest distance:\", cif.shortest_distance) print(\"Shortest bond pair distances:\", cif.shortest_bond_pair_distance) print(\"Shortest site pair distances:\", cif.shortest_site_pair_distance)
Shortest distance: 2.691\nShortest bond pair distances: {('Co', 'In'): 2.691, ('In', 'In'): 2.889, ('Er', 'In'): 3.199, ('Co', 'Er'): 3.698, ('Co', 'Co'): 4.54, ('Er', 'Er'): 4.54}\nShortest site pair distances: {'In2': ('Co', 2.691), 'In1': ('In2', 3.199), 'Co': ('In2', 2.691), 'Er': ('In2', 3.199)}\nIn\u00a0[6]: Copied!
from cifkit import Cif, Example\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\n# Bond counts\nprint(\"\\nCN_bond_count_by_min_dist_method:\")\nprint(cif.CN_bond_count_by_min_dist_method)\n\nprint(\"\\nCN_bond_count_by_min_dist_method_sorted_by_mendeleev:\")\nprint(cif.CN_bond_count_by_min_dist_method_sorted_by_mendeleev)\n\nprint(\"\\nCN_bond_count_by_best_methods:\")\nprint(cif.CN_bond_count_by_best_methods)\n\nprint(\"\\nCN_bond_count_by_best_methods_sorted_by_mendeleev:\")\nprint(cif.CN_bond_count_by_best_methods_sorted_by_mendeleev)\n\n# Bond fractions\nprint(\"\\nCN_bond_fractions_by_min_dist_method:\")\nprint(cif.CN_bond_fractions_by_min_dist_method)\n\nprint(\"\\nCN_bond_fractions_by_min_dist_method_sorted_by_mendeleev:\")\nprint(cif.CN_bond_fractions_by_min_dist_method_sorted_by_mendeleev)\n\nprint(\"\\nCN_bond_fractions_by_best_methods:\")\nprint(cif.CN_bond_fractions_by_best_methods)\n\nprint(\"\\nCN_bond_fractions_by_best_methods_sorted_by_mendeleev:\")\nprint(cif.CN_bond_fractions_by_best_methods_sorted_by_mendeleev)\n\n# Unique coordination numbers\nprint(\"\\nCN_unique_values_by_min_dist_method\")\nprint(cif.CN_unique_values_by_min_dist_method)\n\nprint(\"\\nCN_unique_values_by_best_methods\")\nprint(cif.CN_unique_values_by_best_methods)\n\n# Average coordination number\nprint(\"\\nCN_avg_by_min_dist_method:\")\nprint(cif.CN_avg_by_min_dist_method)\n\nprint(\"\\nCN_avg_by_best_methods: \")\nprint(cif.CN_avg_by_best_methods)\n\n# Min coordination number\nprint(\"\\nCN_max_by_min_dist_method:\")\nprint(cif.CN_max_by_min_dist_method)\n\nprint(\"\\nCN_max_by_best_methods:\")\nprint(cif.CN_max_by_best_methods)\n\n# Max coordination number\nprint(\"\\nCN_min_by_min_dist_method:\")\nprint(cif.CN_min_by_min_dist_method)\n\nprint(\"\\nCN_min_by_best_methods:\")\nprint(cif.CN_min_by_best_methods)\nfrom cifkit import Cif, Example # Initialize cif = Cif(Example.ErCoIn5_file_path) # Bond counts print(\"\\nCN_bond_count_by_min_dist_method:\") print(cif.CN_bond_count_by_min_dist_method) print(\"\\nCN_bond_count_by_min_dist_method_sorted_by_mendeleev:\") print(cif.CN_bond_count_by_min_dist_method_sorted_by_mendeleev) print(\"\\nCN_bond_count_by_best_methods:\") print(cif.CN_bond_count_by_best_methods) print(\"\\nCN_bond_count_by_best_methods_sorted_by_mendeleev:\") print(cif.CN_bond_count_by_best_methods_sorted_by_mendeleev) # Bond fractions print(\"\\nCN_bond_fractions_by_min_dist_method:\") print(cif.CN_bond_fractions_by_min_dist_method) print(\"\\nCN_bond_fractions_by_min_dist_method_sorted_by_mendeleev:\") print(cif.CN_bond_fractions_by_min_dist_method_sorted_by_mendeleev) print(\"\\nCN_bond_fractions_by_best_methods:\") print(cif.CN_bond_fractions_by_best_methods) print(\"\\nCN_bond_fractions_by_best_methods_sorted_by_mendeleev:\") print(cif.CN_bond_fractions_by_best_methods_sorted_by_mendeleev) # Unique coordination numbers print(\"\\nCN_unique_values_by_min_dist_method\") print(cif.CN_unique_values_by_min_dist_method) print(\"\\nCN_unique_values_by_best_methods\") print(cif.CN_unique_values_by_best_methods) # Average coordination number print(\"\\nCN_avg_by_min_dist_method:\") print(cif.CN_avg_by_min_dist_method) print(\"\\nCN_avg_by_best_methods: \") print(cif.CN_avg_by_best_methods) # Min coordination number print(\"\\nCN_max_by_min_dist_method:\") print(cif.CN_max_by_min_dist_method) print(\"\\nCN_max_by_best_methods:\") print(cif.CN_max_by_best_methods) # Max coordination number print(\"\\nCN_min_by_min_dist_method:\") print(cif.CN_min_by_min_dist_method) print(\"\\nCN_min_by_best_methods:\") print(cif.CN_min_by_best_methods)
\nCN_bond_count_by_min_dist_method:\n{'In2': {('Co', 'In'): 2, ('In', 'In'): 7, ('Er', 'In'): 2}, 'In1': {('In', 'In'): 8, ('Er', 'In'): 4}, 'Co': {('Co', 'In'): 8}, 'Er': {('Er', 'In'): 12, ('Co', 'Er'): 2, ('Er', 'Er'): 4}}\n\nCN_bond_count_by_min_dist_method_sorted_by_mendeleev:\n{'In2': {('Co', 'In'): 2, ('In', 'In'): 7, ('Er', 'In'): 2}, 'In1': {('In', 'In'): 8, ('Er', 'In'): 4}, 'Co': {('Co', 'In'): 8}, 'Er': {('Er', 'In'): 12, ('Er', 'Co'): 2, ('Er', 'Er'): 4}}\n\nCN_bond_count_by_best_methods:\n{'In2': {('Co', 'In'): 2, ('In', 'In'): 7, ('Er', 'In'): 2}, 'In1': {('In', 'In'): 8, ('Er', 'In'): 4}, 'Co': {('Co', 'In'): 8, ('Co', 'Er'): 2, ('Co', 'Co'): 4}, 'Er': {('Er', 'In'): 12, ('Co', 'Er'): 2, ('Er', 'Er'): 4}}\n\nCN_bond_count_by_best_methods_sorted_by_mendeleev:\n{'In2': {('Co', 'In'): 2, ('In', 'In'): 7, ('Er', 'In'): 2}, 'In1': {('In', 'In'): 8, ('Er', 'In'): 4}, 'Co': {('Co', 'In'): 8, ('Er', 'Co'): 2, ('Co', 'Co'): 4}, 'Er': {('Er', 'In'): 12, ('Er', 'Co'): 2, ('Er', 'Er'): 4}}\n\nCN_bond_fractions_by_min_dist_method:\n{('Co', 'In'): 0.204, ('In', 'In'): 0.306, ('Er', 'In'): 0.367, ('Co', 'Er'): 0.041, ('Er', 'Er'): 0.082}\n\nCN_bond_fractions_by_min_dist_method_sorted_by_mendeleev:\n{('Co', 'In'): 0.204, ('In', 'In'): 0.306, ('Er', 'In'): 0.367, ('Er', 'Co'): 0.041, ('Er', 'Er'): 0.082}\n\nCN_bond_fractions_by_best_methods:\n{('Co', 'In'): 0.182, ('In', 'In'): 0.273, ('Er', 'In'): 0.327, ('Co', 'Er'): 0.073, ('Co', 'Co'): 0.073, ('Er', 'Er'): 0.073}\n\nCN_bond_fractions_by_best_methods_sorted_by_mendeleev:\n{('Co', 'In'): 0.182, ('In', 'In'): 0.273, ('Er', 'In'): 0.327, ('Er', 'Co'): 0.073, ('Co', 'Co'): 0.073, ('Er', 'Er'): 0.073}\n\nCN_unique_values_by_min_dist_method\n{8, 18, 11, 12}\n\nCN_unique_values_by_best_methods\n{18, 11, 12, 14}\n\nCN_avg_by_min_dist_method:\n12.25\n\nCN_avg_by_best_methods: \n13.75\n\nCN_max_by_min_dist_method:\n18\n\nCN_max_by_best_methods:\n18\n\nCN_min_by_min_dist_method:\n8\n\nCN_min_by_best_methods:\n11\nIn\u00a0[7]: Copied!
from cifkit import Cif, Example\nimport warnings\nwarnings.filterwarnings('ignore') # For Jupyter Notebook only\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\n# Enter site labels. you can get site labels using cif.labels\nprint(\"Site labels:\", cif.site_labels)\n\n# Plot\ncif.plot_polyhedron(\"In1\", is_displayed=True)\nfrom cifkit import Cif, Example import warnings warnings.filterwarnings('ignore') # For Jupyter Notebook only # Initialize cif = Cif(Example.ErCoIn5_file_path) # Enter site labels. you can get site labels using cif.labels print(\"Site labels:\", cif.site_labels) # Plot cif.plot_polyhedron(\"In1\", is_displayed=True)
Site labels: ['In2', 'In1', 'Co', 'Er']\n"},{"location":"notebooks/01_cif/#cif","title":"CIF\u00b6","text":"
The Cif
class generates an object for each .cif
file. Each object can
The Cif
class provides a set of accessible properties that can be accessed. Each object is intialized with the file_path
to the .cif
file.
Tag is parsed from the thrid line of each .cif
file. Some databases such as Pearson's Crystal Data offers tags for each file.
mixing_info_per_label_pair
and mixing_info_per_label_pair_sorted_by_mendeleev
return site mixing information at the pair level.Each bonding pair or each file is defined with one of four atomic mixing categories:
This section involves computing distances between atoms. Unlike instant properties, these properties may require extensive computation, typically ranging from 1-2 seconds for larger supercells containing more than 3,000 atoms.
These properties are loaded lazily, meaning accessing any of the properties will execute compute_connections()
internally. This function will then compute connections
, providing all the nearest neighbors for each site.
There are options in the Cif
class to use either the by_d_min_method
or by_best_methods
. Please refer to the README.md
for complete documentation.
You can get the shortest distance from each site label or the shortest distance for each possible bond pair.
"},{"location":"notebooks/01_cif/#get-computed-properties-coordination-numbers","title":"Get computed properties - coordination numbers\u00b6","text":"Compute avg
, min
, max
, unique
of coordination numbers determined by one of the best methods or min distance method.
You may use Jupyter
notebook or a python script to execute the following to generate and save a polyhedron generated from each site and the nearest neighbor atoms are determined from the coordination number geometry.
from cifkit import CifEnsemble, Example\n\n# Initialize\nensemble = CifEnsemble(Example.ErCoIn_folder_path)\nfrom cifkit import CifEnsemble, Example # Initialize ensemble = CifEnsemble(Example.ErCoIn_folder_path)
\nCIF Preprocessing in Example.ErCoIn_folder_path begun...\n\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif (1/3)\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif (2/3)\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif (3/3)\n\nSUMMARY\n# of files moved to 'error_operations' folder: 0\n# of files moved to 'error_duplicate_labels' folder: 0\n# of files moved to 'error_wrong_loop_value' folder: 0\n# of files moved to 'error_coords' folder: 0\n# of files moved to 'error_invalid_label' folder: 0\n# of files moved to 'error_others' folder: 0\n\nIn\u00a0[11]: Copied!
# Initialize with nested .cif files in the folder\nensemble_nested = CifEnsemble(Example.ErCoIn_folder_path, add_nested_files=True)\n# Initialize with nested .cif files in the folder ensemble_nested = CifEnsemble(Example.ErCoIn_folder_path, add_nested_files=True)
\nCIF Preprocessing in Example.ErCoIn_folder_path begun...\n\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif (1/3)\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif (2/3)\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif (3/3)\n\nSUMMARY\n# of files moved to 'error_operations' folder: 0\n# of files moved to 'error_duplicate_labels' folder: 0\n# of files moved to 'error_wrong_loop_value' folder: 0\n# of files moved to 'error_coords' folder: 0\n# of files moved to 'error_invalid_label' folder: 0\n# of files moved to 'error_others' folder: 0\n\nIn\u00a0[12]: Copied!
# Get .cif file count in the folder\nprint(\"File count:\", ensemble.file_count) # 6\n\n# Get the directory path\nprint(\"Directory path:\", ensemble.dir_path)\n\n# Get all file paths in the folder\nprint(\"File paths:\", ensemble.file_paths)\n\n# Get all Cif objects initialized\nprint(\"Cif objects:\", ensemble.cifs)\n# Get .cif file count in the folder print(\"File count:\", ensemble.file_count) # 6 # Get the directory path print(\"Directory path:\", ensemble.dir_path) # Get all file paths in the folder print(\"File paths:\", ensemble.file_paths) # Get all Cif objects initialized print(\"Cif objects:\", ensemble.cifs)
File count: 3\nDirectory path: Example.ErCoIn_folder_path\nFile paths: ['/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif']\nCif objects: [<cifkit.models.cif.Cif object at 0x16c818980>, <cifkit.models.cif.Cif object at 0x16c86a2d0>, <cifkit.models.cif.Cif object at 0x16c8cb0b0>]\nIn\u00a0[13]: Copied!
# Print each property for each .cif file\nfor cif in ensemble.cifs:\n print(f\"\\n{cif.file_name}\")\n print(\"Formula:\", cif.formula)\n print(\"Tag:\", cif.tag)\n print(\"Mixing type:\", cif.site_mixing_type)\n print(\"Unique bond pairs:\", cif.bond_pairs)\n# Print each property for each .cif file for cif in ensemble.cifs: print(f\"\\n{cif.file_name}\") print(\"Formula:\", cif.formula) print(\"Tag:\", cif.tag) print(\"Mixing type:\", cif.site_mixing_type) print(\"Unique bond pairs:\", cif.bond_pairs)
\nEr10Co9In20.cif\nFormula: Er10Co9In20\nTag: \nMixing type: full_occupancy\nUnique bond pairs: {('Er', 'Er'), ('Co', 'In'), ('In', 'In'), ('Co', 'Er'), ('Er', 'In'), ('Co', 'Co')}\n\nEr5In3.cif\nFormula: Er5In3\nTag: \nMixing type: full_occupancy\nUnique bond pairs: {('Er', 'Er'), ('In', 'In'), ('Er', 'In')}\n\nErCoIn5.cif\nFormula: ErCoIn5\nTag: rt\nMixing type: full_occupancy\nUnique bond pairs: {('Er', 'Er'), ('Co', 'In'), ('In', 'In'), ('Co', 'Er'), ('Er', 'In'), ('Co', 'Co')}\nIn\u00a0[14]: Copied!
# Get unique formulas\nprint(\"Unique formulas:\", ensemble.unique_formulas)\n\n# Get unique elements\nprint(\"Unique elements:\", ensemble.unique_elements)\n\n# Get unique structures\nprint(\"Unique structures:\", ensemble.unique_structures)\n\n# Get unique atomix mixing types\nprint(\"Unique atomic mixing types:\", ensemble.unique_site_mixing_types)\n\n# Get unique elements\nprint(\"Unique elements including nested:\", ensemble_nested.unique_elements)\n\n# Get unique space group names\nprint(\"Unique space group names:\", ensemble.unique_space_group_names)\n\n# Get unique space group numbers\nprint(\"Unique space group numbers:\",ensemble.unique_space_group_numbers)\n\n# Get unique tags\nprint(\"Unique tags:\", ensemble.unique_tags)\n\n# Get unique composition types\nprint(\"Unique composition types:\", ensemble.unique_composition_types)\n# Get unique formulas print(\"Unique formulas:\", ensemble.unique_formulas) # Get unique elements print(\"Unique elements:\", ensemble.unique_elements) # Get unique structures print(\"Unique structures:\", ensemble.unique_structures) # Get unique atomix mixing types print(\"Unique atomic mixing types:\", ensemble.unique_site_mixing_types) # Get unique elements print(\"Unique elements including nested:\", ensemble_nested.unique_elements) # Get unique space group names print(\"Unique space group names:\", ensemble.unique_space_group_names) # Get unique space group numbers print(\"Unique space group numbers:\",ensemble.unique_space_group_numbers) # Get unique tags print(\"Unique tags:\", ensemble.unique_tags) # Get unique composition types print(\"Unique composition types:\", ensemble.unique_composition_types)
Unique formulas: {'ErCoIn5', 'Er5In3', 'Er10Co9In20'}\nUnique elements: {'In', 'Er', 'Co'}\nUnique structures: {'Ho10Ni9In20', 'HoCoGa5', 'Mn5Si3'}\nUnique atomic mixing types: {'full_occupancy'}\nUnique elements including nested: {'In', 'Er', 'Co'}\nUnique space group names: {'P4/nmm(originchoice2)', 'P63/mcm', 'P4/mmm'}\nUnique space group numbers: {129, 123, 193}\nUnique tags: {'', 'rt'}\nUnique composition types: {2, 3}\nIn\u00a0[15]: Copied!
# Get file count per structure\nprint(\"Structure stats:\", ensemble.structure_stats)\n\n# Get file count per formula\nprint(\"Formula stats:\", ensemble.formula_stats)\n\n# Get file count per tag\nprint(\"Tag stats:\", ensemble.tag_stats)\n\n# Get file count per space group number\nprint(\"Space group number stats:\", ensemble.space_group_number_stats)\n\n# Get file count per space group name\nprint(\"Space group name stats:\", ensemble.space_group_name_stats)\n\n# Get file count per composition type\nprint(\"Composition type stats:\", ensemble.composition_type_stats)\n\n# Get file count per Element\nprint(\"Unique elements stats:\", ensemble.unique_elements_stats)\n\n# Get file count per site mixing type\nprint(\"Site mixing type stats:\", ensemble.site_mixing_type_stats)\n\n# Get file count per supercell atom count\nprint(\"Supercell size stats:\", ensemble.supercell_size_stats)\n\n# Get file count per min distance\nprint(\"Min distance stats:\", ensemble.min_distance_stats)\n\n# Get file count per CN value by min dist method\nprint(\"CN value using min dist method stats:\", ensemble.unique_CN_values_by_min_dist_method_stat)\n\n# Get file count per CN value by best methods\nprint(\"CN value using best methods stats:\", ensemble.unique_CN_values_by_method_methods_stat)\n# Get file count per structure print(\"Structure stats:\", ensemble.structure_stats) # Get file count per formula print(\"Formula stats:\", ensemble.formula_stats) # Get file count per tag print(\"Tag stats:\", ensemble.tag_stats) # Get file count per space group number print(\"Space group number stats:\", ensemble.space_group_number_stats) # Get file count per space group name print(\"Space group name stats:\", ensemble.space_group_name_stats) # Get file count per composition type print(\"Composition type stats:\", ensemble.composition_type_stats) # Get file count per Element print(\"Unique elements stats:\", ensemble.unique_elements_stats) # Get file count per site mixing type print(\"Site mixing type stats:\", ensemble.site_mixing_type_stats) # Get file count per supercell atom count print(\"Supercell size stats:\", ensemble.supercell_size_stats) # Get file count per min distance print(\"Min distance stats:\", ensemble.min_distance_stats) # Get file count per CN value by min dist method print(\"CN value using min dist method stats:\", ensemble.unique_CN_values_by_min_dist_method_stat) # Get file count per CN value by best methods print(\"CN value using best methods stats:\", ensemble.unique_CN_values_by_method_methods_stat)
Structure stats: {'Ho10Ni9In20': 1, 'Mn5Si3': 1, 'HoCoGa5': 1}\nFormula stats: {'Er10Co9In20': 1, 'Er5In3': 1, 'ErCoIn5': 1}\nTag stats: {'': 2, 'rt': 1}\nSpace group number stats: {129: 1, 193: 1, 123: 1}\nSpace group name stats: {'P4/nmm(originchoice2)': 1, 'P63/mcm': 1, 'P4/mmm': 1}\nComposition type stats: {3: 2, 2: 1}\nUnique elements stats: {'Er': 3, 'In': 3, 'Co': 2}\nSite mixing type stats: {'full_occupancy': 3}\nSupercell size stats: {2654: 1, 558: 1, 255: 1}\nMin distance stats: {2.626: 1, 3.102: 1, 2.691: 1}\nCN value using min dist method stats: {10: 1, 12: 2, 13: 1, 14: 2, 16: 1, 17: 1, 11: 2, 15: 1, 8: 1, 18: 1}\nCN value using best methods stats: {10: 1, 12: 2, 13: 1, 14: 3, 16: 1, 17: 1, 11: 2, 15: 1, 18: 1}\nIn\u00a0[16]: Copied!
# Return file paths by formulas\nensemble.filter_by_formulas([\"ErCoIn\", \"Er10Co9In20\"]) \n\n# Return file paths by structures\nensemble.filter_by_structures([\"Mn5Si3\"])\n\n# Return file paths by space group names\nensemble.filter_by_space_group_names([\"P4/mmm\"])\n\n# Return file paths by space group numbers\nensemble.filter_by_space_group_numbers([123])\n\n# Return file paths by site mixing types\nensemble.filter_by_site_mixing_types([\"full_occupancy\"])\nensemble.filter_by_site_mixing_types([\"full_occupancy\", \"deficiency_without_atomic_mixing\"])\n\n# Return file paths by composition types (1-> unary, 2-> binary)\nensemble.filter_by_composition_types([3])\n# Return file paths by formulas ensemble.filter_by_formulas([\"ErCoIn\", \"Er10Co9In20\"]) # Return file paths by structures ensemble.filter_by_structures([\"Mn5Si3\"]) # Return file paths by space group names ensemble.filter_by_space_group_names([\"P4/mmm\"]) # Return file paths by space group numbers ensemble.filter_by_space_group_numbers([123]) # Return file paths by site mixing types ensemble.filter_by_site_mixing_types([\"full_occupancy\"]) ensemble.filter_by_site_mixing_types([\"full_occupancy\", \"deficiency_without_atomic_mixing\"]) # Return file paths by composition types (1-> unary, 2-> binary) ensemble.filter_by_composition_types([3]) Out[16]:
{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif',\n '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif'}In\u00a0[51]: Copied!
print(\"\\nFile paths containing Er or Co or In:\")\nprint(ensemble.filter_by_elements_containing([\"Er\", \"Co\", \"In\"])) # \n\nprint(\"\\nFile paths containing Er and In:\")\nprint(ensemble.filter_by_elements_exact_matching([\"Er\", \"In\"]))\n\nprint(\"\\nFile paths containing CN value of 15:\")\nprint(ensemble.filter_by_CN_min_dist_method_containing([15]))\nprint(ensemble.filter_by_CN_best_methods_containing([15]))\n\nprint(\"\\nFile paths containing CN value of 11, 14, and 15:\")\nprint(ensemble.filter_by_CN_min_dist_method_exact_matching([11, 14, 15]))\nprint(ensemble.filter_by_CN_best_methods_exact_matching([11, 14, 15]))\nprint(\"\\nFile paths containing Er or Co or In:\") print(ensemble.filter_by_elements_containing([\"Er\", \"Co\", \"In\"])) # print(\"\\nFile paths containing Er and In:\") print(ensemble.filter_by_elements_exact_matching([\"Er\", \"In\"])) print(\"\\nFile paths containing CN value of 15:\") print(ensemble.filter_by_CN_min_dist_method_containing([15])) print(ensemble.filter_by_CN_best_methods_containing([15])) print(\"\\nFile paths containing CN value of 11, 14, and 15:\") print(ensemble.filter_by_CN_min_dist_method_exact_matching([11, 14, 15])) print(ensemble.filter_by_CN_best_methods_exact_matching([11, 14, 15]))
\nFile paths containing Er or Co or In:\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif'}\n\nFile paths containing Er and In:\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\n\nFile paths containing CN value of 15:\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\n\nFile paths containing CN value of 11, 14, and 15:\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\nIn\u00a0[52]: Copied!
# Return a set of .cif file paths with min distance between 1.0 \u00c5 and 3.0 \u00c5\nprint(\"File paths with min distance between 1.0 \u00c5 and 3.0 \u00c5:\\n\", ensemble.filter_by_min_distance(1.0, 3.0))\n\n# Return a set of .cif file paths with supercell atom count above 500 and below 3000.\nprint(\"File paths with supercell atom count above 500 and below 3000:\\n\",ensemble.filter_by_supercell_count(300, 3000))\n# Return a set of .cif file paths with min distance between 1.0 \u00c5 and 3.0 \u00c5 print(\"File paths with min distance between 1.0 \u00c5 and 3.0 \u00c5:\\n\", ensemble.filter_by_min_distance(1.0, 3.0)) # Return a set of .cif file paths with supercell atom count above 500 and below 3000. print(\"File paths with supercell atom count above 500 and below 3000:\\n\",ensemble.filter_by_supercell_count(300, 3000))
File paths with min distance between 1.0 \u00c5 and 3.0 \u00c5:\n {'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif'}\nFile paths with supercell atom count above 500 and below 3000:\n {'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif'}\n"},{"location":"notebooks/02_cif_ensemble/#cifensemble","title":"CifEnsemble\u00b6","text":"
For high-throuhgput analysis, you can initialize multiple .cif
files using CifEnsemble
.
CifEnsemble
standardizes the site labels in atom_site_label
. Some site labels may contain a comma or a symbol such as M due to atomic mixing. CBA reformats each atom_site_label
so it can be parsed into an element type that matches atom_site_type_symbol.
CifEnsemble
removes the content of publ_author_address
. This section often has an incorrect format that otherwise requires manual modifications.
CifEnsemble
relocates any ill-formatted files, such as those with duplicate labels in atom_site_label
, missing fractional coordinates, or files that require supercell generation.
You can also use the add_nested_files
flag to include .cif
files that are located in folders within the folder path provided.
Once the object is created, you can get instant properties suhc as file count, folder path, etc.
"},{"location":"notebooks/02_cif_ensemble/#get-individual-cif-properties","title":"Get individual .cif properties\u00b6","text":"The CifEnsemble
object contains a property called cifs
which contains a list of Cif
objects. You may loop through each to access both instant and computed properties described in the previous CIF
section.
You can get all unique attributres such as formulas, elements, etc in the folder.
"},{"location":"notebooks/02_cif_ensemble/#get-overall-stats-by-attribute","title":"Get overall stats by attribute\u00b6","text":"Get the number of files for each unique properties.
"},{"location":"notebooks/02_cif_ensemble/#filter-cif-containing-specific-attributes","title":"Filter .cif containing specific attributes\u00b6","text":""},{"location":"notebooks/02_cif_ensemble/#filter-cif-by-specific-attributes","title":"Filter .cif by specific attributes\u00b6","text":"Filter .cif files either containing a set of items or files that exactly contain the values passed. cifkit
supports elements and coordination numbers.
Assume you have a set of file paths filered using the functions described in the previous section. Since we are using Jupyter and with predefined examples, you need to provide file_paths
and dest_dir_path
for your system.
file_paths = {\n \"tests/data/cif/ensemble_test/300169.cif\",\n \"tests/data/cif/ensemble_test/300171.cif\",\n \"tests/data/cif/ensemble_test/300170.cif\",\n}\n\n# To move files\nensemble.move_cif_files(file_paths, dest_dir_path)\n\n# To copy files\nensemble.copy_cif_files(file_paths, dest_dir_path)\n"}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Getting started","text":"
The purpose of this guide is to illustrate some of the main features that cifkit
provides. It assumes a very basic knowledge of Python.
cifkit
is an open source CIF library that supports supercell generation and provide tools for high-throuhgput analysis. It also provides various tools for determining coordination numbers, plotting polyhedrons from each site based on the coordination numbers, bond fractions, move and copy .cif
files based on a set of attributes, and determine atomic mixing information in 2-3 lines of code.
Install cifkit
via:
pip install cifkit\n
You may need to download other dependencies:
pip install cifkit pyvista gemmi\n
gemmi
is used for parsing .cif
files. pyvista
is used for plotting polyhedrons.
cifkit
offers a class called CifEnsemble
which handles many .cif
files in a high-throuhgput way. You can initialize the object using the folder path containing .cif
files shown below.
from cifkit import CifEnsemble\n\n# Initialize\nensemble = CifEnsemble(\"tests/data/cif/ensemble_test\")\n\n# Initialize including nested files\nensemble = CifEnsemble(\"tests/data/cif/ensemble_test\", add_nested_files=True)\n\n# Folder path\nensemble.cif_folder_path\n# \"tests/data/cif/ensemble_test\"\n
If you do not have .cif
files for testing, cifkit
also provides a set of .cif
files accessible.
from cifkit import CifEnsemble, Example\nfrom cifkit import Example\n\n# Initalize with the file path\nensemble = CifEnsemble(Example.ErCoIn_big_folder_path)\n
"},{"location":"#get-unique-attributes","title":"Get unique attributes","text":"Use the ensemble
object to get unique attributes such as elements, formulas, etc.
# Unique formulas\nensemble.unique_formulas\n# {\"EuIr2Ge2\", \"CeRu2Ge2\", \"LaRu2Ge2\", \"Mo\"}\n\n# Unique structures\nensemble.unique_structures\n# {\"CeAl2Ga2\", \"W\"}\n\n# Unique elements\nensemble.unique_elements\n# {\"La\", \"Ru\", \"Ge\", \"Ir\", \"Eu\", \"Ce\", \"Mo\"}\n\n# Unique space group names\nensemble.unique_space_group_names\n# {\"I4/mmm\", \"Im-3m\"}\n\n# Unique space group numbers\nensemble.unique_space_group_numbers\n# {139, 229}\n\n# Unique tags\nensemble.unique_tags\n# {\"hex\", \"rt\", \"rt_hex\", \"\"}\n
"},{"location":"#get-distances-and-supercell-size-per-file","title":"Get distances and supercell size per file","text":"The following computes the size of each supercell and the minimum distance per file.
# Get min distance per file\nensemble.minimum_distances\n# [(\"tests/data/cif/ensemble_test/250709.cif\", 2.725),\n# (\"tests/data/cif/ensemble_test/300171.cif\", 2.383),\n# (\"tests/data/cif/ensemble_test/300170.cif\", 2.28)]\n\n# Get supercell size per file\nensemble_test.supercell_atom_counts\n# [(\"tests/data/cif/ensemble_test/250709.cif\", 54),\n# (\"tests/data/cif/ensemble_test/300171.cif\", 360),\n# (\"tests/data/cif/ensemble_test/300170.cif\", 360)]\n
"},{"location":"#filter-files-by-attributes","title":"Filter files by attributes","text":"The following returns a set of file paths to each .cif
file.
# By formulas\nensemble_test.filter_by_formulas([\"LaRu2Ge2\"])\nensemble_test.filter_by_formulas([\"LaRu2Ge2\", \"Mo\"])\n\n# By structures\nensemble_test.filter_by_structures([\"W\"])\nensemble_test.filter_by_structures(\"CeAl2Ga2\")\n\n# By space group\nensemble_test.filter_by_space_group_names(\"Im-3m\")\n\n# By space group numbers\nensemble_test.filter_by_space_group_numbers([139])\n
"},{"location":"#move-and-copy-files","title":"Move and copy files","text":"Now you have a set of file paths with example below, you can copy and move files to a specific directroy. For high-throuhgout analysis, you might be interested in separating files based on tags, elements, coordination numbers, etc.
file_paths = {\n \"tests/data/cif/ensemble_test/300169.cif\",\n \"tests/data/cif/ensemble_test/300171.cif\",\n \"tests/data/cif/ensemble_test/300170.cif\",\n}\n\n# To move files\nensemble.move_cif_files(file_paths, dest_dir_path)\n\n# To copy files\nensemble.copy_cif_files(file_paths, dest_dir_path)\n
"},{"location":"#are-you-ready","title":"Are you ready?","text":"Now, if you are interested in working with individual .cif
files and learn more about all features in cifkit
, let's visit the Example notebooks
section here!
cifkit
","text":"pip install cifkit\npip install cifkit
In Google Codelab, pyvista
and gemmi
need to be installed.
pip install cifkit pyvista gemmi\npip install cifkit pyvista gemmi"},{"location":"notebooks/00_Intro/#installation","title":"Installation\u00b6","text":"
cifkit
supports Python versions 3.10, 3.11, and 3.12.
You can also run the examples using Google Codelab by clicking the link below:
"},{"location":"notebooks/00_Intro/#feedback-help","title":"Feedback & help\u00b6","text":"If you find cifkit
beneficial for your research, or if you are considering its usage, please do not hesitate to contact me. You can reach out via the email provided on my GitHub profile.
You can initialize Cif
object using a file path to the .cif
file. Or you can simply use the example .cif
provided in cifkit
below.
from cifkit import Example\nfrom cifkit import Cif\n\n# Initalize with the example file provided\ncif = Cif(Example.Er10Co9In20_file_path)\n\n# Print attributes\nprint(\"File name:\", cif.file_name)\nprint(\"Formula:\", cif.formula)\nprint(\"Unique element:\", cif.unique_elements)\nfrom cifkit import Example from cifkit import Cif # Initalize with the example file provided cif = Cif(Example.Er10Co9In20_file_path) # Print attributes print(\"File name:\", cif.file_name) print(\"Formula:\", cif.formula) print(\"Unique element:\", cif.unique_elements)
File name: Er10Co9In20.cif\nFormula: Er10Co9In20\nUnique element: {'Co', 'In', 'Er'}\nIn\u00a0[2]: Copied!
from cifkit import Cif, Example\nimport json\n\n# Utility function for printing dictionary\ndef prettify_dict(dict_data):\n return json.dumps(dict_data, indent=4)\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\n# Print instantly available properties\nprint(\"Formula:\", cif.formula)\nprint(\"Structure:\", cif.structure)\nprint(\"Unique elements:\", cif.unique_elements)\nprint(\"Unitcell lenghts:\", cif.unitcell_lengths)\nprint(\"Unitcell angles:\", cif.unitcell_angles)\nprint(\"Site labels:\", cif.site_labels)\nprint(\"Weight:\", cif.weight)\nprint(\"Atomic mixing type:\", cif.site_mixing_type)\nprint(\"Space group number:\", cif.space_group_number)\nprint(\"Space group number:\", cif.space_group_name)\nprint(\"Composition type:\", cif.composition_type) # 3 -> Ternary\nprint(\"Tag:\", cif.tag)\nprint(\"Atom_site_info:\", prettify_dict(cif.atom_site_info))\nprint(\"Wyckoff_symbol of Er1:\", cif.atom_site_info[\"Er\"][\"wyckoff_symbol\"])\nfrom cifkit import Cif, Example import json # Utility function for printing dictionary def prettify_dict(dict_data): return json.dumps(dict_data, indent=4) # Initialize cif = Cif(Example.ErCoIn5_file_path) # Print instantly available properties print(\"Formula:\", cif.formula) print(\"Structure:\", cif.structure) print(\"Unique elements:\", cif.unique_elements) print(\"Unitcell lenghts:\", cif.unitcell_lengths) print(\"Unitcell angles:\", cif.unitcell_angles) print(\"Site labels:\", cif.site_labels) print(\"Weight:\", cif.weight) print(\"Atomic mixing type:\", cif.site_mixing_type) print(\"Space group number:\", cif.space_group_number) print(\"Space group number:\", cif.space_group_name) print(\"Composition type:\", cif.composition_type) # 3 -> Ternary print(\"Tag:\", cif.tag) print(\"Atom_site_info:\", prettify_dict(cif.atom_site_info)) print(\"Wyckoff_symbol of Er1:\", cif.atom_site_info[\"Er\"][\"wyckoff_symbol\"])
Formula: ErCoIn5\nStructure: HoCoGa5\nUnique elements: {'Co', 'In', 'Er'}\nUnitcell lenghts: [4.54, 4.54, 7.397]\nUnitcell angles: [1.5708, 1.5708, 1.5708]\nSite labels: ['In2', 'In1', 'Co', 'Er']\nWeight: 800.3\nAtomic mixing type: full_occupancy\nSpace group number: 123\nSpace group number: P4/mmm\nComposition type: 3\nTag: rt\nAtom_site_info: {\n \"In2\": {\n \"element\": \"In\",\n \"site_occupancy\": 1.0,\n \"x_frac_coord\": 0.0,\n \"y_frac_coord\": 0.5,\n \"z_frac_coord\": 0.30474,\n \"symmetry_multiplicity\": 4,\n \"wyckoff_symbol\": \"i\"\n },\n \"In1\": {\n \"element\": \"In\",\n \"site_occupancy\": 1.0,\n \"x_frac_coord\": 0.5,\n \"y_frac_coord\": 0.5,\n \"z_frac_coord\": 0.0,\n \"symmetry_multiplicity\": 1,\n \"wyckoff_symbol\": \"c\"\n },\n \"Co\": {\n \"element\": \"Co\",\n \"site_occupancy\": 1.0,\n \"x_frac_coord\": 0.0,\n \"y_frac_coord\": 0.0,\n \"z_frac_coord\": 0.5,\n \"symmetry_multiplicity\": 1,\n \"wyckoff_symbol\": \"b\"\n },\n \"Er\": {\n \"element\": \"Er\",\n \"site_occupancy\": 1.0,\n \"x_frac_coord\": 0.0,\n \"y_frac_coord\": 0.0,\n \"z_frac_coord\": 0.0,\n \"symmetry_multiplicity\": 1,\n \"wyckoff_symbol\": \"a\"\n }\n}\nWyckoff_symbol of Er1: a\nIn\u00a0[3]: Copied!
from cifkit import Cif, Example\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\n# Utility function for printing a set of tuples\ndef print_tuples(tuples):\n for pair in tuples:\n print(f\"({pair[0]}, {pair[1]})\")\n\n# All bond pairs\nprint(\"\\nAll possible bond pairs:\")\nprint_tuples(cif.bond_pairs)\n\nprint(\"\\nAll possible bond pairs sorted by Mendeleev:\")\nprint_tuples(cif.bond_pairs_sorted_by_mendeleev)\n\n# All label pairs\nprint(\"\\nAll possible label pairs from the formula:\")\nprint_tuples(cif.site_label_pairs)\n\nprint(\"\\nAll possible label pairs sorted by Mendeleev:\")\nprint_tuples(cif.site_label_pairs_sorted_by_mendeleev)\n\n# Atomic mixing per pair\nprint(\"\\nAtomic mixing per label pair:\")\nprint((cif.mixing_info_per_label_pair))\n\nprint(\"\\nAtomic mixing per label pair sorted by Mendeleev:\")\nprint(cif.mixing_info_per_label_pair_sorted_by_mendeleev)\nfrom cifkit import Cif, Example # Initialize cif = Cif(Example.ErCoIn5_file_path) # Utility function for printing a set of tuples def print_tuples(tuples): for pair in tuples: print(f\"({pair[0]}, {pair[1]})\") # All bond pairs print(\"\\nAll possible bond pairs:\") print_tuples(cif.bond_pairs) print(\"\\nAll possible bond pairs sorted by Mendeleev:\") print_tuples(cif.bond_pairs_sorted_by_mendeleev) # All label pairs print(\"\\nAll possible label pairs from the formula:\") print_tuples(cif.site_label_pairs) print(\"\\nAll possible label pairs sorted by Mendeleev:\") print_tuples(cif.site_label_pairs_sorted_by_mendeleev) # Atomic mixing per pair print(\"\\nAtomic mixing per label pair:\") print((cif.mixing_info_per_label_pair)) print(\"\\nAtomic mixing per label pair sorted by Mendeleev:\") print(cif.mixing_info_per_label_pair_sorted_by_mendeleev)
\nAll possible bond pairs:\n(Er, Er)\n(Co, Co)\n(Er, In)\n(Co, Er)\n(In, In)\n(Co, In)\n\nAll possible bond pairs sorted by Mendeleev:\n(Er, Er)\n(Co, Co)\n(Er, In)\n(In, In)\n(Co, In)\n(Er, Co)\n\nAll possible label pairs from the formula:\n(Er, Er)\n(Er, In2)\n(In1, In2)\n(Co, Co)\n(Co, Er)\n(Er, In1)\n(In1, In1)\n(Co, In2)\n(Co, In1)\n(In2, In2)\n\nAll possible label pairs sorted by Mendeleev:\n(Er, Er)\n(Co, Co)\n(Er, In2)\n(In1, In2)\n(Er, In1)\n(In1, In1)\n(Co, In2)\n(Co, In1)\n(Er, Co)\n(In2, In2)\n\nAtomic mixing per label pair:\n{('Er', 'Er'): 'full_occupancy', ('Er', 'In2'): 'full_occupancy', ('In1', 'In2'): 'full_occupancy', ('Co', 'Co'): 'full_occupancy', ('Co', 'Er'): 'full_occupancy', ('Er', 'In1'): 'full_occupancy', ('In1', 'In1'): 'full_occupancy', ('Co', 'In2'): 'full_occupancy', ('Co', 'In1'): 'full_occupancy', ('In2', 'In2'): 'full_occupancy'}\n\nAtomic mixing per label pair sorted by Mendeleev:\n{('Er', 'Er'): 'full_occupancy', ('Co', 'Co'): 'full_occupancy', ('Er', 'In2'): 'full_occupancy', ('In1', 'In2'): 'full_occupancy', ('Er', 'In1'): 'full_occupancy', ('In1', 'In1'): 'full_occupancy', ('Co', 'In2'): 'full_occupancy', ('Co', 'In1'): 'full_occupancy', ('Er', 'Co'): 'full_occupancy', ('In2', 'In2'): 'full_occupancy'}\nIn\u00a0[4]: Copied!
from cifkit import Cif, Example\n\ndef print_connected_points(all_labels_connections):\n \"\"\"\n Utility function for printing connections per site label\n \"\"\"\n for label, connections in all_labels_connections.items():\n print(f\"\\nAtom site {label}:\")\n for (\n connected_label,\n dist,\n coords_1,\n coords_2,\n ) in connections:\n print(f\"{connected_label} {dist} {coords_1}, {coords_2}\")\n\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\n# Print CN Connections\nprint(\"\\nFind CN_connections_by_min_dist_method:\")\nprint_connected_points(cif.CN_connections_by_min_dist_method)\n\nprint(\"\\nFind CN_connections_by_best_methods:\")\nprint_connected_points(cif.CN_connections_by_best_methods)\nfrom cifkit import Cif, Example def print_connected_points(all_labels_connections): \"\"\" Utility function for printing connections per site label \"\"\" for label, connections in all_labels_connections.items(): print(f\"\\nAtom site {label}:\") for ( connected_label, dist, coords_1, coords_2, ) in connections: print(f\"{connected_label} {dist} {coords_1}, {coords_2}\") # Initialize cif = Cif(Example.ErCoIn5_file_path) # Print CN Connections print(\"\\nFind CN_connections_by_min_dist_method:\") print_connected_points(cif.CN_connections_by_min_dist_method) print(\"\\nFind CN_connections_by_best_methods:\") print_connected_points(cif.CN_connections_by_best_methods)
\nFind CN_connections_by_min_dist_method:\n\nAtom site In2:\nCo 2.691 [0.0, -2.27, -2.254], [0.0, -4.54, -3.698]\nCo 2.691 [0.0, -2.27, -2.254], [0.0, 0.0, -3.698]\nIn2 2.889 [0.0, -2.27, -2.254], [0.0, -2.27, -5.143]\nIn1 3.199 [0.0, -2.27, -2.254], [-2.27, -2.27, 0.0]\nEr 3.199 [0.0, -2.27, -2.254], [0.0, 0.0, 0.0]\nEr 3.199 [0.0, -2.27, -2.254], [0.0, -4.54, 0.0]\nIn1 3.199 [0.0, -2.27, -2.254], [2.27, -2.27, 0.0]\nIn2 3.21 [0.0, -2.27, -2.254], [2.27, -4.54, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [-2.27, 0.0, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [2.27, 0.0, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [-2.27, -4.54, -2.254]\n\nAtom site In1:\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 4.54, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, -0.0, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 4.54, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [-0.0, 2.27, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [4.54, 2.27, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 0.0, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [-0.0, 2.27, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [4.54, 2.27, 2.254]\nEr 3.21 [2.27, 2.27, 0.0], [-0.0, 4.54, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [0.0, 0.0, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [4.54, 4.54, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [4.54, 0.0, 0.0]\n\nAtom site Co:\nIn2 2.691 [-0.0, -0.0, 3.698], [-2.27, -0.0, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, -2.27, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [2.27, -0.0, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, 2.27, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, 2.27, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [2.27, -0.0, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-2.27, -0.0, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [0.0, -2.27, 2.254]\n\nAtom site Er:\nIn2 3.199 [0.0, 0.0, 0.0], [2.27, -0.0, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-0.0, 2.27, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-2.27, 0.0, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [0.0, -2.27, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [2.27, 0.0, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-0.0, 2.27, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-2.27, -0.0, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [0.0, -2.27, 2.254]\nIn1 3.21 [0.0, 0.0, 0.0], [2.27, 2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [-2.27, -2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [2.27, -2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [-2.27, 2.27, 0.0]\nCo 3.698 [0.0, 0.0, 0.0], [-0.0, -0.0, 3.698]\nCo 3.698 [0.0, 0.0, 0.0], [0.0, 0.0, -3.698]\nEr 4.54 [0.0, 0.0, 0.0], [-0.0, 4.54, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [0.0, -4.54, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [4.54, 0.0, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [-4.54, 0.0, 0.0]\n\nFind CN_connections_by_best_methods:\n\nAtom site In2:\nCo 2.691 [0.0, -2.27, -2.254], [0.0, -4.54, -3.698]\nCo 2.691 [0.0, -2.27, -2.254], [0.0, 0.0, -3.698]\nIn2 2.889 [0.0, -2.27, -2.254], [0.0, -2.27, -5.143]\nIn1 3.199 [0.0, -2.27, -2.254], [-2.27, -2.27, 0.0]\nEr 3.199 [0.0, -2.27, -2.254], [0.0, 0.0, 0.0]\nEr 3.199 [0.0, -2.27, -2.254], [0.0, -4.54, 0.0]\nIn1 3.199 [0.0, -2.27, -2.254], [2.27, -2.27, 0.0]\nIn2 3.21 [0.0, -2.27, -2.254], [2.27, -4.54, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [-2.27, 0.0, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [2.27, 0.0, -2.254]\nIn2 3.21 [0.0, -2.27, -2.254], [-2.27, -4.54, -2.254]\n\nAtom site In1:\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 4.54, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, -0.0, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 4.54, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [-0.0, 2.27, 2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [4.54, 2.27, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [2.27, 0.0, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [-0.0, 2.27, -2.254]\nIn2 3.199 [2.27, 2.27, 0.0], [4.54, 2.27, 2.254]\nEr 3.21 [2.27, 2.27, 0.0], [-0.0, 4.54, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [0.0, 0.0, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [4.54, 4.54, 0.0]\nEr 3.21 [2.27, 2.27, 0.0], [4.54, 0.0, 0.0]\n\nAtom site Co:\nIn2 2.691 [-0.0, -0.0, 3.698], [-2.27, -0.0, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, -2.27, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [2.27, -0.0, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, 2.27, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-0.0, 2.27, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [2.27, -0.0, 5.143]\nIn2 2.691 [-0.0, -0.0, 3.698], [-2.27, -0.0, 2.254]\nIn2 2.691 [-0.0, -0.0, 3.698], [0.0, -2.27, 2.254]\nEr 3.698 [-0.0, -0.0, 3.698], [0.0, 0.0, 0.0]\nEr 3.698 [-0.0, -0.0, 3.698], [-0.0, -0.0, 7.397]\nCo 4.54 [-0.0, -0.0, 3.698], [4.54, -0.0, 3.698]\nCo 4.54 [-0.0, -0.0, 3.698], [-4.54, -0.0, 3.698]\nCo 4.54 [-0.0, -0.0, 3.698], [-0.0, 4.54, 3.698]\nCo 4.54 [-0.0, -0.0, 3.698], [0.0, -4.54, 3.698]\n\nAtom site Er:\nIn2 3.199 [0.0, 0.0, 0.0], [2.27, -0.0, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-0.0, 2.27, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-2.27, 0.0, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [0.0, -2.27, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [2.27, 0.0, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-0.0, 2.27, -2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [-2.27, -0.0, 2.254]\nIn2 3.199 [0.0, 0.0, 0.0], [0.0, -2.27, 2.254]\nIn1 3.21 [0.0, 0.0, 0.0], [2.27, 2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [-2.27, -2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [2.27, -2.27, 0.0]\nIn1 3.21 [0.0, 0.0, 0.0], [-2.27, 2.27, 0.0]\nCo 3.698 [0.0, 0.0, 0.0], [-0.0, -0.0, 3.698]\nCo 3.698 [0.0, 0.0, 0.0], [0.0, 0.0, -3.698]\nEr 4.54 [0.0, 0.0, 0.0], [-0.0, 4.54, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [0.0, -4.54, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [4.54, 0.0, 0.0]\nEr 4.54 [0.0, 0.0, 0.0], [-4.54, 0.0, 0.0]\nIn\u00a0[5]: Copied!
from cifkit import Cif, Example\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\nprint(\"Shortest distance:\", cif.shortest_distance)\nprint(\"Shortest bond pair distances:\", cif.shortest_bond_pair_distance)\nprint(\"Shortest site pair distances:\", cif.shortest_site_pair_distance)\nfrom cifkit import Cif, Example # Initialize cif = Cif(Example.ErCoIn5_file_path) print(\"Shortest distance:\", cif.shortest_distance) print(\"Shortest bond pair distances:\", cif.shortest_bond_pair_distance) print(\"Shortest site pair distances:\", cif.shortest_site_pair_distance)
Shortest distance: 2.691\nShortest bond pair distances: {('Co', 'In'): 2.691, ('In', 'In'): 2.889, ('Er', 'In'): 3.199, ('Co', 'Er'): 3.698, ('Co', 'Co'): 4.54, ('Er', 'Er'): 4.54}\nShortest site pair distances: {'In2': ('Co', 2.691), 'In1': ('In2', 3.199), 'Co': ('In2', 2.691), 'Er': ('In2', 3.199)}\nIn\u00a0[6]: Copied!
from cifkit import Cif, Example\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\n# Bond counts\nprint(\"\\nCN_bond_count_by_min_dist_method:\")\nprint(cif.CN_bond_count_by_min_dist_method)\n\nprint(\"\\nCN_bond_count_by_min_dist_method_sorted_by_mendeleev:\")\nprint(cif.CN_bond_count_by_min_dist_method_sorted_by_mendeleev)\n\nprint(\"\\nCN_bond_count_by_best_methods:\")\nprint(cif.CN_bond_count_by_best_methods)\n\nprint(\"\\nCN_bond_count_by_best_methods_sorted_by_mendeleev:\")\nprint(cif.CN_bond_count_by_best_methods_sorted_by_mendeleev)\n\n# Bond fractions\nprint(\"\\nCN_bond_fractions_by_min_dist_method:\")\nprint(cif.CN_bond_fractions_by_min_dist_method)\n\nprint(\"\\nCN_bond_fractions_by_min_dist_method_sorted_by_mendeleev:\")\nprint(cif.CN_bond_fractions_by_min_dist_method_sorted_by_mendeleev)\n\nprint(\"\\nCN_bond_fractions_by_best_methods:\")\nprint(cif.CN_bond_fractions_by_best_methods)\n\nprint(\"\\nCN_bond_fractions_by_best_methods_sorted_by_mendeleev:\")\nprint(cif.CN_bond_fractions_by_best_methods_sorted_by_mendeleev)\n\n# Unique coordination numbers\nprint(\"\\nCN_unique_values_by_min_dist_method\")\nprint(cif.CN_unique_values_by_min_dist_method)\n\nprint(\"\\nCN_unique_values_by_best_methods\")\nprint(cif.CN_unique_values_by_best_methods)\n\n# Average coordination number\nprint(\"\\nCN_avg_by_min_dist_method:\")\nprint(cif.CN_avg_by_min_dist_method)\n\nprint(\"\\nCN_avg_by_best_methods: \")\nprint(cif.CN_avg_by_best_methods)\n\n# Min coordination number\nprint(\"\\nCN_max_by_min_dist_method:\")\nprint(cif.CN_max_by_min_dist_method)\n\nprint(\"\\nCN_max_by_best_methods:\")\nprint(cif.CN_max_by_best_methods)\n\n# Max coordination number\nprint(\"\\nCN_min_by_min_dist_method:\")\nprint(cif.CN_min_by_min_dist_method)\n\nprint(\"\\nCN_min_by_best_methods:\")\nprint(cif.CN_min_by_best_methods)\nfrom cifkit import Cif, Example # Initialize cif = Cif(Example.ErCoIn5_file_path) # Bond counts print(\"\\nCN_bond_count_by_min_dist_method:\") print(cif.CN_bond_count_by_min_dist_method) print(\"\\nCN_bond_count_by_min_dist_method_sorted_by_mendeleev:\") print(cif.CN_bond_count_by_min_dist_method_sorted_by_mendeleev) print(\"\\nCN_bond_count_by_best_methods:\") print(cif.CN_bond_count_by_best_methods) print(\"\\nCN_bond_count_by_best_methods_sorted_by_mendeleev:\") print(cif.CN_bond_count_by_best_methods_sorted_by_mendeleev) # Bond fractions print(\"\\nCN_bond_fractions_by_min_dist_method:\") print(cif.CN_bond_fractions_by_min_dist_method) print(\"\\nCN_bond_fractions_by_min_dist_method_sorted_by_mendeleev:\") print(cif.CN_bond_fractions_by_min_dist_method_sorted_by_mendeleev) print(\"\\nCN_bond_fractions_by_best_methods:\") print(cif.CN_bond_fractions_by_best_methods) print(\"\\nCN_bond_fractions_by_best_methods_sorted_by_mendeleev:\") print(cif.CN_bond_fractions_by_best_methods_sorted_by_mendeleev) # Unique coordination numbers print(\"\\nCN_unique_values_by_min_dist_method\") print(cif.CN_unique_values_by_min_dist_method) print(\"\\nCN_unique_values_by_best_methods\") print(cif.CN_unique_values_by_best_methods) # Average coordination number print(\"\\nCN_avg_by_min_dist_method:\") print(cif.CN_avg_by_min_dist_method) print(\"\\nCN_avg_by_best_methods: \") print(cif.CN_avg_by_best_methods) # Min coordination number print(\"\\nCN_max_by_min_dist_method:\") print(cif.CN_max_by_min_dist_method) print(\"\\nCN_max_by_best_methods:\") print(cif.CN_max_by_best_methods) # Max coordination number print(\"\\nCN_min_by_min_dist_method:\") print(cif.CN_min_by_min_dist_method) print(\"\\nCN_min_by_best_methods:\") print(cif.CN_min_by_best_methods)
\nCN_bond_count_by_min_dist_method:\n{'In2': {('Co', 'In'): 2, ('In', 'In'): 7, ('Er', 'In'): 2}, 'In1': {('In', 'In'): 8, ('Er', 'In'): 4}, 'Co': {('Co', 'In'): 8}, 'Er': {('Er', 'In'): 12, ('Co', 'Er'): 2, ('Er', 'Er'): 4}}\n\nCN_bond_count_by_min_dist_method_sorted_by_mendeleev:\n{'In2': {('Co', 'In'): 2, ('In', 'In'): 7, ('Er', 'In'): 2}, 'In1': {('In', 'In'): 8, ('Er', 'In'): 4}, 'Co': {('Co', 'In'): 8}, 'Er': {('Er', 'In'): 12, ('Er', 'Co'): 2, ('Er', 'Er'): 4}}\n\nCN_bond_count_by_best_methods:\n{'In2': {('Co', 'In'): 2, ('In', 'In'): 7, ('Er', 'In'): 2}, 'In1': {('In', 'In'): 8, ('Er', 'In'): 4}, 'Co': {('Co', 'In'): 8, ('Co', 'Er'): 2, ('Co', 'Co'): 4}, 'Er': {('Er', 'In'): 12, ('Co', 'Er'): 2, ('Er', 'Er'): 4}}\n\nCN_bond_count_by_best_methods_sorted_by_mendeleev:\n{'In2': {('Co', 'In'): 2, ('In', 'In'): 7, ('Er', 'In'): 2}, 'In1': {('In', 'In'): 8, ('Er', 'In'): 4}, 'Co': {('Co', 'In'): 8, ('Er', 'Co'): 2, ('Co', 'Co'): 4}, 'Er': {('Er', 'In'): 12, ('Er', 'Co'): 2, ('Er', 'Er'): 4}}\n\nCN_bond_fractions_by_min_dist_method:\n{('Co', 'In'): 0.204, ('In', 'In'): 0.306, ('Er', 'In'): 0.367, ('Co', 'Er'): 0.041, ('Er', 'Er'): 0.082}\n\nCN_bond_fractions_by_min_dist_method_sorted_by_mendeleev:\n{('Co', 'In'): 0.204, ('In', 'In'): 0.306, ('Er', 'In'): 0.367, ('Er', 'Co'): 0.041, ('Er', 'Er'): 0.082}\n\nCN_bond_fractions_by_best_methods:\n{('Co', 'In'): 0.182, ('In', 'In'): 0.273, ('Er', 'In'): 0.327, ('Co', 'Er'): 0.073, ('Co', 'Co'): 0.073, ('Er', 'Er'): 0.073}\n\nCN_bond_fractions_by_best_methods_sorted_by_mendeleev:\n{('Co', 'In'): 0.182, ('In', 'In'): 0.273, ('Er', 'In'): 0.327, ('Er', 'Co'): 0.073, ('Co', 'Co'): 0.073, ('Er', 'Er'): 0.073}\n\nCN_unique_values_by_min_dist_method\n{8, 18, 11, 12}\n\nCN_unique_values_by_best_methods\n{18, 11, 12, 14}\n\nCN_avg_by_min_dist_method:\n12.25\n\nCN_avg_by_best_methods: \n13.75\n\nCN_max_by_min_dist_method:\n18\n\nCN_max_by_best_methods:\n18\n\nCN_min_by_min_dist_method:\n8\n\nCN_min_by_best_methods:\n11\nIn\u00a0[7]: Copied!
from cifkit import Cif, Example\nimport warnings\nwarnings.filterwarnings('ignore') # For Jupyter Notebook only\n\n# Initialize\ncif = Cif(Example.ErCoIn5_file_path)\n\n# Enter site labels. you can get site labels using cif.labels\nprint(\"Site labels:\", cif.site_labels)\n\n# Plot\ncif.plot_polyhedron(\"In1\", is_displayed=True)\nfrom cifkit import Cif, Example import warnings warnings.filterwarnings('ignore') # For Jupyter Notebook only # Initialize cif = Cif(Example.ErCoIn5_file_path) # Enter site labels. you can get site labels using cif.labels print(\"Site labels:\", cif.site_labels) # Plot cif.plot_polyhedron(\"In1\", is_displayed=True)
Site labels: ['In2', 'In1', 'Co', 'Er']\n"},{"location":"notebooks/01_cif/#cif","title":"CIF\u00b6","text":"
The Cif
class generates an object for each .cif
file. Each object can
The Cif
class provides a set of accessible properties that can be accessed. Each object is intialized with the file_path
to the .cif
file.
Tag is parsed from the thrid line of each .cif
file. Some databases such as Pearson's Crystal Data offers tags for each file.
mixing_info_per_label_pair
and mixing_info_per_label_pair_sorted_by_mendeleev
return site mixing information at the pair level.Each bonding pair or each file is defined with one of four atomic mixing categories:
This section involves computing distances between atoms. Unlike instant properties, these properties may require extensive computation, typically ranging from 1-2 seconds for larger supercells containing more than 3,000 atoms.
These properties are loaded lazily, meaning accessing any of the properties will execute compute_connections()
internally. This function will then compute connections
, providing all the nearest neighbors for each site.
There are options in the Cif
class to use either the by_d_min_method
or by_best_methods
. Please refer to the README.md
for complete documentation.
You can get the shortest distance from each site label or the shortest distance for each possible bond pair.
"},{"location":"notebooks/01_cif/#get-computed-properties-coordination-numbers","title":"Get computed properties - coordination numbers\u00b6","text":"Compute avg
, min
, max
, unique
of coordination numbers determined by one of the best methods or min distance method.
You may use Jupyter
notebook or a python script to execute the following to generate and save a polyhedron generated from each site and the nearest neighbor atoms are determined from the coordination number geometry.
from cifkit import CifEnsemble, Example\n\n# Initialize\nensemble = CifEnsemble(Example.ErCoIn_folder_path)\nfrom cifkit import CifEnsemble, Example # Initialize ensemble = CifEnsemble(Example.ErCoIn_folder_path)
\nCIF Preprocessing in Example.ErCoIn_folder_path begun...\n\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif (1/3)\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif (2/3)\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif (3/3)\n\nSUMMARY\n# of files moved to 'error_operations' folder: 0\n# of files moved to 'error_duplicate_labels' folder: 0\n# of files moved to 'error_wrong_loop_value' folder: 0\n# of files moved to 'error_coords' folder: 0\n# of files moved to 'error_invalid_label' folder: 0\n# of files moved to 'error_others' folder: 0\n\nIn\u00a0[3]: Copied!
# Initialize with nested .cif files in the folder\nensemble_nested = CifEnsemble(Example.ErCoIn_folder_path, add_nested_files=True)\n# Initialize with nested .cif files in the folder ensemble_nested = CifEnsemble(Example.ErCoIn_folder_path, add_nested_files=True)
\nCIF Preprocessing in Example.ErCoIn_folder_path begun...\n\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif (1/3)\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif (2/3)\nPreprocessing /Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif (3/3)\n\nSUMMARY\n# of files moved to 'error_operations' folder: 0\n# of files moved to 'error_duplicate_labels' folder: 0\n# of files moved to 'error_wrong_loop_value' folder: 0\n# of files moved to 'error_coords' folder: 0\n# of files moved to 'error_invalid_label' folder: 0\n# of files moved to 'error_others' folder: 0\n\nIn\u00a0[4]: Copied!
# Get .cif file count in the folder\nprint(\"File count:\", ensemble.file_count) # 6\n\n# Get the directory path\nprint(\"Directory path:\", ensemble.dir_path)\n\n# Get all file paths in the folder\nprint(\"File paths:\", ensemble.file_paths)\n\n# Get all Cif objects initialized\nprint(\"Cif objects:\", ensemble.cifs)\n# Get .cif file count in the folder print(\"File count:\", ensemble.file_count) # 6 # Get the directory path print(\"Directory path:\", ensemble.dir_path) # Get all file paths in the folder print(\"File paths:\", ensemble.file_paths) # Get all Cif objects initialized print(\"Cif objects:\", ensemble.cifs)
File count: 3\nDirectory path: Example.ErCoIn_folder_path\nFile paths: ['/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif']\nCif objects: [<cifkit.models.cif.Cif object at 0x1554895e0>, <cifkit.models.cif.Cif object at 0x155320980>, <cifkit.models.cif.Cif object at 0x1569ef7a0>]\nIn\u00a0[5]: Copied!
# Print each property for each .cif file\nfor cif in ensemble.cifs:\n print(f\"\\n{cif.file_name}\")\n print(\"Formula:\", cif.formula)\n print(\"Tag:\", cif.tag)\n print(\"Mixing type:\", cif.site_mixing_type)\n print(\"Unique bond pairs:\", cif.bond_pairs)\n# Print each property for each .cif file for cif in ensemble.cifs: print(f\"\\n{cif.file_name}\") print(\"Formula:\", cif.formula) print(\"Tag:\", cif.tag) print(\"Mixing type:\", cif.site_mixing_type) print(\"Unique bond pairs:\", cif.bond_pairs)
\nEr10Co9In20.cif\nFormula: Er10Co9In20\nTag: \nMixing type: full_occupancy\nUnique bond pairs: {('Co', 'In'), ('Er', 'In'), ('In', 'In'), ('Co', 'Er'), ('Er', 'Er'), ('Co', 'Co')}\n\nEr5In3.cif\nFormula: Er5In3\nTag: \nMixing type: full_occupancy\nUnique bond pairs: {('Er', 'In'), ('In', 'In'), ('Er', 'Er')}\n\nErCoIn5.cif\nFormula: ErCoIn5\nTag: rt\nMixing type: full_occupancy\nUnique bond pairs: {('Co', 'In'), ('Er', 'In'), ('In', 'In'), ('Co', 'Er'), ('Er', 'Er'), ('Co', 'Co')}\nIn\u00a0[6]: Copied!
# Get unique formulas\nprint(\"Unique formulas:\", ensemble.unique_formulas)\n\n# Get unique elements\nprint(\"Unique elements:\", ensemble.unique_elements)\n\n# Get unique structures\nprint(\"Unique structures:\", ensemble.unique_structures)\n\n# Get unique atomix mixing types\nprint(\"Unique atomic mixing types:\", ensemble.unique_site_mixing_types)\n\n# Get unique elements\nprint(\"Unique elements including nested:\", ensemble_nested.unique_elements)\n\n# Get unique space group names\nprint(\"Unique space group names:\", ensemble.unique_space_group_names)\n\n# Get unique space group numbers\nprint(\"Unique space group numbers:\",ensemble.unique_space_group_numbers)\n\n# Get unique tags\nprint(\"Unique tags:\", ensemble.unique_tags)\n\n# Get unique composition types\nprint(\"Unique composition types:\", ensemble.unique_composition_types)\n# Get unique formulas print(\"Unique formulas:\", ensemble.unique_formulas) # Get unique elements print(\"Unique elements:\", ensemble.unique_elements) # Get unique structures print(\"Unique structures:\", ensemble.unique_structures) # Get unique atomix mixing types print(\"Unique atomic mixing types:\", ensemble.unique_site_mixing_types) # Get unique elements print(\"Unique elements including nested:\", ensemble_nested.unique_elements) # Get unique space group names print(\"Unique space group names:\", ensemble.unique_space_group_names) # Get unique space group numbers print(\"Unique space group numbers:\",ensemble.unique_space_group_numbers) # Get unique tags print(\"Unique tags:\", ensemble.unique_tags) # Get unique composition types print(\"Unique composition types:\", ensemble.unique_composition_types)
Unique formulas: {'Er5In3', 'ErCoIn5', 'Er10Co9In20'}\nUnique elements: {'In', 'Er', 'Co'}\nUnique structures: {'Ho10Ni9In20', 'HoCoGa5', 'Mn5Si3'}\nUnique atomic mixing types: {'full_occupancy'}\nUnique elements including nested: {'In', 'Er', 'Co'}\nUnique space group names: {'P4/nmm(originchoice2)', 'P63/mcm', 'P4/mmm'}\nUnique space group numbers: {129, 123, 193}\nUnique tags: {'', 'rt'}\nUnique composition types: {2, 3}\nIn\u00a0[7]: Copied!
# Get file count per structure\nprint(\"Structure stats:\", ensemble.structure_stats)\n\n# Get file count per formula\nprint(\"Formula stats:\", ensemble.formula_stats)\n\n# Get file count per tag\nprint(\"Tag stats:\", ensemble.tag_stats)\n\n# Get file count per space group number\nprint(\"Space group number stats:\", ensemble.space_group_number_stats)\n\n# Get file count per space group name\nprint(\"Space group name stats:\", ensemble.space_group_name_stats)\n\n# Get file count per composition type\nprint(\"Composition type stats:\", ensemble.composition_type_stats)\n\n# Get file count per Element\nprint(\"Unique elements stats:\", ensemble.unique_elements_stats)\n\n# Get file count per site mixing type\nprint(\"Site mixing type stats:\", ensemble.site_mixing_type_stats)\n\n# Get file count per supercell atom count\nprint(\"Supercell size stats:\", ensemble.supercell_size_stats)\n\n# Get file count per min distance\nprint(\"Min distance stats:\", ensemble.min_distance_stats)\n\n# Get file count per CN value by min dist method\nprint(\"CN value using min dist method stats:\", ensemble.unique_CN_values_by_min_dist_method_stat)\n\n# Get file count per CN value by best methods\nprint(\"CN value using best methods stats:\", ensemble.unique_CN_values_by_method_methods_stat)\n# Get file count per structure print(\"Structure stats:\", ensemble.structure_stats) # Get file count per formula print(\"Formula stats:\", ensemble.formula_stats) # Get file count per tag print(\"Tag stats:\", ensemble.tag_stats) # Get file count per space group number print(\"Space group number stats:\", ensemble.space_group_number_stats) # Get file count per space group name print(\"Space group name stats:\", ensemble.space_group_name_stats) # Get file count per composition type print(\"Composition type stats:\", ensemble.composition_type_stats) # Get file count per Element print(\"Unique elements stats:\", ensemble.unique_elements_stats) # Get file count per site mixing type print(\"Site mixing type stats:\", ensemble.site_mixing_type_stats) # Get file count per supercell atom count print(\"Supercell size stats:\", ensemble.supercell_size_stats) # Get file count per min distance print(\"Min distance stats:\", ensemble.min_distance_stats) # Get file count per CN value by min dist method print(\"CN value using min dist method stats:\", ensemble.unique_CN_values_by_min_dist_method_stat) # Get file count per CN value by best methods print(\"CN value using best methods stats:\", ensemble.unique_CN_values_by_method_methods_stat)
Structure stats: {'Ho10Ni9In20': 1, 'Mn5Si3': 1, 'HoCoGa5': 1}\nFormula stats: {'Er10Co9In20': 1, 'Er5In3': 1, 'ErCoIn5': 1}\nTag stats: {'': 2, 'rt': 1}\nSpace group number stats: {129: 1, 193: 1, 123: 1}\nSpace group name stats: {'P4/nmm(originchoice2)': 1, 'P63/mcm': 1, 'P4/mmm': 1}\nComposition type stats: {3: 2, 2: 1}\nUnique elements stats: {'Co': 2, 'In': 3, 'Er': 3}\nSite mixing type stats: {'full_occupancy': 3}\nSupercell size stats: {2654: 1, 558: 1, 255: 1}\nMin distance stats: {2.626: 1, 3.102: 1, 2.691: 1}\nCN value using min dist method stats: {10: 1, 12: 2, 13: 1, 14: 2, 16: 1, 17: 1, 11: 2, 15: 1, 8: 1, 18: 1}\nCN value using best methods stats: {10: 1, 12: 2, 13: 1, 14: 3, 16: 1, 17: 1, 11: 2, 15: 1, 18: 1}\nIn\u00a0[8]: Copied!
# Return file paths by formulas\nensemble.filter_by_formulas([\"ErCoIn\", \"Er10Co9In20\"]) \n\n# Return file paths by structures\nensemble.filter_by_structures([\"Mn5Si3\"])\n\n# Return file paths by space group names\nensemble.filter_by_space_group_names([\"P4/mmm\"])\n\n# Return file paths by space group numbers\nensemble.filter_by_space_group_numbers([123])\n\n# Return file paths by site mixing types\nensemble.filter_by_site_mixing_types([\"full_occupancy\"])\nensemble.filter_by_site_mixing_types([\"full_occupancy\", \"deficiency_without_atomic_mixing\"])\n\n# Return file paths by composition types (1-> unary, 2-> binary)\nensemble.filter_by_composition_types([3])\n# Return file paths by formulas ensemble.filter_by_formulas([\"ErCoIn\", \"Er10Co9In20\"]) # Return file paths by structures ensemble.filter_by_structures([\"Mn5Si3\"]) # Return file paths by space group names ensemble.filter_by_space_group_names([\"P4/mmm\"]) # Return file paths by space group numbers ensemble.filter_by_space_group_numbers([123]) # Return file paths by site mixing types ensemble.filter_by_site_mixing_types([\"full_occupancy\"]) ensemble.filter_by_site_mixing_types([\"full_occupancy\", \"deficiency_without_atomic_mixing\"]) # Return file paths by composition types (1-> unary, 2-> binary) ensemble.filter_by_composition_types([3]) Out[8]:
{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif',\n '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif'}In\u00a0[9]: Copied!
print(\"\\nFile paths containing Er or Co or In:\")\nprint(ensemble.filter_by_elements_containing([\"Er\", \"Co\", \"In\"])) # \n\nprint(\"\\nFile paths containing Er and In:\")\nprint(ensemble.filter_by_elements_exact_matching([\"Er\", \"In\"]))\n\nprint(\"\\nFile paths containing CN value of 15:\")\nprint(ensemble.filter_by_CN_min_dist_method_containing([15]))\nprint(ensemble.filter_by_CN_best_methods_containing([15]))\n\nprint(\"\\nFile paths containing CN value of 11, 14, and 15:\")\nprint(ensemble.filter_by_CN_min_dist_method_exact_matching([11, 14, 15]))\nprint(ensemble.filter_by_CN_best_methods_exact_matching([11, 14, 15]))\nprint(\"\\nFile paths containing Er or Co or In:\") print(ensemble.filter_by_elements_containing([\"Er\", \"Co\", \"In\"])) # print(\"\\nFile paths containing Er and In:\") print(ensemble.filter_by_elements_exact_matching([\"Er\", \"In\"])) print(\"\\nFile paths containing CN value of 15:\") print(ensemble.filter_by_CN_min_dist_method_containing([15])) print(ensemble.filter_by_CN_best_methods_containing([15])) print(\"\\nFile paths containing CN value of 11, 14, and 15:\") print(ensemble.filter_by_CN_min_dist_method_exact_matching([11, 14, 15])) print(ensemble.filter_by_CN_best_methods_exact_matching([11, 14, 15]))
\nFile paths containing Er or Co or In:\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\n\nFile paths containing Er and In:\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\n\nFile paths containing CN value of 15:\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\n\nFile paths containing CN value of 11, 14, and 15:\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\n{'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\nIn\u00a0[10]: Copied!
# Return a set of .cif file paths with min distance between 1.0 \u00c5 and 3.0 \u00c5\nprint(\"File paths with min distance between 1.0 \u00c5 and 3.0 \u00c5:\\n\", ensemble.filter_by_min_distance(1.0, 3.0))\n\n# Return a set of .cif file paths with supercell atom count above 500 and below 3000.\nprint(\"File paths with supercell atom count above 500 and below 3000:\\n\",ensemble.filter_by_supercell_count(300, 3000))\n# Return a set of .cif file paths with min distance between 1.0 \u00c5 and 3.0 \u00c5 print(\"File paths with min distance between 1.0 \u00c5 and 3.0 \u00c5:\\n\", ensemble.filter_by_min_distance(1.0, 3.0)) # Return a set of .cif file paths with supercell atom count above 500 and below 3000. print(\"File paths with supercell atom count above 500 and below 3000:\\n\",ensemble.filter_by_supercell_count(300, 3000))
File paths with min distance between 1.0 \u00c5 and 3.0 \u00c5:\n {'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/ErCoIn5.cif'}\nFile paths with supercell atom count above 500 and below 3000:\n {'/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er10Co9In20.cif', '/Users/imac/Downloads/cifkit/src/cifkit/data/ErCoIn/Er5In3.cif'}\n"},{"location":"notebooks/02_cif_ensemble/#cifensemble","title":"CifEnsemble\u00b6","text":"
For high-throuhgput analysis, you can initialize multiple .cif
files using CifEnsemble
.
CifEnsemble
standardizes the site labels in atom_site_label
. Some site labels may contain a comma or a symbol such as M due to atomic mixing. CBA reformats each atom_site_label
so it can be parsed into an element type that matches atom_site_type_symbol.
CifEnsemble
removes the content of publ_author_address
. This section often has an incorrect format that otherwise requires manual modifications.
CifEnsemble
relocates any ill-formatted files, such as those with duplicate labels in atom_site_label
, missing fractional coordinates, or files that require supercell generation.
You can also use the add_nested_files
flag to include .cif
files that are located in folders within the folder path provided.
Once the object is created, you can get instant properties suhc as file count, folder path, etc.
"},{"location":"notebooks/02_cif_ensemble/#get-individual-cif-properties","title":"Get individual .cif properties\u00b6","text":"The CifEnsemble
object contains a property called cifs
which contains a list of Cif
objects. You may loop through each to access both instant and computed properties described in the previous CIF
section.
You can get all unique attributres such as formulas, elements, etc in the folder.
"},{"location":"notebooks/02_cif_ensemble/#get-overall-stats-by-attribute","title":"Get overall stats by attribute\u00b6","text":"Get the number of files for each unique properties.
"},{"location":"notebooks/02_cif_ensemble/#filter-cif-containing-specific-attributes","title":"Filter .cif containing specific attributes\u00b6","text":""},{"location":"notebooks/02_cif_ensemble/#filter-cif-by-specific-attributes","title":"Filter .cif by specific attributes\u00b6","text":"Filter .cif files either containing a set of items or files that exactly contain the values passed. cifkit
supports elements and coordination numbers.
Assume you have a set of file paths filered using the functions described in the previous section. Since we are using Jupyter and with predefined examples, you need to provide file_paths
and dest_dir_path
for your system.
file_paths = {\n \"tests/data/cif/ensemble_test/300169.cif\",\n \"tests/data/cif/ensemble_test/300171.cif\",\n \"tests/data/cif/ensemble_test/300170.cif\",\n}\n\n# To move files\nensemble.move_cif_files(file_paths, dest_dir_path)\n\n# To copy files\nensemble.copy_cif_files(file_paths, dest_dir_path)\n"}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 1bd7c85..6c86bf6 100644 Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ