Highlight atoms by inputing atom numbers

Dear all,

Many times I need to find some specific atoms (by their atom numbers) in a molecular system. It is not an easy task if the system is big and the atoms are not numbered in a reasonable order.

I am wondering if Avogadro can add a feature to help. For example, by entering the atom numbers, the corresponding atoms can be highlighted or selected.

Thank you.
Michael

Dear Michael,

I assume you equate “atom number” with atoms of either carbon, or nitrogen. Perhaps not a solution for Avogadro, but if your aim is the rapid identification of atoms of a particular type, an intermediate alternative may be to process your structure model by Jmol. Among the input formats supported are .xyz, .pdb, .cif, .mmcif; if not available for you by default, .xyz and .pdb are formats OpenBabel (here is the current documentation) may write for you from many other formats.

Once the structure is read by Jmol, open the program’s own script console. Here, 1) select the objects of interest, and 2) assign the colour. For example

select oxygen;
color green;

will substitute the default red about oxygen atoms by green. The commands may be extended, e.g., to select multiple atom types at once

select oxygen, nitrogen;

or to select larger (possibly recurrent) pattern like

select leu;  # selects all leucins if assigned in the .pdb
select protein; # selects assigned proteins in a .mmcif

In terms of colours, you may use instead an RGB definition, too:

color [123, 255, 13];

As an illustration of the above, with the .mmcif of 1NE6, for example,

select arg;  # selection of all arginines
color [255, 255, 255];
write "arginines.png";

yields the following:
arginines

while the calls of

select protein;
color blue;
write "protein.png";

alter the visualization to

protein

which highlights water and guest molecules.

1 Like

Seems pretty easy. In Avogadro 1.x, you can pull up the atom property table and when you click on the row you want, it should select those atoms.

But it’s pretty easy to add command to select a set (or range) of atom numbers.

If you’re using 1.94, I can even add a Python script to do that ASAP.

Hi Thomas,
Very useful information. I actually never tried Jmol.
I mean numbering for “atom number”. For example, I need visually identify atom number 1 among several hundred atoms. Is Jmol capable for the task?
Thank you very much.
Michael

wow the “atom property table” works, although it can only highlight one atom at a time.

what’s the current version of 1.x now? I am using 1.2.0 which is the default version I downloaded from the website.

thanks for the information and help!

Michael

For .pdb the selection of atoms by their appearance in the file in Jmol is possible, too. The instruction then is, e.g.,

select atomno = 13;
color green;  # if using a green colour is fine for you
color cpk;  # to revert back to Jmol's first default colour scheme
color rasmol;  # to enable Jmol's alternative colour scheme

In .cif files which typically describe small molecules (often complementary to the scope of .pdb), a call by the atom label (atom symbol plus a number) is equally possible. E.g., with 1505213.cif from the COD, once loaded into Jmol, from the program’s console:

select H17;
label;  # just to ease localization within the visual
color green;
select atomno >= 4 and atomno < 10;  # a range of atom numbers
color red;
write "green_hydrogen.png"  # provide the permanent record
color cpk;  # revert to the original colour scheme on last selection
set label off;  # the label no longer is shown

label_hydrogen

(Further examples, e.g. in the interactive manual here.)

We’ve been releasing beta versions of Avogadro2, which should be finished sometime this fall. The latest is 1.94 (https://two.avogadro.cc/)

As part of that, I just submitted a patch for selecting a comma-separated list or range (or both), e.g. “1, 2, 5, 6” or “1, 5-10”:

While Avogadro2 isn’t feature-complete, it’s easy for us to release builds from patches for people to try.

1 Like

Thank you all for the help! Mission completed!