Re: Writing an output file into pdb format in a simulation.

From: JC Gumbart (gumbart_at_ks.uiuc.edu)
Date: Thu May 31 2012 - 16:10:38 CDT

Is there a reason you can't use VMD's writepdb command?

On May 31, 2012, at 3:20 PM, Ajith Rathnaweera Rajapaksha Mudalige wrote:

> Hi All,
>
> I am in need to write an output file in pdb format at the stage of simulation in progress.
>
> In order to simply present my requirement I have invented the following trivial case.
>
> I am running a simulation to open a pdb file and write another file using the data in the first pdb file exactly following the pdb format.
>
> I have shown below my TCL script. This script work fine. But, when I look at the output I see 2 problems.
> 1) Records are not separated into lines
> 2) Each record is included within curly brackets
>
> -------------------------------------------------------------------
> set file1 [open "output_from_targets.pdb" w]
>
> set duplicate {}
>
> set inStream [open ubq_protein_only_2.pdb r]
>
> foreach line [split [read $inStream] \n] {
> set rec_name [string range $line 0 5]
> set atm_ID [string range $line 6 10]
> set atm_name [string range $line 12 15]
> set res_name [string range $line 17 19]
> set chain_ID [string range $line 21 21]
> set res_ID [string range $line 21 25]
> set x_coord [string range $line 30 37]
> set y_coord [string range $line 38 47]
> set z_coord [string range $line 46 53]
> set occupancy [string range $line 54 59]
> set beta [string range $line 60 65]
> set seg_name [string range $line 72 75]
> set Element [string range $line 76 77]
>
> if { ($beta == 1)} {
> lappend targets "[string trim $rec_name] [string trim $atm_ID] [string trim $atm_name] [string trim $res_name] [string trim $chain_ID] [string trim $res_ID] [string trim $x_coord] [string trim $y_coord] [string trim $z_coord] [string trim $occupancy] [string trim $beta] [string trim $seg_name] [string trim $Element]"
> }
> }
>
> close $inStream
>
> puts $file1 $duplicate
> ----------------------------------------------------------------
>
> I appreciate any useful comment to rectify the problems I am having.
>
> Thanks in advance.
>
> Ajith

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2012 - 23:21:36 CST