polymerist.polymers.building ============================ .. py:module:: polymerist.polymers.building .. autoapi-nested-parse:: Tools for building polymer conformers out of monomer SMARTS fragments Currently restricted to building linear homopolymers and periodic block copolymers Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/polymerist/polymers/building/linear/index /autoapi/polymerist/polymers/building/mbconvert/index /autoapi/polymerist/polymers/building/sequencing/index Exceptions ---------- .. autoapisummary:: polymerist.polymers.building.MissingPrerequisitePackage Functions --------- .. autoapisummary:: polymerist.polymers.building.modules_installed polymerist.polymers.building.build_linear_polymer polymerist.polymers.building.mbmol_from_mono_rdmol polymerist.polymers.building.mbmol_to_rdmol polymerist.polymers.building.mbmol_to_openmm_pdb polymerist.polymers.building.mbmol_to_rdkit_pdb Package Contents ---------------- .. py:function:: modules_installed(*module_names: list[str]) -> bool Check whether one or more modules are all present Will only return true if ALL specified modules are found :Parameters: **module_names** (**str*) -- Any number of module names, passed as a comma-separated sequence of strings :returns: **all_modules_found** -- Whether or not all modules were found to be installed in the current working environment :rtype: bool .. py:exception:: MissingPrerequisitePackage(importing_package_name: str, use_case: str, install_link: str, dependency_name: str, dependency_name_formal: Optional[str] = None) Bases: :py:obj:`Exception` Raised when a package dependency cannot be found and the user should be alerted with install instructions .. py:function:: 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) -> mbuild.lib.recipes.polymer.Polymer 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 monomers as they should occur within the polymer chain Each unique character in the string will be associated with a unique monomer in the provided MonomerGroup, in the order that they appear, e.g. "BACA" will take the second, first, third, and first monomers defined in the group IMPORTANT: the sequence string only specifies the MIDDLE monomers in the chain, i.e. terminal monomers are not given by the sequence string, but either by the "term_orient" field of the MonomerGroup or the auto-determined end groups if that is unset If the sequence is shorter than n_monomers, the sequence will be repeated until the target chain length is reached. * **minimize_sequence** (*bool, default=True*) -- Whether to attempt to reduce the sequence provided into a minimal, repeating subsequence E.g. "ABABAB" will be reduced to 3*"AB" if this is set to True Note carefully that 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 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 :returns: **chain** -- An mbuild Polymer (Compound) object representing the assembled linear polymer chain :rtype: mbuild.Compound .. py:function:: mbmol_from_mono_rdmol(rdmol: rdkit.Chem.Mol, resname: Optional[str] = None, kekulize: bool = True) -> tuple[mbuild.Compound, list[int]] Accepts a monomer-spec-compliant SMARTS string and returns an mbuild Compound and a list of the indices of atom ports If "resname" is provided, will assign that name to the mBuild Compound returned .. py:function:: mbmol_to_rdmol(mbmol: mbuild.Compound, atom_labeller: Optional[polymerist.molfiles.pdb.SerialAtomLabeller] = None, resname_map: Optional[dict[str, str]] = None) -> rdkit.Chem.Mol Convert an mBuild Compound into an RDKit Mol, with correct atom coordinates and PDB residue info .. py:function:: mbmol_to_openmm_pdb(pdb_path: pathlib.Path, mbmol: mbuild.Compound, atom_labeller: Optional[polymerist.molfiles.pdb.SerialAtomLabeller] = None, resname_map: Optional[dict[str, str]] = None) -> None .. py:function:: mbmol_to_rdkit_pdb(pdb_path: str, mbmol: mbuild.Compound, atom_labeller: Optional[polymerist.molfiles.pdb.SerialAtomLabeller] = None, resname_map: Optional[dict[str, str]] = None) -> None