next up previous contents index
Next: 5.6.3 Image Data Up: 5.6 Exchanging data Previous: 5.6.1 NEMO data files   Contents   Index

5.6.2 Snapshot Data

To import a snapshot into NEMO format one can use atos or write the data in this ASCII (also referred to as the "205") format. In particular a snapshot which is already in table format with masses, positions and velocities in columns 1,2-4,5-7, can be converted to snapshot format using a simple C-shell. For example,

    % table_to_snapshot tab_file snap_file

with the following simplified version of the table_to_snapshot C-shell script (without any bells and whistles) using awk (tabmath could have been used similarly):

#! /bin/csh -f
#       table_to_snapshot: demo version
set infile=$1           # input table (m,x,y,z,vx,vy,vz)
set outfile=$2          # output snapshot
set tmpfile=tmp$$       # a temporary scratch name

awk "END {print NR}"   $infile   > $tmpfile
echo "3"                        >> $tmpfile
echo "0.0"                      >> $tmpfile
awk '{print $1}'       $infile  >> $tmpfile
awk '{print $2,$3,$4}' $infile  >> $tmpfile
awk '{print $5,$6,$7}' $infile  >> $tmpfile

atos $tmpfile $outfile
rm $tmpfile

The full version of this script can be found in in $NEMO/csh.



(c) Peter Teuben