<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://msl-libraries.org/index.php?action=history&amp;feed=atom&amp;title=Tutorial%3AMolecular_Object_Getters</id>
	<title>Tutorial:Molecular Object Getters - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://msl-libraries.org/index.php?action=history&amp;feed=atom&amp;title=Tutorial%3AMolecular_Object_Getters"/>
	<link rel="alternate" type="text/html" href="http://msl-libraries.org/index.php?title=Tutorial:Molecular_Object_Getters&amp;action=history"/>
	<updated>2026-04-09T09:34:12Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.6</generator>
	<entry>
		<id>http://msl-libraries.org/index.php?title=Tutorial:Molecular_Object_Getters&amp;diff=385&amp;oldid=prev</id>
		<title>Senes: /* Operators */</title>
		<link rel="alternate" type="text/html" href="http://msl-libraries.org/index.php?title=Tutorial:Molecular_Object_Getters&amp;diff=385&amp;oldid=prev"/>
		<updated>2010-03-02T19:05:28Z</updated>

		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Operators&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 19:05, 2 March 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l105&quot; &gt;Line 105:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 105:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Operators==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Operators==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The braket operators are &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wrapper &lt;/del&gt;for the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;&lt;/del&gt;by index&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot; &lt;/del&gt;and &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;&lt;/del&gt;by identifier&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot; getters&lt;/del&gt;. The round braket () always return the next down in the hierarchy (System-&amp;gt;Chain-&amp;gt;Position-&amp;gt;Residue-&amp;gt;Atom). The square braket [] returns Atoms for all objects&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* &lt;/ins&gt;The braket operators are &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;shortcut &lt;/ins&gt;for the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;corresponding ''get functions'', specifically get &lt;/ins&gt;by index &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(unsigned int) &lt;/ins&gt;and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;get &lt;/ins&gt;by identifier &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(string)&lt;/ins&gt;.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* &lt;/ins&gt;The round braket () always return the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;object that is &lt;/ins&gt;next down in the hierarchy (System-&amp;gt;Chain-&amp;gt;Position-&amp;gt;Residue-&amp;gt;Atom).  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* &lt;/ins&gt;The square braket [] returns Atoms for all objects&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;// &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;round &lt;/del&gt;() returns the &amp;quot;next&amp;quot; object in the hierarchy&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;System sys;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;sys&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;.getChain&lt;/del&gt;(&amp;quot;A&amp;quot;) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;-&amp;gt; &lt;/del&gt;sys(&amp;quot;A&amp;quot;) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt; // &lt;/del&gt;by chainId&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;// () returns the &amp;quot;next&amp;quot; object in the hierarchy&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;. For system it is a Chain&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;sys&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;.getChain&lt;/del&gt;(2) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;-&amp;gt; &lt;/del&gt;sys(2) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;     // &lt;/del&gt;3-rd &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;atom in the array&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Chain &amp;amp; chainA = &lt;/ins&gt;sys(&amp;quot;A&amp;quot;)&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;; // corresponds to &lt;/ins&gt;sys&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;.getChain&lt;/ins&gt;(&amp;quot;A&amp;quot;)&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, get &lt;/ins&gt;by chainId&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;// &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;square &lt;/del&gt;[] always return atoms&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Chain &amp;amp; chainC = &lt;/ins&gt;sys(2)&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;;   // corresponds to &lt;/ins&gt;sys&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;.getChain&lt;/ins&gt;(2)&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, get the &lt;/ins&gt;3-rd &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;chain&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;sys&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;.getAtom(&lt;/del&gt;&amp;quot;A,37,CA&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;) &amp;lt;-&amp;gt; &lt;/del&gt;sys&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;[&lt;/del&gt;&amp;quot;A,37,CA&amp;quot;] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;  &lt;/del&gt;// &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;by atomId&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;// [] always return atoms&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;sys.getAtom(56) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;-&amp;gt; sys[56]                 // &lt;/del&gt;57-th atom&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Atom &amp;amp; atomA37CA = &lt;/ins&gt;sys&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[&lt;/ins&gt;&amp;quot;A,37,CA&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]; // corresponds to &lt;/ins&gt;sys&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;.getAtom(&lt;/ins&gt;&amp;quot;A,37,CA&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;), by atomId&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Atom  &amp;amp; atom56 = sys[56&lt;/ins&gt;]&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;;          &lt;/ins&gt;// &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;corresponds to &lt;/ins&gt;sys.getAtom(56)&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, the &lt;/ins&gt;57-th atom&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Going down the hierarchy things behave similarly&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Going down the hierarchy things behave similarly&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Chain==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Chain==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Senes</name></author>
		
	</entry>
	<entry>
		<id>http://msl-libraries.org/index.php?title=Tutorial:Molecular_Object_Getters&amp;diff=384&amp;oldid=prev</id>
		<title>Senes: Created page with '== The identifiers ==   There are 5 pieces of information to identify an atom: # chain # residue number # insertion code # residue name # atom name  Now this information can be p…'</title>
		<link rel="alternate" type="text/html" href="http://msl-libraries.org/index.php?title=Tutorial:Molecular_Object_Getters&amp;diff=384&amp;oldid=prev"/>
		<updated>2010-03-02T18:07:30Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;== The identifiers ==   There are 5 pieces of information to identify an atom: # chain # residue number # insertion code # residue name # atom name  Now this information can be p…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== The identifiers == &lt;br /&gt;
&lt;br /&gt;
There are 5 pieces of information to identify an atom:&lt;br /&gt;
# chain&lt;br /&gt;
# residue number&lt;br /&gt;
# insertion code&lt;br /&gt;
# residue name&lt;br /&gt;
# atom name&lt;br /&gt;
&lt;br /&gt;
Now this information can be passed using &amp;quot;identifiers&amp;quot;, i.e. comma separated strings that specify a Chain, Position, Residue or Atom in this order. There is an identifier for each level and their syntax is the following:&lt;br /&gt;
&lt;br /&gt;
# Chain identifier: &amp;quot;A&amp;quot;&lt;br /&gt;
# Position identifier: &amp;quot;A,37&amp;quot; or &amp;quot;A,37A&amp;quot; with an icode&lt;br /&gt;
# Identity: &amp;quot;A,37,ILE&amp;quot; &amp;quot;A,37A,ILE&amp;quot;&lt;br /&gt;
# Atom: &amp;quot;A,37,CA&amp;quot; &amp;quot;A,37A,CA&amp;quot;&lt;br /&gt;
# Atom of a specific identity: &amp;quot;A,37,ILE,CA&amp;quot; &amp;quot;A,37A,CA&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Space separated identifier are also parsed (&amp;quot;A 37 CA&amp;quot;), as well as underscore separated (&amp;quot;A_37_CA&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Getters ==&lt;br /&gt;
&lt;br /&gt;
The getters have been rationalized. Here are the examples that apply to the System but the usage is made homogeneous across the hierarchy (Position, Residue, Atom)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the System we have now 3 getters:&lt;br /&gt;
&lt;br /&gt;
==== by index (starting from 0, like an array) ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
Chain &amp;amp; getChain(unsigned int _index);&lt;br /&gt;
Atom &amp;amp; getPosition(unsigned int _index);&lt;br /&gt;
Residue &amp;amp; getIdentity(unsigned int _index); // the current identity of the _index position&lt;br /&gt;
Atom &amp;amp; getAtom(unsigned int _index);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== by individual fields (note, the icode is now always required, if there is no icode, use a blank string) ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
Chain &amp;amp; getChain(string _chain);&lt;br /&gt;
Position &amp;amp; getPosition(string _chain, int _resnum, string _icode);&lt;br /&gt;
Residue &amp;amp; getIdentity(string _chain, int _resnum, string _icode, string _resname);&lt;br /&gt;
Atom &amp;amp; getAtom(string _chain, int _resnum, string _icode, string atomName); // active identity&lt;br /&gt;
Atom &amp;amp; getAtom(string _chain, int _resnum, string _icode, string _resname, string atomName);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== and finally by identifier ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
Chain &amp;amp; getChain(string _chainid); // &amp;quot;A&amp;quot;&lt;br /&gt;
Atom &amp;amp; getPosition(string _positionId); // &amp;quot;A,37&amp;quot; &amp;quot;A,37A&amp;quot;&lt;br /&gt;
Residue &amp;amp; getIdentity(string _identityId); // &amp;quot;A,37,ILE&amp;quot; &amp;quot;A,37A, ILE&amp;quot;&lt;br /&gt;
Atom &amp;amp; getAtom(string _atomId); // &amp;quot;A,37,CA&amp;quot; &amp;quot;A,37,ILE,CA&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Exists functions==&lt;br /&gt;
&lt;br /&gt;
The functions atomExists, identityExists, positionExists and chainExists check for the existance of a Chain/Position/Residue/Atom and store a reference to the address of the object.  The object can then be retreived using a getLastFoundXxxx function (getLastFoundChain(), getLastFoundPosition(), getLastFoundIdentity(), getLastFoundAtom()).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The various exists function take the same arguments of the getters, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool chainExists(string _chainId); // &amp;quot;A&amp;quot;&lt;br /&gt;
bool positionExists(string _chain, int _resnum, string _icode);&lt;br /&gt;
bool positionExists(string _positionId); // &amp;quot;A,37&amp;quot;&lt;br /&gt;
bool identityExists(string _chain, int _resnum, string _icode, string _resname);&lt;br /&gt;
bool identityExists(string _identityId); // &amp;quot;A,37,LEU&amp;quot;&lt;br /&gt;
bool atomExists(string _atomId); // &amp;quot;A,37,CA&amp;quot; &amp;quot;A,37,ILE,CA&amp;quot;&lt;br /&gt;
bool atomExists(string _chain, int _resnum, string _icode, string _resname, string atomName);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So the safest and most efficient way to code is something on the lines of the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
System sys;&lt;br /&gt;
if (sys.chainExists(&amp;quot;A&amp;quot;) {&lt;br /&gt;
	Chain &amp;amp; chainA = sys.getLastFoundChain();&lt;br /&gt;
}&lt;br /&gt;
if (sys.positionExists(&amp;quot;A,37&amp;quot;) {&lt;br /&gt;
	Position &amp;amp; posA37 = sys.getLastFoundPosition();&lt;br /&gt;
}&lt;br /&gt;
if (sys.identityExists(&amp;quot;A,37,ILE&amp;quot;) {&lt;br /&gt;
	Residue &amp;amp; resA37ILE = sys.getLastFoundIdentity();&lt;br /&gt;
}&lt;br /&gt;
if (sys.atomExists(&amp;quot;A,37,CA&amp;quot;) {&lt;br /&gt;
  Atom &amp;amp; atomA37CA = sys.getLastFoundAtom();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Atoms, Residues, Positions and Chains can return their identifier:====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
string chainId = chain.getChainId();         // returns &amp;quot;A&amp;quot;&lt;br /&gt;
string posId = pos.getPositionId();          // returns &amp;quot;A,37&amp;quot;&lt;br /&gt;
string identityId = res.getIdentityId();     // returns &amp;quot;A,37,ILE&amp;quot;&lt;br /&gt;
string atomId = atom.getAtomId();            // returns &amp;quot;A,37,CA&amp;quot;&lt;br /&gt;
string atomId = atom.getAtomofIdentityId();  // returns &amp;quot;A,37,ILE,CA&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Operators==&lt;br /&gt;
&lt;br /&gt;
The braket operators are wrapper for the &amp;quot;by index&amp;quot; and &amp;quot;by identifier&amp;quot; getters. The round braket () always return the next down in the hierarchy (System-&amp;gt;Chain-&amp;gt;Position-&amp;gt;Residue-&amp;gt;Atom). The square braket [] returns Atoms for all objects&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// round () returns the &amp;quot;next&amp;quot; object in the hierarchy&lt;br /&gt;
sys.getChain(&amp;quot;A&amp;quot;) &amp;lt;-&amp;gt; sys(&amp;quot;A&amp;quot;)  // by chainId&lt;br /&gt;
sys.getChain(2) &amp;lt;-&amp;gt; sys(2)      // 3-rd atom in the array&lt;br /&gt;
// square [] always return atoms&lt;br /&gt;
sys.getAtom(&amp;quot;A,37,CA&amp;quot;) &amp;lt;-&amp;gt; sys[&amp;quot;A,37,CA&amp;quot;]   // by atomId&lt;br /&gt;
sys.getAtom(56) &amp;lt;-&amp;gt; sys[56]                 // 57-th atom&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Going down the hierarchy things behave similarly&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Chain==&lt;br /&gt;
&lt;br /&gt;
The following is the API for the Chain. Very similar to the one of System, but note how the chain id drops from the identifier (&amp;quot;A,37,CA&amp;quot; becomes &amp;quot;37,CA&amp;quot;). &amp;quot;A,37,CA&amp;quot; is actually legal, but the chain ID is ignored, it will just look for resnum 37, icode &amp;quot;&amp;quot; and name &amp;quot;CA&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// getters&lt;br /&gt;
Position &amp;amp; getPosition(unsigned int _index);&lt;br /&gt;
Position &amp;amp; getPosition(int _resnum, string _icode);&lt;br /&gt;
Position &amp;amp; getPosition(string _positionId); // &amp;quot;37&amp;quot; or &amp;quot;37A&amp;quot;&lt;br /&gt;
Residue &amp;amp; getIdentity(unsigned int _index);&lt;br /&gt;
Residue &amp;amp; getIdentity(int _resnum, string _icode, string _identity);&lt;br /&gt;
Residue &amp;amp; getIdentity(string _identityId); // &amp;quot;37,ILE&amp;quot; or &amp;quot;37A,ILE&amp;quot;&lt;br /&gt;
Atom &amp;amp; getAtom(unsigned int _index);&lt;br /&gt;
Atom &amp;amp; getAtom(int _resnum, string _icode, string _atomName);&lt;br /&gt;
Atom &amp;amp; getAtom(int _resnum, string _icode, string _identity, string _atomName);&lt;br /&gt;
Atom &amp;amp; getAtom(string _atomId); // &amp;quot;37,ILE,CA&amp;quot; or &amp;quot;37,CA&amp;quot;&lt;br /&gt;
// existance&lt;br /&gt;
bool positionExists(int _resnum, string _icode);&lt;br /&gt;
bool positionExists(string _positionId); // &amp;quot;37&amp;quot; or &amp;quot;37A&amp;quot;&lt;br /&gt;
// ...&lt;br /&gt;
bool atomExists(string _atomId); &amp;quot;37,CA&amp;quot; &amp;quot;37,ILE,CA&amp;quot;&lt;br /&gt;
// getters operators () []&lt;br /&gt;
Position &amp;amp; operator()(unsigned int _index);&lt;br /&gt;
Position &amp;amp; operator()(string _positionId);  // &amp;quot;37&amp;quot; or &amp;quot;37A&amp;quot;&lt;br /&gt;
Atom &amp;amp; operator[](unsigned int _index);&lt;br /&gt;
Atom &amp;amp; operator[](string _atomId);  &amp;quot;37,CA&amp;quot; &amp;quot;37,ILE,CA&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Position ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// getters&lt;br /&gt;
Residue &amp;amp; getIdentity(unsigned int _index);&lt;br /&gt;
Residue &amp;amp; getIdentity(string _identityId); // &amp;quot;ILE&amp;quot;&lt;br /&gt;
Atom &amp;amp; getAtom(unsigned int _index);&lt;br /&gt;
Atom &amp;amp; getAtom(string _identity, string _atomName);&lt;br /&gt;
Atom &amp;amp; getAtom(string _atomId); // &amp;quot;ILE,CA&amp;quot; or &amp;quot;CA&amp;quot;&lt;br /&gt;
// existance&lt;br /&gt;
bool identityExists(string _identityId); // &amp;quot;ILE&amp;quot;&lt;br /&gt;
// ...&lt;br /&gt;
bool atomExists(string _identity, string _atomName);&lt;br /&gt;
bool atomExists(string _atomId); &amp;quot;37,CA&amp;quot; &amp;quot;37,ILE,CA&amp;quot;&lt;br /&gt;
// getters operators () []&lt;br /&gt;
Residue &amp;amp; operator()(unsigned int _index);&lt;br /&gt;
Residue &amp;amp; operator()(string _identityId);  // &amp;quot;ILE&amp;quot;&lt;br /&gt;
Atom &amp;amp; operator[](unsigned int _index);&lt;br /&gt;
Atom &amp;amp; operator[](string _atomId);  &amp;quot;CA&amp;quot; &amp;quot;ILE,CA&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Residue ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// getters&lt;br /&gt;
Atom &amp;amp; getAtom(unsigned int _index);&lt;br /&gt;
Atom &amp;amp; getAtom(string _atomId); // &amp;quot;CA&amp;quot;&lt;br /&gt;
// existance&lt;br /&gt;
bool atomExists(string _atomId); &amp;quot;CA&amp;quot;&lt;br /&gt;
// getters operators []&lt;br /&gt;
Atom &amp;amp; operator[](unsigned int _index);&lt;br /&gt;
Atom &amp;amp; operator[](string _atomId);  &amp;quot;CA&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Senes</name></author>
		
	</entry>
</feed>