You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned in #1205 I've been throwing around some ideas and making some changes to improve the polymer building experience with mBuild. With this, there are a few things to think about, so I'm starting a discussion as a place to get feedback and input before making a PR.
I think Polymer() is becoming more than a recipe, but a core class of mBuild, that has a lot of room for further development of polymer-specific methods and properties that don't need to (or can't) be included in Compound. We should move Polymer() out of lib/recipes and up to the same “level” as Compound(). There are arguments to do this for some other classes we have in lib/recipes but we can focus on Polymer for now.
Initializing molecules and systems involves generating starting configurations at different length scales. Right now, packing.py has several methods designed to initialize bulk systems of several molecules. However, some initialization problems are limited to just a single molecule (e.g. a chain configuration of a single polymer), so I'm proposing we have a file analogous to packing.py but with methods to produce starting molecular configurations. Maybe we call this configuration.py or conformation.py...any other ideas?
In order to use the idea of number 2 in the polymer class, we could add some polymer specific methods and properties. For example, a method that returns the set of backbone bond vectors (monomer-monomer bonds, not atomistic ones), another that gets the bond lengths of these vectors, a method that can change the monomer center of mass position, etc...
The most immediately obvious applications for this are generating polymer chain configurations. Right now, we often get some pretty whacky and unwieldy chain configurations from the polymer builder that make things like packing a box, or building a lattice difficult. Some examples of polymer configurations of a single chain would be a random coil, a lamellar structure, or enforcing a straight chain. Here are some examples:
frommbuildimportPolymerfromconformationsimportrandom_walkpolymer=Polymer(..)
polymer.build(n=30) # Current configuration is a "bad" onecoords=random_walk(n=30, bond_L=0.25)
polymer.set_monomer_coordinates(coordinates=coords) # Now, a "good" configuraiton
frommbuildimportPolymerfromconformationsimportlamellarpolymer=Polymer(..)
polymer.build(n=30) # Current configuration is a "bad" onecoords=lamellar(n_layers=10, layer_length=7, layer_separation=0.7)
polymer.set_monomer_coordinates(coordinates=coords) # Now, a "good" configuraiton
In both of these cases, the methods in conformations are creating a coarse-grain chain configuration, which we then map the atomistic structure onto with set_monomer_coordinates. These snapshots were obtained using the changes on my fork here, and a gist of the notebook can be found here
These multistep workflows could individually have wrapper build() methods in Polymer in addition to current build() method. For example:
# I want a lamellar structure with given dimensions, but I don't know the exact chain length that requires.mon=mb.load("CC", smiles=True)
pe=Polymer()
pe.add_monomer(compound=mon, indices=[2, 6], replace=True, separation=0.15)
pe.build_lamellae(num_layers=5, layer_length=3, layer_separation=0.70)
# I want to build a random polymer configurationmon=mb.load("CC", smiles=True)
pe=Polymer()
pe.add_monomer(compound=mon, indices=[2, 6], replace=True, separation=0.15)
pe.build_random_configuration(n=30, min_angle=np.pi/2, max_angle=np.pi, seed=32)
# I want a straight chain to use in a lattice builder latermon=mb.load("CC", smiles=True)
pe=Polymer()
pe.add_monomer(compound=mon, indices=[2, 6], replace=True, separation=0.15)
pe.build_straight_chain(n=30, axis=(1,0,0))
conformations.py would be very extensible. Any algorithm that generates a set of bonded coordinates could be added. It could hold more types of random walks, building in complexity, maybe some combination of lamellar layers and random walks to create semi-crystalline chains, etc.
I'd love to hear any ideas and thoughts!
The text was updated successfully, but these errors were encountered:
As mentioned in #1205 I've been throwing around some ideas and making some changes to improve the polymer building experience with mBuild. With this, there are a few things to think about, so I'm starting a discussion as a place to get feedback and input before making a PR.
I think
Polymer()
is becoming more than a recipe, but a core class of mBuild, that has a lot of room for further development of polymer-specific methods and properties that don't need to (or can't) be included inCompound
. We should movePolymer()
out oflib/recipes
and up to the same “level” asCompound()
. There are arguments to do this for some other classes we have inlib/recipes
but we can focus onPolymer
for now.Initializing molecules and systems involves generating starting configurations at different length scales. Right now,
packing.py
has several methods designed to initialize bulk systems of several molecules. However, some initialization problems are limited to just a single molecule (e.g. a chain configuration of a single polymer), so I'm proposing we have a file analogous topacking.py
but with methods to produce starting molecular configurations. Maybe we call thisconfiguration.py
orconformation.py
...any other ideas?In order to use the idea of number 2 in the polymer class, we could add some polymer specific methods and properties. For example, a method that returns the set of backbone bond vectors (monomer-monomer bonds, not atomistic ones), another that gets the bond lengths of these vectors, a method that can change the monomer center of mass position, etc...
The most immediately obvious applications for this are generating polymer chain configurations. Right now, we often get some pretty whacky and unwieldy chain configurations from the polymer builder that make things like packing a box, or building a lattice difficult. Some examples of polymer configurations of a single chain would be a random coil, a lamellar structure, or enforcing a straight chain. Here are some examples:
In both of these cases, the methods in
conformations
are creating a coarse-grain chain configuration, which we then map the atomistic structure onto withset_monomer_coordinates
. These snapshots were obtained using the changes on my fork here, and a gist of the notebook can be found hereThese multistep workflows could individually have wrapper
build()
methods inPolymer
in addition to currentbuild()
method. For example:conformations.py
would be very extensible. Any algorithm that generates a set of bonded coordinates could be added. It could hold more types of random walks, building in complexity, maybe some combination of lamellar layers and random walks to create semi-crystalline chains, etc.I'd love to hear any ideas and thoughts!
The text was updated successfully, but these errors were encountered: