code: private IQueryAtom matchExact(final IAtomContainer mol, final IAtom atom) {
          final IChemObjectBuilder bldr = atom.getBuilder();
  
          int elem = atom.getAtomicNumber();
  
          // attach atom skipped
          if (elem == 0)
              return null;
  
          int hcnt = atom.getImplicitHydrogenCount();
          int val = hcnt;
          int con = hcnt;
  
          for (IBond bond : mol.getConnectedBondsList(atom)) {
              val += bond.getOrder().numeric();
              con++;
              if (bond.getOther(atom).getAtomicNumber() == 1)
                  hcnt++;
          }
  
          Expr expr = new Expr(Expr.Type.ELEMENT, elem)
                  .and(new Expr(Expr.Type.TOTAL_DEGREE, con))
                  .and(new Expr(Expr.Type.TOTAL_H_COUNT, hcnt))
                  .and(new Expr(Expr.Type.VALENCE, val));
          return new QueryAtom(expr);
      }
docs: Make a query atom that matches atomic number, h count, valence, and
  connectivity. This effectively provides an exact match for that atom
  type.
  
  @param mol  molecule
  @param atom atom of molecule
  @return the query atom (null if attachment point)