In [1]:
import mbuild as mb
from mbuild.lib.moieties import CH2, CH3
from mbuild.examples import Propane, Hexane

hexane_box = mb.fill_box(Hexane(), 50, box=[4, 4, 4])
print(hexane_box)
hexane_box.visualize()


<Compound 1000 particles, periodicity: [4. 4. 4.], 950 bonds, id: 4793962624>

You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol

Out[1]:
<py3Dmol.view at 0x1203cba90>

In [2]:
united_atom_particles = [CH2, CH3]
united_atom = mb.coarse_grain(hexane_box, particle_classes=united_atom_particles)
print(united_atom)
united_atom.visualize()


<Compound (proxy)  300 particles, non-periodic, 250 bonds, id: 4837841328>
/Users/mike/Projects/mbuild/mbuild/compound.py:2323: UserWarning: Guessing that "<CH2 (proxy)  pos=( 1.7544, 2.8371, 3.4367), 0 bonds, id: 4842918688>" is element: "C"
  atom, element))

You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol

Out[2]:
<py3Dmol.view at 0x121703d30>

In [3]:
three_to_one_particles = [Propane]
three_to_one = mb.coarse_grain(hexane_box, particle_classes=three_to_one_particles)
print(three_to_one)
three_to_one.visualize()


<Compound (proxy)  100 particles, non-periodic, 50 bonds, id: 4856810240>
/Users/mike/Projects/mbuild/mbuild/compound.py:2323: UserWarning: Guessing that "<Propane (proxy)  pos=( 1.7582, 3.0006, 3.4327), 0 bonds, id: 4860111728>" is element: "P"
  atom, element))

You appear to be running in JupyterLab (or JavaScript failed to load for some other reason). You need to install the 3dmol extension:
jupyter labextension install jupyterlab_3dmol

Out[3]:
<py3Dmol.view at 0x1221a6f60>