Lsf example

From ScotGrid

-bash-3.00$ cat usr_script_sweep3.lsf 
# file: usr_script_sweep3.lsf
# This file shows how to run multiple simulations using scripting.
# You should open script_help_sweep.fsp before running this script

##############################################################

# define 10 rod radii to use
rad = linspace(0.5e-6,3e-6,10);

# set up batch file for running all the jobs
batch_filename = "scripting_sweep.sh";

# delete the file if it already exists
rm(batch_filename);

# start a loop over each desired radius
for(i=1:length(rad)) {

  # switch to layout mode so that you can edit the objects
  switchtolayout;

  # switch to the structures tab to edit the scattering rod
  structures;

  # set the radius of the object named "rod" to the desired value
  setnamed("rod","radius",rad(i));

  # output which simulation is running
  ?"running simulation " + num2str(i) + " of " + num2str(length(rad));

  # save file under a new name to be run later
  filename = "temp_"+num2str(i);
  setparallel("Create parallel shell/batch file when saving fsp file",1);
  save(filename);
  mypath = pwd;
  write(batch_filename,"./"+mypath+"/"+filename + ".sh");

} # end of the main loop over the radius