Exemple #1
0
 /**
  * Prepare a collection of molecules for rendering. If coordinates are not present they are
  * generated, if coordinates exists they are scaled to be consistent (length=1.5).
  *
  * @param mols molecules
  * @return coordinates
  * @throws CDKException
  */
 private List<Double> prepareCoords(Iterable<IAtomContainer> mols) throws CDKException {
   List<Double> scaleFactors = new ArrayList<>();
   for (IAtomContainer mol : mols) {
     if (ensure2dLayout(mol)) {
       scaleFactors.add(Double.NaN);
     } else if (mol.getBondCount() > 0) {
       final double factor = GeometryUtil.getScaleFactor(mol, 1.5);
       GeometryUtil.scaleMolecule(mol, factor);
       scaleFactors.add(factor);
     } else {
       scaleFactors.add(1d); // no bonds
     }
   }
   return scaleFactors;
 }