User 870ab5b546
09-12-2006 04:36:36
We have this code:
We submit this molecule:
We get a weird exception from Molecule.toFormat():
What might be causing this exception? I've never before seen anything like it from toFormat().
So I put in a try statement to catch the exception. But later, we call this method:
And then we get the same weird exception:
What's going on here? We're using JChem 3.2.1.
Code: |
studentMolecule = getSearchMolecule(studentXml, true); // hydrogenize authorMolecule = getSearchMolecule(authorXml, false); // don't hydro. if (studentMolecule == null || authorMolecule == null) { return false; } // if missing data print("hasSubstructure: got student molecule"); print("hasSubstructure: student molecule is:\n" + studentMolecule.toFormat("mrv")); print("hasSubstructure: author molecule is:\n" + authorMolecule.toFormat("mrv")); ... public Molecule getSearchMolecule(String xml, boolean hydrogenizeIt) throws MolFormatException { MolImporter importer = new MolImporter(); Molecule molecule = importer.importMol(xml); molecule.ungroupSgroups(); molecule.aromatize(); if (hydrogenizeIt) molecule = ChemUtils.addImplicitHnoClone(molecule); molecule = MechSet.normalizeRadicals(molecule); molecule = MolFunctions.replaceHnoClone(molecule); return molecule; } // getStudentData() |
We submit this molecule:
Code: |
<?xml version="1.0" ?> <MDocument> <MPolyline id="o1" color="#000000" headLength="0.8" headWidth="0.5"> <MRectanglePoint pos="6" rectRef="o7" /> <MRectanglePoint pos="4" rectRef="o6" /> </MPolyline> <MPolyline id="o2" color="#000000" headLength="0.8" headWidth="0.5"> <MPoint x="1.3970290422439575" y="-7.937664985656738" /> <MRectanglePoint pos="5" rectRef="o7" /> </MPolyline> <MPolyline id="o3" color="#000000" headLength="0.8" headWidth="0.5"> <MRectanglePoint pos="6" rectRef="o9" /> <MRectanglePoint pos="4" rectRef="o8" /> </MPolyline> <MPolyline id="o4" color="#000000" headLength="0.8" headWidth="0.5"> <MPoint x="-1.2065250873565674" y="0.0" /> <MRectanglePoint pos="7" rectRef="o9" /> </MPolyline> <MPolyline id="o5" color="#000000" headLength="0.8" headWidth="0.5"> <MPoint x="-5.016603946685791" y="4.8261003494262695" /> <MRectanglePoint pos="4" rectRef="o10" /> </MPolyline> <MRectangle id="o6" color="#000000"> <MPoint x="-10.033207893371582" y="-12.636762619018555" /> <MPoint x="0.6350131630897522" y="-12.636762619018555" /> <MPoint x="0.6350131630897522" y="-18.478883743286133" /> <MPoint x="-10.033207893371582" y="-18.478883743286133" /> </MRectangle> <MRectangle id="o7" color="#000000"> <MPoint x="-10.223711967468262" y="-4.8261003494262695" /> <MPoint x="0.0" y="-4.8261003494262695" /> <MPoint x="0.0" y="-9.969706535339355" /> <MPoint x="-10.223711967468262" y="-9.969706535339355" /> </MRectangle> <MRectangle id="o8" color="#000000"> <MPoint x="1.3970290422439575" y="-4.699097633361816" /> <MPoint x="10.160210609436035" y="-4.699097633361816" /> <MPoint x="10.160210609436035" y="-11.049229621887207" /> <MPoint x="1.3970290422439575" y="-11.049229621887207" /> </MRectangle> <MRectangle id="o9" color="#000000"> <MPoint x="1.6510342359542847" y="4.1275858879089355" /> <MPoint x="10.287213325500488" y="4.1275858879089355" /> <MPoint x="10.287213325500488" y="-3.492572546005249" /> <MPoint x="1.6510342359542847" y="-3.492572546005249" /> </MRectangle> <MRectangle id="o10" color="#000000"> <MPoint x="-10.160210609436035" y="3.4290711879730225" /> <MPoint x="-1.2065250873565674" y="3.4290711879730225" /> <MPoint x="-1.2065250873565674" y="-3.3020684719085693" /> <MPoint x="-10.160210609436035" y="-3.3020684719085693" /> </MRectangle> <MRectangle id="o11" color="#000000"> <MPoint x="-10.096709251403809" y="10.541218757629395" /> <MPoint x="0.12700264155864716" y="10.541218757629395" /> <MPoint x="0.12700264155864716" y="4.8261003494262695" /> <MPoint x="-10.096709251403809" y="4.8261003494262695" /> </MRectangle> <MEFlow id="o12" color="#000000" arcAngle="-254.995522631729" headSkip="0.25" headLength="0.5" headWidth="0.4" tailSkip="0.15"> <MAtomSetPoint atomRefs="m1.a57 m1.a60" /> <MAtomSetPoint atomRefs="m1.a57" /> </MEFlow> <MEFlow id="o13" color="#000000" arcAngle="248.39738999999997" headSkip="0.25" headLength="0.5" headWidth="0.4" tailSkip="0.15"> <MAtomSetPoint atomRefs="m1.a44 m1.a46" /> <MAtomSetPoint atomRefs="m1.a46" /> </MEFlow> <MEFlow id="o14" color="#000000" arcAngle="-254.995522631729" headSkip="0.15" headLength="0.5" headWidth="0.4" tailSkip="0.25"> <MAtomSetPoint atomRefs="m1.a45" /> <MAtomSetPoint atomRefs="m1.a44 m1.a45" /> </MEFlow> <MEFlow id="o15" color="#000000" arcAngle="248.39738999999997" headSkip="0.25" headLength="0.5" headWidth="0.4" tailSkip="0.15"> <MAtomSetPoint atomRefs="m1.a35 m1.a36" /> <MAtomSetPoint atomRefs="m1.a35" /> </MEFlow> <MEFlow id="o16" color="#000000" arcAngle="150.0" headSkip="0.15" headLength="0.5" headWidth="0.4" tailSkip="0.25"> <MAtomSetPoint atomRefs="m1.a33" /> <MAtomSetPoint atomRefs="m1.a33 m1.a36" weights="0.25 0.75" /> </MEFlow> <MEFlow id="o17" color="#000000" arcAngle="248.39738999999997" headSkip="0.25" headLength="0.5" headWidth="0.4" tailSkip="0.15"> <MAtomSetPoint atomRefs="m1.a19 m1.a20" /> <MAtomSetPoint atomRefs="m1.a20" /> </MEFlow> <MEFlow id="o18" color="#000000" arcAngle="-150.0" headSkip="0.15" headLength="0.5" headWidth="0.4" tailSkip="0.25"> <MAtomSetPoint atomRefs="m1.a23" /> <MAtomSetPoint atomRefs="m1.a23 m1.a19" weights="0.25 0.75" /> </MEFlow> <MEFlow id="o19" color="#000000" arcAngle="150.0" headSkip="0.15" headLength="0.5" headWidth="0.4" tailSkip="0.25"> <MAtomSetPoint atomRefs="m1.a9" /> <MAtomSetPoint atomRefs="m1.a9 m1.a11" weights="0.25 0.75" /> </MEFlow> <MChemicalStruct> <molecule molID="m1"> <atomArray atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23 a24 a25 a26 a27 a28 a29 a30 a31 a32 a33 a34 a35 a36 a37 a38 a39 a40 a41 a42 a43 a44 a45 a46 a47 a48 a49 a50 a51 a52 a53 a54 a55 a56 a57 a58 a59 a60 a61 a62 a63 a64 a65 a66 a67 a68 a69 a70 a71" elementType="C C C C C C C C O O H C C C C C C C C O O C O C C C C C C C C O O C O H C C C C C C C C O O C O C C C C C C C C O O C H C C C C C C C C O O C" formalCharge="0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0" x2="-7.940625190734863 -9.274294531783122 -9.274294531783122 -7.940625190734863 -6.606955849686605 -6.606955849686605 -5.273276727858569 -3.9395976060305333 -3.9395976060305333 -2.6059184842024976 -0.721875011920929 -7.80853614832265 -9.142205489370909 -9.142205489370909 -7.80853614832265 -6.474866807274392 -6.474866807274392 -5.141187685446356 -3.8075085636183204 -3.8075085636183204 -2.4738294417902846 -5.823124885559082 -4.283124885559082 3.3790980628858165 2.045428721837558 2.045428721837558 3.3790980628858165 4.712767403934075 4.712767403934075 6.046446525762111 7.380125647590146 7.380125647590146 8.713804769418182 5.364509325649385 6.904509325649385 8.23818844747742 3.361228847336668 2.0275595062884095 2.0275595062884095 3.361228847336668 4.694898188384927 4.694898188384927 6.028577310212962 7.362256432040997 7.362256432040997 8.695935553869035 5.346640110100236 6.886640110100236 -8.04916120554311 -9.382830546591368 -9.382830546591368 -8.04916120554311 -6.715491864494851 -6.715491864494851 -5.381812742666815 -4.0481336208387795 -4.0481336208387795 -2.7144544990107438 -1.380775377182708 -2.7144544990107438 -7.435183744470551 -8.76885308551881 -8.76885308551881 -7.435183744470551 -6.101514403422293 -6.101514403422293 -4.767835281594257 -3.4341561597662214 -3.4341561597662214 -2.1004770379381856 -0.7667979161101499" y2="8.951283995558999 8.181267054999958 6.6412331738818775 5.871216233322837 6.6412331738818775 8.181267054999958 5.871233173881878 6.6412331738818775 8.181233173881878 5.871233173881878 9.48062515258789 2.906790690720298 2.1367737501612574 0.5967398690431764 -0.17327707151586402 0.5967398690431764 2.1367737501612574 -0.17326013095682313 0.5967398690431764 2.1367398690431774 -0.17326013095682313 -2.2618749141693115 -2.2618749141693115 3.2248213271312753 2.454804386572235 0.914770505454154 0.14475356489511348 0.914770505454154 2.454804386572235 0.14477050545415437 0.914770505454154 2.454770505454155 0.14477050545415437 -1.943844277758334 -1.943844277758334 -2.713844277758334 -4.930180737490621 -5.700197678049661 -7.240231559167742 -8.010248499726782 -7.240231559167742 -5.700197678049661 -8.010231559167742 -7.240231559167742 -5.700231559167741 -8.010231559167742 -10.09884634238023 -10.09884634238023 -5.900084156691811 -6.670101097250852 -8.210134978368933 -8.980151918927973 -8.210134978368933 -6.670101097250852 -8.980134978368932 -8.210134978368933 -6.670134978368932 -8.980134978368932 -8.210134978368933 -5.900134978368932 -13.523082419720563 -14.293099360279605 -15.833133241397686 -16.603150181956725 -15.833133241397686 -14.293099360279605 -16.603133241397686 -15.833133241397686 -14.293133241397683 -16.603133241397686 -15.833133241397686" /> <bondArray> <bond atomRefs2="a1 a2" order="1" /> <bond atomRefs2="a1 a6" order="2" /> <bond atomRefs2="a2 a3" order="2" /> <bond atomRefs2="a3 a4" order="1" /> <bond atomRefs2="a4 a5" order="2" /> <bond atomRefs2="a5 a6" order="1" /> <bond atomRefs2="a5 a7" order="1" /> <bond atomRefs2="a7 a8" order="1" /> <bond atomRefs2="a8 a9" order="2" /> <bond atomRefs2="a8 a10" order="1" /> <bond atomRefs2="a12 a13" order="1" /> <bond atomRefs2="a12 a17" order="2" /> <bond atomRefs2="a13 a14" order="2" /> <bond atomRefs2="a14 a15" order="1" /> <bond atomRefs2="a15 a16" order="2" /> <bond atomRefs2="a16 a18" order="1" /> <bond atomRefs2="a16 a17" order="1" /> <bond atomRefs2="a18 a19" order="1" /> <bond atomRefs2="a19 a21" order="1" /> <bond atomRefs2="a19 a20" order="2" /> <bond atomRefs2="a22 a23" order="1" /> <bond atomRefs2="a24 a25" order="1" /> <bond atomRefs2="a24 a29" order="2" /> <bond atomRefs2="a25 a26" order="2" /> <bond atomRefs2="a26 a27" order="1" /> <bond atomRefs2="a27 a28" order="2" /> <bond atomRefs2="a28 a30" order="1" /> <bond atomRefs2="a28 a29" order="1" /> <bond atomRefs2="a30 a31" order="1" /> <bond atomRefs2="a31 a33" order="1" /> <bond atomRefs2="a31 a32" order="1" /> <bond atomRefs2="a34 a35" order="1" /> <bond atomRefs2="a31 a35" order="1" /> <bond atomRefs2="a35 a36" order="1" /> <bond atomRefs2="a37 a38" order="1" /> <bond atomRefs2="a37 a42" order="2" /> <bond atomRefs2="a38 a39" order="2" /> <bond atomRefs2="a39 a40" order="1" /> <bond atomRefs2="a40 a41" order="2" /> <bond atomRefs2="a41 a43" order="1" /> <bond atomRefs2="a41 a42" order="1" /> <bond atomRefs2="a43 a44" order="1" /> <bond atomRefs2="a44 a46" order="1" /> <bond atomRefs2="a44 a45" order="1" /> <bond atomRefs2="a44 a48" order="1" /> <bond atomRefs2="a47 a48" order="1" /> <bond atomRefs2="a49 a50" order="1" /> <bond atomRefs2="a49 a54" order="2" /> <bond atomRefs2="a50 a51" order="2" /> <bond atomRefs2="a51 a52" order="1" /> <bond atomRefs2="a52 a53" order="2" /> <bond atomRefs2="a53 a55" order="1" /> <bond atomRefs2="a53 a54" order="1" /> <bond atomRefs2="a55 a56" order="1" /> <bond atomRefs2="a56 a58" order="1" /> <bond atomRefs2="a56 a57" order="2" /> <bond atomRefs2="a58 a59" order="1" /> <bond atomRefs2="a57 a60" order="1" /> <bond atomRefs2="a61 a62" order="1" /> <bond atomRefs2="a61 a66" order="2" /> <bond atomRefs2="a62 a63" order="2" /> <bond atomRefs2="a63 a64" order="1" /> <bond atomRefs2="a64 a65" order="2" /> <bond atomRefs2="a65 a67" order="1" /> <bond atomRefs2="a65 a66" order="1" /> <bond atomRefs2="a67 a68" order="1" /> <bond atomRefs2="a68 a70" order="1" /> <bond atomRefs2="a68 a69" order="2" /> <bond atomRefs2="a70 a71" order="1" /> </bondArray> </molecule> </MChemicalStruct> </MDocument> |
We get a weird exception from Molecule.toFormat():
Code: |
MechSubStructSearch::hasSubstructure: got student molecule MechSubstructure: exception thrown, msg = MultiFaceAtom does not have any visible face java.lang.RuntimeException: MultiFaceAtom does not have any visible face at chemaxon.struc.graphics.MAtomSetPoint$MultiFaceAtom.getVisible(MAtomSetPoint.java:65) at chemaxon.struc.graphics.MAtomSetPoint.getAtoms(MAtomSetPoint.java:242) at chemaxon.marvin.modules.MrvExport.appendPoint(MrvExport.java:139) at chemaxon.marvin.modules.MrvExport.convert(MrvExport.java:112) at chemaxon.struc.Molecule.exportToObject(Molecule.java:1141) at chemaxon.struc.Molecule.exportToObject(Molecule.java:1106) at chemaxon.struc.Molecule.exportToFormat(Molecule.java:955) at chemaxon.struc.Molecule.toFormat(Molecule.java:933) at com.prenhall.epoch.mechanisms.MechSubStructSearch.hasSubstructure(MechSubStructSearch.java:63) |
What might be causing this exception? I've never before seen anything like it from toFormat().
So I put in a try statement to catch the exception. But later, we call this method:
Code: |
public static int getFlowType(MEFlow flow) { Object source = flow.getMolObject(MEFlow.E_SOURCE); Object sink = flow.getMolObject(MEFlow.E_SINK); int theSStype = SSTypeOf(source)*10 + SSTypeOf(sink); if (flow.getNumElectrons() == 2) // flow types for 2-electron flows theSStype *= -1; // are negative. return theSStype; } // flowType() |
And then we get the same weird exception:
Code: |
java.lang.RuntimeException: MultiFaceAtom does not have any visible face at chemaxon.struc.graphics.MAtomSetPoint$MultiFaceAtom.getVisible(MAtomSetPoint.java:65) at chemaxon.struc.graphics.MAtomSetPoint.getAtoms(MAtomSetPoint.java:242) at chemaxon.struc.graphics.MEFlow.getMolObject(MEFlow.java:106) at com.prenhall.epoch.mechanisms.MechSubStructSearch.getFlowType(MechSubStructSearch.java:359) |
What's going on here? We're using JChem 3.2.1.