VMD-L Mailing List
From: Brian Kidd (bkidd_at_u.washington.edu)
Date: Mon Jan 08 2007 - 22:01:12 CST
- Next message: Peter Freddolino: "Re: question about setting variables in a loop"
- Previous message: Axel Kohlmeyer: "Re: Unaligned access to ..."
- Next in thread: Peter Freddolino: "Re: question about setting variables in a loop"
- Reply: Peter Freddolino: "Re: question about setting variables in a loop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
hello,
i'm interested in specifying an input list of residue numbers. the
number of residues (elements) in this list will vary and i'd like to
create the a set of variables to store each element in the list.
ultimately, i'd like to loop through the list of variables and set an
atomtype based on the element in the list. how can i specify the
variable to store each value as i'm looping through the list so that
i can retrieve it later? below is a snippet of code for how this
might work, but i don't know the correct syntax for line 8 or 9 where
i set the variable and retrieve its contents respectively. thanks, brian
proc read_inputlist {instring} {
set res_list [list $instring]
set res_num [llength ($res_list)]
# store Calpha values for each residue in list
for { set i 0 } { $i < $res_num } { incr i } {
set Ca_{i} [atomselect top "resid [lindex $res_list 0 $i] and name
CA"]
puts "[$Ca_{i} get {x y z}]"
}
- Next message: Peter Freddolino: "Re: question about setting variables in a loop"
- Previous message: Axel Kohlmeyer: "Re: Unaligned access to ..."
- Next in thread: Peter Freddolino: "Re: question about setting variables in a loop"
- Reply: Peter Freddolino: "Re: question about setting variables in a loop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]