emmet.core.utils
Define utility functions used across the emmet namespace packages.
Functions
Simple decorator to mark a Pydantic model as being incompatible with serialization using pyarrow. |
|
Check that something that we expect to be a molecule is actually a Molecule object, and not a dictionary representation. |
|
Validate datetime-like objects. |
|
Import arbitrary module or object. |
|
Get robocrystallographer description of a structure. |
|
Get all sub-models from a pydantic model. |
|
Return the Weisfeiler Lehman (WL) graph hash of the MoleculeGraph described by this molecule, using the OpenBabelNN strategy with extension for metal coordinate bonds |
|
Get the hash of a file in byte chunks. |
|
Return an MPculeID for a molecule, with the hash component based on a particular attribute of the molecule graph representation. |
|
Get the number of formula units in a dict-like composition. |
|
helper function to get spacegroup with a loose tolerance |
|
Groups molecules according to composition, charge, and equality |
|
Groups structures according to space group and structure matching |
|
This method cleans an input json-like object, either a list or a dict or some sequence, nested or otherwise, by converting all non-string dictionary keys (such as int and float) to strings, and also recursively encodes all objects using Monty's as_dict() protocol. Args: obj: input json-like object. strict (bool): This parameters sets the behavior when jsanitize encounters an object it does not understand. If strict is True, jsanitize will try to get the as_dict() attribute of the object. If no such attribute is found, an attribute error will be thrown. If strict is False, jsanitize will simply call str(object) to convert the object to a string representation. allow_bson (bool): This parameters sets the behavior when jsanitize encounters an bson supported type such as objectid and datetime. If True, such bson types will be ignored, allowing for proper insertion into MongoDb databases. Returns: Sanitized dict that can be json serialized. |
|
Construct a MoleculeGraph using OpenBabelNN with metal_edge_extender and (optionally) Critic2 bonding information. |
|
Decorator for pyarrow-dependent functionality. |
|
Decorator for MSONables defined in emmet with arrow compatible type hints. |
|
Pydantic model decorator for declaring a field should be serialized as a type that does not match the type hint for the field. |
|
Get an undeformed structure by applying transformations in a reverse order. |
|
Get UTC time right now. |
Classes
bool(x) -> bool |