re: Scripting: Handle for energy terms in the PSF file?

From: Chang, Christopher (
Date: Thu Dec 13 2007 - 13:39:18 CST



   The original posting of this neglected that the NAMD PSF atom numbers
are 1-indexed, whereas VMD's "index" uses 0-indexing. Thus, 1 has to be
subtracted from each number in $dihelistfile, as reflected below.


Original + mod



OK, here's one hack that seems to be working.


1. Convert dihedral section of PSF to one index per line, such that
every four lines represents the atoms involved in a dihedral angle.
Filename "dihelist.txt" for the following.


2. Run the following VMD script:


package require namdenergy

mol new minimize_in.pdb

set dihelistfile [open dihelist.txt r]

set dihelist [read $dihelistfile]

close $dihelistfile

unset dihelistfile

set limit [expr [llength $dihelist] - 3]

set i 0

while {$i <= $limit} {

   set a [expr [lindex $dihelist $i] - 1]

   set b [expr [lindex $dihelist [expr $i + 1]] - 1]

   set c [expr [lindex $dihelist [expr $i + 2]] - 1]

   set d [expr [lindex $dihelist [expr $i + 3]] - 1]

   namdenergy -tempname namden -dihe -sel [atomselect top "index $a $b
$c $d"] -psf 1FEH_RRRRRR.psf -ofile test_$i.out -par

   exec echo $a $b $c $d >> test_all.out

   exec cat test_$i.out >> test_all.out

   exec rm test_$i.out

   incr i 4



Slow, but seems to be doing the trick.

Christopher H. Chang, Ph.D.
Scientist II
National Renewable Energy Laboratory
1617 Cole Blvd., Mail Stop 1608
Golden, CO 80401
Phone (303) 275-3751
Fax (303) 275-4007


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