CoREMOF.calculation package

Submodules

CoREMOF.calculation.Zeopp module

Geometery properties calculation based on Zeo++ software You need install Zeo++ package independently from source (https://www.zeoplusplus.org/download.html) or conda (https://anaconda.org/conda-forge/zeopp-lsmo) Befor run this class please test “network” commond is works or not.

CoREMOF.calculation.Zeopp.ChanDim(structure, probe_radius=0, high_accuracy=True, prefix='tmp_chan')[source]

Analysis dimension of channel.

Parameters:
  • structure (str) – path to your CIF.

  • probe_radius (float) – probe of radiu.

  • high_accuracy (bool) – use high accuracy or not.

  • prefix (str) – temporary file.

Returns:

  • unit by [“unit”], always nan.

  • dimention by [“Dimension”].

Return type:

Dictionary

CoREMOF.calculation.Zeopp.FrameworkDim(structure, high_accuracy=True, prefix='tmp_strinfo')[source]

Analysis dimension of framework.

Parameters:
  • structure (str) – path to your CIF.

  • high_accuracy (bool) – use high accuracy or not.

  • prefix (str) – temporary file.

Returns:

  • unit by [“unit”], always nan

  • dimention by [“Dimension”]

  • number of 2D framewor by [“N_1D”]

  • number of 1D framework by [“N_2D”]

  • number of 3D framewor by [“N_3D”]

Return type:

Dictionary

CoREMOF.calculation.Zeopp.PoreDiameter(structure, high_accuracy=True, prefix='tmp_pd')[source]

Analysis pore diameter of structure.

Parameters:
  • structure (str) – path to your CIF.

  • high_accuracy (bool) – use high accuracy or not.

  • prefix (str) – temporary file.

Returns:

  • unit by [“unit”], always angstrom, Å

  • largest cavity diameter by [“LCD”]

  • pore-limiting diameter by [“PLD”]

  • largest free pore diameter by [“LFPD”]

Return type:

Dictionary

CoREMOF.calculation.Zeopp.PoreVolume(structure, chan_radius=0, probe_radius=0, num_samples=5000, high_accuracy=True, prefix='tmp_pv')[source]

Analysis pore volume of structure.

Parameters:
  • structure (str) – path to your CIF.

  • chan_radius (float) – probe of channel, it is advised to keep chan_radius=probe_radius.

  • probe_radius (float) – probe of radiu.

  • num_samples (int) – number of MC samples per atom.

  • high_accuracy (bool) – use high accuracy or not.

  • prefix (str) – temporary file.

Returns:

  • unit by [“unit”], always PV: Å^3, cm^3/g; VF: nan

  • accessible pore volume by [“PV”]

  • non-accessible pore volume by [“NPV”]

  • accessible void fraction by [“VF”]

  • non-accessible void fraction by [“NVF”]

Return type:

Dictionary

CoREMOF.calculation.Zeopp.SurfaceArea(structure, chan_radius=1.655, probe_radius=1.655, num_samples=5000, high_accuracy=True, prefix='tmp_sa')[source]

Analysis surface area of structure.

Parameters:
  • structure (str) – path to your CIF.

  • chan_radius (float) – probe of channel, it is advised to keep chan_radius=probe_radius.

  • probe_radius (float) – probe of radiu.

  • num_samples (int) – number of MC samples per atom.

  • high_accuracy (bool) – use high accuracy or not.

  • prefix (str) – temporary file.

Returns:

  • unit by [“unit”], always Å^2, m^2/cm^3, m^2/g

  • accessible surface area by [“ASA”]

  • non-accessible surface area by [“NASA”]

Return type:

Dictionary

CoREMOF.calculation.atomic_parameters module

Parameters of atom used for open metal site analysis.

class CoREMOF.calculation.atomic_parameters.Atom(element)[source]

Bases: object

A class to hold atomic information, and check bonds. Covalent radii taken from DOI: Covalent radii revisited Beatriz Cordero, Verónica Gómez, Ana E. Platero-Prats, Marc Revés, Jorge Echeverría, Eduard Cremades, Flavia Barragána and Santiago Alvarez Dalton Trans., 2008, 2832-2838. DOI: 10.1039/B801115J.

Parameters:

element – Element of the Atom object. This determines it’s properties.

bond_tolerance(ele2)[source]

Determine if atom is a actinide.

check_bond(ele2, dist, bond_tol=None)[source]

Check if the atom is bonded with a given atom

property co

Coordination radius.

property is_actinide

Check if atom is a actinide.

property is_heavy_metal

Determine if atom has a covelant radii larger than 1.95.

property is_lanthanide

Check if atom is a lanthanide.

property is_lanthanide_or_actinide

Check if atom is a lanthanide or actinide.

property is_metal

Check if atom is metal or not.

max_bond(ele2, bond_tol=None)[source]

Get the maximum possible distance between the Atom object and another atom of type ele2.

Parameters:
  • ele2 – Element of the atom that the max_bond corresponds to.

  • bond_tol – Bold tolerance to use, if not set then the default will be used.

Returns:

The some of covelant radii for Atom and Atom(ele2) plus their covalant radii.

CoREMOF.calculation.mof module

Classes used for open metal site analysis.

class CoREMOF.calculation.mof.Helper[source]

Bases: object

classmethod compare_lists(l1, l2)[source]
classmethod copy_folder(dest, src)[source]
classmethod get_checksum(filename)[source]
classmethod make_folder(output_folder)[source]
class CoREMOF.calculation.mof.MetalSite(*args: Any, **kwargs: Any)[source]

Bases: MofStructure

center_around_metal()[source]

Shift atoms across periodic boundary conditions to have the coordination appear centered around the metal atom for visualisation purposes

check_if_open()[source]

Get t-factor, check if problematic based on number of linkers and if necessary call to check the dihedrals to determine if the metal site is open.

static get_t4_factor(a, b)[source]
static get_t5_factor(a, b)[source]
static get_t6_factor(c)[source]
get_t_factor()[source]

Compute t-factors, only meaningful for 4-,5-, and 6-coordinated metals, if not the value of -1 is assigned.

property is_open

Whether the MetalSite is open or not.

property is_problematic

Whether the MetalSite is problematic or not.

property is_unique

Whether the MetalSite is unique or not.

keep_valid_bonds()[source]

Loop over atoms in the coordination sphere and remove any extraneous sites.

property metal_summary

Whether the MetalSite is problematic or not.

property metal_type

The type of the metal center.

property num_linkers

Number of linkers in coordination sphere of MetalSite.

property tolerance

Tolerance values for dihedral checks. If not set, defaults are given.

write_cif_file(output_folder, index)[source]

Write MofSite to specified output_folder as a CIF file and use index to name it.

class CoREMOF.calculation.mof.MofStructure(*args: Any, **kwargs: Any)[source]

Bases: Structure

Extend the pymatgen Structure class to add MOF specific features. Create a MOf structure. The arguments are the same as in the pymatgen Structure class with the addition of the name argument. The super constructor is called and additional MOF specific properties are initialized.

Parameters:

Structure – MOF name, used to identify the structure.

property all_coord_spheres_indices

Compute the indices of the atoms in the first coordination shell for all atoms in the MofStructure

property all_distances

Distances between all atoms in the MofStructure

analyze_metals(output_folder, verbose='normal')[source]

Run analysis to detect all open metal sites in a MofStructure. In addition the metal sites are marked as unique.

Parameters:
  • output_folder (str) – Folder where OMS analysis results will be stored.

  • verbose – Verbosity level for the output of the analysis.

classmethod from_file(filename, primitive=False, sort=False, merge_tol=0.0)[source]

Create a MofStructure from a CIF file. This makes use of the from_file function of the Structure class and catches the exception in case a CIF file cannot be read. If the CIF is read successfully then the MofStructure is marked as okay, and the file checksum is added to the summary. If the CIF file cannot be read then it is marked as not okay and all the other properties are set to None and because there cannot be an empty Structure a carbon atom is added as placeholder at 0,0,0.

Parameters:
  • filename (str) – The filename to read from.

  • primitive (bool) – Whether to convert to a primitive cell Only available for cifs. Defaults to False.

  • sort (bool) – Whether to sort sites. Default to False.

  • merge_tol (float) – If this is some positive number, sites that are within merge_tol from each other will be merged. Usually 0.01 should be enough to deal with common numerical issues.

Returns:

  • The created MofStructure

property metal_coord_spheres

For all metal atoms in a MofStructure compute the first coordination sphere as a MetalSite object.

property name

Name of the MofStructure.

property tolerance

Tolerance values for dihedral checks. If not set, defaults are given.

write_results(output_folder, verbose='normal')[source]

Store summary dictionary holding all MOF and OMS information to a JSON file, store CIF files for the metal and non-metal parts of the MOF as well as all the identified coordination spheres.

Parameters:
  • output_folder – Location to be used to store.

  • verbose – Verbosity level.

CoREMOF.calculation.mof_collection module

class CoREMOF.calculation.mof_collection.MofCollection(path_list, analysis_folder='analysis_folder')[source]

Bases: object

A collection to hold and analyse MOF structures from CIF files. Create a MofCollection from a list of path names.

Parameters:
  • path_list – List of paths to MOF CIF files to be added to the collection.

  • analysis_folder – Path to the folder where the results will be stored.

analyse_mofs(overwrite=False, num_batches=1, analysis_limit=None)[source]

Run OMS analysis for the MOFs in the collection.

Parameters:
  • overwrite – Controls if the results will be overwritten or not.

  • num_batches – Sets the number of batches the structures will be split in and analyzed on a separate process.

  • analysis_limit – Analyze only up to the number of MOFs set by analysis_limit, if set to None all MOFs will be analyzed.

property analysis_folder

Get value of the analysis folder.

check_analysis_status()[source]

Iterate over all the MOFs in the collection and check if the results from the OMS analysis exist.

check_structures()[source]

Iterate over all the MOFs in the collection and validate that they can be read and a MofStructure can be created.

copy_cifs(target_folder)[source]

Copy cif files from their existing location to the specified target_folder.

Parameters:

target_folder – Path of folder to copy collection CIF files to.

copy_results(target_folder)[source]

Copy OMS result files from their existing location to the specified target_folder.

Parameters:

target_folder – Path of folder to copy collection OMS result files to.

filter_collection(using_filter=None, new_collection_folder=None, new_analysis_folder=None)[source]

Filter a collection given a number of filters. Calling this method of a MofCollection applies the filter and creates a new collection for the MOFs that match the filter. The cif files that match the filter are copied to the new_collection_folder. The filters can be one or more of the following: ‘density’: [min, max] (range of values), ‘oms_density’: [min, max] (range of values), ‘uc_volume’: [min, max] (range of values), ‘metal_species’: [“Cu”, “Zn”, …] (list of metal species), ‘non_metal_species’: [“C”, “N”, …] (list of non metal species), ‘cif_okay’: True (boolean value), ‘has_oms’: True (boolean value), ‘mof_name’: [mof_name1, mof_name2] (string values)

Parameters:
  • using_filter – Filter used to identify MOFs with certain characteristics. Has to be a python dictionary.

  • new_collection_folder – Path to the folder where the CIF files of the filtered collection will be stored. If set to None the CIF files will not be copied.

  • new_analysis_folder – Path to the folder where the OMS result files of the filtered collection will be stored. If set to None the result files will not be copied.

Returns:

  • A MofCollection with only the filtered MOFs. If new_collection_folder or new_analysis_folder is not set then the collection will point to the original location of these files.

classmethod from_folder(collection_folder, analysis_folder='analysis_folder', name_list=None)[source]

Create a MofCollection from a the CIF files in a folder.

Parameters:
  • collection_folder – Path to the folder containing the CIF files to be added to the collection.

  • analysis_folder – Path to the folder where the results will be stored.

  • name_list – List of MOF names to include in the collection. If set, all the other CIF files in the folder will be excluded.

Returns:

  • A MofCollection object holding the specified MOF structures.

property metal_site_df

Get a pandas DataFrame that lists the OMS results for each metal type.

property mof_oms_df

Get a pandas DataFrame that lists for each MOF whether it has an OMS or not and if it has an OMS what metal types it is.

property oms_results_folder

Get value of the OMS results folder.

property properties

Get value for the MOF properties. If the property variable is not None and the pickle file exists, then load the file and return it.

read_cif_files()[source]

Iterate over all MOF files in the collection, load each CIF and store MOF properties such as density, unit cell volume etc.

read_oms_results()[source]

Iterate over all MOF files in the collection, load each OMS result file and store OMS information to the MOF properties.

sample_collection(sample_size=50)[source]

Randomly select a sample of MOFs in the collection and return a new collection with the MOFs in the sample.

Parameters:

sample_size – Number of MOFs to be selected. Default value is 50.

separator = '--------------------------------------------------'
summarize_results(max_atomic_number=None)[source]

Create a summary table for the OMS results of the collection, group results by metal type.

Parameters:

max_atomic_number – Maximum atomic number to be included in summary table. If not defined all metal atoms will be considered.

summarize_tfactors()[source]

Summarize the t-factor information and make histograms for all the MOFs in the collection.

property summary_folder

Get value of the summary folder.

CoREMOF.calculation.mof_features module

Analysis topology, open metal sites, revised autocorrelation and so on.

CoREMOF.calculation.mof_features.Mass(structure)[source]

Analysis total mass of structure.

Parameters:

structure (str) – path to your CIF.

Returns:

  • unit by [“unit”], always amu

  • total mass by [“total_mass”]

Return type:

Dictionary

CoREMOF.calculation.mof_features.RACs(structure)[source]

Revised Autocorrelation features (https://github.com/hjkgrp/molSimplify).

Parameters:
  • input_folder (str) – path to your folder.

  • n_batch (int) – number of batches.

Returns:

  • metal by [“Metal”]

  • linker by [“Linker”]

  • function group by [“Function-group”]

Return type:

Dictionary

CoREMOF.calculation.mof_features.SpaceGroup(structure)[source]

Analysis space group of structure.

Parameters:

structure (str) – path to your CIF.

Returns:

  • unit by [“unit”], always nan

  • hall symbol by [“hall_symbol”]

  • space group number by [“space_group_number”]

  • crystal system by [“crystal_system”]

Return type:

Dictionary

CoREMOF.calculation.mof_features.Volume(structure)[source]

Analysis total volume of structure.

Parameters:

structure (str) – path to your CIF.

Returns:

  • unit by [“unit”], always Å^3

  • total volume by [“total_volume”]

Return type:

Dictionary

CoREMOF.calculation.mof_features.get_oms_file(structure)[source]

Analysis open metal site of structure from CoRE MOF 2019 (https://github.com/emmhald/open_metal_detector).

Parameters:

structure (str) – path to your CIF.

Returns:

  • all types of metal by [“Metal Types”]

  • has OMS or not by [“Has OMS”], -> True or False

  • of type of OMS if has by [“OMS Types”]

Return type:

Dictionary

CoREMOF.calculation.mof_features.get_oms_folder(input_folder, n_batch=1)[source]

Analysis open metal site of folder with structures from CoRE MOF 2019 (https://github.com/emmhald/open_metal_detector).

Parameters:
  • input_folder (str) – path to your folder.

  • n_batch (int) – number of batches.

Returns:

  • all types of metal of each structure by [structure][“Metal Types”]

  • has OMS or not of each structure by [structure][“Has OMS”], -> True or False

  • type of OMS if has of each structure by [structure][“OMS Types”]

Return type:

Dictionary

CoREMOF.calculation.mof_features.n_atom(structure)[source]

Analysis number of atoms of structure.

Parameters:

structure (str) – path to your CIF.

Returns:

  • unit by [“unit”], always nan

  • number of atoms by [“number_atoms”]

Return type:

Dictionary

CoREMOF.calculation.mof_features.topology(structure, node_type='single')[source]

Analysis topology of structure by CrystalNets.jl (https://github.com/coudertlab/CrystalNets.jl?tab=readme-ov-file).

Parameters:
  • structure (str) – path to your CIF.

  • node_type (str) – the clustering algorithm used to group atoms into vertices. single: each already-defined cluster is mapped to a vertex; all: keep points of extension for organic clusters.

Returns:

  • dimension by [“dimension”]

  • topology by [“topology”]

  • catenation by [“catenation”]

Return type:

Dictionary

Module contents