<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Patrick,<div><span class="Apple-tab-span" style="white-space:pre"> </span>chimera.Atom is the Atom class, so with this statement:</div><div><br></div><div>at1=chimera.Atom</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>you are simply providing an alternate name (at1) for the chimera.Atom class, not instantiating an Atom. So therefore with this statement:</div><div><br></div><div>at1.name="BC1"</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>you are assigning the Atom <i>class</i> attribute "name" to be "BC1". Therefore, whenever the "name" attribute is looked up in any Atom instance after that, it finds the class assignment first and uses that, which is why all the atoms seem to have the name BC1 afterward.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>In Chimera, you can't create an Atom "directly" -- you have to have a Molecule instance, which in turn has a method for adding Atoms. One of the simpler ways of adding Atoms is to use chimera.molEdit.addAtom(). That function has a pretty good doc string describing its arguments. Before you can use that function though you need to create a Molecule and Residue instance to contain the Atom. Look at the _newModel and _newResidue methods of BuildStructure/__init__.py for example code for that.<br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>There's a somewhat useful handout we made for a Chimera programming class this summer that you may want to look over. It's available as a link off the Chimera Programmer's Guide page: <a href="http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html">http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/index.html</a></div><div><br></div><div>--Eric</div><div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>Eric Pettersen</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>UCSF Computer Graphics Lab</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> </span><a href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a></font></p><br class="Apple-interchange-newline"></div></span> </div><br><div><div>On Oct 14, 2008, at 7:45 AM, Patrick Ladam wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hello to the list,<br>I start trying to write my first py code in chimera (not that easy<br>without too much doc strings) and have a first question to submit.<br><br>Here is what I am doing in IDLE:<br><br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">import chimera<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">opened = chimera.openModels.open('1zik.pdb')<br></blockquote></blockquote></blockquote><br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">mol = opened[0]<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">for i in mol.atoms:<br></blockquote></blockquote></blockquote><span class="Apple-tab-span" style="white-space:pre"> </span>print i.name<br><br>N<br>CA<br>CB<br>CG<br>CD<br>.../...<br><br># Now I want to instanciate an atom and set its name attribute:<br><br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">at1=chimera.Atom<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">at1.name="BC1"<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">print at1.name<br></blockquote></blockquote></blockquote>BC1<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><br># Now I redo the previous loop:<br><br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">for i in mol.atoms:<br></blockquote></blockquote></blockquote><span class="Apple-tab-span" style="white-space:pre"> </span>print i.name<br><br><span class="Apple-tab-span" style="white-space:pre"> </span><br>BC1<br>BC1<br>BC1<br>BC1<br>BC1<br>BC1<br>BC1<br>BC1<br>BC1<br>BC1<br>BC1<br>BC1<br>.../...<br><br>They're all BC1!!!<br><br>How come ? My created atom 'at1' and my 'mol' are supposed to be<br>completely seperated objects no?<br><br>Can someone help, I am afraid I missed something really basic here...<br>Bye to all<br>_______________________________________________<br>Chimera-dev mailing list<br><a href="mailto:Chimera-dev@cgl.ucsf.edu">Chimera-dev@cgl.ucsf.edu</a><br>http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev<br></div></blockquote></div><br></div></body></html>