code: private boolean ensure2dLayout(IAtomContainer container) throws CDKException {
          if (!GeometryUtil.has2DCoordinates(container)) {
              StructureDiagramGenerator sdg = new StructureDiagramGenerator();
              sdg.generateCoordinates(container);
              return true;
          }
          return false;
      }
docs: Automatically generate coordinates if a user has provided a molecule without them.
  
  @param container a molecule
  @return if coordinates needed to be generated
  @throws CDKException coordinates could not be generated