[Chimera-users] Getting names of selected atoms and renaming

Eric Pettersen pett at cgl.ucsf.edu
Fri Mar 17 16:36:40 PDT 2017

	You can change the names of selected atoms with the “setattr” command, e.g.:

setattr a name HX sel

will change the name of all selected atoms to HX.  You can’t easily modify an atom name though (i.e. add a character or number to the existing name) without using Python.


	Eric Pettersen
	UCSF Computer Graphics Lab

> On Mar 17, 2017, at 10:49 AM, Elaine Meng <meng at cgl.ucsf.edu> wrote:
> Dear Vladislav Dziuba,
> Chimera doesn’t have a tool to rename the atoms.  It would probably be simplest to text-edit the input file to change the names directly, or write a script to do it. But maybe some of the following will make what you want to do possible without changing the names.
> You can write a list of the selected atoms with menu: Actions… Write List, or command “writesel”.  However, this list will give the atom names but not their serial numbers, so in your example it would give H27, not 100. 
> In Chimera commands, you can actually specify atoms by serial number, for example:
> color blue @/serialNumber=12
> select @/serialNumber>8
> Serial number is an attribute of the atom, and although in general you can write a list of atoms with attribute values, this specific attribute is kept hidden.  There is a tricky way to copy it to a new attribute and then write it out.  First select the atoms you want, then:
> (1) open the Attribute Calculator tool (in menu under Tools… Structure Analysis)
> (2) in that dialog, enter Formula:   atom.serialNumber
> (and whatever name you want for the new atom attribute in the entry field at the top, I just kept the default “attributeName”)
> (3) check the 2nd and 5th boxes in dialog “Restrict  formula domain…” (to only include the selected atoms) and “Save calculation results to file”
> (you can optionally check the 4th box to also show output in the Reply Log)
> (4) click OK or Apply and then specify output filename and location in the resulting dialog
> One stupid thing, however, is that it changes the integers (e.g. 10) to real numbers (e.g. 10.0) so you may still have to text-edit the results. This process might not be any easier than text-editing the atom names in the original input… your choice.
> I hope this helps,
> Elaine
> -----
> Elaine C. Meng, Ph.D.                       
> UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
>> On Mar 16, 2017, at 6:03 PM, Vladyslav Dziuba <xenonbat at ya.ru> wrote:
>> Dear Sir or Madam,
>> I have some difficulties with using ORCA and UCSF Chimera together. Let me describe my problem first. I need to freeze some atoms (actually, a lot of atoms) in my calculations (geometry optimization), e.g. make their coordinates constant. To do that I need to specify numbers of atoms from xyz file, which is obtained from pdb-file. The problem is that for every atom in pdb-file OpenBabel generates a new number (for example H27 may become 100th atom in xyz file), so that specifying atoms that must be frozen becomes much more complicated. Given that, I'd like to ask to help me find answer on some questions:
>> 1. How can I rename atoms? It would greatly help me identificate atoms that must be frozen. Can I rename only all selected atoms?
>> 2.Can I modify names of selected atoms?
>> 3. How can I get list of numbers of selected atoms? For instance I've chosen some aminoacids residues and I want to get names or numbers of all atoms chosen.
>> Because if I one wants to get a list of atoms in xyz file, he needs names or numbers of atoms in pdb file, but the last ones are disordered. Manual atom picking and comparison in pdb- and xyz-files is very time-consuming. UCSF Chimera is a truly powerful program so I believe there must exist an elegant solution to my problem.
>> Hope to receive a letter from you soon.
>> Thanks in advance!
>> Best regards,
>> Vladislav Dziuba
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu
> Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20170317/405fafe1/attachment.html>

More information about the Chimera-users mailing list