Skip to content

Instantly share code, notes, and snippets.

@redacted
Created October 25, 2011 17:42
Show Gist options
  • Save redacted/1313617 to your computer and use it in GitHub Desktop.
Save redacted/1313617 to your computer and use it in GitHub Desktop.
import subprocess
from multiprocessing import Pool
import shlex
## Drive spheremodel automagically!
def do(string, desc=""):
""" execute a string as a shell call """
if len(desc) > 0: print(desc)
cmd = shlex.split(string)
subprocess.call(cmd)
def call_with_args(l):
i = l[0]
j = l[1]
do("python spheremodel_scipy.py --system-size {0} --radius {1}".format(i,j),
desc="Starting at {0} and running for {1}".format(i,j))
if __name__ == '__main__':
p = Pool(64)
radius_low = 0.40
radius_high = 0.61
r_mult = 1000
radii = [float(i)/r_mult for i in range(int(radius_low*r_mult), int(radius_high*r_mult + 1), 2)]
Ns = [2,3,4]
pairs = []
for i in Ns:
for j in radii:
pairs.append([i,j])
p.map(call_with_args, pairs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment