VMD-L Mailing List
From: McGuire, Kelly (mcg05004_at_byui.edu)
Date: Thu Oct 11 2018 - 14:05:56 CDT
- Next message: Giacomo Fiorin: "Re: Display representations with Tk Console"
- Previous message: Vermaas, Joshua: "RE: Display representations with Tk Console"
- In reply to: Souvik Sinha: "Re: VMD Tk Console Columns"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Thanks Souvik and Giacomo, that worked perfectly.
Kelly L. McGuire
PhD Scholar
Biophysics
Department of Physiology and Developmental Biology
Brigham Young University
LSB 3050
Provo, UT 84602
________________________________
From: Souvik Sinha <souvik.sinha893_at_gmail.com>
Sent: Thursday, October 11, 2018 1:54:11 AM
To: McGuire, Kelly
Cc: Giacomo Fiorin; Vmd l
Subject: Re: vmd-l: VMD Tk Console Columns
Hi kelly, I think Dr. Fiorin meant something like this:
# measure the dihedral and save to output
for { set frame 0 } { $frame < $ntot } { incr frame } {
foreach c [list 1 2 3 4] {
set x [measure dihed "$dihe0($c)" frame $frame ]
lappend xdihe$c $x
}
foreach c1 $xdihe1 c2 $xdihe2 c3 $xdihe3 c4 $xdihe4 {
puts $outdid [format "%.4f %.4f %.4f %.4f" $c1 $c2 $c3 $c4]
}
}
Regards,
Souvik
On Thu, Oct 11, 2018 at 6:15 AM McGuire, Kelly <mcg05004_at_byui.edu<mailto:mcg05004_at_byui.edu>> wrote:
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<mailto:giacomo.fiorin_at_gmail.com>>
Sent: Wednesday, October 10, 2018 2:19:05 PM
To: McGuire, Kelly
Cc: vmd-l_at_ks.uiuc.edu<mailto: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 -- Souvik Sinha Research Fellow Bioinformatics Centre (SGD LAB) Bose Institute Contact: 033 25693275
- Next message: Giacomo Fiorin: "Re: Display representations with Tk Console"
- Previous message: Vermaas, Joshua: "RE: Display representations with Tk Console"
- In reply to: Souvik Sinha: "Re: VMD Tk Console Columns"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]