private void writeRadicalPattern(Iterator<Map.Entry<Integer, SPIN_MULTIPLICITY>> iterator, int i) throws IOException { Map.Entry<Integer, SPIN_MULTIPLICITY> entry = iterator.next(); writer.write(" "); writer.write(formatMDLInt(entry.getKey() + 1, WIDTH)); writer.write(" "); writer.write(formatMDLInt(entry.getValue().getValue(), WIDTH)); i = i + 1; if (i < NN8 && iterator.hasNext()) writeRadicalPattern(iterator, i); }
writer.write(formatMDLInt(wrapSgroups.size(), 3)); for (Sgroup sgroup : wrapSgroups) { writer.write(' '); writer.write(formatMDLInt(1 + sgroups.indexOf(sgroup), 3)); writer.write(' '); writer.write(sgroup.getType().getKey()); writer.write(formatMDLInt(id, 3)); writer.write(formatMDLInt(atoms.size(), 3)); for (IAtom atom : atoms) { writer.write(' '); writer.write(formatMDLInt(1+atomidxs.get(atom), 3)); writer.write(formatMDLInt(id, 3)); writer.write(formatMDLInt(bonds.size(), 3)); for (IBond bond : bonds) { writer.write(' '); writer.write(formatMDLInt(1+container.indexOf(bond), 3)); writer.write(formatMDLInt(parents.size(), 3)); for (Sgroup parent : parents) { writer.write(' '); writer.write(formatMDLInt(id, 3)); writer.write(' '); writer.write(formatMDLInt(1 + sgroups.indexOf(parent), 3)); case CtabSubScript: writer.write("M SMT "); writer.write(formatMDLInt(id, 3));
RGroupList rgList = rGroupQuery.getRGroupDefinitions().get(rgrpNum); int restH = rgList.isRestH() ? 1 : 0; String logLine = "M LOG" + MDLV2000Writer.formatMDLInt(1, 3) + MDLV2000Writer.formatMDLInt(rgrpNum, 4) + MDLV2000Writer.formatMDLInt(rgList.getRequiredRGroupNumber(), 4) + MDLV2000Writer.formatMDLInt(restH, 4) + " " + rgList.getOccurrence(); rootBlock.append(logLine).append(LSEP); for (int atIdx = 0; atIdx < rootAtc.getAtomCount(); atIdx++) { if (rootAtc.getAtom(atIdx).equals(rgroupAtom)) { aalLine.append(MDLV2000Writer.formatMDLInt((atIdx + 1), 4)); aalLine.append(MDLV2000Writer.formatMDLInt(rApo.size(), 3)); aalLine.append(MDLV2000Writer.formatMDLInt(a + 1, 4)); aalLine.append(MDLV2000Writer.formatMDLInt(apoIdx, 4)); if (rgrpList != null && rgrpList.size() != 0) { rgpBlock.append("$RGP").append(LSEP);; rgpBlock.append(MDLV2000Writer.formatMDLInt(rgrpNum, 4)).append(LSEP); for (int atIdx = 0; atIdx < rgroup.getGroup().getAtomCount(); atIdx++) { if (rgroup.getGroup().getAtom(atIdx).equals(firstAttachmentPoint)) { apoLine.append(MDLV2000Writer.formatMDLInt((atIdx + 1), 4)); apoCount++; if (secondAttachmentPoint != null && secondAttachmentPoint.equals(firstAttachmentPoint)) { apoLine.append(MDLV2000Writer.formatMDLInt(3, 4)); } else { apoLine.append(MDLV2000Writer.formatMDLInt(1, 4));
line.append(formatMDLInt(container.getAtomCount(), 3)); line.append(formatMDLInt(container.getBondCount(), 3)); line.append(" 0 0"); atomprops[5] = determineValence(container, atom); atomprops[9] = determineAtomMap(atom); line.append(formatMDLInt(atomprops[0], 2)); // dd (mass-number) line.append(formatMDLInt(atomprops[1], 3)); // ccc (charge) int last = atomprops.length-1; if (!writeDefaultProps.isSet()) line.append(formatMDLInt(atomprops[i], 3)); line.append('\n'); writer.write(line.toString()); line.append(formatMDLInt(atomindex.get(bond.getEnd()) + 1, 3)); line.append(formatMDLInt(atomindex.get(bond.getBegin()) + 1, 3)); } else { line.append(formatMDLInt(atomindex.get(bond.getBegin()) + 1, 3)); line.append(formatMDLInt(atomindex.get(bond.getEnd()) + 1, 3)); line.append(formatMDLInt(bondType, 3)); line.append(" "); switch (bond.getStereo()) { && !((String) atom.getProperty(CDKConstants.COMMENT)).trim().equals("")) { writer.write("V "); writer.write(formatMDLInt(i + 1, 3)); writer.write(" ");