VMD-L Mailing List
From: Ashar Malik (asharjm_at_gmail.com)
Date: Wed Apr 18 2018 - 09:53:53 CDT
- Next message: Giacomo Fiorin: "Re: vmd tcl script writing issue"
- Previous message: Sandip Mondal: "vmd tcl script writing issue"
- In reply to: Sandip Mondal: "vmd tcl script writing issue"
- Next in thread: Giacomo Fiorin: "Re: vmd tcl script writing issue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Best programming practice is to always close what you open.
Second you don't necessarily have to provide "writepdb" a file handle. I
haven't used it this way and I am not sure if it can handle that!!??
What you can do is something like this
$atoms writepdb frame_$i.pdb
This should create a pdb-file with "frame_" and the value of the variable "
*i"* ...
Be sure to always delete any selections you make when you no longer need
them.
On Thu, Apr 19, 2018 at 2:29 AM, Sandip Mondal <sandchem13_at_gmail.com> wrote:
> Dear user,
>
> I am new in writing tcl script. I wrote a simple script for writing
> selected regions in pdb format from a dcd.
>
> The script is as follows
>
> set atoms [atomselect top "not water"]
> set nf [molinfo top get numframes]
> set out [open "file.pdb" w]
> for {set i 0} {$i < $nf} {incr i} {
> if {$i == 123} {
> $atoms frame $i
> $atoms writepdb $out
> }
> }
>
> Here 123th frame of a dcd is just for example. This script doesn't
> write anything in that $out file, however it creates a new file which I
> expect in $out file. Can you plz suggest the way.
>
> Thanking you,
> Sandip
>
-- Best, /A
- Next message: Giacomo Fiorin: "Re: vmd tcl script writing issue"
- Previous message: Sandip Mondal: "vmd tcl script writing issue"
- In reply to: Sandip Mondal: "vmd tcl script writing issue"
- Next in thread: Giacomo Fiorin: "Re: vmd tcl script writing issue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]