Advertisement
phirippu

Untitled

Dec 21st, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.23 KB | None | 0 0
  1. #!/usr/bin/python3.6
  2. import numpy
  3.  
  4. E0 = 10
  5. Emax = 50
  6. nstep = 40
  7. npart = 500000
  8. # print("for i in {10..15}")
  9. # print("\tdo")
  10. # print("\techo \"Run ${i} started\"")
  11. for i in range(nstep-1, 0, -1):
  12.     step = numpy.power(10, ((i + 1) / nstep) * (numpy.log10(Emax) - numpy.log10(E0)) + numpy.log10(E0)) + \
  13.            numpy.power(10, ((i - 1) / nstep) * (numpy.log10(Emax) - numpy.log10(E0)) + numpy.log10(E0))
  14.     filename = "G4Opt{0:5.2f}_{1:d}K.sh".format(step / 2, npart//1000)
  15.     afile = open(filename, mode='w')
  16.     print("#!/bin/csh", file=afile)
  17.     print("#SBATCH -J G4Opt{0:.0f}_{1:d}K".format(step / 0.02, npart//1000), file=afile)
  18.     print("#SBATCH -e G4Opt{0:.0f}_%j.txt".format(step / 0.02), file=afile)
  19.     print("#SBATCH -o G4Opt_%j.out", file=afile)
  20.     print("#SBATCH --mem-per-cpu=1000", file=afile)
  21.     print("#SBATCH -t 0-06:05:00", file=afile)
  22.     print("#SBATCH -n 768", file=afile)
  23.     print("#SBATCH -p all\n", file=afile)
  24.     print("mpirun ./G4OpticEdep ./RADMON.v2.gdml -n {1:8d} -p proton -e {0:6.3f}".format(step / 2, npart), file=afile)
  25.     afile.close()
  26.     print("sbatch ", filename, sep='', end='\n')
  27. print("done")
  28. # (10, ) - pow(10, ((double)(i - 1) / nstep) * (log10(Emax) - log10(E0)) + log10(E0));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement