code: public static Pattern findSubstructure(IAtomContainer query) {
          boolean isQuery = query instanceof IQueryAtomContainer;
          return findSubstructure(query,
                                  isQuery ? AtomMatcher.forQuery() : AtomMatcher.forElement(),
                                  isQuery ? BondMatcher.forQuery() : BondMatcher.forOrder());
      }
docs: Create a pattern which can be used to find molecules which contain the
  {@code query} structure.
  
  @param query the substructure to find
  @return a pattern for finding the {@code query}