|
This command file for running a LINUS simulation will perform multiple simulations.
Each simulation output will be in a new subdirectory; sim_1, sim_2, sim_3, etc.
The user should edit the "range" to set the number simulations to be run. In the example below five simulations will be run.
for i in range(5):
Make a copy of this file in your working directory and edit it appropriately.
To run a LINUS simulation see the Examples section.
from pylinus_2_4 import linusSim, ran
def gen_seeds():
from random import uniform
s1 = long(uniform(1.0, ran.M1))
s2 = long(uniform(1.0, ran.M1))
s3 = long(uniform(1.0, ran.M1))
s4 = long(uniform(1.0, ran.M2))
s5 = long(uniform(1.0, ran.M2))
s6 = long(uniform(1.0, ran.M2))
return s1, s2, s3, s4, s5, s6
def run(file,seed=None,mlfile=None,wtsfile=None,msfile=None,
pmsfile=None,distfile=None):
if seed is None:
gen = apply(ran.generator, gen_seeds())
else:
gen = apply(ran.generator, seed)
sim = linusSim.Linus(file, gen)
sim.load_movelist(mlfile)
sim.set_simulation_parameters(numsave=100,
numcycle=5000)
sim.set_hbond_parameters(use_hbond=1)
sim.set_contact_parameters(use_contact=1)
sim.run()
if __name__ == "__main__":
try:
import psyco
except ImportError:
pass
else:
psyco.bind(run)
import sys, os
filename = sys.argv[1]
file = os.path.basename(filename)
basedir = os.getcwd()
#
# The loop below demonstrates how to launch multiple simulations
# from one command file.
# Increment the range to perform additional simulations
#
# Note that the "filename" file needs to be linked in each sub-directory
#
for i in range(5):
curdir = basedir + os.sep + 'sim_' + `i+1`
os.mkdir(curdir)
os.link(filename, curdir+os.sep+file)
os.chdir(curdir)
run(file)
| |