code: private static GeometryEncoder encoder(ITetrahedralChirality tc, Map<IAtom, Integer> atomToIndex) {
  
          IAtom[] ligands = tc.getLigands();
  
          int centre = atomToIndex.get(tc.getChiralAtom());
          int[] indices = new int[4];
  
          int offset = -1;
  
          for (int i = 0; i < ligands.length; i++) {
              indices[i] = atomToIndex.get(ligands[i]);
              if (indices[i] == centre) offset = i;
          }
  
          // convert clockwise/anticlockwise to -1/+1
          int parity = tc.getStereo() == CLOCKWISE ? -1 : 1;
  
          // now if any atom is the centre (indicating an implicit
          // hydrogen) we need to adjust the indicies and the parity
          if (offset >= 0) {
  
              // remove the 'implicit' central from the first 3 vertices
              for (int i = offset; i < indices.length - 1; i++) {
                  indices[i] = indices[i + 1];
              }
  
              // we now take how many vertices we moved which is
              // 3 (last index) minus the index where we started. if the
              // value is odd we invert the parity (odd number of
              // inversions)
              if (Integer.lowestOneBit(3 - offset) == 0x1) parity *= -1;
  
              // trim the array to size we don't include the last (implicit)
              // vertex when checking the invariants
              indices = Arrays.copyOf(indices, indices.length - 1);
          }
  
          return new GeometryEncoder(centre, new BasicPermutationParity(indices), GeometricParity.valueOf(parity));
      }
docs: Create an encoder for the {@link ITetrahedralChirality} element.
  
  @param tc          stereo element from an atom container
  @param atomToIndex map of atoms to indices
  @return a new geometry encoder