From: McGuire, Kelly (mcg05004_at_byui.edu)
Date: Wed Oct 10 2018 - 19:14:04 CDT

Could that be done within this script, where would the foreach loop and format be placed?:

# input
 set input1 Simulation_QwikMD
 set input2 win8-1
 mol load psf $input1.psf dcd $input2.dcd

# output
 set outdi "../Dihedrals/win8-1.dat"
 set outdiid [open $outdi "w"]

# write header
 #set headdi "# frame ASP44-1 ASP44-2 ASP44-3 ASP44-4 TRP41-1 TRP41-2 TRP41-3 TRP41-4 HIS37-1 HIS37-2 #HIS37-3 HIS37-4 SER31-1 SER31-2 SER31-3 SER31-4 VAL27-1 VAL27-2 VAL27-3 VAL27-4"
 #puts $outdiid $headdi

# atom selection
 set dihe01 [[atomselect top "segname PP1 and (name N CA CB CG1) and
 resname VAL and resid 27"] get index]

 set dihe02 [[atomselect top "segname PP2 and (name N CA CB CG1) and
 resname VAL and resid 27"] get index]

 set dihe03 [[atomselect top "segname PP3 and (name N CA CB CG1) and
 resname VAL and resid 27"] get index]

 set dihe04 [[atomselect top "segname PP4 and (name N CA CB CG1) and
 resname VAL and resid 27"] get index]

# obtain total number of frames
 set ntot [molinfo top get numframes]

# measure the dihedral and save to output
 for { set frame 0 } { $frame < $ntot } { incr frame } {
 set xdihe01 [measure dihed "$dihe01" frame $frame ]
 puts $outdiid VAL27PP1\t$xdihe01
 }

 for { set frame 0 } { $frame < $ntot } { incr frame } {
 set xdihe02 [measure dihed "$dihe02" frame $frame ]
 puts $outdiid VAL27PP2\t$xdihe02
 }

 for { set frame 0 } { $frame < $ntot } { incr frame } {
 set xdihe03 [measure dihed "$dihe03" frame $frame ]
 puts $outdiid VAL27PP3\t$xdihe03
 }

 for { set frame 0 } { $frame < $ntot } { incr frame } {
 set xdihe04 [measure dihed "$dihe04" frame $frame ]
 puts $outdiid VAL27PP4\t$xdihe04
 }

# close output
 close $outdiid

Kelly L. McGuire

PhD Scholar

Biophysics

Department of Physiology and Developmental Biology

Brigham Young University

LSB 3050

Provo, UT 84602

________________________________
From: Giacomo Fiorin <giacomo.fiorin_at_gmail.com>
Sent: Wednesday, October 10, 2018 2:19:05 PM
To: McGuire, Kelly
Cc: vmd-l_at_ks.uiuc.edu
Subject: Re: vmd-l: VMD Tk Console Columns

Hi Kelly, you could use a "foreach" loop to iterate over the four lists, and the "format" command to print the four values in a specific arrangement.
https://tcl.tk/man/tcl8.5/TclCmd/contents.htm

Giacomo

On Wed, Oct 10, 2018 at 4:05 PM McGuire, Kelly <mcg05004_at_byui.edu<mailto:mcg05004_at_byui.edu>> wrote:

I am writing dihedrals of 4 sidechains from a trajectory. Everything works great, except I would like to write the four lists of dihedrals in separate columns instead of on long list. How do I write separate columns spaced and next to each other? Thanks!

Kelly L. McGuire

PhD Scholar

Biophysics

Department of Physiology and Developmental Biology

Brigham Young University

LSB 3050

Provo, UT 84602

--
Giacomo Fiorin
Associate Professor of Research, Temple University, Philadelphia, PA
Contractor, National Institutes of Health, Bethesda, MD
http://goo.gl/Q3TBQU
https://github.com/giacomofiorin