Re: [AMBER] how to obtain index of atoms based on residue and atom masks

From: Matthew Guberman-Pfeffer <>
Date: Tue, 18 Jan 2022 22:12:31 -0500

Hello Tammy,

One thought is that you can use the mask keyword in cpptraj to generate a file. This file, call it mask.txt, will list the atom numbers in the second column. You then can process this file with a bash script to get a comma separated list, something like the following:

while IFS= read -r F1 <&2;do

  if [ $idx != 0 ];then
    atnum=$(echo $F1 | awk '{print $2}')
    echo -n “${atnum},";

done 2< mask.txt

Note that the line indexing (idx) is to skip the “AtomNum” header in mask.txt.

Hope this work-around helps.



> On Jan 18, 2022, at 8:01 PM, Ming Tang <> wrote:
> *Message sent from a system outside of UConn.*
> Dear list,
> Is there a command to print out atom indexes (separated by comma) for a large number of residues? I want to use them as cv_i in ABMD.
> Thanks,
> Tammy
> _______________________________________________
> AMBER mailing list

AMBER mailing list
Received on Tue Jan 18 2022 - 19:30:02 PST
Custom Search