polymerist.polymers.building.linear

For generating linear polymer structure from monomer, sequence, and chain length information

Attributes

LOGGER

Functions

build_linear_polymer(→ mbuild.lib.recipes.polymer.Polymer)

Builds a linear polymer structure from a specified pool of monomers, sequence, target chain length, and other parameters

Module Contents

polymerist.polymers.building.linear.LOGGER
polymerist.polymers.building.linear.build_linear_polymer(monomers: polymerist.polymers.monomers.repr.MonomerGroup, n_monomers: int, sequence: str = 'A', minimize_sequence: bool = True, allow_partial_sequences: bool = False, add_Hs: bool = False, energy_minimize: bool = False, sequence_map: dict[str, str] | None = None) mbuild.lib.recipes.polymer.Polymer[source]

Builds a linear polymer structure from a specified pool of monomers, sequence, target chain length, and other parameters

Parameters:
  • monomers (MonomerGroup) – A group of fragments containing AT LEAST the distinct repeat units which occur in the target polymer

    IMPORTANT: if the “term_orient” field of the MonomerGroup is not set (with “head” and “tail” monomer designations), the first two terminal (1-valent) monomers in the group will be auto-assigned and taken as the head and tail, respectively, or, if there is only one terminal monomer present, it will be used as both the head and tail.

  • n_monomers (int) – The number of monomer units in the target polymer chain

    This INCLUDES the terminal monomers in the count; E.g. n_monomers=10 with a head and tail group specified will induce 8 middle monomers

  • sequence (str, default=’A’) – A string of characters representing the sequence of MIDDLE monomers as they should occur within the polymer chain If the sequence is shorter than n_monomers - # end groups, the sequence will be repeated until the target chain length is reached.

    Each unique character in the string will be associated with a unique repeat unit in the provided MonomerGroup, as specified by sequence_map (see below)

    IMPORTANT: terminal monomers are not given by this sequence string, but are specified by either the “term_orient” field of the MonomerGroup or the auto-determined end groups if that is unset

  • minimize_sequence (bool, default=True) – Whether to attempt to reduce the sequence provided into a minimal, repeating subsequence (“kernel”) E.g. “ABABAB” will be reduced to 3*”AB” if this is set to True

    N.B.: this has NOTHING TO DO WITH energy minimization; that is controlled by the energy_minimize flag

  • allow_partial_sequences (bool, default=False) – Whether to allow fractional repetitions of the sequence kernel to fill the target chain length

    For example, given a monomer group with head/tail specified and parameters n_monomers=10 and sequence=”BAC” (inducing 10 - 2 = 8 middle monomers): * allow_partial_sequences=True will repeat the sequence 2 + 2/3 times,

    yielding the equivalent middle monomer sequence “BACBACBA”, while

    • allow_partial_sequences=False would raise PartialBlockSequence Exception, since the sequence “BAC” cannot be repeated to fill 8 middle monomers exactly.

  • add_Hs (bool, default=False) – Whether to instruct the mbuild Polymer recipe to cap uncapped terminal groups with hydrogens, in cases where the user has failed to provide ANY terminal monomers in the MonomerGroup

  • energy_minimize (bool, default=False) – Whether to perform a brief UFF energy minimization after build to relax the resulting polymer structure Tends to give less-unphysical conformers for larger polymers but is significantly slower, especially for longer chains

  • sequence_map (dict[str, str], default None) – Mapping from individual symbols (characters) in the sequence to the names of repeat units in monomers to associate with those symbols

    If no explicit mapping is provided, each unique symbol will be mapped to the MIDDLE repeat unit at that symbol’s position when lexicographically sorted E.g. “BACA” will take the second, first, third, and first monomers defined in the MonomerGroup; so will “baca”, “2131”, “caea”, and “tipi”

    For a more detailed example, suppose the contents of monomers.monomers looked like: >>> { >>> ‘EG_term’ : […] >>> ‘EG’ : […], >>> ‘GA’ : […], >>> ‘LA’ : […], >>> … >>> }

    Given sequence=’bac’ with sequence_map unset, a map of >>> sequence_map = { # this is the default!! >>> ‘a’ : ‘EG’, >>> ‘b’ : ‘GA’, >>> ‘c’ : ‘LA’, >>> } would be generated by default (skipping over the terminal repeat unit ‘EG_term’) and the resulting polymer would be build as [head group]-[GA]-[EG]-[LA]-[GA]-[EG]-…

    On the other hand, supplying a map as: >>> sequence_map = { >>> ‘a’ : ‘GA’, >>> ‘b’ : ‘LA’, >>> ‘c’ : ‘EG’, >>> } would instead assemble the polymer as [head group]-[LA]-[GA]-[EG]-[LA]-[GA]-…

Returns:

chain – An mbuild Polymer (Compound) object representing the assembled linear polymer chain

Return type:

mbuild.Compound