VMD-L Mailing List
From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Fri Jun 08 2012 - 12:10:36 CDT
- Next message: harish vashisth: "Re: Finding the Number of Chains Present via Scripting"
- Previous message: Nate Hurley: "Finding the Number of Chains Present via Scripting"
- In reply to: Nate Hurley: "Finding the Number of Chains Present via Scripting"
- Next in thread: harish vashisth: "Re: Finding the Number of Chains Present via Scripting"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
On Fri, Jun 8, 2012 at 12:19 PM, Nate Hurley <natech_at_gmail.com> wrote:
> Hi all,
>
> I'm new to VMD as of this week, and I'm trying to write a script that needs
> to determine how many chains exist in a pdb file. In each of my files there
> is a chain A, and then there are somewhere between 5 and 20 chains Z, Y, X,
> . . . . Is there a way that I can easily find how many chains I have?
yes. it just needs a little Tcl scripting. i suggest you spend some
time working your way through the Tcl tutorial on www.tcl.tk.
there also is a scripting tutorial section in the VMD user's guide.
the code for this particular problem is simple.
after you have loaded the pdb file type (or copy)
this into the VMD console window:
set sel [atomselect top all]
set chains [lsort -ascii -unique [$sel get chain]]
puts "the current file contains [llength $chains] chain(s)"
$sel delete
axel.
>
> Thanks for your help.
>
> -Nate Hurley
-- Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0 College of Science and Technology Temple University, Philadelphia PA, USA.
- Next message: harish vashisth: "Re: Finding the Number of Chains Present via Scripting"
- Previous message: Nate Hurley: "Finding the Number of Chains Present via Scripting"
- In reply to: Nate Hurley: "Finding the Number of Chains Present via Scripting"
- Next in thread: harish vashisth: "Re: Finding the Number of Chains Present via Scripting"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]