Why does JMOL fail here?

asked 10 years ago

dazedANDconfused gravatar image

updated 10 years ago

FrédéricC gravatar image

Sorry, but I can't think of a good title for the question. I put together code for the Menger's Sponge (3d) [EDIT: and ran it in a Sage notebook. I also tried it in a Sage Cell Server.]

H = J = K = Graphics()
for i in range(0,3):
    for j in range(0,3):
        for k in range(0,3):
            if not((i==1 and j==1)or(i==1 and k==1)or(j==1 and k==1)):
                H += cube().scale(1).translate(1/2+i, 1/2+j, 1/2+k)
for i in range(0,3):
    for j in range(0,3):
        for k in range(0,3):
            if not((i==1 and j==1)or(i==1 and k==1)or(j==1 and k==1)):
                J += H.translate(3/2+3*i, 3/2+3*j, 3/2+3*k) 
for i in range(0,3):
    for j in range(0,3):
        for k in range(0,3):
            if not((i==1 and j==1)or(i==1 and k==1)or(j==1 and k==1)):
                K += J.translate(4.5+9*i, 4.5+9*j, 4.5+9*k)
#K.show()
K.save('Menger3.gif')

The code runs and creates the image of the 3rd iteration of Menger's sponge. But if I comment out: K.save('Menger3.gif') and uncomment K.show() then the code won't run. I get lots of errors like:

__main__:19: UserWarning: Duplicate name: 'obj_660992.pmesh'

after which I'm told

Traceback (click to the left of this block for traceback)
...
RuntimeError: Jmol failed to create file
'/tmp/tmpMSjmcm/.jmol_images/sage0-size500.jmol.png',

and I'm told to look at a temporary text file (which turns out to be empty).

So the questions are "Why does JMOL fail to create the third iteration of Menger's Sponge when I can view the image of it?", "How do I revise the code so JMOL won't fail?".

By the way, for the second iteration of Menger's Sponge, JMOL works.

Preview: (hide)

Comments

SMC (which doesn't use JMOL) is creating the gif file but not displaying the 3D image within the worksheet with the `show` command. This appears to be an issue of timing out or some such. Interesting that there are issues in more than one environment.

calc314 gravatar imagecalc314 ( 10 years ago )

I should have mentioned that I ran the Sage code in a notebook. I also tried a Sage Cell Server. It had the same basic behavior as the notebook but a lot slower. I haven't tried SMC.

dazedANDconfused gravatar imagedazedANDconfused ( 10 years ago )

I got the same kind of errors for a different kind of plot. The code is messy and uninteresting. Only my text file is not empty: Viewer handling error condition: java.lang.OutOfMemoryError GC overhead limit exceeded. (Note that this file is on the server.) Which led me to think either the file or the computations involed were too big. I tired export "_JAVA_OPTS= -server -Xmx1024m" (still on the server) to grant more memory to java It did work once but I do not know if it is reproducible (might just be chance) jmol saving view failed to save all the objects (or redisplay them on my machine anyway) I can reproce your error. making interactive displays a partial picture (not the whole cube) (I am very new to all this so my guesses are likely unaccurate.)

bb16 gravatar imagebb16 ( 10 years ago )

Sorry to post second comment. I tried export "_JAVA_OPTIONS= -server -Xmx2048m" (different variable from last time ???) I still got the warnings you described but got a picture with K.show(). making it interactive jmol freezes... (unable to finish launching).

bb16 gravatar imagebb16 ( 10 years ago )

It works for me (no error) from the command line, though jmol is very slow due to the number of objects.

tmonteil gravatar imagetmonteil ( 10 years ago )