ID of atom bonded to a specific atom

Dear all,

Suppose that one atom (ID = i) is bonded to another atom (ID = j) in a large molecule. In the in script, if we know the value of i, can we obtain the value of j by any commands or need we combine some loop and judgment structures?

I have checked two relating commands:
(a) compute property/local batom1 batom2;
(b) compute coord/atom cutoff.
However, (a) provides me the atom IDs of the 2 atoms in all bonds in the molecule instead of the wanted one (i-j); (b) provides me the coordination number instead of the atom ID.

Any suggestions would be appreciated.

Best regards,
Zheng Li

This cannot be done directly.

Please elaborate on what you want to do with the bond partner information to be able to make some suggestions.

Please also explain how you want to handle the ambiguity when an atom is involved in multiple bonds.

Thank you very much for your reply.
Actually the atom with ID = i is the hydrogen atom of the hydroxyl group and the atom with ID = j is the oxygen atom of the hydroxyl group. Thus there is only one atom (atom j) bonded with atom i. I want to recognize these atoms and name a group to them. Then delete_atoms will be used to delete them.

Your answer is still ambiguous. Which atoms do you want to delete? The Hydrogen atoms or the Oxygen atoms?

You should be able to use the “overlap” option of the delete_atoms command to do what you want to do after defining one group with the Hydrogen atoms and a second group with the Oxygen atoms using a suitable cutoff and (temporarily) adjusting the special_bonds settings.

Thank you very much for your reply. I want to delete both Hydrogen and Oxygen atoms. Since I know the Oxygen atom ID i, I can name a group of Oxygen atoms. But I don’t know the Hydrogen atom ID j, I cannot name a group of Hydrogen atoms. That’s why I want to get the value of j.

I will also try the “overlap” option of the delete_atoms command as you suggested. Thank you very much.