ligning.monomer

Build lignin monomers

class ligning.monomer.Monomer(monomer_type: str, monomer_index: Optional[int] = 0)

Lignin monomer object

create() nxgraph

Initialize a monomer graph from the three types: H, G, S

Returns

G – the monomer graph

Return type

nxgraph

Raises

ValueError – Input monomer type not allowed

ligning.monomer.add_OCH3(G: nxgraph, monomer_type: str, C_index: int, color: str, monomer_index: Optional[int] = 0) nxgraph

Add an OCH3 group to a monomer

Parameters
  • G (nxgraph) – the monomer graph

  • monomer_type (str) – monomer type, must be ‘H’ or ‘G’

  • C_index (int) – the bonding Carbon atom index

  • color (str) – the color of the nodes in plotting

  • monomer_index (Optional[str], optional) – the index of monomer in a polymer, by default 0

Returns

G – the monomer graph

Return type

nxgraph

Raises

ValueError – Input monomer type not allowed

ligning.monomer.monomer_G(color: Optional[str] = 'lightgreen', monomer_index: Optional[int] = 0) nxgraph

Generate a G monomer

Parameters
  • color (Optional[str], optional) – the color of the nodes in plottin, by default ‘g’ (green)

  • monomer_index (Optional[str], optional) – the index of monomer in a polymer, by default 0

Returns

G – the monomer graph

Return type

nxgraph

ligning.monomer.monomer_H(color: Optional[str] = 'lightcoral', monomer_index: Optional[int] = 0) nxgraph

Generate a H monomer

Parameters
  • color (Optional[str], optional) – the color of the nodes in plottin, by default ‘r’ (red)

  • monomer_index (Optional[str], optional) – the index of monomer in a polymer, by default 0

Returns

G – the monomer graph

Return type

nxgraph

ligning.monomer.monomer_S(color: Optional[str] = 'lightblue', monomer_index: Optional[int] = 0) nxgraph

Generate an S monomer

Parameters
  • color (Optional[str], optional) – the color of the nodes in plottin, by default ‘b’ (blue)

  • monomer_index (Optional[str], optional) – the index of monomer in a polymer, by default 0

Returns

G – the monomer graph

Return type

nxgraph

ligning.monomer.monomer_graph(monomer_type: str, color: Optional[str] = 'lightcoral', monomer_index: Optional[int] = 0) nxgraph

Generate a general monomer with 9 carbons

Parameters
  • monomer_type (str) – monomer type, must be ‘H’, ‘G’ or ‘S’

  • color (Optional[str], optional) – the color of the nodes in plotting, by default ‘r’

  • monomer_index (Optional[str], optional) – the index of monomer in a polymer, by default 0

Returns

G – the monomer graph

Return type

nxgraph

Raises

ValueError – Input monomer type not allowed

ligning.monomer.select_random_monomer() nxgraph

Generate a random monomer for initialization purpose

Returns

P – the initial polymer graph

Return type

nxgraph