comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Molecular models and contour maps
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Molecular models and contour maps [message #31582] Thu, 01 August 2002 13:49
Rick Matthews is currently offline  Rick Matthews
Messages: 9
Registered: May 2002
Junior Member
Thanks for the reply. This helps.

Rick

Mark Hadfield wrote:
> From: "Rick Matthews" <matthews@wfu.edu>
>
>> 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.
>
>
> IDL can certainly do this.
>
> The IDL Object Graphics system is (for the most part) a collection of
> building blocks with which you can build visualisations. You have to
> assemble the building blocks yourself. This is simple in principle but
> there are a lot of details to learn and you will encounter a few
> surprises.
>
>
>> 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?
>
>
> Routine MESH_OBJ generates data describing a simple shape like a ball
> or a cylinder. You pass the data to an IDLgrPolygon object to display the
> shape. You then mount the IDLgrPolygons in IDLgrModel objects to
> translate, scale & rotate them. You can use XOBJVIEW to display the
> collection of IDLgrModels.
>
> I suggest you search the group archives at http://groups.google.co/m
> for a thread earlier this month entitled "Plotting on a sphere". While
> you're at it, try a search for "mesh_obj".
>
>
>> If I succeed in 1, is there a way to display planar contour maps in
>> the image?
>
>
> The IDLgrContour object implements planar (or non-planar) contour-map
> objects.
>
> ---
> Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
> m.hadfield@niwa.co.nz
> National Institute for Water and Atmospheric Research (NIWA)
>
>
>


--
Rick Matthews matthews@wfu.edu
Department of Physics http://www.wfu.edu/~matthews
Wake Forest University 336-758-5340 (Voice)
Winston-Salem, NC 27109-7507 336-758-6142 (FAX)
USA
Re: Molecular models and contour maps [message #31583 is a reply to message #31582] Thu, 01 August 2002 13:47 Go to previous message
Rick Matthews is currently offline  Rick Matthews
Messages: 9
Registered: May 2002
Junior Member
Rick,

This is *extremely* helpful. Thank you very much.

This should get me off to a good start.

Rick

Rick Towler wrote:
> "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
>
>
>
>


--
Rick Matthews matthews@wfu.edu
Department of Physics http://www.wfu.edu/~matthews
Wake Forest University 336-758-5340 (Voice)
Winston-Salem, NC 27109-7507 336-758-6142 (FAX)
USA
Re: Molecular models and contour maps [message #31584 is a reply to message #31583] Thu, 01 August 2002 13:40 Go to previous message
Rick Matthews is currently offline  Rick Matthews
Messages: 9
Registered: May 2002
Junior Member
David Fanning wrote:
> Rick Matthews (matthews@wfu.edu) writes:
>> Newbie question:
> Oh, oh. :-(
>> 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.
<snip>

> Do you mean you are a programming newbie, or an IDL
> newbie?

IDL newbie. 33 years (Oh my, am I that old?) in other
languages.

> If the former, and you don't have any 3D
> graphics or object experience,

I have zero 3-D graphics experience.

> you may be looking
> at quite a project here.

I was afraid of that. However, visualizing 3-D
charge density maps are going to be a recurring need
for my next decade, so it may be worth the investment.

> If it's the latter, and
> you are a proficient C++ programmer, then maybe
> there is some hope ahead.

More in Fortran and a few other languages than C++,
but I think I understand objects well enough if that
is critical. The 3-D experience may be a problem.

> But what you want to do is in no way a trivial
> programming exercise in IDL, I'm afraid. I'm hoping
> Ronn Kling's latest book, due out soon, will shed
> some light on this sort of thing. But you are going
> to have to pretty much build this yourself, I think.
> I'm reasonably sure it can be done with IDL, just not
> as easily as you were probably hoping.

Thanks for the heads up. I have also looked at OpenDX,
where this particular task might be easier, but

1. IDL is closer to the languages I use most, and
2. IDL seems to be better equipped to make movies, which
will be the next step in the project.

I appreciate your help.

Rick

--
Rick Matthews matthews@wfu.edu
Department of Physics http://www.wfu.edu/~matthews
Wake Forest University 336-758-5340 (Voice)
Winston-Salem, NC 27109-7507 336-758-6142 (FAX)
USA
Re: Molecular models and contour maps [message #31627 is a reply to message #31584] Mon, 29 July 2002 22:08 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
From: "Rick Matthews" <matthews@wfu.edu>

> 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.

IDL can certainly do this.

The IDL Object Graphics system is (for the most part) a collection of
building blocks with which you can build visualisations. You have to
assemble the building blocks yourself. This is simple in principle but
there are a lot of details to learn and you will encounter a few
surprises.

> 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?

Routine MESH_OBJ generates data describing a simple shape like a ball
or a cylinder. You pass the data to an IDLgrPolygon object to display the
shape. You then mount the IDLgrPolygons in IDLgrModel objects to
translate, scale & rotate them. You can use XOBJVIEW to display the
collection of IDLgrModels.

I suggest you search the group archives at http://groups.google.co/m
for a thread earlier this month entitled "Plotting on a sphere". While
you're at it, try a search for "mesh_obj".

> If I succeed in 1, is there a way to display planar contour maps in
> the image?

The IDLgrContour object implements planar (or non-planar) contour-map
objects.

---
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: Molecular models and contour maps [message #31634 is a reply to message #31627] Mon, 29 July 2002 18:05 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
"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
Re: Molecular models and contour maps [message #31638 is a reply to message #31634] Mon, 29 July 2002 12:58 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Rick Matthews (matthews@wfu.edu) writes:

> Newbie question:

Oh, oh. :-(

> 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. :-)

Do you mean you are a programming newbie, or an IDL
newbie? If the former, and you don't have any 3D
graphics or object experience, you may be looking
at quite a project here. If it's the latter, and
you are a proficient C++ programmer, then maybe
there is some hope ahead.

But what you want to do is in no way a trivial
programming exercise in IDL, I'm afraid. I'm hoping
Ronn Kling's latest book, due out soon, will shed
some light on this sort of thing. But you are going
to have to pretty much build this yourself, I think.
I'm reasonably sure it can be done with IDL, just not
as easily as you were probably hoping.

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: PNG Read
Next Topic: Re: integer?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:44:08 PDT 2025

Total time taken to generate the page: 0.33073 seconds