
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.jmol.org/index.php?action=history&amp;feed=atom&amp;title=Recycling_Corner%2FFront_Selection</id>
	<title>Recycling Corner/Front Selection - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.jmol.org/index.php?action=history&amp;feed=atom&amp;title=Recycling_Corner%2FFront_Selection"/>
	<link rel="alternate" type="text/html" href="https://wiki.jmol.org/index.php?title=Recycling_Corner/Front_Selection&amp;action=history"/>
	<updated>2026-05-30T20:15:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>https://wiki.jmol.org/index.php?title=Recycling_Corner/Front_Selection&amp;diff=10074&amp;oldid=prev</id>
		<title>EricMartz: Added new function</title>
		<link rel="alternate" type="text/html" href="https://wiki.jmol.org/index.php?title=Recycling_Corner/Front_Selection&amp;diff=10074&amp;oldid=prev"/>
		<updated>2021-09-12T18:31:19Z</updated>

		<summary type="html">&lt;p&gt;Added new function&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;If you &amp;quot;select on&amp;quot; before running this function, then the selected atoms will have halos. This function does not change whether or not selection halos are displayed. This is a Jmol function (not a Javascript function).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function selectFrontPercentage(pct) # pct range: 0 to 100.&lt;br /&gt;
{&lt;br /&gt;
	# This is a Jmol function (not a Javascript function).&lt;br /&gt;
	# This function selects atoms within the specified percentage of the front of the&lt;br /&gt;
	# molecule, using the screen Z coordinate atom property &amp;quot;sz&amp;quot;.&lt;br /&gt;
	# selectFrontPercentage() returns true on success, or false for an invalid parameter.&lt;br /&gt;
	# Screen Z depends on the orientation of the molecule.&lt;br /&gt;
	# After selection, rotating the molecule does not change the atoms selected, unless&lt;br /&gt;
	# selectFrontPercentage() is executed again.&lt;br /&gt;
&lt;br /&gt;
	validRangeMsg = &amp;quot;The valid range is 0 to 100.&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	szmax = {*}.sz.max; // # Rearmost screen Z value.&lt;br /&gt;
	szmin = {*}.sz.min; # Low values of screen Z are the front of the view.&lt;br /&gt;
	pctf = 0.0 + pct; # cast to float.&lt;br /&gt;
	if (pctf == &amp;quot;NaN&amp;quot; || pct.length == 0)&lt;br /&gt;
	{&lt;br /&gt;
		prompt ('&amp;quot;' + pct + '&amp;quot; is not a number.\n' + validRangeMsg)&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
	if (pctf &amp;lt; 0.0 || pctf &amp;gt;100.0)&lt;br /&gt;
	{&lt;br /&gt;
		prompt ('&amp;quot;' + pct + '&amp;quot; is out of range.\n' + validRangeMsg)&lt;br /&gt;
		return false;&lt;br /&gt;
	}&lt;br /&gt;
	fxn = pctf/100.0;&lt;br /&gt;
	szfront = szmin + ((szmax - szmin) * fxn); # front fraction.&lt;br /&gt;
	select sz &amp;lt; szfront;&lt;br /&gt;
	return true	&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>EricMartz</name></author>
		
	</entry>
</feed>