espressomd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ESPResSo] Extracting Values of Quantities Calculated during Simulat


From: Axel Arnold
Subject: Re: [ESPResSo] Extracting Values of Quantities Calculated during Simulation
Date: Tue, 20 Nov 2007 13:37:53 +0100
User-agent: KMail/1.8.2

On Tuesday 20 November 2007 12:53, Lorenzo Isella wrote:
> If I try saving the velocities with a blockfile using:
>
> set f [open "config_vel_$i" "w"]
> #blockfile $f write tclvariable {box_l density}
> #blockfile $f write variable box_l
> blockfile $f write particles "id v"
> close $f
>
> then in the resulting blockfile particle positions are automatically
> added and I end up storing both the velocities and the positions,
> which in itself would be pleasant.

Dear Lorenzo,

this has internal reasons; Espresso cannot add particles without knowing their 
positions, and therefore they need to be included in the particle block for 
automated reading.

> I can still follow your suggestions to get the system configuration,
> but I have not been able to retrieve the velocities.
>
> Things like
>
> blockfile "config_vel_27" read particles
>
> did not work at all. Any suggestions? The info I need is already in
> the blockfile, but I do not know how to get it.

The best way to get the particle properties is to use the part command. For 
that, you first read the configurations, which is done via

set f [open "config_vel_26" "r"]
while { [blockfile $f read auto] != "eof" } {}
close $f

(see the user's guide, first steps). Then you can use a loop to get all 
particle properties, and store them in whatever format you like. For example 
this generates two Tcl matrices:

set Mpos {}
set Mvel {}
for {set p 0} {$p <= [setmd max_part]} {incr p} {
        set pos [part $p print pos]
        set vel  [part $p print v]
        lappend Mpos $pos
        lappend Mvel $vel
}

Many regards,
Axel

-- 
Dr. Axel Arnold
FOM Institute for Atomic and Molecular Physics
Kruislaan 407                                   Phone: +31 20 6081 275
1098 SJ Amsterdam, The Netherlands              E-mail: address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]