polymerist.polymers.monomers.repr

For representing monomer information

Attributes

LOGGER

Classes

MonomerGroup

Stores collections of residue-labelled monomer SMARTS

Module Contents

polymerist.polymers.monomers.repr.LOGGER
class polymerist.polymers.monomers.repr.MonomerGroup[source]

Stores collections of residue-labelled monomer SMARTS

monomers: dict[str, polymerist.smileslib.Smarts | list[polymerist.smileslib.Smarts]]
term_orient: dict[str, str]
add_monomer(resname: str, smarts: polymerist.smileslib.Smarts | Iterable[polymerist.smileslib.Smarts]) None[source]

Register new monomers, either directly from SMARTS or from a container of SMARTS

static is_terminal(monomer: rdkit.Chem.Mol) bool[source]

Determine whether or not a monomer is terminal

property SMARTS: dict[str, list[polymerist.smileslib.Smarts]]

Alias of legacy “monomers” attribute

iter_rdmols(term_only: bool | None = None) Generator[tuple[str, rdkit.Chem.Mol], None, None][source]

Generate (residue name, RDKit Mol) pairs of all monomers present Simplifies iteration over internal lists of monomer Mols

Can optionally filter by monomer termination:

term_only=True -> only terminal monomers term_only=False -> only middle monomers term_only=None -> all monomers

rdmols(term_only: bool | None = None) dict[str, list[rdkit.Chem.Mol]][source]

Returns dict of RDKit Mol lists keyed by residue name

Can optionally filter by monomer termination:

term_only=True -> only terminal monomers term_only=False -> only middle monomers term_only=None -> all monomers

contributions(term_only: bool | None = None) dict[str, list[int]][source]

Returns dict of the number of real (i.e. non-linker) atoms in each residue list

property n_monomers: int

Returns number of distinct monomer templates present Distinct monomers under the same residue name are counted separately

linear_end_groups() dict[str, tuple[str, rdkit.Chem.Mol]][source]

Returns head-and-tail end group residue names and Mol objects as defined by term_orient

If term orient is undefined, will automatically take then first <= 2 terminal groups available to be the end groups

Returns:

end_groups – A dict whose keys are any of {‘head’, ‘tail’} and whose values are 2-tuples of residue names and Mols for the corresponding monomer

Return type:

dict[str, tuple[str, Chem.Mol]]

is_homopolymer() bool[source]

Identify if a polymer is a homopolymer (i.e. only 1 type of middle monomer)

property is_branchable: bool

Whether it is possible to generate a branched polymer from this set of monomers

property is_linear: bool

Whether a group of monomers can ONLY be assembled into a linear chain

property is_linear_homopolymer: bool

Identify if a polymer is a linear homopolymer

property num_mid_and_term: tuple[int, int]

Counts of how many of the monomers are middle vs terminal, respectively