code: def _virtual_molecule(self, mol, ilabels, eq_atoms):
          
          vmol = ob.OBMol()
  
          non_unique_atoms = set([a for g in eq_atoms for a in g])
          all_atoms = set(range(1, len(ilabels) + 1))
          unique_atom_labels = sorted(all_atoms - non_unique_atoms)
  
          #try to align molecules using unique atoms
          for i in unique_atom_labels:
              orig_idx = ilabels[i-1]
              oa1 = mol.GetAtom(orig_idx)
              a1 = vmol.NewAtom()
              a1.SetAtomicNum(oa1.GetAtomicNum())
              a1.SetVector(oa1.GetVector())
  
          #try to align using centroids of the equivalent atoms
          if vmol.NumAtoms() < 3:
              for symm in eq_atoms:
                  c1x, c1y, c1z = self._group_centroid(mol, ilabels, symm)
                  min_distance = float("inf")
                  for i in range(1, vmol.NumAtoms()+1):
                      va = vmol.GetAtom(i)
                      distance = math.sqrt((c1x - va.x())**2 + (c1y - va.y())**2
                                           + (c1z - va.z())**2)
                      if distance < min_distance:
                          min_distance = distance
                  if min_distance > 0.2:
                      a1 = vmol.NewAtom()
                      a1.SetAtomicNum(9)
                      a1.SetVector(c1x, c1y, c1z)
  
          return vmol
docs: Create a virtual molecule by unique atoms, the centriods of the
          equivalent atoms
  
          Args:
              mol: The molecule. OpenBabel OBMol object
              ilables: inchi label map
              eq_atoms: equivalent atom labels
              farthest_group_idx: The equivalent atom group index in which
                  there is the farthest atom to the centroid
  
          Return:
              The virtual molecule