VMD-L Mailing List
From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Fri Jul 05 2013 - 17:00:17 CDT
- Next message: Bennion, Brian: "RE: manipulation of atomselections"
- Previous message: Bennion, Brian: "manipulation of atomselections"
- In reply to: Bennion, Brian: "manipulation of atomselections"
- Next in thread: Bennion, Brian: "RE: manipulation of atomselections"
- Reply: Bennion, Brian: "RE: manipulation of atomselections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
On Fri, Jul 5, 2013 at 10:54 PM, Bennion, Brian <Bennion1_at_llnl.gov> wrote:
> Hello,
>
> At some level this question is a tcl and vmd syntax issue.
this is entirely Tcl.
> set 1 [atomselect $loop1 "resname OBDN and (name O34 or name O35)"]
> set 2 [atomselect $loop1 " resname I61 and name O9"]
> set 3 [atomselect $loop1 " resname hlo0 and (name O14 or name O17)"]
using numbers as variable names is usually not a great idea. but anyway.
> foreach x { 1 2 3 } {
this is not referencing the variables from above but just the plain
numbers. if you want a list of the atom selections, you can use
foreach x [list $1 $2 $3] {
or
foreach x "$1 $2 $3" {
another option is to skip the variable definition and just do
set list [atomselect ...]
lappend list [atomselect...]
lappend list [atomselect...]
and then:
foreach x $list {
> if { [$x list ] != {} } {
> do something
> }
> }
>
> The error is: invalid command name "1"
yes. because that is the value you assign to x.
> I am just trying to check to make sure the atomselection actually contains
> something before I operate on it.
now on that subject, you can also improve your test and simply use
if { [$x num] > 0} {
(well, this is a VMD thingy after all.)
axel.
> Brian
>
-- Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0 International Centre for Theoretical Physics, Trieste. Italy.
- Next message: Bennion, Brian: "RE: manipulation of atomselections"
- Previous message: Bennion, Brian: "manipulation of atomselections"
- In reply to: Bennion, Brian: "manipulation of atomselections"
- Next in thread: Bennion, Brian: "RE: manipulation of atomselections"
- Reply: Bennion, Brian: "RE: manipulation of atomselections"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]