Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions src/SH12A_ddd/postprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,17 @@ echo "-----------">> README.md
echo "(add your description here)" >> README.md
echo "" >> README.md

#switch to wdir and build all
#switch to wdir and convert all bdo files to ddd files
cd $pwdir/$wdir
for shdir in $(find . -mindepth 3 -maxdepth 3 -type d )
do
echo
echo "Processing directory: "$wdir/$shdir

cd $shdir
echo convertmc tripddd --many "*.bdo"
cd $shdir
convertmc tripddd --many "*.bdo"
cd $pwdir

# strip energy directory from dir current dir name
tdir=`dirname $shdir`

# build energy specific target directory and copy ddd file to it
targetdir=$ddir/$tdir
mkdir -p $targetdir
echo cp -v $shdir/*.ddd $targetdir/.
done

cd $pwdir
find $wdir -name "*.ddd" | xargs -i sh -c 'echo {}; echo {} | mkdir -p $ddir/`cut -d/ -f3-4`/; cp -v {} $ddir/`cut -d/ -f3-4`/'
18 changes: 9 additions & 9 deletions src/SH12A_ddd/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ def fwhm_to_sigma(fwhm):
"""
return fwhm / (2.0 * np.sqrt(2.0 * np.log(2.0)))

def read(self, dir):
def read(self, dir_path):
"""
Reads the template files, and stores them in self object.
"""
fname_beam = os.path.join(dir, "beam.dat")
fname_geo = os.path.join(dir, "geo.dat")
fname_mat = os.path.join(dir, "mat.dat")
fname_det = os.path.join(dir, "detect.dat")
fname_beam = os.path.join(dir_path, "beam.dat")
fname_geo = os.path.join(dir_path, "geo.dat")
fname_mat = os.path.join(dir_path, "mat.dat")
fname_det = os.path.join(dir_path, "detect.dat")

self.template_dir = dir
self.template_dir = dir_path

with open(fname_beam) as file:
self.tbeam = file.readlines()
Expand All @@ -88,7 +88,7 @@ def read(self, dir):
with open(fname_det) as file:
self.tdet = file.readlines()

def write(self, ion):
def write(self):
"""
Write the SH12A output files to self.path for given ion.
Stopping power files are symlinked to the files found in template/
Expand Down Expand Up @@ -205,9 +205,9 @@ def main(args):
logger.info(ion.name)
for energy in np.arange(ion.emin, ion.emax, ion.estep):
t.generate_dats(ion, energy, nstat, nsave, rifi=True)
t.write(ion)
t.write()
t.generate_dats(ion, energy, nstat, nsave, rifi=False)
t.write(ion)
t.write()


if __name__ == '__main__':
Expand Down
8 changes: 6 additions & 2 deletions src/SH12A_ddd/rsshield.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
#SBATCH --output=shieldhitJob.%j.out # standard output file name
#SBATCH --error=shieldhitJob.%j.err # standard error output file name
#SBATCH --ntasks=1
#SBATCH --contiguous
#SBATCH --ntasks-per-node=1
#SBATCH -p plgrid
#SBATCH --time=0:59:00


#echo Node ID $SLURM_NODEID
#echo NTasks $SLURM_NTASKS
#echo NNodes $SLURM_NNODES
#echo LocalID $SLURM_LOCALID
#echo Array task ID $SLURM_ARRAY_TASK_ID

shieldhit -N${SLURM_ARRAY_TASK_ID}
# overwrite number of histories and set upper limit on execution time
shieldhit -N${SLURM_ARRAY_TASK_ID} -n 10000000 --time="00:58:00"
3 changes: 1 addition & 2 deletions src/SH12A_ddd/submit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ for shdir in $(find . -mindepth 3 -maxdepth 3 -type d )
do
cd $shdir
echo $shdir
# echo sbatch --array 0-16 rsshield.sh
echo sbatch --array 0 ../../../../rsshield.sh
sbatch --array 0 ../../../../rsshield.sh
cd ${wdir}/wdir
done
2 changes: 1 addition & 1 deletion src/SH12A_ddd/template/geo.dat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*---><---><--------><------------------------------------------------>
0 0 Water target for DDD generation.
1 0 Water target for DDD generation.
*---><---><--------><--------><--------><--------><--------><-------->
* phantom / target
RPP 1 -30.0 30.0 -30.0 30.0 0.0 60.0
Expand Down