pysimm.apps.random_walk
¶
Module Contents¶
Functions¶
|
pysimm.apps.random_walk.displ_next_unit_default |
pysimm.apps.random_walk.find_last_backbone_vector |
|
|
pysimm.apps.random_walk.copolymer |
|
pysimm.apps.random_walk.random_walk |
pysimm.apps.random_walk.find_last_tail_vector |
|
|
pysimm.apps.random_walk.rot_mat_about_axis |
|
pysimm.apps.random_walk.define_plane |
|
pysimm.apps.random_walk.reflect_coords_thru_plane |
|
pysimm.apps.random_walk.scale_monomer |
|
pysimm.apps.random_walk.redo_monomer_insertion |
|
pysimm.apps.random_walk.constrained_opt |
|
pysimm.apps.random_walk.random_walk_tacticity |
|
pysimm.apps.random_walk.__check_tags__ |
|
pysimm.apps.random_walk.check_tacticity |
- pysimm.apps.random_walk.displ_next_unit_default(m, s)[source]¶
pysimm.apps.random_walk.displ_next_unit_default
Default implementation of displacement of next repetitive unit in random walk method for a polymer growth
- Parameters
m –
System
object – updateds –
ItemContainer
of ~pysimm.system.Particle objects
- Returns
general placeholder for connectivity order of linker atoms; default implementation assumes work with polymers with a single linkage bond, thus no connectivity order is needed
- Return type
empty list
- pysimm.apps.random_walk.find_last_backbone_vector(s, m)[source]¶
pysimm.apps.random_walk.find_last_backbone_vector
Finds vector between backbone atoms in terminal monomer. Requires current system s, and reference monomer m.
- pysimm.apps.random_walk.copolymer(m, nmon, s_=None, **kwargs)[source]¶
pysimm.apps.random_walk.copolymer
Builds copolymer using random walk methodology using pattern
- Parameters
m – list of reference monomer :class:`~pysimm.system.System`s
nmon – total number of monomers to add to chain
s –
System
in which to build polymer chain (None)settings – dictionary of simulation settings
density – density at which to build polymer (0.3)
forcefield –
Forcefield
object to acquire new force field parameterscapped – True/False if monomers are capped
unwrap – True to unwrap final system
traj – True to build xyz trajectory of polymer growth (True)
pattern – list of pattern for monomer repeat units, should match length of m ([1 for _ in range(len(m))])
limit – during MD, limit atomic displacement by this max value (LAMMPS ONLY)
sim –
Simulation
object for relaxation between polymer growth
- Returns
new copolymer
System
- pysimm.apps.random_walk.random_walk(m, nmon, s_=None, **kwargs)[source]¶
pysimm.apps.random_walk.random_walk
Builds homopolymer using random walk methodology
- Parameters
m – reference monomer
System
nmon – total number of monomers to add to chain
s –
System
in which to build polymer chain (None)extra_bonds – EXPERMINTAL, True if making ladder backbone polymer
geometry_rule – a pointer to a method that orients series of atoms of the next repetitive unit in random run
settings – dictionary of simulation settings
density – density at which to build polymer (0.3)
forcefield –
Forcefield
object to acquire new force field parameterscapped – True/False if monomers are capped
unwrap – True to unwrap final system
traj – True to build xyz trajectory of polymer growth (True)
limit – during MD, limit atomic displacement by this max value (LAMMPS ONLY)
sim –
Simulation
object for relaxation between polymer growthdebug – Boolean; print extra-output
- Returns
new polymer
System
- pysimm.apps.random_walk.find_last_tail_vector(s)[source]¶
pysimm.apps.random_walk.find_last_tail_vector Finds vector defined by bond in the system between the tail atom and its capping atom. Requires list of particles s that formed a monomer connected on previous step of the polymerisation.
- Parameters
s – ItemContainer of
Particle
objects- Returns
list of vector components
- pysimm.apps.random_walk.rot_mat_about_axis(v, theta)[source]¶
pysimm.apps.random_walk.rot_mat_about_axis This function returns the matrix that represents a rotation about vector v by theta degrees. Used for isotactic insertions of monomers
- Parameters
v – vector about which to rotate
theta – degrees to rotate
- Returns
matrix representation of rotation
- pysimm.apps.random_walk.define_plane(a1, a2, a3)[source]¶
pysimm.apps.random_walk.define_plane This function returns the mathematical constants defining a plane containing three input particles
- Parameters
a1 – three atoms or particles
a2 – three atoms or particles
a3 – three atoms or particles
- Returns
np.array containing a,b,c,d that define the plane a*x + b*y + c*z + d = 0 that contains the input particles
- pysimm.apps.random_walk.reflect_coords_thru_plane(atom, plane)[source]¶
pysimm.apps.random_walk.reflect_coords_thru_plane This function reflects an atom through a plane, and is used for implementing syndiotactic insertions of monomers
- Parameters
atom – either an atom or an array containing x,y,z coordinates for an atom, to be reflected through the plane
plane – np.array containing a,b,c,d that define a plane, a*x + b*y + c*z + d = 0
- Returns
new coordinates after reflection through plane
- pysimm.apps.random_walk.scale_monomer(atom, origin, scale)[source]¶
pysimm.apps.random_walk.scale_monomer This function scales the atom–origin vector. It is used by redo_monomer_insertion to scale the last monomer relative to its attachment point to the polymer chain
- Parameters
atom – either an atom or an array containing x,y,z coordinates for an atom, to be scaled relative to the origin
origin – either an atom or an array containing x,y,z coordinates for where the “atom” argument should be scaled to
scale – the factor by which the atom–origin vector should be scaled.
- Returns
scaled atom–origin vector
- pysimm.apps.random_walk.redo_monomer_insertion(s, m, i)[source]¶
pysimm.apps.random_walk.redo_monomer_insertion This function is called by random_walk_tacticity if the latest capped monomer insertion resulted in hardcore overlaps. 1) The hardcore overlap is resolved by shrinking the last monomer by a factor of 0.8, iteratively, until there are no more hardcore overlaps. 2) Then the shrunken last monomer is frozen while the rest of the polymer chain is optimized, and the last monomer is scaled in size by 1.05 3) Cycles of contrainedOptimization and regrowth are alternated until a reasonable structure is obtained
- Parameters
s –
System
is a polymer chain in which the last monomer insertion has generated a hardcore overlapm – reference monomer
System
. Must be a capped monomer, with headCap and tail_cap as the first and last atoms in the .mol file.i – number of the offending monomer, used for labelling diagnostic .xyz output files
- Returns
nothing; all changes to the polymer chain are written to the argument s_
- pysimm.apps.random_walk.constrained_opt(s, m, active)[source]¶
pysimm.apps.random_walk.constrained_opt This function is called by redo_monomer_insertion and optimizes polymer chain s while keeping the last monomer fixed.
- Parameters
- Returns
nothing; all changes to the polymer chain are written to the argument s_
- pysimm.apps.random_walk.random_walk_tacticity(m, nmon, s_=None, **kwargs)[source]¶
pysimm.apps.random_walk.random_walk_tacticity Builds homopolymer with controllable tacticity from capped monomer structure
- Parameters
m – reference monomer
System
. Must be a capped monomer, with headCap and tail_capfile. (as the first and last atoms in the .mol) –
nmon – total number of monomers to add to chain
s –
System
in which to build polymer chain (None)extra_bonds – EXPERMINTAL, True if making ladder backbone polymer
settings – dictionary of simulation settings
density – density at which to build polymer (0.3)
forcefield –
Forcefield
object to acquire new force field parametersunwrap – True to unwrap final system
debug – Boolean; print extra-output (False)
traj – True to build xyz trajectory of polymer growth (True)
limit – during MD, limit atomic displacement by this max value (LAMMPS ONLY)
sim –
Simulation
object for relaxation between polymer growthtacticity – float between 0 and 1. 1 = 100% isotactic insertions 0 = 100% syndiotactic insertions 0.5 = equal changes of isotactic or syndiotactic insertions (i.e. atactic)
rotation – degrees to rotate monomer per insertion
md_spacing – how many monomer insertion steps to perform between MD relaxation steps (1)
error_check – True/False for if monomers should be checked for hardcore overlaps after insertion
- Returns
new polymer
System
- pysimm.apps.random_walk.__check_tags__(m, **kwargs)[source]¶
pysimm.apps.random_walk.__check_tags__ private method to assert the polymerisation-related decorators assigned to the system ‘m’ that represents the next repetitive unit
- pysimm.apps.random_walk.check_tacticity(s, char_idxs, mon_len)[source]¶
pysimm.apps.random_walk.check_tacticity Method evaluates the local geometry of the polymer
System
. correct input includes :param char_idxs: characteristic indexes that define the structure of repetetive unit of the monomer. :type char_idxs: list of int :param It is supposed to have 4 elements which define index of: :type It is supposed to have 4 elements which define index of: 1) first atom in backbone; (2 :param backbone;: :type backbone;: 3) closest to backbone atom on the fisrt side chain; (4 :param side chain: :param mon_len: number of atoms in uncapped rep. unit :type mon_len: intNote: currentely it is assumed that polymerisation does not change local indexing so indexes of corresponding characteristic atoms of the chain can be found by adding a number multiple of mon_len
- Returns
angles (in deg) between corresponding pairs of backbone vector (1-2) and normal to the plane produced by to side chains (2-3 x 2-4). Those vectors can be either on one half-space of (3-2-4) plane, so the angle will be >90 (deg) or on the opposite half-spaces of the plane, so the angle <90 (deg). orientations (list of boolean): sequence that tracks local geometry of a chain: records True if two consecutive rep.units form a meso dyad, and False if they form a racemo dyad
- Return type
angles (list of float)