Am 19.01.17 um 05:26 schrieb Max Pinheiro Jr: > Hi Bob, > > The problem that still persist is how to use the values bond lengths to > assign the colors for each bond. I included a new variable to get the > bond length inside the for loop: y=x.bonds.length. However, I think the > variable colors[ ] just accept integer values, right? So, one > possibility that I check is to convert the bond length into an integer > using "% 0". But in most of the cases it is necessary to rescale the > bond length to get more decimal places before to convert into an > integer. When I tried to run the script with the values of bond length > times 100 and rounded, this variable used as argument to the colors fall > out of the range. Do you have any other idea of how to use the bond > length as an argument for the colors()? Max, you could use the following formula to normalize a bond length value to the color index range before you convert the bond length value to an integer value, e.g.:
minColorIndex=1; maxColorIndex=32; minBondlength=0.1; maxBondLength=1.5; normalizedBondLength = (bondLength - minBondLength) * maxColorIndex / (maxBondLength - minBondLength) + minColorIndex; If you would like to get directly comparable results between different atom sets you should use the same 'minBondLength' and 'maxBondLength' values for each atom set and the same 'minColorIndex' and 'maxColorIndex' value. If you would like to get the maximum color range for each atom set instead (loosing comparability) you should determine the actual minimum and maximum bond length individually for each atom set. Regards, Rolf ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users