The mofchecker API reference

The main class

MOFChecker: Basic sanity checks for MOFs

class mofchecker.MOFChecker(structure, primitive=True)[source]

Bases: object

MOFChecker performs basic sanity checks for MOFs

__init__(structure, primitive=True)[source]

Class that can perform basic sanity checks for MOF structures

Parameters
  • structure (Structure) – pymatgen Structure object

  • primitive (bool) – If True, it will perform the analysis on the primitive structure

Raises

NotImplementedError in the case of partial occupancies

__weakref__

list of weak references to the object (if defined)

property density

Density of structure

property formula

Return the chemical formula of the structure

classmethod from_cif(path, primitive=True)[source]

Create a MOFChecker instance from a CIF file

Parameters
  • path (Union[str, Path]) – Path to string file

  • primitive (bool) – If True, it will perform the analysis on the primitive structure

Returns

Instance of MOFChecker

Return type

MOFChecker

get_cn(site_index)[source]

Get coordination number for site with CrystalNN method

Uses internal cache for speedup.

Parameters

site_index (int) – index of site in pymatgen Structure

Returns

Coordination number

Return type

int

get_connected_sites(site_index)[source]

Get connected sites for given index.

Uses internal cache for speedup.

Return type

List[ConnectedSite]

get_metal_descriptors()[source]

Return local structure order parameters for coordination number (CN), element string and wheter site is open or not. Key is the site index.

Raises

NoMetal – If no metal can be found in the structure

Returns

Key is the site index.

Return type

dict

get_metal_descriptors_for_site(site_index)[source]

Computes the checks for one metal site

Return type

dict

get_mof_descriptors()[source]

Run most of the sanity checks and get a dictionary with the result

Returns

result of overall checks

Return type

OrderedDict

get_overlapping_indices()[source]

Return the indices of overlapping atoms

property graph

pymatgen structure graph.

Return type

StructureGraph

property graph_hash

Return the Weisfeiler-Lehman graph hash. Hashes are identical for isomorphic graphs (taking the atomic kinds into account) and there are guarantees that non-isomorphic graphs will get different hashes.

property has_atomic_overlaps

Check if there are any overlaps in the structure

property has_carbon

Check if there is any carbon atom in the structure

property has_high_charges

Check if the structure has unreasonably high EqEq charges. Returns None if the check could not be run successfully.

Return type

Optional[bool]

property has_hydrogen

Check if there is any hydrogen atom in the structure

property has_lone_atom

Returns True if there is a isolated floating atom

Return type

bool

property has_lone_molecule

Returns true if there is a isolated floating atom or molecule

Return type

bool

property has_metal

Checks if there is at least one metal in the structure

property has_oms

True if the structure contains open metal sites (OMS). Also returns True in case of low coordination numbers (CN <=3) which typically indicate open coordination for MOFs. For high coordination numbers, no good order parameter for open structures is available, and so we return None even though this might change in a future release.

Raises

NoMetal – Raised if the structure contains no metal

Returns

True if the structure contains OMS

Return type

[bool]

property has_overvalent_c

Returns true if there is some carbon in the structure that has more than 4 neighbors.

Returns

True if carbon with CN > 4 in structure.

Return type

[bool]

property has_overvalent_h

Returns true if there is some hydrogen in the structure that has more than 1 neighbor.

Returns

True if hydrogen with CN > 1 in structure.

Return type

[bool]

property has_overvalent_n

Returns true if there is some nitrogen in the structure that has more than 4 neighbors.

Returns

True if nitrogen with CN > 4 in structure.

Return type

[bool]

property has_undercoordinated_c

Check if there is a carbon that likely misses hydrogen

Return type

bool

property has_undercoordinated_metal

Check if a metal has unusually low coordination

property has_undercoordinated_n

Check if there is a nitrogen that likely misses hydrogen

Return type

bool

property is_porous

Returns True if the MOF is porous according to the CoRE-MOF definition. Returns None if the check could not be run successfully.

Return type

Optional[bool]

is_site_open(site_index)[source]

Check for a site if is open (based on the values of some coordination geometry fingerprints)

Parameters

site_index (int) – Index of the site in the structure

Returns

True if site is open

Return type

bool

property name

Return filename if the MOFChecker instance was created based on a histogram.

property nx_graph

Returns a networkx graph with atom numbers as node labels

Return type

Graph

property scaffold_hash

Return the Weisfeiler-Lehman graph hash. Hashes are identical for isomorphic graphs and there are guarantees that non-isomorphic graphs will get different hashes.

property volume

Volume of structure in A^3

Helper functions

Helper functions for the MOFChecker

exception mofchecker.utils.HighCoordinationNumber[source]

Bases: KeyError

Error for high coordination number

__weakref__

list of weak references to the object (if defined)

exception mofchecker.utils.LowCoordinationNumber[source]

Bases: KeyError

Error for low coordination number

__weakref__

list of weak references to the object (if defined)

exception mofchecker.utils.NoMetal[source]

Bases: KeyError

Error in case there is no metal in structure

__weakref__

list of weak references to the object (if defined)

exception mofchecker.utils.NoOpenDefined[source]

Bases: KeyError

Error in case the open check is not defined for this coordination numberF

__weakref__

list of weak references to the object (if defined)

mofchecker.utils.compute_overlap_matrix(distance_matrix, allatomtypes, tolerance=1.0)[source]

Find atomic overlap based on pairwise distance and Covalent radii.

Criterion: if dist < min (CovR_1,CovR_2) -> overlap

(this function is used in molsimplify)

mofchecker.utils.get_charges(structure)[source]

Compute EqEq charges for a pymatgen structure

mofchecker.utils.get_overlaps(s)[source]

Find overlapping atoms in a structure.

Return type

list

mofchecker.utils.get_subgraphs_as_molecules_all(structure_graph)[source]

Copied from http://pymatgen.org/_modules/pymatgen/analysis/graphs.html#StructureGraph.get_subgraphs_as_molecules and removed the duplicate check

Parameters

structure_graph (pymatgen.analysis.graphs.StructureGraph) – Structuregraph

Returns

list of molecules

Return type

List

mofchecker.utils.is_metal(site)[source]

according to conquest help: transition metal, lanthanide, actinide, or Al, Ga, In, Tl, Ge, Sn, Pb, Sb, Bi, Po

Return type

bool

mofchecker.utils.print_dict(dictionary)[source]

Print a dictionary to stdout line by line.