fatal error in drawing

User 870ab5b546

20-04-2007 12:53:54

The following structure cannot be loaded into MarvinSketch. An error is generated, "error in line 268" if you try to import the source, nothing if you try to Paste, or an ArrayOutOfBoundsException: 49 if you try to load it into MarvinView in a jsp page. I think the problem is that the student has drawn an isolated EtO shortcut group not attached to anything, but I could be wrong. In any case, whatever the error is, it should not prevent the structrue from being loaded.





Code:
<?xml version="1.0" ?>


<MDocument>


  <MPolyline id="o1" color="#000000" headLength="0.8" headWidth="0.5">


    <MPoint x="4.716249942779541" y="-2.213749885559082" />


    <MPoint x="0.2887499928474426" y="-1.203125" />


  </MPolyline>


  <MPolyline id="o2" color="#000000" headLength="0.8" headWidth="0.5">


    <MPoint x="7.940625190734863" y="6.400625228881836" />


    <MPoint x="5.823124885559082" y="3.898124933242798" />


  </MPolyline>


  <MPolyline id="o3" color="#000000" headLength="0.8" headWidth="0.5">


    <MPoint x="3.5612499713897705" y="6.545000076293945" />


    <MPoint x="4.956874847412109" y="6.352499961853027" />


  </MPolyline>


  <MPolyline id="o4" color="#000000" headLength="0.8" headWidth="0.5">


    <MPoint x="-5.101250171661377" y="6.111875057220459" />


    <MPoint x="0.38499999046325684" y="6.496874809265137" />


  </MPolyline>


  <MRectangle id="o5" color="#000000">


    <MPoint x="-5.919374942779541" y="3.0799999237060547" />


    <MPoint x="0.6256250143051147" y="3.0799999237060547" />


    <MPoint x="0.6256250143051147" y="-1.6843750476837158" />


    <MPoint x="-5.919374942779541" y="-1.6843750476837158" />


  </MRectangle>


  <MRectangle id="o6" color="#000000">


    <MPoint x="4.042500019073486" y="4.571875095367432" />


    <MPoint x="9.817500114440918" y="4.571875095367432" />


    <MPoint x="9.817500114440918" y="-4.379374980926514" />


    <MPoint x="4.042500019073486" y="-4.379374980926514" />


  </MRectangle>


  <MRectangle id="o7" color="#000000">


    <MPoint x="4.76437520980835" y="11.309374809265137" />


    <MPoint x="11.213125228881836" y="11.309374809265137" />


    <MPoint x="11.213125228881836" y="5.775000095367432" />


    <MPoint x="4.76437520980835" y="5.775000095367432" />


  </MRectangle>


  <MRectangle id="o8" color="#000000">


    <MPoint x="-1.8768750429153442" y="11.116874694824219" />


    <MPoint x="3.8499999046325684" y="11.116874694824219" />


    <MPoint x="3.8499999046325684" y="6.06374979019165" />


    <MPoint x="-1.8768750429153442" y="6.06374979019165" />


  </MRectangle>


  <MRectangle id="o9" color="#000000">


    <MPoint x="-10.876250267028809" y="10.68375015258789" />


    <MPoint x="-3.994374990463257" y="10.68375015258789" />


    <MPoint x="-3.994374990463257" y="4.716249942779541" />


    <MPoint x="-10.876250267028809" y="4.716249942779541" />


  </MRectangle>


  <MEFlow id="o10" color="#000000" arcAngle="-254.995522631729"


          headSkip="0.25" headLength="0.5" headWidth="0.4" tailSkip="0.15">


    <MAtomSetPoint atomRefs="m1.a25 m1.a26" />


    <MAtomSetPoint atomRefs="m1.a25" />


  </MEFlow>


  <MEFlow id="o11" color="#000000" arcAngle="-150.0" headSkip="0.15"


          headLength="0.5" headWidth="0.4" tailSkip="0.25">


    <MAtomSetPoint atomRefs="m1.a22" />


    <MAtomSetPoint atomRefs="m1.a22 m1.a26" weights="0.25 0.75" />


  </MEFlow>


  <MEFlow id="o12" color="#000000" arcAngle="-254.995522631729"


          headSkip="0.25" headLength="0.5" headWidth="0.4" tailSkip="0.15">


    <MAtomSetPoint atomRefs="m1.a16 m1.a17" />


    <MAtomSetPoint atomRefs="m1.a17" />


  </MEFlow>


  <MEFlow id="o13" color="#000000" arcAngle="150.0" headSkip="0.15"


          headLength="0.5" headWidth="0.4" tailSkip="0.25">


    <MAtomSetPoint atomRefs="m1.a50" />


    <MAtomSetPoint atomRefs="m1.a50 m1.a16" weights="0.25 0.75" />


  </MEFlow>


  <MEFlow id="o14" color="#000000" arcAngle="-254.995522631729"


          headSkip="0.25" headLength="0.5" headWidth="0.4" tailSkip="0.15">


    <MAtomSetPoint atomRefs="m1.a12 m1.a13" />


    <MAtomSetPoint atomRefs="m1.a13" />


  </MEFlow>


  <MEFlow id="o15" color="#000000" arcAngle="-254.995522631729"


          headSkip="0.15" headLength="0.5" headWidth="0.4" tailSkip="0.25">


    <MAtomSetPoint atomRefs="m1.a12" />


    <MAtomSetPoint atomRefs="m1.a11 m1.a12" />


  </MEFlow>


  <MEFlow id="o16" color="#000000" arcAngle="-182.17399554899995"


          headSkip="0.15" headLength="0.5" headWidth="0.4" tailSkip="0.15">


    <MAtomSetPoint atomRefs="m1.a10 m1.a11" />


    <MAtomSetPoint atomRefs="m1.a10 m1.a12" 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.a3 m1.a9" />


    <MAtomSetPoint atomRefs="m1.a3" />


  </MEFlow>


  <MEFlow id="o18" color="#000000" arcAngle="235.9971" headSkip="0.15"


          headLength="0.5" headWidth="0.4" tailSkip="0.25">


    <MAtomSetPoint atomRefs="m1.a6" />


    <MAtomSetPoint atomRefs="m1.a6 m1.a9" 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"


          elementType="R C C Br O R Na H H R C C Br O O C C R R O C C R R O H R C C R O"


          formalCharge="0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0"


          sgroupRef="sg1 0 0 0 0 sg2 0 0 0 sg3 0 0 0 0 0 0 0 sg4 sg5 0 0 0 sg6 sg7 0 0 sg8 0 0 sg9 0"


          x2="-9.625 -8.291320878171964 -6.803795105686799 -5.714850662659516 -8.689902207629846 -6.689374923706055 -8.02305404553409 -8.137474227514835 -5.714850662659516 -0.8662499785423279 0.46742914328570784 1.8011082651137436 2.8900527081410265 0.06884781382782607 6.929999828338623 7.328581157796505 8.66226027962454 10.149786052109706 6.641250133514404 6.641250133514404 6.641250133514404 7.730194576541687 9.063873698369722 5.307571011686369 7.988749980926514 6.655070859098478 -4.235000133514404 -2.9013210116863686 -1.5676418898583329 -0.47869744683104964 -3.2999023411442505"


          y2="7.603750228881836 8.373750228881836 7.975168899423954 9.064113342451238 9.861276001367 6.06374979019165 5.29374979019165 7.2051688994239536 6.886224456396671 7.988749980926514 8.758749980926513 7.988749980926514 9.077694423953798 10.246275753411679 10.346875190734863 8.859349418249698 8.089349418249698 8.48793074770758 6.641250133514404 2.8393750190734863 1.2993750190734863 0.21043057604620308 0.980430576046203 0.5293750190734857 -2.8393750190734863 -2.069375019073486 -0.2887499928474426 0.4812500071525573 -0.2887499928474426 0.8001944501798406 1.9687757796377223"


          />


      <bondArray>


        <bond atomRefs2="a2 a3" order="1" />


        <bond atomRefs2="a3 a4" order="1" />


        <bond atomRefs2="a2 a5" order="2" />


        <bond atomRefs2="a3 a8" order="1" />


        <bond atomRefs2="a3 a9" order="1" />


        <bond atomRefs2="a11 a12" order="1" />


        <bond atomRefs2="a12 a13" order="1" />


        <bond atomRefs2="a11 a14" order="2" />


        <bond atomRefs2="a15 a16" order="2" />


        <bond atomRefs2="a16 a17" order="2" />


        <bond atomRefs2="a20 a21" order="2" />


        <bond atomRefs2="a21 a22" order="1" />


        <bond atomRefs2="a25 a26" order="1" />


        <bond atomRefs2="a28 a29" order="1" />


        <bond atomRefs2="a28 a31" order="2" />


        <bond atomRefs2="a29 a30" order="1" />


        <bond atomRefs2="a27 a28" order="1" />


        <bond atomRefs2="a21 a24" order="1" />


        <bond atomRefs2="a22 a23" order="1" />


        <bond atomRefs2="a17 a18" order="1" />


        <bond atomRefs2="a10 a11" order="1" />


        <bond atomRefs2="a6 a7" order="1" />


        <bond atomRefs2="a1 a2" order="1" />


      </bondArray>


      <molecule id="sg1" role="SuperatomSgroup" title="Ph" molID="m2">


        <atomArray


            atomID="a32 a33 a34 a35 a36 a37"


            elementType="C C C C C C"


            attachmentPoint="1 0 0 0 0 0"


            x2="-9.961874961853027 -8.62819584002499 -8.62819584002499 -9.961874961853026 -11.295554083681061 -11.295554083681063"


            y2="5.871250114440917 6.6412501144409175 8.181250114440918 8.951250114440917 8.18125011444092 6.641250114440918"


            />


        <bondArray>


          <bond atomRefs2="a32 a33" order="2" />


          <bond atomRefs2="a32 a37" order="1" />


          <bond atomRefs2="a33 a34" order="1" />


          <bond atomRefs2="a34 a35" order="2" />


          <bond atomRefs2="a35 a36" order="1" />


          <bond atomRefs2="a36 a37" order="2" />


        </bondArray>


      </molecule>


      <molecule id="sg2" role="SuperatomSgroup" title="OEt" leftName="EtO" molID="m3">


        <atomArray


            atomID="a38 a39 a40"


            elementType="O C C"


            attachmentPoint="1 0 0"


            x2="-8.02305404553409 -6.689374923706055 -5.355695801878019"


            y2="6.320416456858317 5.550416456858317 6.320416456858317"


            />


        <bondArray>


          <bond atomRefs2="a39 a38" order="1" />


          <bond atomRefs2="a40 a39" order="1" />


        </bondArray>


      </molecule>


      <molecule id="sg3" role="SuperatomSgroup" title="Ph" molID="m4">


        <atomArray


            atomID="a41 a42 a43 a44 a45 a46"


            elementType="C C C C C C"


            attachmentPoint="1 0 0 0 0 0"


            x2="-1.1549999713897714 0.1786791504382661 0.1786791504382661 -1.1549999713897694 -2.4886790932178053 -2.4886790932178062"


            y2="6.6412496185302725 7.411249618530273 8.951249618530273 9.721249618530273 8.951249618530275 7.411249618530274"


            />


        <bondArray>


          <bond atomRefs2="a41 a42" order="2" />


          <bond atomRefs2="a41 a46" order="1" />


          <bond atomRefs2="a42 a43" order="1" />


          <bond atomRefs2="a43 a44" order="2" />


          <bond atomRefs2="a44 a45" order="1" />


          <bond atomRefs2="a45 a46" order="2" />


        </bondArray>


      </molecule>


      <molecule id="sg4" role="SuperatomSgroup" title="Ph" molID="m5">


        <atomArray


            atomID="a47 a48 a49 a50 a51 a52"


            elementType="C C C C C C"


            attachmentPoint="1 0 0 0 0 0"


            x2="9.913749694824219 11.247428816652256 11.247428816652256 9.91374969482422 8.580070572996185 8.580070572996183"


            y2="6.881874999999999 7.6518749999999995 9.191875 9.961875 9.191875000000001 7.651875"


            />


        <bondArray>


          <bond atomRefs2="a47 a48" order="2" />


          <bond atomRefs2="a47 a52" order="1" />


          <bond atomRefs2="a48 a49" order="1" />


          <bond atomRefs2="a49 a50" order="2" />


          <bond atomRefs2="a50 a51" order="1" />


          <bond atomRefs2="a51 a52" order="2" />


        </bondArray>


      </molecule>


      <molecule id="sg5" role="SuperatomSgroup" title="OEt" leftName="EtO" molID="m6">


        <atomArray


            atomID="a53 a54 a55"


            elementType="C C O"


            attachmentPoint="0 0 1"


            x2="7.97492925534244 6.641250133514404 5.307571011686369"


            y2="6.897916800181071 6.127916800181071 6.897916800181071"


            />


        <bondArray>


          <bond atomRefs2="a53 a54" order="1" />


          <bond atomRefs2="a54 a55" order="1" />


        </bondArray>


      </molecule>


      <molecule id="sg6" role="SuperatomSgroup" title="Ph" molID="m7">


        <atomArray


            atomID="a56 a57 a58 a59 a60 a61"


            elementType="C C C C C C"


            attachmentPoint="1 0 0 0 0 0"


            x2="9.047499656677246 10.381178778505284 10.381178778505284 9.047499656677248 7.713820534849211 7.71382053484921"


            y2="-0.7218749904632573 0.04812500953674281 1.5881250095367427 2.358125009536743 1.5881250095367436 0.0481250095367437"


            />


        <bondArray>


          <bond atomRefs2="a56 a57" order="2" />


          <bond atomRefs2="a56 a61" order="1" />


          <bond atomRefs2="a57 a58" order="1" />


          <bond atomRefs2="a58 a59" order="2" />


          <bond atomRefs2="a59 a60" order="1" />


          <bond atomRefs2="a60 a61" order="2" />


        </bondArray>


      </molecule>


      <molecule id="sg7" role="SuperatomSgroup" title="OEt" leftName="EtO" molID="m8">


        <atomArray


            atomID="a62 a63 a64"


            elementType="O C C"


            attachmentPoint="1 0 0"


            x2="3.334446030759855 4.668125152587891 6.001804274415926"


            y2="0.7379166547457375 -0.032083345254262596 0.737916654745738"


            />


        <bondArray>


          <bond atomRefs2="a63 a62" order="1" />


          <bond atomRefs2="a64 a63" order="1" />


        </bondArray>


      </molecule>


      <molecule id="sg8" role="SuperatomSgroup" title="OEt" leftName="EtO" molID="m9">


        <atomArray


            atomID="a65 a66 a67"


            elementType="O C C"


            attachmentPoint="1 0 0"


            x2="-5.61680404553409 -4.283124923706055 -2.949445801878019"


            y2="-0.22458332141240456 -0.9945833214124047 -0.2245833214124041"


            />


        <bondArray>


          <bond atomRefs2="a66 a65" order="1" />


          <bond atomRefs2="a67 a66" order="1" />


        </bondArray>


      </molecule>


      <molecule id="sg9" role="SuperatomSgroup" title="Ph" molID="m10">


        <atomArray


            atomID="a68 a69 a70 a71 a72 a73"


            elementType="C C C C C C"


            attachmentPoint="1 0 0 0 0 0"


            x2="0.24062499403953463 1.5743041158675721 1.5743041158675721 0.24062499403953663 -1.0930541277884993 -1.0930541277885002"


            y2="-0.6737500214576726 0.09624997854232753 1.6362499785423275 2.406249978542328 1.6362499785423283 0.09624997854232842"


            />


        <bondArray>


          <bond atomRefs2="a68 a69" order="2" />


          <bond atomRefs2="a68 a73" order="1" />


          <bond atomRefs2="a69 a70" order="1" />


          <bond atomRefs2="a70 a71" order="2" />


          <bond atomRefs2="a71 a72" order="1" />


          <bond atomRefs2="a72 a73" order="2" />


        </bondArray>


      </molecule>


    </molecule>


  </MChemicalStruct>


</MDocument>

ChemAxon 7c2d26e5cf

20-04-2007 20:06:37

We will check it.

User ef5e605ae6

21-04-2007 05:34:08

The buggy electron flow arrow (in lines 64-67) points from an internal atom (a50) of the upper right Ph group, to the a50-a16 incipient bond. I cannot imagine how could he draw it but I could reproduce other non-fatal (exceptionless) bugs by drawing arrows from atoms of an expanded group and then contracting the group.


It would probably be cumbersome to prepare MRV import to such cases and possibly double work because MRV import will be rewritten in Marvin 4.2 or 4.3 (using java 1.4 DOM parsing).


An easier fix is to prevent such situations: the S-group will be immediately ungrouped if one of its internal atoms are used as arrow starting or ending point. Would you like this solution?

User ef5e605ae6

21-04-2007 07:30:12

A related bug. If you draw an electron flow arrow, then create a superatom S-group from a part of the molecule that contains an end point of the arrow, then you get an invalid molecule: you cannot contract the S-group and a RuntimeException is thrown ("MultiFaceAtom does not have any visible face"). I fixed it now with a fast workaround: any arrow pointing to or from an atom in the selection is automatically deleted before the S-group is created.


So I hope you don't need electron flow arrows inside S-groups because it seems to be impossible; both in the latest release (because of the bugs) and the current, fixed code on the CVS.

User 870ab5b546

21-04-2007 12:12:24

We do not need electron-flow arrows inside shortcut groups. All the solutions you describe sound good to me.





I have no idea either how the student managed to do what you said she did.

User 870ab5b546

22-04-2007 23:25:05

I should mention another fatal error that I am seeing fairly often. A student types OEt, then places the group on the canvas as an isolated molecule. When Marvin tries to load such a drawing, it throws an error.





I suggest that a shortcut group not attached to anything be treated like a valence error. It should be underlined in red in Marvin, and hasValenceError() should return true.

ChemAxon 7c2d26e5cf

23-04-2007 12:24:18

I can not reproduce it. Could you send an example (an MRV file)?

User 870ab5b546

23-04-2007 12:42:57

It looks like the error occurs when an electron-flow arrow starts at the shortcut group.





The solution here is if a shortcut group is used as the starting point for an electron-flow arrow, it should be ungrouped, and the attachment point of the shortcut group should serve as the starting point of the arrow.





[Another alternative, but one that might be trickier to program, is to allow shortcut groups to be charged, with the attachment point getting the charge. In that case, it would be possible to put a negative charge on the OEt shortcut group, and the O atom would have the negative charge. If this were possible, then we could have electron-flow arrows start at shortcut groups. But you would still need to handle the case where no charge was placed on the shortcut group.]





However, it should remain possible for an electron-flow arrow to point to a shortcut group without the shortcut group being ungrouped. In this case, as is the case now, the attachment point of the shortcut group serves as the ending point of the electron-flow arrow.





Code:
<?xml version="1.0" ?>


<MDocument>


  <MPolyline id="o1" headLength="0.8" headWidth="0.5">


    <MRectanglePoint pos="5" rectRef="o3" />


    <MRectanglePoint pos="7" rectRef="o2" />


  </MPolyline>


  <MRectangle id="o2">


    <MPoint x="-9.882797241210938" y="23.729007720947266" />


    <MPoint x="-4.117832183837891" y="23.729007720947266" />


    <MPoint x="-4.117832183837891" y="18.42729949951172" />


    <MPoint x="-9.882797241210938" y="18.42729949951172" />


  </MRectangle>


  <MRectangle id="o3">


    <MPoint x="-20.846525192260742" y="25.221723556518555" />


    <MPoint x="-12.096132278442383" y="25.221723556518555" />


    <MPoint x="-12.096132278442383" y="18.01551628112793" />


    <MPoint x="-20.846525192260742" y="18.01551628112793" />


  </MRectangle>


  <MEFlow id="o4" arcAngle="248.39738999999997" headSkip="0.25"


          headLength="0.5" headWidth="0.4" tailSkip="0.15">


    <MAtomSetPoint atomRefs="m1.a1 m1.a8" />


    <MAtomSetPoint atomRefs="m1.a1" />


  </MEFlow>


  <MEFlow id="o5" arcAngle="150.0" headSkip="0.15" headLength="0.5"


          headWidth="0.4" tailSkip="0.25">


    <MAtomSetPoint atomRefs="m1.a6" />


    <MAtomSetPoint atomRefs="m1.a6 m1.a8" 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"


          elementType="C C C C C R H H C C C C C O O"


          formalCharge="0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0"


          sgroupRef="0 0 0 0 0 sg1 0 0 0 0 0 0 0 0 0"


          x2="-16.16469955444336 -17.410565883460386 -16.934703466073167 -15.394695642813552 -14.918833225426333 -13.17706298828125 -16.563280883901243 -15.39469955444336 -8.132719039916992 -9.378585368934019 -8.902722951546798 -7.362715128287185 -6.886852710899964 -5.399326938414799 -18.950565883460385"


          y2="21.685663641496305 20.780447042984306 19.315899603064416 19.315899603064416 20.780447042984306 22.905441284179688 23.17318941398147 23.01934276332434 22.156517447038297 21.2513008485263 19.78675340860641 19.78675340860641 21.2513008485263 21.649882177984182 20.780447042984306"


          />


      <bondArray>


        <bond atomRefs2="a1 a2" order="1" />


        <bond atomRefs2="a2 a3" order="1" />


        <bond atomRefs2="a3 a4" order="1" />


        <bond atomRefs2="a4 a5" order="1" />


        <bond atomRefs2="a1 a5" order="1" />


        <bond atomRefs2="a1 a7" order="1" />


        <bond atomRefs2="a1 a8" order="1" />


        <bond atomRefs2="a9 a10" order="1" />


        <bond atomRefs2="a10 a11" order="1" />


        <bond atomRefs2="a11 a12" order="1" />


        <bond atomRefs2="a12 a13" order="1" />


        <bond atomRefs2="a9 a13" order="1" />


        <bond atomRefs2="a13 a14" order="2" />


        <bond atomRefs2="a2 a15" order="2" />


      </bondArray>


      <molecule id="sg1" role="SuperatomSgroup" title="OEt" leftName="EtO" molID="m2">


        <atomArray


            atomID="a16 a17 a18"


            elementType="C C O"


            attachmentPoint="0 0 1"


            x2="-11.843383866453214 -13.17706298828125 -14.510742110109284"


            y2="23.162107950846355 22.392107950846352 23.162107950846355"


            />


        <bondArray>


          <bond atomRefs2="a16 a17" order="1" />


          <bond atomRefs2="a17 a18" order="1" />


        </bondArray>


      </molecule>


    </molecule>


  </MChemicalStruct>


</MDocument>


ChemAxon 7c2d26e5cf

23-04-2007 13:26:50

Which Marvin do you use? I've tried the latest one (4.1.7).


There is no exception by the attached mrv file.


Ungrouping/extracting OEt works fine. The starting point of the arrow will be the attachment point.


You are knocking opened doors.

User 870ab5b546

23-04-2007 14:37:03

I get the error in Marvin 4.1.5 or 4.1.6. It happens when I am reloading a file into Marvin after submitting it by AJAX. Here is the stack trace that appears in the Safari popup:





Code:
java.io.IOException: cannot find atom "m1.a17"


   at chemaxon.marvin.modules.MrvImport.b(Unknown Source)


   at chemaxon.marvin.modules.MrvImport.b(Unknown Source)


   at chemaxon.marvin.modules.MrvImport.a(Unknown Source)


   at chemaxon.marvin.modules.MrvImport.readDocument(Unknown Source)


   at chemaxon.marvin.util.MolLoader.a(Unknown Source)


   at chemaxon.marvin.util.MolLoader.b(Unknown Source)


   at chemaxon.marvin.util.MolLoader.run(Unknown Source)


   at chemaxon.marvin.common.swing.MolPanel.startLoader(Unknown Source)


   at chemaxon.marvin.sketch.swing.SketchPanel.setMol(Unknown Source)


   at JMSketch.a(Unknown Source)


   at JMSketch.run(Unknown Source)


   at java.lang.Thread.run(Thread.java:552)






I can paste the MRV directly into Marvin or via the Source page. It's only when it's loaded into Marvin via:





Code:
msketch_param("mol",parent.qframe.getMol());






that I see the problem.





In this particular example, BTW, parent.qframe.getMol() is:





Code:
function getMol() {


   return '<?xml version="1.0" ?>\n<MDocument>\n  <MRectangle id="o1">\n    <MPoint x="-12.833333492279053" y="8.108334064483643" />\n    <MPoint x="-4.375000029802322" y="8.108334064483643" />\n    <MPoint x="-4.375000029802322" y="1.8666670322418213" />\n    <MPoint x="-12.833333492279053" y="1.8666670322418213" />\n  </MRectangle>\n  <MChemicalStruct>\n    <molecule molID="m1">\n      <atomArray\n          atomID="a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21"\n          elementType="Cl Cl Cl C H O O Cl Cl Cl C C C R C R C Cl Cl C Cl"\n          radical="0 0 0 0 0 monovalent monovalent 0 0 0 monovalent 0 0 0 monovalent 0 0 0 0 0 0"\n          sgroupRef="0 0 0 0 0 0 0 0 0 0 0 0 0 sg1 0 sg2 0 0 0 0 0"\n          x2="-10.09166669845581 -11.63166669845581 -10.09166669845581 -10.09166669845581 -8.551666698455811 -7.116666793823242 -5.576666793823242 2.484999904632568 0.944999904632569 2.484999904632568 2.484999904632568 6.125 6.8950000000000005 8.435 0.4433333214124051 1.9833333214124043 -0.3266666785875949 -1.866666678587595 -3.406666678587595 -1.866666678587595 -1.866666678587595"\n          y2="5.915000476837158 4.375000476837158 2.835000476837158 4.375000476837158 4.375000476837158 6.708333492279053 6.708333492279053 6.498333492279052 4.958333492279053 3.4183334922790536 4.958333492279053 3.558333396911621 4.892012518739657 4.892012518739657 -3.4054401973565565 -3.4054401973565565 -4.739119319184592 -3.199119319184592 -4.739119319184592 -4.739119319184592 -6.279119319184592"\n          />\n      <bondArray>\n        <bond atomRefs2="a4 a1" order="1" />\n        <bond atomRefs2="a4 a2" order="1" />\n        <bond atomRefs2="a4 a3" order="1" />\n        <bond atomRefs2="a4 a5" order="1" />\n        <bond atomRefs2="a6 a7" order="1" />\n        <bond atomRefs2="a11 a8" order="1" />\n        <bond atomRefs2="a11 a9" order="1" />\n        <bond atomRefs2="a11 a10" order="1" />\n        <bond atomRefs2="a12 a13" order="2" />\n        <bond atomRefs2="a17 a15" order="1" />\n        <bond atomRefs2="a17 a20" order="1" />\n        <bond atomRefs2="a20 a18" order="1" />\n        <bond atomRefs2="a20 a19" order="1" />\n        <bond atomRefs2="a20 a21" order="1" />\n        <bond atomRefs2="a15 a16" order="1" />\n        <bond atomRefs2="a13 a14" order="1" />\n      </bondArray>\n      <molecule id="sg1" role="SuperatomSgroup" title="Ph" molID="m2">\n        <atomArray\n            atomID="a22 a23 a24 a25 a26 a27"\n            elementType="C C C C C C"\n            attachmentPoint="1 0 0 0 0 0"\n            x2="8.691666603088379 10.025345724916416 10.025345724916416 8.69166660308838 7.357987481260344 7.357987481260343"\n            y2="3.418333492279052 4.188333492279052 5.728333492279052 6.498333492279052 5.728333492279054 4.188333492279053"\n            />\n        <bondArray>\n          <bond atomRefs2="a22 a23" order="2" />\n          <bond atomRefs2="a22 a27" order="1" />\n          <bond atomRefs2="a23 a24" order="1" />\n          <bond atomRefs2="a24 a25" order="2" />\n          <bond atomRefs2="a25 a26" order="1" />\n          <bond atomRefs2="a26 a27" order="2" />\n        </bondArray>\n      </molecule>\n      <molecule id="sg2" role="SuperatomSgroup" title="Ph" molID="m3">\n        <atomArray\n            atomID="a28 a29 a30 a31 a32 a33"\n            elementType="C C C C C C"\n            attachmentPoint="1 0 0 0 0 0"\n            x2="2.2399999245007827 3.57367904632882 3.57367904632882 2.2399999245007844 0.9063208026727487 0.9063208026727478"\n            y2="-4.8791192238171615 -4.10911922381716 -2.569119223817161 -1.7991192238171614 -2.569119223817159 -4.10911922381716"\n            />\n        <bondArray>\n          <bond atomRefs2="a28 a29" order="2" />\n          <bond atomRefs2="a28 a33" order="1" />\n          <bond atomRefs2="a29 a30" order="1" />\n          <bond atomRefs2="a30 a31" order="2" />\n          <bond atomRefs2="a31 a32" order="1" />\n          <bond atomRefs2="a32 a33" order="2" />\n        </bondArray>\n      </molecule>\n    </molecule>\n  </MChemicalStruct>\n  <MRectangle id="o3">\n    <MPoint x="-0.23333333432674408" y="7.641666889190674" />\n    <MPoint x="9.449999809265137" y="7.641666889190674" />\n    <MPoint x="9.449999809265137" y="2.3333332538604736" />\n    <MPoint x="-0.23333333432674408" y="2.3333332538604736" />\n  </MRectangle>\n  <MRectangle id="o4">\n    <MPoint x="-5.6583333015441895" y="-2.0999999046325684" />\n    <MPoint x="3.7916667461395264" y="-2.0999999046325684" />\n    <MPoint x="3.7916667461395264" y="-7.291666507720947" />\n    <MPoint x="-5.6583333015441895" y="-7.291666507720947" />\n  </MRectangle>\n  <MPolyline id="o5" headLength="0.8" headWidth="0.5">\n    <MRectanglePoint pos="5" rectRef="o1" />\n    <MRectanglePoint pos="7" rectRef="o3" />\n  </MPolyline>\n  <MPolyline id="o6" headLength="0.8" headWidth="0.5">\n    <MRectanglePoint pos="6" rectRef="o3" />\n    <MRectanglePoint pos="4" rectRef="o4" />\n  </MPolyline>\n</MDocument>\n';


}








Log into ACE and submit the response to any mechanism question, and you will see what I mean.

ChemAxon 7c2d26e5cf

24-04-2007 15:41:55

I've created a simple applet example to check it.


Although it is not an Ajax example but it load the same molecule string (that you give in getMol() function). This example works fine (the example is attached).


Probably, the reported issue can be a encoding problem in your Ajax example by javascript side.

User 870ab5b546

25-04-2007 14:48:44

I isolated the error. It is produced when an MRV containing an electron-flow originating from a shortcut group is converted into a Molecule, then back into MRV. Here's the method:





Code:
    public static String unhighlightMPolylines(String originalMrv)


          throws  chemaxon.formats.MolFormatException


    {


        System.out.println("ChemUtils.unhighlightMPolylines: processing:\n"


                + originalMrv);


        Molecule    molecule = MolImporter.importMol(originalMrv);


        MDocument   doc = molecule.getDocument();


        if (doc == null) return originalMrv;


        for (int objIndex = 0; objIndex < doc.getObjectCount(); objIndex++) {


            MObject obj = doc.getObject(objIndex);


            if (obj instanceof MPolyline)


                ((MPolyline) obj).setColor(Color.BLACK);


        } // for each object in the MDocument


        String newMRV = molecule.toFormat("mrv");


        System.out.println("ChemUtils.unhighlightMPolylines: returning:\n"


                + newMRV);


        return newMRV;


    } // unhighlightMPolylines()






And here's the output; notice the change in MEFlow o5:





Code:
ChemUtils.unhighlightMPolylines: processing:


<?xml version="1.0" ?>


<MDocument>


  <MPolyline id="o1" color="#000000" headLength="0.8" headWidth="0.5">


    <MRectanglePoint pos="5" rectRef="o3" />


    <MRectanglePoint pos="7" rectRef="o2" />


  </MPolyline>


  <MRectangle id="o2" color="#000000">


    <MPoint x="-9.882797241210938" y="23.729007720947266" />


    <MPoint x="-4.117832183837891" y="23.729007720947266" />


    <MPoint x="-4.117832183837891" y="18.42729949951172" />


    <MPoint x="-9.882797241210938" y="18.42729949951172" />


  </MRectangle>


  <MRectangle id="o3" color="#000000">


    <MPoint x="-20.846525192260742" y="25.221723556518555" />


    <MPoint x="-12.096132278442383" y="25.221723556518555" />


    <MPoint x="-12.096132278442383" y="18.01551628112793" />


    <MPoint x="-20.846525192260742" y="18.01551628112793" />


  </MRectangle>


  <MEFlow id="o4" color="#000000" arcAngle="248.39738999999997"


          headSkip="0.25" headLength="0.5" headWidth="0.4" tailSkip="0.15">


    <MAtomSetPoint atomRefs="m1.a1 m1.a8" />


    <MAtomSetPoint atomRefs="m1.a1" />


  </MEFlow>


  <MEFlow id="o5" color="#000000" arcAngle="150.0" headSkip="0.15"


          headLength="0.5" headWidth="0.4" tailSkip="0.25">


    <MAtomSetPoint atomRefs="m1.a6" />


    <MAtomSetPoint atomRefs="m1.a6 m1.a8" 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"


          elementType="C C C C C R H H C C C C C O O"


          formalCharge="0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0"


          sgroupRef="0 0 0 0 0 sg1 0 0 0 0 0 0 0 0 0"


          x2="-16.16469955444336 -17.410565883460386 -16.934703466073167 -15.394695642813552 -14.918833225426333 -13.17706298828125 -16.563280883901243 -15.39469955444336 -8.132719039916992 -9.378585368934019 -8.902722951546798 -7.362715128287185 -6.886852710899964 -5.399326938414799 -18.950565883460385"


          y2="21.685663641496305 20.780447042984306 19.315899603064416 19.315899603064416 20.780447042984306 22.905441284179688 23.17318941398147 23.01934276332434 22.156517447038297 21.2513008485263 19.78675340860641 19.78675340860641 21.2513008485263 21.649882177984182 20.780447042984306"


          />


      <bondArray>


        <bond atomRefs2="a1 a2" order="1" />


        <bond atomRefs2="a2 a3" order="1" />


        <bond atomRefs2="a3 a4" order="1" />


        <bond atomRefs2="a4 a5" order="1" />


        <bond atomRefs2="a1 a5" order="1" />


        <bond atomRefs2="a1 a7" order="1" />


        <bond atomRefs2="a1 a8" order="1" />


        <bond atomRefs2="a9 a10" order="1" />


        <bond atomRefs2="a10 a11" order="1" />


        <bond atomRefs2="a11 a12" order="1" />


        <bond atomRefs2="a12 a13" order="1" />


        <bond atomRefs2="a9 a13" order="1" />


        <bond atomRefs2="a13 a14" order="2" />


        <bond atomRefs2="a2 a15" order="2" />


      </bondArray>


      <molecule id="sg1" role="SuperatomSgroup" title="OEt" leftName="EtO" molID="m2">


        <atomArray


            atomID="a16 a17 a18"


            elementType="C C O"


            attachmentPoint="0 0 1"


            x2="-11.843383866453214 -13.17706298828125 -14.510742110109284"


            y2="23.162107950846355 22.392107950846352 23.162107950846355"


            />


        <bondArray>


          <bond atomRefs2="a16 a17" order="1" />


          <bond atomRefs2="a17 a18" order="1" />


        </bondArray>


      </molecule>


    </molecule>


  </MChemicalStruct>


</MDocument>





ChemUtils.unhighlightMPolylines: returning:


<?xml version="1.0" ?>


<MDocument>


  <MPolyline id="o1" color="#000000" headLength="0.8" headWidth="0.5">


    <MRectanglePoint pos="5" rectRef="o3" />


    <MRectanglePoint pos="7" rectRef="o2" />


  </MPolyline>


  <MRectangle id="o2" color="#000000">


    <MPoint x="-9.882797241210938" y="23.729007720947266" />


    <MPoint x="-4.117832183837891" y="23.729007720947266" />


    <MPoint x="-4.117832183837891" y="18.42729949951172" />


    <MPoint x="-9.882797241210938" y="18.42729949951172" />


  </MRectangle>


  <MRectangle id="o3" color="#000000">


    <MPoint x="-20.846525192260742" y="25.221723556518555" />


    <MPoint x="-12.096132278442383" y="25.221723556518555" />


    <MPoint x="-12.096132278442383" y="18.01551628112793" />


    <MPoint x="-20.846525192260742" y="18.01551628112793" />


  </MRectangle>


  <MEFlow id="o4" color="#000000" arcAngle="248.39738999999997"


          headSkip="0.25" headLength="0.5" headWidth="0.4" tailSkip="0.15">


    <MAtomSetPoint atomRefs="m1.a1 m1.a8" />


    <MAtomSetPoint atomRefs="m1.a1" />


  </MEFlow>


  <MEFlow id="o5" color="#000000" arcAngle="150.0" headSkip="0.15"


          headLength="0.5" headWidth="0.4" tailSkip="0.25">


    <MAtomSetPoint atomRefs="m1.a17" />


    <MAtomSetPoint atomRefs="m1.a17 m1.a8" 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"


          elementType="C C C C C R H H C C C C C O O"


          formalCharge="0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0"


          sgroupRef="0 0 0 0 0 sg1 0 0 0 0 0 0 0 0 0"


          x2="-16.16469955444336 -17.410565883460386 -16.934703466073167 -15.394695642813552 -14.918833225426333 -13.17706298828125 -16.563280883901243 -15.39469955444336 -8.132719039916992 -9.378585368934019 -8.902722951546798 -7.362715128287185 -6.886852710899964 -5.399326938414799 -18.950565883460385"


          y2="21.685663641496305 20.780447042984306 19.315899603064416 19.315899603064416 20.780447042984306 22.905441284179688 23.17318941398147 23.01934276332434 22.156517447038297 21.2513008485263 19.78675340860641 19.78675340860641 21.2513008485263 21.649882177984182 20.780447042984306"


          />


      <bondArray>


        <bond atomRefs2="a1 a2" order="1" />


        <bond atomRefs2="a2 a3" order="1" />


        <bond atomRefs2="a3 a4" order="1" />


        <bond atomRefs2="a4 a5" order="1" />


        <bond atomRefs2="a1 a5" order="1" />


        <bond atomRefs2="a1 a7" order="1" />


        <bond atomRefs2="a1 a8" order="1" />


        <bond atomRefs2="a9 a10" order="1" />


        <bond atomRefs2="a10 a11" order="1" />


        <bond atomRefs2="a11 a12" order="1" />


        <bond atomRefs2="a12 a13" order="1" />


        <bond atomRefs2="a9 a13" order="1" />


        <bond atomRefs2="a13 a14" order="2" />


        <bond atomRefs2="a2 a15" order="2" />


      </bondArray>


      <molecule id="sg1" role="SuperatomSgroup" title="OEt" leftName="EtO" molID="m2">


        <atomArray


            atomID="a16 a17 a18"


            elementType="C C O"


            attachmentPoint="0 0 1"


            x2="-11.843383866453214 -13.17706298828125 -14.510742110109284"


            y2="23.162107950846355 22.392107950846352 23.162107950846355"


            />


        <bondArray>


          <bond atomRefs2="a16 a17" order="1" />


          <bond atomRefs2="a17 a18" order="1" />


        </bondArray>


      </molecule>


    </molecule>


  </MChemicalStruct>


</MDocument>


ChemAxon 7c2d26e5cf

26-04-2007 18:29:23

We will check it.

User 870ab5b546

03-05-2007 01:49:02

The error occurs during export of the Molecule to MRV format, not during import from MRV into the Molecule as I thought earlier. In the import process, the MEFlows pointing to or originating from shortcut groups are made to point to or originate from the attachment points. In the export process, the MEFlows that were originally *pointing to* shortcut groups are again made to point to the shortcut groups (correctly), but the MEFlows that were *originating from* shortcut groups are allowed to remain originating from the attachment points (incorrectly). Visit this page to see a manifestation and the evidence. I'm attaching the jsp page to this post.

ChemAxon 7c2d26e5cf

04-05-2007 09:47:50

Thanks for the example.


After submitting the form, importing the first MRV source on the refreshed page (via the Edit Source frame) is managed. But NullPointerException is thrown by the second one.


It seems that the problem is with MAtomSetPoints of the second MEFlow in the second MRV:


Code:
    <MAtomSetPoint atomRefs="m1.a6" />


    <MAtomSetPoint atomRefs="m1.a6 m1.a2" weights="0.25 0.75" />

User ef5e605ae6

04-05-2007 11:55:37

Fixed.


If you want it to work before 4.1.8, then the temporary workaround is to call molecule.setGUIContracted(true) before exporting the MRV.

User ef5e605ae6

04-05-2007 11:58:13

(at least I fixed the conversion problem but I'm lost in the tons of comments... If there is anything else, then please summarize them)

User 870ab5b546

04-05-2007 12:02:52

Yes, exactly. It should read,





Code:
    <MAtomSetPoint atomRefs="m1.a3" />


    <MAtomSetPoint atomRefs="m1.a3 m1.a2" weights="0.25 0.75" />






like it does in the first MRV.





Unfortunately, it seems that there is no way to work around this bug in the API. Atoms a1 and a3 in the MRV code seem to be constructed by the Molecule.toFormat("mrv") process in order to represent the contracted shortcut groups in the MRV file. They do not seem to exist in the imported Molecule object. So there is no way to use MPolyline.setPoints() to make the MEFlow point to one of these dummy atoms. The only way to work around the bug would be to manipulate the MRV string itself -- ugh.





Again, Molecule.toFormat("mrv") works correctly when an MEFlow *points to* a shortcut group. It is only buggy when an MEFlow *originates at* a shortcut group *that is not attached to anything*. (Add a CH3 group to the OEt group in the example, and everything works well.) Of course, an MRV file should not contain an isolated shortcut group not attached to anything. But our students draw it sometimes anyway.





So, I hope you see now that I am not knocking on doors that are already open. Sorry for the earlier misdiagnosis.

User 870ab5b546

04-05-2007 14:20:47

cspeter wrote:
Fixed.


If you want it to work before 4.1.8, then the temporary workaround is to call molecule.setGUIContracted(true) before exporting the MRV.
Köszönöm, Peter! The workaround works great.