Skip to content

Commit

Permalink
Convergence checking and Ziggy queue checking added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristaps Ermanis committed Jun 19, 2019
1 parent ad8bcd0 commit eaebd05
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
2 changes: 2 additions & 0 deletions GaussianDarwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

IsGausCompleted = Gaussian.IsGausCompleted

Converged = Gaussian.Converged

def RunNMRCalcs(Isomers, settings):
print('\nRunning Gaussian NMR calculations on Darwin...')

Expand Down
22 changes: 21 additions & 1 deletion GaussianZiggy.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

IsGausCompleted = Gaussian.IsGausCompleted

Converged = Gaussian.Converged

def RunNMRCalcs(Isomers, settings):
print('\nRunning Gaussian NMR calculations on Ziggy...')

Expand Down Expand Up @@ -171,17 +173,25 @@ def RunBatchOnZiggy(findex, queue, GausFiles, settings):

print(str(len(GausFiles)) + ' .com and slurm files uploaded to ziggy')

JobIDs = []
#Launch the calculations
for f in GausFiles:
job = '~/' + folder + '/' + f[:-4]
outp = subprocess.check_output('ssh ziggy sbatch ' + job + 'slurm', shell=True)
status = outp.decode()[:-1]
print(status)
JobIDs.append(status.split('job ')[1])

print(str(len(GausFiles)) + ' jobs submitted to the queue on ziggy')

outp = subprocess.check_output('ssh ziggy qstat', shell=True)
if settings.user in outp.decode():
print("Jobs are running on ziggy")

time.sleep(60)
OldQRes = CheckZiggyQueue(JobIDs, settings)
print('Pending: ' + str(OldQRes[0]) + ', Running: ' + str(OldQRes[1]) + ', Not in queue: ' + str(OldQRes[2]))

Jobs2Complete = list(GausFiles)
n2complete = len(Jobs2Complete)

Expand All @@ -195,7 +205,17 @@ def RunBatchOnZiggy(findex, queue, GausFiles, settings):
n2complete = len(Jobs2Complete)
print(str(n2complete) + " remaining.")

time.sleep(60)
QRes = CheckZiggyQueue(JobIDs, settings)
if QRes != OldQRes:
OldQRes = QRes
print('Pending: ' + str(OldQRes[0]) + ', Running: ' + str(OldQRes[1]) + ', Not in queue: ' + str(OldQRes[2]))

if QRes[2] == len(JobIDs):
#check each gaussian file to ascertain the status of individual gaus jobs
print('No jobs left in Ziggy queue')
break

time.sleep(120)

#When done, copy the results back
print("\nCopying the output files back to localhost...")
Expand Down
19 changes: 16 additions & 3 deletions PyDP4.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ def main(settings):

# Run DFT optimizations, if requested
if ('o' in settings.Workflow):

now = datetime.datetime.now()
settings.StartTime = now.strftime('%d%b%H%M')

print('\nSetting up geometry optimization calculations...')
Isomers = DFT.SetupOptCalcs(Isomers, settings)
print('\nRunning geometry optimization calculations...')
Expand All @@ -245,9 +249,14 @@ def main(settings):
#Add convergence check here before continuing with calcs!
if DFT.Converged(Isomers) == False:
print('Some of the conformers did not converge, quitting...')
quit()

# Run DFT single-point energy calculations, if requested
if ('e' in settings.Workflow):

now = datetime.datetime.now()
settings.StartTime = now.strftime('%d%b%H%M')

print('\nSetting up energy calculations...')
Isomers = DFT.SetupECalcs(Isomers, settings)
print('\nRunning energy calculations...')
Expand All @@ -260,6 +269,10 @@ def main(settings):

# Run DFT NMR calculations, if requested
if ('n' in settings.Workflow):

now = datetime.datetime.now()
settings.StartTime = now.strftime('%d%b%H%M')

print('\nSetting up NMR calculations...')
Isomers = DFT.SetupNMRCalcs(Isomers, settings)
print('\nRunning NMR calculations...')
Expand All @@ -278,15 +291,15 @@ def main(settings):
print(iso.InputFile + ": " + str(iso.DFTEnergies))

else:
# Run DFT optimizations, if requested
# Read DFT optimized geometries, if requested
if ('o' in settings.Workflow):
Isomers = DFT.ReadDFTGeometries(Isomers, settings)

# Run DFT single-point energy calculations, if requested
# Read DFT single-point energies, if requested
if ('e' in settings.Workflow):
Isomers = DFT.ReadDFTEnergies(Isomers, settings)

# Run DFT NMR calculations, if requested
# Read DFT NMR data, if requested
if ('n' in settings.Workflow):
Isomers = DFT.ReadShieldings(Isomers)
Isomers = DFT.ReadDFTEnergies(Isomers)
Expand Down

0 comments on commit eaebd05

Please sign in to comment.