Thanks Rolf,
Since it looks like I'm using correct syntax, I'll send the problematic
code:
var pa = -.2;var a = {atomIndex=_atomPicked};select a;flash;var t=a.xyz;
var p = a.xyz*2 - {connected(a)}.xyz;if({atomIndex = _atomPicked and
connected(1)} == 1){p = a.xyz;pa = .1;}
var x = p.x;var y = p.y + pa;var z = p.z + pa;set appendNew false;
var w = '1\ntest\nC ' + x + ' ' + y + ' ' + z + '\n';data 'append @w';var i
= {*}[0].atomIndex;
connect (atomIndex=_atomPicked) (atomIndex=i) single;
The above has an extraneous var t=a.xyz, which I'll explain below. In the
above, I'm using a -.2 adjustment to the z coordinate prior to the use of
Bob's chirality retention code. I cannot use Bob's code on terminal C atoms
because this often creates unrecoverable linear additions of the new atom,
so the above takes all terminal atoms via my chirality destroying route. The
- .2 adjustment is a work around in Bob's chirality retention route to take
care of superimposition of the new atom and the clicked atom. What I really
want to do is use the following "if" statement:
if({atomIndex = _atomPicked and connected(1)} == 1 || {t} == {p})
This statement should catch a trouble maker in Bob's chirality retention
code. The case where the new atom exactly coincides with the clicked atom.
The problem is that the above seems to result in every atom click meeting
the condition. Since the work-around works, I should move on. However, point
comparison will help me clean up other problem aspects of this process, so
I'd like to understand the problem.
Otis
On Fri, Mar 26, 2010 at 6:43 AM, Rolf Huehne <[email protected]> wrote:
> On 03/26/2010 06:30 AM, Otis Rothenberger wrote:
> > Bob,
> >
> > I'm making some progress on your suggestion to check and branch during
> the
> > addition of atoms (below). One problem that I'm having is comparing
> points,
> > so I thought that better check with you. If I have two points defined, a
> and
> > b, shouldn't the following syntax produce a true or false based on xyz
> > identity of the points?
> >
> > If ({a} == {b}){do stuff;};continue on to other stuff;
> >
> > I can send you the specific code, but I thought I'd ask about my basic
> > understanding of point math and logic first. My problem is that the above
> > seems to be true for points that are not the same.
> >
> The scripting documentation on Jmol math says:
>
> point == point
> true if the distance between the points is less than 1E-6.
>
> So the coordinates must not be identical.
> Maybe it helps if you compare the individual xyz values instead:
>
> if ({a}.x == {b}.x AND {a}.y == {b}.y AND {a}.z == {b}.z)
>
> 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
>
>
>
--
Otis Rothenberger
http://chemagic.org
------------------------------------------------------------------------------
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