#!/bin/bash # Set the kernel in the Config.sh file of Gadget and recompile, # then uncomment the corresponding line below. # kernel=cubic # kernel=quintic kernel=wendc2 # kernel=wendc2b # kernel=wendc6 # kernel=wendc8 for ics in grid_10x10x10 packed_12x12x12 glass_10x10x10 do resultsfile=$kernel-$ics test -f $resultsfile && rm $resultsfile # Note that the ICs might have different box sizes. boxsize=1 # It looks like the new glass file also has coordinates from 0...1. # test $ics = glass_10x10x10 && boxsize=1e5 level=27 while ((level < 71)) do # In order to avoid having to run too many models, # we use a quasi-exponential number of neighbors. neighbors=`dc -e '3k2vvv'$level'^0k1~rp'` echo "$kernel - $ics - $neighbors" # We use double quotes here (and not single quotes) # because we want parameter expansion to still take place. sed -e " s/InitCondFile.*/InitCondFile $ics/ s/BoxSize.*/BoxSize $boxsize/ s/SnapshotFileBase.*/SnapshotFileBase output/ s/DesNumNgb.*/DesNumNgb $neighbors/ " box.param rm output_* # Make sure the path to your OpenGadget executable is correct. mpirun -np 1 ../OpenGadget3/P-Gadget3 box.param echo " $neighbors `./meandensity`" >>$resultsfile ((level+=1)) done done