Function _mol_info

Source
pub fn _mol_info(mol_block: &str) -> PyResult<String>
Expand description

Get a pretty-printable string of this molecule’s graph representation.

Python version of crate::molecule::Molecule::info.

§Python Parameters

  • mol_block: The contents of a .mol file as a str.

§Python Returns

  • A pretty-printable str detailing the molecule’s atoms and bonds.

§Python Example

import assembly_theory as at

# Load a mol block from file.
with open('data/checks/anthracene.mol') as f:
    mol_block = f.read()

# Print the molecule's graph structure.
print(at.mol_info(mol_block))

# graph {
#     0 [ label = "Atom { element: Carbon, capacity: 0 }" ]
#     1 [ label = "Atom { element: Carbon, capacity: 0 }" ]
#     2 [ label = "Atom { element: Carbon, capacity: 0 }" ]
#     ...
#     0 -- 1 [ label = "Double" ]
#     1 -- 2 [ label = "Single" ]
#     2 -- 5 [ label = "Double" ]
#     ...
# }