code: private static void assignRoleAndGrp(IAtomContainer mol, ReactionRole role, int grpId) {
          for (IAtom atom : mol.atoms()) {
              atom.setProperty(CDKConstants.REACTION_ROLE, role);
              atom.setProperty(CDKConstants.REACTION_GROUP, grpId);
          }
      }
docs: Assigns a reaction role and group id to all atoms in a molecule.
  
  @param mol molecule
  @param role role to assign
  @param grpId group id