code: def _create_equivalence_transform(equiv):
      
      from mbuild.compound import Compound
      self_points = np.array([])
      self_points.shape = (0, 3)
      other_points = np.array([])
      other_points.shape = (0, 3)
  
      for pair in equiv:
          if not isinstance(pair, tuple) or len(pair) != 2:
              raise ValueError('Equivalence pair not a 2-tuple')
          if not (isinstance(pair[0], Compound) and isinstance(pair[1], Compound)):
              raise ValueError('Equivalence pair type mismatch: pair[0] is a {0} '
                               'and pair[1] is a {1}'.format(type(pair[0]),
                                                             type(pair[1])))
  
          # TODO: vstack is slow, replace with list concatenation
          if not pair[0].children:
              self_points = np.vstack([self_points, pair[0].pos])
              other_points = np.vstack([other_points, pair[1].pos])
          else:
              for atom0 in pair[0]._particles(include_ports=True):
                  self_points = np.vstack([self_points, atom0.pos])
              for atom1 in pair[1]._particles(include_ports=True):
                  other_points = np.vstack([other_points, atom1.pos])
      T = RigidTransform(self_points, other_points)
      return T
docs: Compute an equivalence transformation that transforms this compound
      to another compound's coordinate system.
  
      Parameters
      ----------
      equiv : np.ndarray, shape=(n, 3), dtype=float
          Array of equivalent points.
  
      Returns
      -------
      T : CoordinateTransform
          Transform that maps this point cloud to the other point cloud's
          coordinates system.