PHYSICS 141/241

Winter 2006

Laboratory Session V

2/13/06

1. nbody2  package

nbody2.tar.Z (Fortran code)

manual



2. Fortran and C Practice with the Aarseth Codes
  • nbody0.tar.gz (Fortran code)

  • There are instruction below how to run the Fortran code.
  • nbody0-lab.c  C code 

  • initc.data

  • Running the C code:
  • Compilation of C code: gcc -o xnbody nbody0-lab.c -lm
  • To run: xnbody reads in initc.data file and ouputs sphere.data. 
  • initc.data  has 1 header line plus one line for each particle in 7 columns: mass, x, y, z, vx, vy, vz
  • header line of initc.data has 5 data: # of particles, eta=0.02, dt, tmax, epsilon**2=0.25
  • sphere.data has 4 columns: mass, x, y, z
  • Running the Fortran code:
  • Save, gunzip and untar in a directory:

    gunzip nbody0.tar.gz

    tar tvf nbody0.tar

    tar xvf nbody0.tar

    equivalently:

    gunzip -d -c nbody.tar.gz | tar xvf -

  • Compile the Fortran code:

    g77 -o xrun main.f nbody0.f nbodyio.f

  • Run the test program first

    xnb0 < data.in &



  • 3. nbody-hermit C++  package (Hut and Makino)

    nbody-hermit-C++.tar.Z (C++ code)

    manual