Re: force dcd files??

From: Joshua D. Moore (jdmoore_at_unity.ncsu.edu)
Date: Mon Dec 10 2007 - 10:32:36 CST

Hi,

I also would like to do this, and it seems to me that you are right. They
haven't included a way to do this other than through the tcl interface since
version 1.6. I have been doing this for fairly small systems (< 10,000
atoms) recently using this tcl script (it seems that the forces you pull are
for the previous step.....). Maybe this can help you. I wrote a lot of
notes to myself, so you can ignore most of these. I also attempted to write
a dcd style file, but had some trouble for some reason as I recall.

It seems that this would slow things down, but when outputting every 500
steps (it still checks this script every step), it doesn't seem to be that
bad. Like I said, I was only using it for a fairly small system, however.

I don't see why the force dcd option can't be included. After all this is
MD!

Josh

# TCL FORCES SCRIPT TO OUTPUT FORCES DURING SIMULATION
# The IDS of the atoms
# DEFINE NUMATOMS AS THE NUMBER OF ATOMS IN SIMULATION

set numatoms 7485
set force_freq 500

for {set i 1} {$i <= $numatoms} {incr i 1} {
     addatom $i
     }

proc calcforces {} {

# if [file exists forces.dcd] {
# mv forces.dcd forces.dcd.BAK
# }

# set filename "forces.dcd"
# set fileID [open $filename "a"]

    set filename_check "forces.txt"
    set fileID_check [open $filename_check "a"]

    global numatoms force_freq

    set frame [getstep]

# Write coordinates every $force_frame steps (force written next step...see
note below)
# if {int(fmod($frame,$force_freq))==0 && ($frame!=0)} {

# puts $fileID_check $frame

# loadcoords q

# for {set i 1} {$i <=$numatoms} {incr i 1} {

# puts $fileID_check $q($i)

# }

# }

# On next frame load the forces (as they correspond to the previous frames
coordinates) (See NAMD 2.6 Manual for description)
# Note that the loadtotalforces loads the forces from the previous time
step, so I need to load when mod(frame-1,500)=0 so frame 501 will give the
forces at step 500
# expr $frame-1 checks to see that I don't add the 0 frame (i.e the frame 1
forces)
    if {int(fmod([expr $frame-1],$force_freq))==0 && ([expr $frame-1]!=0)} {

    puts $fileID_check [expr $frame-1]

    loadtotalforces p

    for {set i 1} {$i <= $numatoms} {incr i 1} {

    if {[array exists p]} {
# set f $p($i)

# set fx [lindex $f 0]
# set fy [lindex $f 1]
# set fz [lindex $f 2]

# set outBinData [binary format fff $fx $fy $fz]
# fconfigure $fileID -translation binary

# puts -nonewline $fileID $outBinData

# ADDING TO WRITE ATOMIC COORDINATES ALSO 6-27-2007

    puts $fileID_check $p($i)

    }
    }

On Dec 6, 2007 2:22 PM, Thomas C. Bishop <bishop_at_tulane.edu> wrote:

> I'm trying to analyze the forces on every atom during my simulation.
>
> In version 1.6 namd allowed for a force dcd file using same config
> options as for velocity or coordinate dcds.
>
> Any way to keep a record of the forces on each and every atom during a
> simulation other than the tcl interface?
>
> How much would using tcl to dump the forces on all atoms slow down a
> simulation?
>
> Any ideas/assistance greatly appreciated.
>
> Tom
>
>
> --
> ***********************
> * Thomas C. Bishop *
> *Office: 504-862-3370 *
> *CCS: 504-862-8391 *
> *Fax: 504-862-8392 *
> ***********************
>
>

-- 
------------------------------------------------
Joshua D. Moore
Graduate Student
North Carolina State University
Dept. of Chemical and Biomolecular Engineering
Box 7905 Centennial Campus
Engineering Building I
911 Partners Way
Raleigh, NC  27695-7905
Phone: (919) 513-2051
Fax:   (919) 513-2470
Email:  jdmoore_at_unity.ncsu.edu
------------------------------------------------

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 05:20:49 CST