VMD-L Mailing List
From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Mon Apr 23 2007 - 14:00:35 CDT
- Next message: Dominique Compton: "W4tches from simple to luxurious at Prest1ge Repl1cas"
- Previous message: John Stone: "Re: How to visualize phi maps calculated with delphi V. 4"
- In reply to: preeda: "About openning a file to write in callback function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
On Tue, 24 Apr 2007, preeda wrote:
> Dear John and other VMD users,
>
> Thank you for your advice about using trace function to retrieve force
> data.
>
> I wrote a tcl file name "saveforce.tcl" to use trace function by calling
> vmd_frame, now force data can be printed out continuously during
> simulation runs but I can not save these force data into a file. Output
> file is created but nothing inside; it seems like a problem about
> opening and closing file channelId.
try opening in append mode from within the callback.
otherwise, you'll close it after the first call to it.
axel.
> Here is my code "saveforce.tcl"
>
> set pullatoms "index 1"
> set sel [atomselect top "$pullatoms"]
>
> set outfilename [open output.dat w]
>
> proc trace {} {
> global vmd_frame
> trace variable vmd_frame w IMD::tracetimestep
> }
>
> proc IMD::tracetimestep {args} {
> global cen sel outfilename
> set force [$sel get {ufx ufy ufz}]
> puts "force = $force"
> # output
> puts $outfilename "$force"
> close $outfilename
> }
>
> Do you know what I did wrong? Any advice will be greatly appreciated.
>
> Best Regards,
>
> Preeda
>
-- ======================================================================= 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.
- Next message: Dominique Compton: "W4tches from simple to luxurious at Prest1ge Repl1cas"
- Previous message: John Stone: "Re: How to visualize phi maps calculated with delphi V. 4"
- In reply to: preeda: "About openning a file to write in callback function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]