Topic Options
#37139 - 09/05/18 10:04 AM Loop Syntax
EArtikis Offline
Forum Member

Registered: 06/01/16
Posts: 23
How do I advance to the next ?SELIRES in the system command of the loop? I would like to write out all the selected residues to a data.txt file.

Code:
set h = 1
label hloop
        .....
        print coor sele ca end    
        if ?nsel ne 0
                set a 1
                label seli
                   system "echo @H ?SELIRES >> data.txt"
                   incr a
                   if @a le ?nsel goto seli
                   else
                   endif 
incr h by 1
if h le ?nres goto hloop
else
endif 
stop

Top
#37140 - 09/05/18 11:39 AM Re: Loop Syntax [Re: EArtikis]
lennart Online   content

Forum Member

Registered: 09/25/03
Posts: 4742
Loc: ~ 59N, 15E
See select.doc, item 11 on subsets.
You don't have to use the system command, CHARMM's own echo command should be fine (miscom.doc):
open unit 201 write form name data.txt
echu 201

label seli
echo @H ....
_________________________
Lennart Nilsson
Karolinska Institutet
Stockholm, Sweden

Top
#37141 - 09/05/18 11:41 AM Re: Loop Syntax [Re: EArtikis]
rmv Online   content

Forum Member

Registered: 09/17/03
Posts: 8379
Loc: 39 03 48 N, 77 06 54 W
The ?SELIRES value always refers to the first atom of a selection, and does not change unless the selection changes.

Use the .SUBSET. keyword; it requires an integer value which is the index (PSF based order) of each atom within the selection.

See select.doc for details.
_________________________
Rick Venable
computational chemist


Top
#37142 - 09/05/18 01:53 PM Re: Loop Syntax [Re: rmv]
EArtikis Offline
Forum Member

Registered: 06/01/16
Posts: 23
Thank you! It worked.

Top

Moderator:  John Legato, lennart