Hello,
I would like to display lots of spheres (about 6000) in jmol but when I've to many points it crashs with this error :
Exception in thread "main" java.lang.NullPointerException
at org.jmol.shapesurface.Isosurface.allocMesh(Unknown Source)
at org.jmol.shape.MeshCollection.setMesh(Unknown Source)
at org.jmol.shape.MeshCollection.setProperty(Unknown Source)
at org.jmol.shapesurface.Isosurface.setPropertySuper(Unknown Source)
at org.jmol.shapesurface.Isosurface.setProperty(Unknown Source)
at org.jmol.shape.Shape.setShapeProperty(Unknown Source)
at org.jmol.viewer.ShapeManager.setShapeProperty(Unknown Source)
at org.jmol.script.ScriptEvaluator.setShapeProperty(Unknown Source)
at org.jmol.script.ScriptEvaluator.color(Unknown Source)
at org.jmol.script.ScriptEvaluator.instructionDispatchLoop(Unknown Source)
at org.jmol.script.ScriptEvaluator.script(Unknown Source)
at org.jmol.script.ScriptEvaluator.instructionDispatchLoop(Unknown Source)
at org.jmol.script.ScriptEvaluator.evaluateCompiledScript(Unknown Source)
at org.jmol.viewer.Viewer.evalStringWaitStatus(Unknown Source)
at org.jmol.viewer.Viewer.scriptWaitStatus(Unknown Source)
at org.openscience.jmol.app.JmolApp.runScript(Unknown Source)
at org.openscience.jmol.app.JmolApp.startViewer(Unknown Source)
at org.openscience.jmol.app.JmolData.<init>(Unknown Source)
at org.openscience.jmol.app.JmolData.main(Unknown Source)
If I try to run the interactive mode (even If don't have any picture) I've this error : "Jmol Applet #2 is having trouble loading. Will retry once."
How could I do to get a picture of my work ?
Thanks,
Tobias.
PS : This is the kind of code I run :
charge_elementaire = 1.602176565e-19
def get_position(r, theta, phi):
return [abs(r*cos(phi))*cos(theta),abs(r*cos(phi))*sin(theta),r*sin(phi)]
def create_sources_sphere(r, res_theta, res_phi, charge):
delta_theta = 2*pi/res_theta
delta_phi = pi/res_phi
s = []
for i in range(res_theta):
for j in range(res_phi):
s.append( [get_position(r, i*delta_theta, j*delta_phi), charge] )
for j in range(1,res_phi):
s.append( [get_position(r, i*delta_theta, -j*delta_phi), charge] )
return s
def create_plan(h, charge, dx,dy, n_x, n_y):
s = []
for k_x in range(-n_x, n_x):
for k_y in range(-n_x, n_y):
s.append( [[k_x*dx+dx/2, k_y*dy+dy/2, h], charge] )
return s
def dessin_sources(t, size):
s = 0
for k in range(len(t)):
s += sphere(t[k][0], size=size, color='black', aspect_ratio=[1,1,1])
return s
plan1 = create_plan(500, charge_elementaire, 40,30, 25, 25)
plan2 = create_plan(-500, charge_elementaire, 40,30, 25, 25)
t = create_sources_sphere(200, 60, 1, charge_elementaire)
t = t + plan1 + plan2
td = dessin_sources(t, 1)
td.show()