Re: Energy Plugin

From: bo baker (bo.bybaker_at_gmail.com)
Date: Wed Jan 04 2006 - 16:26:24 CST

Hello, Peter:

I can't make the 'namddat' to work on the Mac computer. It has some
format problem. The command can't be recongized. Here is how I did:

[mriv209-01:~] bo% cd desktop
[mriv209-01:~/desktop] bo% setenv PATH .:$PATH
[mriv209-01:~/desktop] bo% ./namddat N62-2.log
tcsh: ./namddat: Command not found.

I then try the 'namdplot' downloaded previously with 'scripts.dmg',
and extracted into my local directory. It works fine:

[mriv209-01:~/desktop] bo% ./namdplot TEMP N62-2.log
ETITLE: TS BOND ANGLE DIHED IMPRP ELECT VDW BOUNDARY MISC KINETIC
TOTAL TEMP TOTAL2 TOTAL3 TEMPAVG PRESSURE GPRESSURE VOLUME PRESSAVG
GPRESSAVG
Plotting TEMP vs TS
[1] 1842

When I try to modify the 'namdplot', to add two lines from your
'namddat' using 'vi' from 'terminal' window:
-----
echo $xtitle $ytitle >! data.dat
cat $tmpfile >> data.dat
-----

and then save the it as 'namdplot-2'. Then load it :

[mriv209-01:~/desktop] bo% ./namdplot-2 N62-2.log
tcsh: ./namdplot-2: Permission denied.
[mriv209-01:~/desktop] bo%

It seems that the 'namdplot-2' is modified by the computer, and no
longer be recognized. I have included the two files as attachemntd. I
use Mac OSX 10.3.9, and I have the X-11 loaded.

Thanks for any suggestions

bo

On 1/3/06, Peter Freddolino <petefred_at_ks.uiuc.edu> wrote:
> Dear Bo,
> in this case you'll probably want to use namddat (attached here for your
> convenience). This is exactly like namdplot, but it extracts the
> energies to a file called data.dat instead of trying to print it. You
> can then load data.dat into excel to plot it. Please let me know if you
> have any problems with this.
> Best,
> Peter
>
> bo baker wrote:
>
> >Dear Peter:
> >
> >Thank you for the information.
> >
> >
> >
> >>However, I am curious what you mean by saying the energy information is
> >>in a ---.log file. If all you want to do is extract energy information
> >>from a preexisting log file, you are better off just using existing
> >>shell tools (I can give you more details if you need).
> >>
> >>
> >
> >I just want to extract energy information from the .log file. I try
> >to use 'namdplot', but I don't have 'gramcx' in the computer. I use
> >Mac OSX. Can you give me more details for the shell tool? So I can
> >extract the energy to a text file, then plot it using other program,
> >such as Excel?
> >
> >Thank you for advice.
> >
> >Bo
> >
> >On 1/2/06, Peter Freddolino <petefred_at_ks.uiuc.edu> wrote:
> >
> >
> >>Dear Bo,
> >>NAMDEnergy is not fully implemented in VMD 1.8.3. If you want to use it
> >>from the console, you should run the commands
> >>package require namdenergy
> >>namdenergy
> >>
> >>to get usage instructions. A more mature version of NAMDEnergy is
> >>included in VMD 1.8.4; there is also a GUI available in this version.
> >>You can download this version from the VMD website.
> >>
> >>However, I am curious what you mean by saying the energy information is
> >>in a ---.log file. If all you want to do is extract energy information
> >>from a preexisting log file, you are better off just using existing
> >>shell tools (I can give you more details if you need). NAMDEnergy is
> >>designed to do new simulations to calculate the energies of subsystems,
> >>which cannot be obtained from the logfile of a prior run.
> >>
> >>Peter
> >>
> >>bo baker wrote:
> >>
> >>
> >>
> >>>Hello, NAMD:
> >>>I am condused on how to make the "NAMD Energy Plugin" to work in VMD?
> >>>The energy information is in a ---.log file. I go to 'console', what
> >>>is the command should I type? I use VMD 1.8.3. There is no "NAMD
> >>>Energy Plugin" under "Extension - Analysis'.
> >>>
> >>>Thank you for your help
> >>>
> >>>Bo
> >>>
> >>>
> >>>
> >>>
>
>
> #!/bin/csh
>
> # Written in 1999 by Jim Phillips, Theoretical Biophysics Group,
> # Beckman Institute, University of Illinois at Urbana-Champaign.
>
> if ( $#argv < 1 ) then
> echo "Usage: $0 [zero] [diff] [<yfield> [<yfield> ...] [vs <xfield>]] <file>"
> exit -1
> endif
>
> set titles = `awk '/^ETITLE:/ { print; exit }' $argv[$#argv]`
> echo $titles
>
> if ( $#argv < 2 ) then
> echo "Usage: $0 [zero] [diff] [<yfield> [<yfield> ...] [vs <xfield>]] <file>"
> exit -1
> endif
>
> if ( $1 == zero ) then
> set zero = 1
> shift argv
> else
> set zero = 0
> endif
>
> if ( $1 == diff ) then
> set zero = 1
> set diff = 1
> shift argv
> else
> set diff = 0
> endif
>
> set ytargets =
> while ( $#argv > 1 && $1 != vs )
> @ pos = 1
> foreach t ( $titles )
> if ( $t == $1 ) set ytargets = ( $ytargets $pos )
> @ pos++
> end
> shift argv
> end
>
> if ( $#ytargets == 0 ) exit -1
>
> set xtarget = 2
> if ( $1 == vs ) then
> shift argv
> @ pos = 1
> foreach t ( $titles )
> if ( $t == $1 ) set xtarget = $pos
> @ pos++
> end
> shift argv
> endif
>
> set file = $argv[1]
>
> set ytitle =
> foreach y ( $ytargets )
> set ytitle = ( $ytitle $titles[$y] )
> end
> set xtitle = $titles[$xtarget]
>
> #echo Plotting $ytitle vs $xtitle
> echo Calculating average of $ytitle
>
> set title = $file
>
> set open = '{'
> set close = '}'
> set dollar = '$'
>
> if ( $zero ) then
> set subtitle = "change from initial value"
> set prog = "NR == 1 $open"
> foreach y ( $ytargets )
> set prog = "$prog z$y = $dollar$y;"
> end
> set prog = "$prog $close"
> set prog = "$prog $open print $dollar$xtarget"
> foreach y ( $ytargets )
> set prog = "$prog, $dollar$y - z$y"
> end
> set prog = "$prog $close"
> if ( $diff ) then
> set subtitle = "running backward difference"
> set prog = "$prog $open"
> foreach y ( $ytargets )
> set prog = "$prog z$y = $dollar$y;"
> end
> set prog = "$prog $close"
> endif
> else
> set subtitle = ""
> set prog = "$open print $dollar$xtarget"
> foreach y ( $ytargets )
> set prog = "$prog, $dollar$y"
> end
> set prog = "$prog $close"
> endif
>
>
> #echo $prog
>
> set quote = '"'
> set p_title = "TITLE $quote$title$quote"
> set p_subtitle = "SUBTITLE $quote$subtitle$quote"
> set p_xaxis = "XAXIS LABEL $quote$xtitle$quote"
>
> set tmpfile = /tmp/namdplot.$USER.$$.tmp
>
> set l_cmd = ( 0 0 0 0 0 0 0 0 0 0 )
> @ pos = 1
> foreach t ( $ytitle )
> @ i = $pos - 1
> set l_cmd[$pos] = "S$i LEGEND $quote$t$quote"
> @ pos++
> end
>
> while ( $pos <= 10 )
> set l_cmd[$pos] = "S$i LEGEND $quote$t$quote"
> @ pos++
> end
>
> grep '^ENERGY:' $argv | grep -v '[a-z]' | awk "$prog" > $tmpfile
>
>
>
> set ys=`echo $ytitle | awk '{print NF}'`
> #echo $ys
>
> echo $xtitle $ytitle >! data.dat
> cat $tmpfile >> data.dat
>
> #set j=2
> #while ( $j < $ys + 2 )
> # echo $j
> # set av=`tail +102 $tmpfile | awk -v i=$j 'BEGIN{sum=0}{sum+= $i} END{print sum/NR}' `
> # set k=`expr $j - 1`
> # echo " $ytitle[$k] \t $av"
> # @ j++
> #end
>
>
>
>
> #xmgrace \
> # -pexec "LEGEND on" \
> # -pexec "$l_cmd[1]" \
> # -pexec "$l_cmd[2]" \
> # -pexec "$l_cmd[3]" \
> # -pexec "$l_cmd[4]" \
> # -pexec "$l_cmd[5]" \
> # -pexec "$l_cmd[6]" \
> # -pexec "$l_cmd[7]" \
> # -pexec "$l_cmd[8]" \
> # -pexec "$l_cmd[9]" \
> # -pexec "$l_cmd[10]" \
> # -pexec "$p_title" -pexec "$p_subtitle" -pexec "$p_xaxis" \
> # -pexec "XAXIS TICKLABEL FORMAT DECIMAL" -pexec "XAXIS TICKLABEL PREC 0" \
> # -pexec "YAXIS TICKLABEL FORMAT DECIMAL" -pexec "YAXIS TICKLABEL PREC 0" \
> # -autoscale xy -remove -nxy $tmpfile &
>
>
>


This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:41:29 CST