original_docstring: Given a mol, this function would break all the single bond in the molecule,
      and then return (fragments smiles, Carbons/hydrogens Types)
docstring: Given a mol, this function would break all the single bond in the molecule,
  and then return (fragments smiles, Carbons/hydrogens Types)
docstring_tokens: Given a mol this function would break all the single bond in the molecule and then return ( fragments smiles Carbons / hydrogens Types )
code: def breakBond(m, MapNum=False, returnidx=False):
      '''Given a mol, this function would break all the single bond in the molecule,
      and then return (fragments smiles, Carbons/hydrogens Types)'''
      mol = m.__copy__()
      idx2map = {}
      CHs, CHs_idx, frags, frag_idx = [], [], [], []
      for atom in mol.GetAtoms():
          if MapNum:
              idx2map[atom.GetIdx()]=atom.GetAtomMapNum()
          atom.SetAtomMapNum(atom.GetIdx())
      no_link = set()
      for bond in mol.GetBonds():
          if bond.GetBondTypeAsDouble() == 1.0:
              atom1 = bond.GetBeginAtom()
              atom2 = bond.GetEndAtom()
              if sp3merge(atom1, atom2):
                  continue
              no_link.add(bond.GetIdx())
      links = set(range(mol.GetNumBonds())).difference(no_link)
      if not links: links=[mol.GetNumBonds()]
      # To avoid empty sp3_link ==> all bonds, set an impossible value
      rwmol = AtomListToSubMol(mol, range(mol.GetNumAtoms()), links)
      for mm in Chem.GetMolFrags(rwmol, asMols=True, sanitizeFrags=False):
          if mm.GetNumAtoms() == 1 and mm.GetAtomWithIdx(0).GetSymbol() in ['C', 'H']:
              atom = mol.GetAtomWithIdx(mm.GetAtomWithIdx(0).GetAtomMapNum())
              CHs.append(atom.GetSymbol()+str(int(atom.GetIsAromatic()))+str(atom.GetDegree())
          +str(atom.GetFormalCharge()))
              CHs_idx.append((atom.GetAtomMapNum(),))
          else:
              mm_renum, order = standize(mm, asMol=True, Order=True)
              frag_idx.append(tuple([mm.GetAtomWithIdx(i).GetAtomMapNum() for i in order]))
              frags.append(mm_renum)
      if not returnidx:
          return frags, CHs
      if idx2map:
          frag_idx = [tuple(map(lambda x: idx2map[x],group)) for group in frag_idx]
          CHs_idx = [tuple(map(lambda x: idx2map[x],group)) for group in CHs_idx]
      return frags, CHs, frag_idx, CHs_idx
code_tokens: def breakBond ( m , MapNum = False , returnidx = False ) : mol = m . __copy__ ( ) idx2map = { } CHs , CHs_idx , frags , frag_idx = [ ] , [ ] , [ ] , [ ] for atom in mol . GetAtoms ( ) : if MapNum : idx2map [ atom . GetIdx ( ) ] = atom . GetAtomMapNum ( ) atom . SetAtomMapNum ( atom . GetIdx ( ) ) no_link = set ( ) for bond in mol . GetBonds ( ) : if bond . GetBondTypeAsDouble ( ) == 1.0 : atom1 = bond . GetBeginAtom ( ) atom2 = bond . GetEndAtom ( ) if sp3merge ( atom1 , atom2 ) : continue no_link . add ( bond . GetIdx ( ) ) links = set ( range ( mol . GetNumBonds ( ) ) ) . difference ( no_link ) if not links : links = [ mol . GetNumBonds ( ) ] rwmol = AtomListToSubMol ( mol , range ( mol . GetNumAtoms ( ) ) , links ) for mm in Chem . GetMolFrags ( rwmol , asMols = True , sanitizeFrags = False ) : if mm . GetNumAtoms ( ) == 1 and mm . GetAtomWithIdx ( 0 ) . GetSymbol ( ) in [ 'C' , 'H' ] : atom = mol . GetAtomWithIdx ( mm . GetAtomWithIdx ( 0 ) . GetAtomMapNum ( ) ) CHs . append ( atom . GetSymbol ( ) + str ( int ( atom . GetIsAromatic ( ) ) ) + str ( atom . GetDegree ( ) ) + str ( atom . GetFormalCharge ( ) ) ) CHs_idx . append ( ( atom . GetAtomMapNum ( ) , ) ) else : mm_renum , order = standize ( mm , asMol = True , Order = True ) frag_idx . append ( tuple ( [ mm . GetAtomWithIdx ( i ) . GetAtomMapNum ( ) for i in order ] ) ) frags . append ( mm_renum ) if not returnidx : return frags , CHs if idx2map : frag_idx = [ tuple ( map ( lambda x : idx2map [ x ] , group ) ) for group in frag_idx ] CHs_idx = [ tuple ( map ( lambda x : idx2map [ x ] , group ) ) for group in CHs_idx ] return frags , CHs , frag_idx , CHs_idx
short_docstring: Given a mol, this function would break all the single bond in the molecule,
  and then return (fragments smiles, Carbons/hydrogens Types)
short_docstring_tokens: Given a mol this function would break all the single bond in the molecule and then return ( fragments smiles Carbons / hydrogens Types )
comment: '''Given a mol, this function would break all the single bond in the molecule,
      and then return (fragments smiles, Carbons/hydrogens Types)'''$SEP$# To avoid empty sp3_link ==> all bonds, set an impossible value