#!/usr/bin/env python ################################################# from os import path, getcwd # from os import chdir, system # from shutil import copy, move # from sys import argv # ################################################# # Define traj labels ############################ if len(argv) == 2: # first=int(argv[1]) # last =int(argv[1]) # else: # first = 1 # last = 500 # # # Define calculation parameters ################# # this value will be used in the Job file ####### # JobName ='163v1R' # Just a general lable: "JobName_NumTraj" TimeLimit ='120' # in hours: "TimeLimit:00:00" NCores ='24' # SubmissionSteps ='1000' # # ################################################# JobName = JobName here=getcwd() for i in range(first,(last+1)): #cicle on the trajectories dir = '%.4d' % i # define workdir if path.exists(dir): chdir(dir) # move in workdir if path.exists('outcome') and open('outcome').readline().split()[0] == 'UNCLEAR': runs = -1 # check number of runs while path.exists('XDATCAR_%d' % (runs+1)): runs += 1 # copy('CONTCAR_%d' % runs, 'POSCAR') # copy('%s/INPUTS/Job-restart' % here , 'Job-restart') lable = dir + '_R' + str((runs+1)) + '_' + JobName modify = 'sed -e \"s|_JOBNAME_|%s|g\" Job-restart > Job' % lable # modify the Jobfile system(modify) # modify = 'sed -i \"s|_TIMELIMIT_|%s|g\" Job' % TimeLimit # system(modify) # modify = 'sed -i \"s|_NCORES_|%s|g\" Job' % NCores # system(modify) # modify = 'sed -i \"s|_SUBSTEPS_|%s|g\" Job' % SubmissionSteps # system(modify) # system('sbatch Job > ID.job') ################################################# system('cat ID.job') move('outcome', 'outcome_%d' % runs) chdir('..')