def _update_atomtypes(unatomtyped_topology, res_name, prototype):
    """Update atomtypes in residues in a topology using a prototype topology.

    Atomtypes are updated when residues in each topology have matching names.

    Parameters
    ----------
    unatomtyped_topology : openmm.app.Topology
        Topology lacking atomtypes defined by `find_atomtypes`.
    prototype : openmm.app.Topology
        Prototype topology with atomtypes defined by `find_atomtypes`.

    """
    for res in unatomtyped_topology.residues():
        if res.name == res_name:
            for old_atom, new_atom_id in zip([atom for atom in res.atoms()], [atom.id for atom in prototype.atoms()]):
                old_atom.id = new_atom_id
Update atomtypes in residues in a topology using a prototype topology.

    Atomtypes are updated when residues in each topology have matching names.

    Parameters
    ----------
    unatomtyped_topology : openmm.app.Topology
        Topology lacking atomtypes defined by `find_atomtypes`.
    prototype : openmm.app.Topology
        Prototype topology with atomtypes defined by `find_atomtypes`.