On 02/19/2010 06:20 AM, Otis Rothenberger wrote:
> Hello-
>
> I'm working on an atom append script to click append a C atom (methyl group
> actually) to an existing atom in a Jmol model. The following JavaScript
> function works, but it is far from elegant. I'm fairly sure that there are
> Jmol math approaches to deal with some specific script actions that I'm
> attempting, but I could use some guidance. I'm new to Jmol math. The
> function and my questions:
>
> function appendC(x) {
> var scpt = "select;set appendNew false;data 'append'|1|add|At 2 2 2|end
> 'append';show data;select astatine;"
> scpt += "{selected}.element='C';connect (selected)(atomIndex=" + x +
> ");select *;wireframe 0.15; spacefill 23%;boundbox {*};"
> scpt += "centerat boundbox;delete hydrogens;minimize addHydrogens;"
> jmolScript(scpt, "01");
> }
>
> x is the atomIndex of the clicked atom via a pickCallback function.
>
I think you could define this javascript function also as a Jmol script
function. Then you could use for example the boundbox information more
easily to set the position of the new atom (see below).
> 1) The ridiculous addition of astatine relates to my inability to use
> getProperty for the atomIndex of the newly appended atom, so I appended a
> very rare element, selected it, and changed it to carbon. Is there a way to
> get this atomIndex a bit more gracefully?
Isn't the atomIndex just a sequential number? If this is true I would
expect that it will be the current (before the addition) maximum
atomIndex + 1. But I don't know how atom deletions might interfere here.
>
> 2) The 2 2 2 coordinates were selected to get the appended atom away from
> existing atoms in ammonia. I'd really like a general approach to get this
> atom outside of the VDW surface of any molecule. I know how to calculate the
> isosurface area if I generate it, but I really don't want a surface painted
> on the screen. Further, I'm not sure the area will help. I could calculate a
> diameter, but in a long molecule, I would still be in trouble. Is there any
> Jmol math approach that will calculate a safe distance for this appended
> atom?
>
You could use the boundbox to determine the outer borders of the
molecule and then add some offset. I use the following script to
determine the boundbox values:
boundbox_selection_expression = "NOT WATER";
boundbox (@{boundbox_selection_expression});
bound_box = getProperty("boundboxInfo", "vector");
vector_x = bound_box.x;
vector_y = bound_box.y;
vector_z = bound_box.z;
> 3) One approach is to really put the appended atom into orbit. The
> coordinates 50 50 50 actually work with ammonia. By using a zoom 2000, you
> can even see the result. The function really works very nicely if you get
> the appended atom away from existing atoms. If you do not, then the minimize
> produces chemical nonsense even though I explicitly connect only the two
> atoms. If this orbit approach turns out to be the best approach, then a
> scaling factor that normalizes molecule size would be useful. One
> possibility is using math with zoom 100 and the orbit coordinates, 50 50 50.
> Is this math doable with zoom? Is there another math approach that can be
> used to redefine zoom 100?
>
I am not sure if I understand what the problem is here.
Is it that you want to display everything except the appended atom at
"50 50 50" filling the view?
If this is the problem you could try "zoomto (atom expression)".
Regards,
Rolf
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users