Re: how to get rid of TCL messages in namd.log from tclForcesScript

From: Roman Petrenko (rpetrenko_at_gmail.com)
Date: Fri Mar 13 2009 - 20:47:30 CDT

Axel,
thanks a lot!

On Fri, Mar 13, 2009 at 8:24 PM, Axel Kohlmeyer
<akohlmey_at_cmm.chem.upenn.edu> wrote:
> On Fri, 2009-03-13 at 19:45 -0400, Roman Petrenko wrote:
>> Dear all,
>> i have a script that reports the forces exerted on the 1st and 2nd CA
>> atoms (listed below). How to get rid of TCL-messages in the namd log
>> file every time i increment a "time"-variable $ts? Please, help.
>
> from "man n proc":
>
> The proc command returns an empty string. When a procedure is invoked,
> the procedure\u2019s return value is the value specified
> in a return command. __If the procedure doesn't execute an
> explicit return, then its return value is the value of the last
> command executed in the procedure's body__. If an error occurs
> while executing the procedure body, then the
> procedure-as-a-whole will return that same error.
>
> so please try the following addition.
>
>> -----------------------------------------------------------------------------------------------------------------------------------------
>> tclForces on
>> tclForcesScript {
>> set aid1 [atomid SEG0 1 CA]
>> set aid2 [atomid SEG0 2 CA]
>> set tclfreq 500
>>
>> set ts 1
>> addatom $aid1
>> addatom $aid2
>> proc calcforces {} {
>> global aid1
>> global aid2
>> global tclfreq
>> global ts
>> if {[expr $ts % $tclfreq == 0]} {
>>
>> #print coordinates
>> loadcoords xyz
>> foreach {atomid coord} [array get xyz] {
>> puts "XYZ:$atomid:$ts $coord"
>> }
>>
>> #print forces
>> loadforces f
>> foreach {atomid force} [array get f] {
>> puts "FORCEext:$atomid:$ts $force"
>> }
>>
>> #print total forces
>> loadtotalforces ft
>> foreach {atomid force} [array get ft] {
>> puts "FORCEtot:$atomid:$ts $force"
>> }
>> }
>> incr ts #<--- this is the beast
>
> return ; # the return value is checked whether it is empty.
>
>> #set ts [expr $ts+1]
>> }
>> }
>
> cheers,
> axel.
>
> --
> =======================================================================
> Axel Kohlmeyer akohlmey_at_cmm.chem.upenn.edu http://www.cmm.upenn.edu
> Center for Molecular Modeling -- University of Pennsylvania
> Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
> tel: 1-215-898-1582, fax: 1-215-573-6233, office-tel: 1-215-898-5425
> =======================================================================
> If you make something idiot-proof, the universe creates a better idiot.
>
>

-- 
Roman Petrenko
Physics Department
University of Cincinnati

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