## jmol-users

 [Jmol-users] Callback to use unit cell lengths in jmolScript ? From: Alan Hewat - 2007-05-29 12:05:22 ```This must be a simple javascript problem, but I am having trouble with it:-) In my slider display I execute a jmolScript to limit the displayed volume: jmolScript( 'display within(-999,plane,z='+z1+') and within(999,plane,z='+z2+') and ...etc where z1, z2 etc are javascript variables proportional to the unit cell lengths a,b,c i.e. I want something like z1=c/40 etc... So how do I factor the unit cell lengths into the the "within...plane" definition, or else how do I retrieve the unit cell dimensions as javascript constants so that I can write z1=c/40 etc... ? Alan. _____________________________________________________________ Dr Alan Hewat, ILL Grenoble, FRANCEfax+33.476.20.76.48 +33.476.20.72.13 (.26 Mme Guillermet) http://www.ill.fr/dif/people/hewat/ _____________________________________________________________ ```
 Re: [Jmol-users] Callback to use unit cell lengths in jmolScript ? From: Bob Hanson - 2007-05-29 22:59:26 ```Alan, It seems to me the most sensible thing to do is use Miller plane notation "hkl" instead of "plane" for that WITHIN definition. display within(-999,hkl,{0,40,0}) as long as you can use crystallographic coordinates instead of Cartesian. Alternatively, you can define the plane using three fractional coordinates: display within(-999,plane,{0 1/40 0},{1 1/40 0},{1 1/40 1}) or something of that nature. As for getting the coordinates in JavaScript, var unitcell = jmolGetPropertyAsArray('auxiliaryinfo').models[0].notionalUnitcell gets you an array containing a, b, c, alpha, beta, gamma in elements 0 through 5. var a = unitcell[0] var b = unitcell[1] etc. Note that there may be a different unit cell for each model loaded -- models[0], models[1], etc. Bob Alan Hewat wrote: >This must be a simple javascript problem, but I am having trouble with it:-) >In my slider display I execute a jmolScript to limit the displayed volume: >jmolScript( 'display within(-999,plane,z='+z1+') and within(999,plane,z='+z2+') and ...etc >where z1, z2 etc are javascript variables proportional to the unit cell lengths a,b,c >i.e. I want something like z1=c/40 etc... > >So how do I factor the unit cell lengths into the the "within...plane" definition, or else how do I retrieve the unit cell dimensions as javascript constants so that I can write z1=c/40 etc... ? > >Alan. >_____________________________________________________________ >Dr Alan Hewat, ILL Grenoble, FRANCEfax+33.476.20.76.48 >+33.476.20.72.13 (.26 Mme Guillermet) http://www.ill.fr/dif/people/hewat/ >_____________________________________________________________ > > >------------------------------------------------------------------------- >This SF.net email is sponsored by DB2 Express >Download DB2 Express C - the FREE version of DB2 express and take >control of your XML. No limits. Just data. Click to get it now. >http://sourceforge.net/powerbar/db2/ >_______________________________________________ >Jmol-users mailing list >Jmol-users@... >https://lists.sourceforge.net/lists/listinfo/jmol-users > > -- Robert M. Hanson 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 ```