"David Fanning" <david@dfanning.com> wrote
> Rick Matthews (matthews@wfu.edu) writes:
>
>> I want to use IDL for help with 3-D visualization of
>> electron density calculations. I want like IDL to display a ball and
>> stick model of a molecule, with interleaved contour maps of the density
>> surrounding the atoms in planes of my choosing.
>>
>> 1. I have not found visualization routines to generate 3-d
>> displays of the balls for atoms or sticks connecting them. Is
>> there a straightforward way to do this?
>> 2. If I succeed in 1, is there a way to display planar contour
>> maps in the image?
>
> Uh, Rick, our friend Rick Towler will get back to you ASAP. :-)
Sorry to take so long ;), I am trying to get a manuscript out the door and
my pdf maker has decided to stop working.
For 1 you can use the oh so handy "orb" object for the balls and the
IDLgrPolyline object for the lines. The orb is undocumented but the source
can be found in $RSI_DIR\Files\RSI\IDL55\examples\visual which contains a
description of the keywords and properties.
Basically you create an instance like so:
atom1 = obj_new('orb', pos=[0,0,0], color=[255,0,0], $
radius=0.5, density=1.0)
since orbs are a subclass of IDLgrModel you can throw an orb right into
xobjview:
xobjview, atom1
Now it has been a while since I used styrofoam balls and toothpicks to stick
together my favorite molocules but here is something to start with:
; a couple of hydrogen atoms
h1 = obj_new('orb', pos=[-2,0,0], color=[200,200,200], radius=0.5)
h2 = obj_new('orb', pos=[0.61,2,0], color=[200,200,200], radius=0.5)
;an oxygen atom
o = obj_new('orb', pos=[0,0,0], color=[255,0,0], radius=1.0)
; make the sticks
x = [-2,0,.61]
y = [0,0,2]
z = [0,0,0]
sticks = obj_new('IDLgrPolyline', x,y,z, color=[0,0,0], thick=20.0)
; put everything in a model
water = obj_new('IDLgrModel')
water -> add, [sticks, h1, h2, o]
; view the model in xobjview
xobjview, water, /block
; clean up our objects
obj_destroy, [sticks, h1, h2, o]
Obviously this could get complicated but I can see the process simplified by
creating some basic objects that include your common atoms and their sticks
and piecing them together by passing bond angles and location (I am thinking
of the wooden stick and ball models, I don't know how sophisticated you want
to get).
As for 2) you can project contours onto a plane so I *think* you could do
what you want. It just might be more work than you had hoped. But then
again, your program will turn out so cool it will all be worth it.
Good luck!
-Rick
|