Re: [Jmol-users] Molecular Formula Problem Related to Breaking a Bond

2016-06-28 Thread Robert Hanson
Otis, this is because your site is doing something funky. Or there's a bug.

{*}[0] is an atom reference, not a number. It has all the properties of an
atom, including .molecule.


​
--
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Molecular Formula Problem Related to Breaking a Bond

2016-06-28 Thread Otis Rothenberger
Bob,

> 
> {*}[0]  
> 

Agree: It appears to generate the atomIndex of the last atom.

> {*}[0].molecule
> 

I don’t think so: It consistently generates the number 1 for any number of 
fragments in the window.

On the other hand, using the infinite number of monkeys writing Shakespeare 
approach, n = {*}[-1].molecule generates the number of models! Go figure…

Otis--
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Molecular Formula Problem Related to Breaking a Bond

2016-06-28 Thread Robert Hanson
On Tue, Jun 28, 2016 at 1:24 AM, Otis Rothenberger 
wrote:

> Bob,
>
> My model kit puts multiple models in the same Jmol frame. It appears that n
> = {*}.molecule[0] (not n = {*}[0].molecule) is the correct expression,
> but results are very erratic. The value of n is often (but not always) 2X
> the number of fragments, with the extra “mf” values = “”.
>
> I don't think so.

{*}[0]

means "the  last atom"

so

{*}[0].molecule

means "the number of molecules"


{*}.molecule

is a number, specifically the average molecule number for all atoms.

{*}.molecule[0]

converts that number to a string and takes the first digit.




-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
--
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Molecular Formula Problem Related to Breaking a Bond

2016-06-27 Thread Otis Rothenberger
Bob,

My model kit puts multiple models in the same Jmol frame. It appears that n = 
{*}.molecule[0] (not n = {*}[0].molecule) is the correct expression, but 
results are very erratic. The value of n is often (but not always) 2X the 
number of fragments, with the extra “mf” values = “”.

With a larger number of fragments, n is usually low, and identical fragments 
are only represented once. Through all of this, 
Jmol.getPropertyAsJavaObject(jmolApplet0, 
"moleculeInfo.mf").modCount.toString() gives the proper number of model 
fragments, but Jmol.getPropertyAsJavaObject(jmolApplet0, 
"moleculeInfo.mf").toString() gives “saturated” mf values.

I need to sleep on it. Maybe I can pick the correct formulas out with the value 
of n from Jmol.getPropertyAsJavaObject(jmolApplet0, 
"moleculeInfo.mf").modCount.toString() using x = {molecule=#}.find("MF”);

Otis

--
Otis Rothenberger
o...@chemagic.org
http://chemagic.org

> On Jun 27, 2016, at 6:04 PM, Robert Hanson  wrote:
> 
> x = []
> n = {*}[0].molecule;
> for (var i = 1; i <= n; i++){ 
> x .push({molecule=i}.find("MF"))
> }

--
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


Re: [Jmol-users] Molecular Formula Problem Related to Breaking a Bond

2016-06-27 Thread Robert Hanson
I guess I had not noticed that, Otis -- getProperty("moleculeInfo.mf") does
a hybridization check and adds hydrogens as needed. This is useful for
proteins, for example. I'm not convinced it is a bug.

I suggest instead using in Jmol:

x = []
n = {*}[0].molecule;
for (var i = 1; i <= n; i++){
x .push({molecule=i}.find("MF"))
}

Bob

On Sun, Jun 26, 2016 at 7:36 PM, Otis Rothenberger 
wrote:

> Bob,
>
> This is kind of esoteric, and I don’t know exactly when it broke. I was OK
> in 4.4.4_2015_03_25. It’s broken in the latest JSmol version. The JS below
> uses a simple regular expression to convert a Jmol mf into a standard
> arithmetic expression:
>
> var strMods =
> Jmol.getPropertyAsJavaObject(jmolApplet0,"moleculeInfo.mf"); var mf;
> for (var i = 0; i < strMods.size(); i++) {
> mf = strMods.get(i).replace(/([a-z])\s([0-9])/ig,
> '$1\*$2').replace(/([0-9])\s([a-z])/ig, '$1\+$2');
> alert(mf);
> echoStr2 += "" + roundnum(eval(mf), 4) + " | ";
> }
>
> Using 2-butanone as an example, when I break the C2-C3 bond
> 4.4.4_2015_03_25 correctly reports the following at the alert:
>
> H*3+C*2+O*1 and H*5+C*2
>
> Note that the JS code reads the atomic symbols as actual masses. The
> current version of JSmol reports:
>
> H*4+C*2+O*1 and H*6+C*2
>
> In other words hydrogen atoms for the 2 separate fragments are being
> “corrected," but the 2 extra H's are not visible. Further, the script
> select *;display selected shows 13 atoms selected (and visible) in both
> 4.4.4_2015_03_25 and the current version.
>
> This all relates to mass spec study in the model kit. The bond is being
> broken by set picking assignBond_0.
>
> Otis
>
> --
> Otis Rothenberger
> o...@chemagic.org
> http://chemagic.org
>
>
>
> --
> Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> ___
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>



-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
--
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


[Jmol-users] Molecular Formula Problem Related to Breaking a Bond

2016-06-26 Thread Otis Rothenberger
Bob,

This is kind of esoteric, and I don’t know exactly when it broke. I was OK in 
4.4.4_2015_03_25. It’s broken in the latest JSmol version. The JS below uses a 
simple regular expression to convert a Jmol mf into a standard arithmetic 
expression:

var strMods = 
Jmol.getPropertyAsJavaObject(jmolApplet0,"moleculeInfo.mf"); var mf;
for (var i = 0; i < strMods.size(); i++) {
mf = strMods.get(i).replace(/([a-z])\s([0-9])/ig, 
'$1\*$2').replace(/([0-9])\s([a-z])/ig, '$1\+$2');
alert(mf);
echoStr2 += "" + roundnum(eval(mf), 4) + " | ";
}

Using 2-butanone as an example, when I break the C2-C3 bond 4.4.4_2015_03_25 
correctly reports the following at the alert:

H*3+C*2+O*1 and H*5+C*2

Note that the JS code reads the atomic symbols as actual masses. The current 
version of JSmol reports:

H*4+C*2+O*1 and H*6+C*2

In other words hydrogen atoms for the 2 separate fragments are being 
“corrected," but the 2 extra H's are not visible. Further, the script select 
*;display selected shows 13 atoms selected (and visible) in both 
4.4.4_2015_03_25 and the current version.

This all relates to mass spec study in the model kit. The bond is being broken 
by set picking assignBond_0.

Otis

--
Otis Rothenberger
o...@chemagic.org
http://chemagic.org


--
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users