private int getNumberOfDimensions(IAtomContainer mol) { for (IAtom atom : mol.atoms()) { if (atom.getPoint3d() != null && !forceWriteAs2DCoords.isSet()) return 3; else if (atom.getPoint2d() != null) return 2; } return 0; }
private int getNumberOfDimensions(IAtomContainer mol) { for (IAtom atom : mol.atoms()) { if (atom.getPoint3d() != null && !forceWriteAs2DCoords.isSet()) { return 3; } else if (atom.getPoint2d() != null) { return 2; } } return 0; }
private void customizeJob() { fireIOSettingQuestion(optimize); try { if (optimize.isSet()) { mopacCommands.setSetting("PM3 NOINTER NOMM BONDS MULLIK PRECISE"); } else { mopacCommands.setSetting("PM3 NOINTER NOMM BONDS MULLIK XYZ 1SCF"); } } catch (CDKException exception) { throw new IllegalArgumentException(exception); } fireIOSettingQuestion(mopacCommands); }
private void customizeJob() { fireIOSettingQuestion(optimize); try { if (optimize.isSet()) { mopacCommands.setSetting("PM3 NOINTER NOMM BONDS MULLIK PRECISE"); } else { mopacCommands.setSetting("PM3 NOINTER NOMM BONDS MULLIK XYZ 1SCF"); } } catch (CDKException exception) { throw new IllegalArgumentException(exception); } fireIOSettingQuestion(mopacCommands); }
private void writeAtom(IAtom atom) throws Exception { if (atom instanceof IPseudoAtom) { writer.write(" IPseudoAtom " + atom.getID() + " = builder.newInstance(IPseudoAtom.class);"); writer.write('\n'); writer.write(" atom.setLabel(\"" + ((IPseudoAtom) atom).getLabel() + "\");"); writer.write('\n'); } else { writer.write(" IAtom " + atom.getID() + " = builder.newInstance(IAtom.class,\"" + atom.getSymbol() + "\");"); writer.write('\n'); } if (atom.getFormalCharge() != null) { writer.write(" " + atom.getID() + ".setFormalCharge(" + atom.getFormalCharge() + ");"); writer.write('\n'); } if (write2DCoordinates.isSet() && atom.getPoint2d() != null) { Point2d p2d = atom.getPoint2d(); writer.write(" " + atom.getID() + ".setPoint2d(new Point2d(" + p2d.x + ", " + p2d.y + "));"); writer.write('\n'); } if (write3DCoordinates.isSet() && atom.getPoint3d() != null) { Point3d p3d = atom.getPoint3d(); writer.write(" " + atom.getID() + ".setPoint3d(new Point3d(" + p3d.x + ", " + p3d.y + ", " + p3d.z + "));"); writer.write('\n'); } }
private void customizeJob() { fireIOSettingQuestion(cmlIds); fireIOSettingQuestion(namespacedOutput); if (namespacedOutput.isSet()) { fireIOSettingQuestion(namespacePrefix); } fireIOSettingQuestion(schemaInstanceOutput); if (schemaInstanceOutput.isSet()) { fireIOSettingQuestion(instanceLocation); } fireIOSettingQuestion(indent); fireIOSettingQuestion(xmlDeclaration); }
private void writeAtom(IAtom atom) throws Exception { if (atom instanceof IPseudoAtom) { writer.write(" IPseudoAtom " + atom.getID() + " = builder.newInstance(IPseudoAtom.class);"); writer.write('\n'); writer.write(" atom.setLabel(\"" + ((IPseudoAtom) atom).getLabel() + "\");"); writer.write('\n'); } else { writer.write(" IAtom " + atom.getID() + " = builder.newInstance(IAtom.class,\"" + atom.getSymbol() + "\");"); writer.write('\n'); } if (atom.getFormalCharge() != null) { writer.write(" " + atom.getID() + ".setFormalCharge(" + atom.getFormalCharge() + ");"); writer.write('\n'); } if (write2DCoordinates.isSet() && atom.getPoint2d() != null) { Point2d p2d = atom.getPoint2d(); writer.write(" " + atom.getID() + ".setPoint2d(new Point2d(" + p2d.x + ", " + p2d.y + "));"); writer.write('\n'); } if (write3DCoordinates.isSet() && atom.getPoint3d() != null) { Point3d p3d = atom.getPoint3d(); writer.write(" " + atom.getID() + ".setPoint3d(new Point3d(" + p3d.x + ", " + p3d.y + ", " + p3d.z + "));"); writer.write('\n'); } }
private void customizeJob() { fireIOSettingQuestion(cmlIds); fireIOSettingQuestion(namespacedOutput); if (namespacedOutput.isSet()) { fireIOSettingQuestion(namespacePrefix); } fireIOSettingQuestion(schemaInstanceOutput); if (schemaInstanceOutput.isSet()) { fireIOSettingQuestion(instanceLocation); } fireIOSettingQuestion(indent); fireIOSettingQuestion(xmlDeclaration); }
if (setting instanceof BooleanIOSetting) { BooleanIOSetting boolSet = (BooleanIOSetting) setting; boolean set = boolSet.isSet(); if (set) { this.out.print(" [Yn]");
/** * Writes the content from molecule to output. * * @param molecule Molecule of which the data is given as output. */ public void writeAtomContainer(IAtomContainer molecule) { SmilesGenerator sg = new SmilesGenerator(); if (useAromaticityFlag.isSet()) sg = sg.aromatic(); String smiles = ""; try { smiles = sg.create(molecule); logger.debug("Generated SMILES: " + smiles); writer.write(smiles); writer.write('\n'); writer.flush(); logger.debug("file flushed..."); } catch (CDKException | IOException exc) { logger.error("Error while writing Molecule: ", exc.getMessage()); logger.debug(exc); } }
if (paramWriteData.isSet()) { Map<Object, Object> sdFields = container.getProperties(); boolean writeAllProperties = propertiesToWrite == null;
if (atom.getPoint3d() != null) { Point3d point = atom.getPoint3d(); writeAtom(atom, point.x, point.y, point.z, optimize.isSet() ? 1 : 0); } else if (atom.getPoint2d() != null) { Point2d point = atom.getPoint2d(); writeAtom(atom, point.x, point.y, 0, optimize.isSet() ? 1 : 0); } else writeAtom(atom, 0, 0, 0, 1);
private boolean writeV3000(IAtomContainer container) { if (paramWriteV3000.isSet()) return true; if (container.getAtomCount() > 999) return true; if (container.getBondCount() > 999) return true; // check for positional variation, this can be output in base V3000 and not V2000 List<Sgroup> sgroups = container.getProperty(CDKConstants.CTAB_SGROUPS); if (sgroups != null) { for (Sgroup sgroup : sgroups) if (sgroup.getType() == SgroupType.ExtMulticenter) return true; } return false; }
if (atom.getPoint3d() != null) { Point3d point = atom.getPoint3d(); writeAtom(atom, point.x, point.y, point.z, optimize.isSet() ? 1 : 0); } else if (atom.getPoint2d() != null) { Point2d point = atom.getPoint2d(); writeAtom(atom, point.x, point.y, 0, optimize.isSet() ? 1 : 0); } else writeAtom(atom, 0, 0, 0, 1);
private int determineIsotope(IAtom atom) { Integer mass = atom.getMassNumber(); IIsotope major = null; if (mass == null) return 0; try { major = Isotopes.getInstance().getMajorIsotope(atom.getSymbol()); } catch (IOException e) { // ignored } if (!writeMajorIsotopes.isSet() && major != null && mass.equals(major.getMassNumber())) mass = null; if (mass != null) { mass -= major != null ? major.getMassNumber() : 0; return mass >= -3 && mass <= 4 ? mass : 0; } return 0; }
private int determineIsotope(IAtom atom) { Integer mass = atom.getMassNumber(); IIsotope major = null; if (mass == null) { return 0; } try { major = Isotopes.getInstance().getMajorIsotope(atom.getSymbol()); } catch (IOException e) { // ignored } if (!writeMajorIsotopes.isSet() && major != null && mass.equals(major.getMassNumber())) { mass = null; } if (mass != null) { mass -= major != null ? major.getMassNumber() : 0; return mass >= -3 && mass <= 4 ? mass : 0; } return 0; }
if (!readOptimizedStructureOnly.isSet()) { sequence.addChemModel(model); } else {
Convertor convertor = new Convertor(cmlIds.isSet(), (namespacePrefix.getSetting().length() > 0) ? namespacePrefix.getSetting() : null); try { Serializer serializer = null; if (xmlDeclaration.isSet()) { serializer = new Serializer(output, "ISO-8859-1"); } else { serializer = new CustomSerializer(output, "ISO-8859-1"); if (indent.isSet()) { logger.info("Indenting XML output"); serializer.setIndent(2); if (schemaInstanceOutput.isSet()) { root.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance"); root.addAttribute(new Attribute("xsi:schemaLocation=", "http://www.w3.org/2001/XMLSchema-instance",
return atom; if (symbol.equals("D") && interpretHydrogenIsotopes.isSet()) { if (mode == Mode.STRICT) throw new CDKException("invalid symbol: " + symbol); IAtom atom = builder.newInstance(IAtom.class, "H"); return atom; if (symbol.equals("T") && interpretHydrogenIsotopes.isSet()) { if (mode == Mode.STRICT) throw new CDKException("invalid symbol: " + symbol); IAtom atom = builder.newInstance(IAtom.class, "H");
return atom; if (symbol.equals("D") && interpretHydrogenIsotopes.isSet()) { if (mode == Mode.STRICT) { throw new CDKException("invalid symbol: " + symbol); return atom; if (symbol.equals("T") && interpretHydrogenIsotopes.isSet()) { if (mode == Mode.STRICT) { throw new CDKException("invalid symbol: " + symbol);