def to_parmed(self, box=None, title='', residues=None, show_ports=False):
        """Create a ParmEd Structure from a Compound.

        Parameters
        ----------
        box : mb.Box, optional, default=self.boundingbox (with buffer)
            Box information to be used when converting to a `Structure`.
            If 'None', a bounding box is used with 0.25nm buffers at
            each face to avoid overlapping atoms, unless `self.periodicity`
            is not None, in which case those values are used for the
            box lengths.
        title : str, optional, default=self.name
            Title/name of the ParmEd Structure
        residues : str of list of str
            Labels of residues in the Compound. Residues are assigned by
            checking against Compound.name.
        show_ports : boolean, optional, default=False
            Include all port atoms when converting to a `Structure`.

        Returns
        -------
        parmed.structure.Structure
            ParmEd Structure object converted from self

        See Also
        --------
        parmed.structure.Structure : Details on the ParmEd Structure object

        """
        structure = pmd.Structure()
        structure.title = title if title else self.name
        atom_mapping = {}  # For creating bonds below
        guessed_elements = set()

        if isinstance(residues, string_types):
            residues = [residues]
        if isinstance(residues, (list, set)):
            residues = tuple(residues)

        default_residue = pmd.Residue('RES')
        port_residue = pmd.Residue('PRT')
        compound_residue_map = dict()
        atom_residue_map = dict()

        for atom in self.particles(include_ports=show_ports):
            if atom.port_particle:
                current_residue = port_residue
                atom_residue_map[atom] = current_residue

                if current_residue not in structure.residues:
                    structure.residues.append(current_residue)

                pmd_atom = pmd.Atom(atomic_number=0, name='VS',
                                    mass=0, charge=0)
                pmd_atom.xx, pmd_atom.xy, pmd_atom.xz = atom.pos * 10  # Angstroms

            else:
                if residues and atom.name in residues:
                    current_residue = pmd.Residue(atom.name)
                    atom_residue_map[atom] = current_residue
                    compound_residue_map[atom] = current_residue
                elif residues:
                    for parent in atom.ancestors():
                        if residues and parent.name in residues:
                            if parent not in compound_residue_map:
                                current_residue = pmd.Residue(parent.name)
                                compound_residue_map[parent] = current_residue
                            atom_residue_map[atom] = current_residue
                            break
                    else:  # Did not find specified residues in ancestors.
                        current_residue = default_residue
                        atom_residue_map[atom] = current_residue
                else:
                    current_residue = default_residue
                    atom_residue_map[atom] = current_residue

                if current_residue not in structure.residues:
                    structure.residues.append(current_residue)

                atomic_number = None
                name = ''.join(char for char in atom.name if not char.isdigit())
                try:
                    atomic_number = AtomicNum[atom.name]
                except KeyError:
                    element = element_by_name(atom.name)
                    if name not in guessed_elements:
                        warn(
                            'Guessing that "{}" is element: "{}"'.format(
                                atom, element))
                        guessed_elements.add(name)
                else:
                    element = atom.name

                atomic_number = atomic_number or AtomicNum[element]
                mass = Mass[element]
                pmd_atom = pmd.Atom(atomic_number=atomic_number, name=atom.name,
                                    mass=mass, charge=atom.charge)
                pmd_atom.xx, pmd_atom.xy, pmd_atom.xz = atom.pos * 10  # Angstroms

            residue = atom_residue_map[atom]
            structure.add_atom(pmd_atom, resname=residue.name,
                               resnum=residue.idx)

            atom_mapping[atom] = pmd_atom

        structure.residues.claim()

        for atom1, atom2 in self.bonds():
            bond = pmd.Bond(atom_mapping[atom1], atom_mapping[atom2])
            structure.bonds.append(bond)
        # pad box with .25nm buffers
        if box is None:
            box = self.boundingbox
            box_vec_max = box.maxs.tolist()
            box_vec_min = box.mins.tolist()
            for dim, val in enumerate(self.periodicity):
                if val:
                    box_vec_max[dim] = val
                    box_vec_min[dim] = 0.0
                if not val:
                    box_vec_max[dim] += 0.25
                    box_vec_min[dim] -= 0.25
            box.mins = np.asarray(box_vec_min)
            box.maxs = np.asarray(box_vec_max)

        box_vector = np.empty(6)
        if box.angles is not None:
            box_vector[3:6] = box.angles
        else:
            box_vector[3] = box_vector[4] = box_vector[5] = 90.0
        for dim in range(3):
            box_vector[dim] = box.lengths[dim] * 10
        structure.box = box_vector
        return structure
Create a ParmEd Structure from a Compound.

        Parameters
        ----------
        box : mb.Box, optional, default=self.boundingbox (with buffer)
            Box information to be used when converting to a `Structure`.
            If 'None', a bounding box is used with 0.25nm buffers at
            each face to avoid overlapping atoms, unless `self.periodicity`
            is not None, in which case those values are used for the
            box lengths.
        title : str, optional, default=self.name
            Title/name of the ParmEd Structure
        residues : str of list of str
            Labels of residues in the Compound. Residues are assigned by
            checking against Compound.name.
        show_ports : boolean, optional, default=False
            Include all port atoms when converting to a `Structure`.

        Returns
        -------
        parmed.structure.Structure
            ParmEd Structure object converted from self

        See Also
        --------
        parmed.structure.Structure : Details on the ParmEd Structure object