MolFormatException: Parallel bonds: null

User 870ab5b546

19-01-2016 17:34:17

The following MRV was generated by our LewisJS program and subjected to MolImporter:


<?xml version="1.0" encoding="UTF-8"?>
<cml>
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<propertyList>
<property dictRef="is Lewis Structure?" title="is Lewis Structure?">
<scalar>true</scalar>
</property>
</propertyList>
<atomArray>
<atom id="a1" elementType="C" x2="134" y2="158" />
<atom id="a2" elementType="C" x2="183" y2="126" />
<atom id="a3" elementType="C" x2="241" y2="152" />
<atom id="a4" elementType="O" x2="183" y2="75" />
<atom id="a5" elementType="H" x2="112" y2="129" />
<atom id="a6" elementType="H" x2="108" y2="181" />
<atom id="a7" elementType="H" x2="154" y2="184" />
<atom id="a8" elementType="H" x2="232" y2="182" />
<atom id="a9" elementType="H" x2="274" y2="167" />
<atom id="a10" elementType="H" x2="253" y2="121" />
</atomArray>
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a2 a4" order="2" />
<bond atomRefs2="a1 a5" order="1" />
<bond atomRefs2="a1 a6" order="1" />
<bond atomRefs2="a1 a7" order="1" />
<bond atomRefs2="a3 a8" order="1" />
<bond atomRefs2="a3 a9" order="1" />
<bond atomRefs2="a3 a9" order="1" />
<bond atomRefs2="a3 a10" order="1" />
</bondArray>
</molecule>
</MChemicalStruct>
</MDocument>
</cml>

It threw the following exception:


INFO: chemaxon.formats.MolFormatException: Parallel bonds: null
at chemaxon.marvin.io.formats.cml.BondReader.processBondArrays(BondReader.java:374)
at chemaxon.marvin.io.formats.cml.CMLImport.readMol0(CMLImport.java:508)
at chemaxon.marvin.io.formats.cml.CMLImport.readMol00(CMLImport.java:418)
at chemaxon.marvin.io.formats.cml.CMLImport.readMolecule(CMLImport.java:380)
at chemaxon.marvin.io.formats.cml.MrvImport.readChemicalStruct(MrvImport.java:352)
at chemaxon.marvin.io.formats.cml.MrvImport.readMDocument(MrvImport.java:191)
at chemaxon.marvin.io.formats.cml.MrvImport.readMRV(MrvImport.java:135)
at chemaxon.marvin.io.formats.cml.MrvImport.readDocument(MrvImport.java:75)
at chemaxon.marvin.io.formats.cml.CMLImport.readDocument(CMLImport.java:208)
at chemaxon.marvin.io.MRecordImporter.readMol(MRecordImporter.java:714)
at chemaxon.marvin.io.MRecordImporter.readMol(MRecordImporter.java:686)
at chemaxon.marvin.io.MRecordImporter.readMol0(MRecordImporter.java:594)
at chemaxon.marvin.io.MRecordImporter.readMol(MRecordImporter.java:511)
at chemaxon.formats.MolImporter.readMol(MolImporter.java:883)
at chemaxon.formats.MolImporter.read(MolImporter.java:766)
at chemaxon.formats.MolImporter.importMol(MolImporter.java:1308)
at chemaxon.formats.MolImporter.importMol(MolImporter.java:1499)
at chemaxon.formats.MolImporter.importMol(MolImporter.java:1465)
at com.epoch.lewis.LewisMolecule.<init>(LewisMolecule.java:51)

When does the error message mean, and how can we avoid it in the future?


This structure also elicits the error:


<?xml version="1.0" encoding="UTF-8"?>
<cml>
<MDocument>
<MChemicalStruct>
<molecule molID="m1">
<propertyList>
<property dictRef="is Lewis Structure?" title="is Lewis Structure?">
<scalar>true</scalar>
</property>
</propertyList>
<atomArray>
<atom id="a1" elementType="C" x2="168" y2="158" />
<atom id="a2" elementType="C" x2="217" y2="126" />
<atom id="a3" elementType="C" x2="275" y2="152" />
<atom id="a4" elementType="O" x2="217" y2="75">
<scalar id="a4:prop1" title="paired electrons" convention="marvin:atomprop" dataType="xsd:integer" value="4" />
</atom>
<atom id="a5" elementType="H" x2="146" y2="129" />
<atom id="a6" elementType="H" x2="142" y2="181" />
<atom id="a7" elementType="H" x2="188" y2="184" />
<atom id="a8" elementType="H" x2="266" y2="182" />
<atom id="a9" elementType="H" x2="308" y2="167" />
<atom id="a10" elementType="H" x2="287" y2="121" />
</atomArray>
<bondArray>
<bond atomRefs2="a1 a2" order="1" />
<bond atomRefs2="a2 a3" order="1" />
<bond atomRefs2="a2 a4" order="2" />
<bond atomRefs2="a1 a5" order="1" />
<bond atomRefs2="a1 a6" order="1" />
<bond atomRefs2="a1 a7" order="1" />
<bond atomRefs2="a3 a8" order="1" />
<bond atomRefs2="a3 a9" order="1" />
<bond atomRefs2="a3 a9" order="1" />
<bond atomRefs2="a3 a10" order="1" />
</bondArray>
</molecule>
</MChemicalStruct>
</MDocument>
</cml>

Finally, if I just redraw the structure, then the program accepts it. So there's something uniquely wrong with the MRV in these (and a few other) MRVs.

ChemAxon 044c6721bc

20-01-2016 07:50:46

Hi Bob,


There are parallel bonds between a3 and a9 in both mrvs. Parallel bonds are not supported in our API. A solution can be filtering parallel bonds in your exporter.


Janos

User 870ab5b546

20-01-2016 19:15:12

Ah, I see, parallel bonds are two separate bonds between the same pair of atoms.


Is there any reason your API can't just ignore the second bond rather than throwing an exception?


Anyway, i modified our code to avoid creating such bonds. Thanks for your explanation.

ChemAxon a202a732bf

21-01-2016 07:53:21

Hi Bob,


If we would just ignore a request to add a second bond between two atoms then we could hide coding mistakes. I think it would be similar to not throwing AIOBE if someone refers to an element of an array with a negative index.


Regards,


Zsuzsa