null MDocument after importing MOL structure

User 870ab5b546

30-10-2013 20:38:20

The code:


    public LewisMolecule(String molSt) throws VerifyException {
final String SELF = "LewisMolecule: ";
try {
molStr = molSt;
debugPrint(SELF + "molStr:\n", molStr);
molecule = MolImporter.importMol(molStr);
mDoc = molecule.getDocument();
if (mDoc == null) debugPrint(SELF + "MDocument is null");
...

The log output:


Oct 30, 2013 4:33:06 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: LewisMolecule: molStr:
<?xml version="1.0" ?>
<cml>
<MDocument atomSetRGB="0:N,1:N" atomSetFont="0:SansSerif-PLAIN-12,1:Serif-PLAIN-14">
<MChemicalStruct>
<molecule molID="m1">
<atomArray>
<atom id="a1" elementType="N" x2="202.0" y2="48.0">
<scalar id="a1:prop1" title="paired electrons" convention="marvin:atomprop" dataType="xsd:integer" value="2" />
</atom>
<atom id="a2" elementType="O" formalCharge="-1"
x2="248.0" y2="93.0">
<scalar id="a2:prop1" title="paired electrons" convention="marvin:atomprop" dataType="xsd:integer" value="6" />
</atom>
<atom id="a3" elementType="N" formalCharge="1"
x2="248.0" y2="48.0" />
<atom id="a4" elementType="H" x2="157.0" y2="93.0" />
<atom id="a5" elementType="H" x2="112.0" y2="48.0" />
<atom id="a6" elementType="C" x2="157.0" y2="48.0" />
<atom id="a7" elementType="H" x2="157.0" y2="2.0" />
<atom id="a8" elementType="H" x2="293.0" y2="2.0" />
<atom id="a9" elementType="H" x2="293.0" y2="93.0" />
<atom id="a10" elementType="C" x2="293.0" y2="48.0" />
<atom id="a11" elementType="H" x2="339.0" y2="48.0" />
</atomArray>
<bondArray>
<bond atomRefs2="a6 a1" order="1" />
<bond atomRefs2="a1 a3" order="2" />
<bond atomRefs2="a3 a2" order="1" />
<bond atomRefs2="a3 a10" order="1" />
<bond atomRefs2="a6 a4" order="1" />
<bond atomRefs2="a6 a5" order="1" />
<bond atomRefs2="a6 a7" order="1" />
<bond atomRefs2="a10 a8" order="1" />
<bond atomRefs2="a10 a9" order="1" />
<bond atomRefs2="a10 a11" order="1" />
</bondArray>
</molecule>
</MChemicalStruct>
</MDocument>
</cml>

LewisMolecule: molStr:

Lewis 122110121158

11 10 0 0 0 99 V2000
202.0000 129.0000 0.0000 N 0 0 0 0 0 0
252.0000 129.0000 0.0000 N 0 0 0 0 0 0
152.0000 129.0000 0.0000 C 0 0 0 0 0 0
303.0000 129.0000 0.0000 C 0 0 0 0 0 0
252.0000 177.0000 0.0000 O 0 0 0 0 0 0
152.0000 176.0000 0.0000 H 0 0 0 0 0 0
105.0000 129.0000 0.0000 H 0 0 0 0 0 0
152.0000 83.0000 0.0000 H 0 0 0 0 0 0
303.0000 88.0000 0.0000 H 0 0 0 0 0 0
345.0000 129.0000 0.0000 H 0 0 0 0 0 0
303.0000 176.0000 0.0000 H 0 0 0 0 0 0
1 2 1 0 0
1 3 1 0 0
2 4 1 0 0
2 5 1 0 0
3 6 1 0 0
3 7 1 0 0
3 8 1 0 0
4 9 1 0 0
4 10 1 0 0
4 11 1 0 0
M LNE 1 1 2
M END

LewisMolecule: MDocument is null

When I import a molecule in MOL format, the MDocument of the resulting Molecule is null.  This seems to me to be a bug.  I am using JChem 6.1.0.

ChemAxon 25dcd765a3

02-11-2013 09:41:57

"When I import a molecule in MOL format, the MDocument of the resulting Molecule is null.  This seems to me to be a bug."


Yes the resulting MDocment is null. You may consider this as bug, in my view but the importer imports the smallest molecule object into which the molecule can fit. So if it a reaction you get a RxnMolecule, if it is an MDocument you get a Molecule with MDocument. In this case it is a Molecule which does not have document feature so the MDocument object will be null.


You can create an MDocument from a Molecule(Graph) with the MDocument constructor.

User 870ab5b546

04-11-2013 17:34:42

Thanks, that's helpful.  And once I create the MDocument, any time I use MoleculeGraph.getDocument() in the future, it will return the MDocument, correct?

ChemAxon 25dcd765a3

05-11-2013 07:59:36

Yes.