scine_puffin.utilities.masm_helper

masm_helper.py: Collection of common procedures to be carried out with molassembler

Functions

add_masm_info(structure, bo_collection, ...)

Generates a structure's CBOR graph and decision lists and adds them to the database.

get_cbor_graph(atoms, bond_orders, ...[, ...])

Generates the CBOR graph of an atom collection and bond order collection.

get_cbor_graph_from_molecule(molecule)

Generates the canonical CBOR graph from a single masm.Molecule

get_decision_list_from_molecule(molecule, atoms)

Generates the dihedral decision list for rotatable bonds in a single molecule.

get_decision_lists(atoms, bond_orders, ...)

Generates the dihedral decision lists for rotatable bonds in a given system.

get_molecules_result(atoms, bond_orders, ...)

Generates the molassembler molecules interpretation of an atom collection and a bond order collection optionally made subject to distance based adaptations.

make_bin_str(int_bounds, dihedral, sym)

Turn integer bounds and a floating dihedral into a joint string

scine_puffin.utilities.masm_helper.add_masm_info(structure: db.Structure, bo_collection: utils.BondOrderCollection, connectivity_settings: Dict[str, bool | int], unimportant_atoms: List[int] | Set[int] | None = None) None[source]

Generates a structure’s CBOR graph and decision lists and adds them to the database.

Parameters:
structuredb.Structure

The structure to be analyzed. It has to be linked to a database.

bo_collectionutils.BondOrderCollection

The bond order collection to be interpreted.

connectivity_settingsDict[str, Union[bool, int]]

Settings describing whether to use the connectivity as predicted based on inter-atomic distances by the utils.BondDetector.

unimportant_atomsUnion[List[int], None]

The indices of atoms for which no stereopermutators shall be determined.

scine_puffin.utilities.masm_helper.get_cbor_graph(atoms: utils.AtomCollection, bond_orders: utils.BondOrderCollection, connectivity_settings: Dict[str, bool | int], pbc_string: str = '', unimportant_atoms: List[int] | Set[int] | None = None) str[source]

Generates the CBOR graph of an atom collection and bond order collection. Multiple graphs are concatenated with “;” as a deliminator.

Parameters:
atomsutils.AtomCollection

The atom collection to be interpreted.

bond_ordersutils.BondOrderCollection

The bond order collection to be interpreted.

connectivity_settingsDict[str, Union[bool, int]]

Settings describing whether to use the connectivity as predicted based on inter-atomic distances by the utils.BondDetector.

pbc_stringstr

The string specifying periodic boundaries, empty string represents no periodic boundaries.

unimportant_atomsOptional[Union[List[int], Set[int]]]

The indices of atoms for which no stereopermutators shall be determined.

Returns:
masm_cbor_graphsstr

The cbor graphs as sorted strings separated by semicolons.

scine_puffin.utilities.masm_helper.get_cbor_graph_from_molecule(molecule: masm.Molecule)[source]

Generates the canonical CBOR graph from a single masm.Molecule

Parameters:
moleculemasm.Molecule

The molecule of which a graph is to be generated

Returns:
cbor_string:: str

The cbor graph string.

scine_puffin.utilities.masm_helper.get_decision_list_from_molecule(molecule: masm.Molecule, atoms: utils.AtomCollection) str[source]

Generates the dihedral decision list for rotatable bonds in a single molecule.

Parameters:
moleculemasm.Molecule

The molecule.

atomsutils.AtomCollection

The atoms and their positions in the molecule.

Returns:
masm_decision_liststr

The dihedral decision list for rotatable bonds.

scine_puffin.utilities.masm_helper.get_decision_lists(atoms: utils.AtomCollection, bond_orders: utils.BondOrderCollection, connectivity_settings: Dict[str, bool | int], pbc_string: str = '', unimportant_atoms: Set[int] | List[int] | None = None) List[str][source]

Generates the dihedral decision lists for rotatable bonds in a given system.

Parameters:
atomsutils.AtomCollection

The atom collection to be interpreted.

bond_ordersutils.BondOrderCollection

The bond order collection to be interpreted.

connectivity_settingsDict[str, Union[bool, int]]

Settings describing whether to use the connectivity as predicted based on inter-atomic distances by the utils.BondDetector.

pbc_stringstr

The string specifying periodic boundaries, empty string represents no periodic boundaries.

unimportant_atomsUnion[List[int], None]

The indices of atoms for which no stereopermutators shall be determined.

Returns:
masm_decision_listsList[str]

The dihedral decision lists for rotatable bonds in all molecules in the given input.

scine_puffin.utilities.masm_helper.get_molecules_result(atoms: utils.AtomCollection, bond_orders: utils.BondOrderCollection, connectivity_settings: Dict[str, bool | int], pbc_string: str = '', unimportant_atoms: List[int] | Set[int] | None = None, modifications: List[Tuple[int, int, float]] | None = None) masm.interpret.MoleculesResult[source]

Generates the molassembler molecules interpretation of an atom collection and a bond order collection optionally made subject to distance based adaptations.

Parameters:
atomsutils.AtomCollection

The atom collection to be interpreted.

bond_ordersutils.BondOrderCollection

The bond order collection to be interpreted.

connectivity_settingsDict[str, Union[bool, int]]

Settings describing whether to use the connectivity as predicted based on inter-atomic distances by the utils.BondDetector.

pbc_stringstr

The string specifying periodic boundaries, empty string represents no periodic boundaries.

unimportant_atomsOptional[Union[List[int], Set[int]]]

The indices of atoms for which no stereopermutators shall be determined.

modificationsOptional[List[Tuple[int, int, float]]]

Manual bond modifications. They are specified as a list with each element containing the indices and the new bond order between those two indices

Returns:
masm_resultsmasm.interpret.MoleculesResult

The result of the molassembler interpretation.

scine_puffin.utilities.masm_helper.make_bin_str(int_bounds: Tuple[int, int], dihedral: float, sym: int) str[source]

Turn integer bounds and a floating dihedral into a joint string