code: private static int countAlignedBonds(IAtomContainer mol) {
          final double ref = Math.toRadians(30);
          final double diff = Math.toRadians(1);
          int count = 0;
          for (IBond bond : mol.bonds()) {
              Point2d beg = bond.getBegin().getPoint2d();
              Point2d end = bond.getEnd().getPoint2d();
              if (beg.x > end.x) {
                  Point2d tmp = beg;
                  beg = end;
                  end = tmp;
              }
              Vector2d vec = new Vector2d(end.x - beg.x, end.y - beg.y);
              double angle = Math.atan2(vec.y, vec.x);
  
              if (Math.abs(angle) - ref < diff) {
                  count++;
              }
          }
          return count;
      }
docs: Count the number of bonds aligned to 30 degrees.
  
  @param mol molecule
  @return number of aligned bonds