HTML automatically generated with rman
Table of Contents

Name

stod - convert a NEMO snapshot to a STARLAB dyn (node/story)

Synopsis

stod in=snapshot [parameter=value]

Description

stod converts a snapshot from NEMO to a dyn system for STARLAB consumption (see dtos(1NEMO) for the reverse operation). In traditional NEMO the input snapshot file is given via a standard keyword in= (see getparam(3NEMO) ), whereas the output is limited to stdout (cout in C++).

This is an experimental program, merely written to aid conversion and show that NEMO and STARLAB code can be linked together, albeit with some caveats and boundary conditions.

Parameters

The following parameters are recognized in any order if the keyword is also given:
in=snapshot
Input snapshot file. No default.
headline=text
Additional comment line that can be added. By default the one inherited from the input snapshot will be used, and if that is not present, nothing will be added.
label=t|f
Add ordinal labels to stars? Labels are the equivalent of a snapshot Key, though starlab’s labels are 1-based, snapshot key’s are 0-based. [Default: f].

Example


    % mkplummer - 2 | stod - "mkplummer test" label=t
(Particle
  N = 2
(Log
mkplummer test
 ### This is still an experimental conversion ### 
 ===>  Fri Jul 16 11:53:57 1993
       Starlab 1.0 (beta) : "stod - mkplummer test label=t 1.0" "mkplummer
- 2 VERSION=2.5a"
)Log
(Dynamics
  m  =  1
  r  =  0  0  0
  v  =  0  0  0
)Dynamics
(Hydro
)Hydro
(Star
)Star
(Particle
  i = 1
  N = 1
(Log
)Log
(Dynamics
  m  =  0.5
  r  =  0.337823  0.0637204  -0.0639563
  v  =  0.222878  -0.544599  0.272201
)Dynamics
(Hydro
)Hydro
(Star
)Star
)Particle
(Particle
  i = 2
  N = 1
(Log
)Log
(Dynamics
  m  =  0.5
  r  =  -0.337823  -0.0637204  0.0639563
  v  =  -0.222878  0.544599  -0.272201
)Dynamics
(Hydro
)Hydro
(Star
)Star
)Particle
)Particle

The reverse operation, conversion from a dyn to a snapshot can also be achieved using a small number of existing tools (although the NEMO program dtos(1NEMO) would be easier to use).

First the dyn is printed in a ‘‘dumb’’ table format (which can also be used by NBODY1-5). For example, to convert a dyn file run1.dyn to a snapshot file run1.snap we can use a temporary (ascii) table, or directly convert using a pipe:

   dumbp < run1.dyn > run1.tab
   tabtos run1.tab run1.snap "" mass,pos,vel
   rm run1.tab
   dumbp < run1.dyn | tabtos - run1.snap  \
                  block1=mass,pos,vel nbody=9999 error=1
Note that in the second example the number of bodies cannot be obtained directly from the pipe, and some arbitrarely large number must be given for the keyword nobody=, and the risky error=1 must be used to bypass an ‘‘unexpected EOF’’ fatal error to properly close the file with the actually encountered number of particles.

Bugs

storys cannot handle very long input lines, as e.g. generated by the NEMO history mechanism. NEMO needs to break them in single lines to write them to the log.

Files


src/nbody/io/starlab    stod.C stod_stubs.c
See Alsodtos(1NEMO), snapshot(5NEMO), dumbp(1starlab), tabtos(1NEMO) AuthorPeter
Teuben Update History
16-Jul-93    V0.1 Created                         PJT
30-Jul-96       documented the reverse conversion    PJT
6-aug-96    V1.1a handle multiple snapshots on input    PJT


Table of Contents