code: public static IAtomContainerSet getAllAtomContainers(IReactionScheme scheme, IAtomContainerSet molSet) {
          // A ReactionScheme can contain other IRreactionSet objects
          if (scheme.getReactionSchemeCount() != 0) for (IReactionScheme rm : scheme.reactionSchemes()) {
              for (IAtomContainer ac : getAllAtomContainers(rm, molSet).atomContainers()) {
                  boolean contain = false;
                  for (IAtomContainer atomContainer : molSet.atomContainers()) {
                      if (atomContainer.equals(ac)) {
                          contain = true;
                          break;
                      }
                  }
                  if (!contain) molSet.addAtomContainer((IAtomContainer) (ac));
              }
          }
          for (IReaction reaction : scheme.reactions()) {
              List<IAtomContainer> newAtomContainerSet = ReactionManipulator.getAllAtomContainers(reaction);
              for (IAtomContainer ac : newAtomContainerSet) {
                  boolean contain = false;
                  for (IAtomContainer atomContainer : molSet.atomContainers()) {
                      if (atomContainer.equals(ac)) {
                          contain = true;
                          break;
                      }
                  }
                  if (!contain) molSet.addAtomContainer(ac);
  
              }
          }
  
          return molSet;
      }
docs: Get all molecule objects from a set of Reactions given a {@link IAtomContainerSet} to add.
  
  @param  scheme The set of reaction to inspect
  @param  molSet The set of molecules to be added
  @return        The IAtomContainerSet