In [1]:
import mbuild as mb

from mbuild.examples.alkane.alkane import Alkane
from mbuild.lib.moieties import Silane


class AlkylSilane(mb.Compound):
    """A silane functionalized alkane chain with one Port. """
    def __init__(self, chain_length):
        super(AlkylSilane, self).__init__()

        alkane = Alkane(chain_length, cap_end=False)
        self.add(alkane, 'alkane')
        silane = Silane()
        self.add(silane, 'silane')
        mb.force_overlap(self['alkane'], self['alkane']['down'], self['silane']['up'])

        # Hoist silane port to AlkylSilane level.
        self.add(silane['down'], 'down', containment=False)

In [2]:
alkyl_silane = AlkylSilane(10)
print(alkyl_silane)
alkyl_silane.visualize()


<AlkylSilane 36 particles, non-periodic, 35 bonds, id: 4432611984>

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 0x11b5d0ef0>

In [ ]: