#!/usr/bin/env python #this script set up and runs several molecular dynamics trajectories #this script must be called in the directory containing the n traj folders named as 000n #a properly formatted Job file is required in the same foulder of the script ################################################# from os import path, getcwd # from os import chdir, system, mkdir # from time import sleep # from shutil import copy # ################################################# # Define calculation parameters ################# # this value will be used in the Job file ####### # #JobName ='D1elbow' # Just a general lable: "JobName_NumTraj" TimeLimit ='1' # in hours: "TimeLimit:00:00" Ntraj =1 # Njobtraj =1 # Name ='54-323K-RPMD' # ################################################# if (Ntraj % Njobtraj) != 0.: print('WARNING: Ntraj/Njobtraj is not an integer') exit() Njobs = int(Ntraj/Njobtraj) here=getcwd() #workdir for i in range(Njobs): Nfirst = '{:06d}'.format( i*Njobtraj ) Nlast = '{:06d}'.format( int(Nfirst) + Njobtraj - 1 ) modify = 'sed -e \"s|_FIRSTJOB_|{:s}|g\" Job_ > Job'.format( Nfirst ) system(modify) # modify = 'sed -i \"s|_TIMELIMIT_|{:s}|g\" Job'.format( TimeLimit ) system(modify) modify = 'sed -i \"s|_LASTJOB_|{:s}|g\" Job'.format( Nlast ) system(modify) modify = 'sed -i \"s|_NAME_|{:s}|g\" Job'.format( Name ) system(modify) system('sbatch Job') # RUN JOB ####################################### #sleep(1)