Skip to content

Commit

Permalink
A few bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristaps Ermanis committed Jun 27, 2019
1 parent c744c93 commit ab9fbea
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
6 changes: 3 additions & 3 deletions ConfPrune.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def AlignMolecules(mol1, mol2, atoms):
atomnum = GetAtomNum(a)
#w.append(GetAtomWeight(atomnum))
w.append(1)

#move both molecules to origin
mol1 = Move2Origin(mol1, w)
mol2 = Move2Origin(mol2, w)
Expand All @@ -139,10 +139,10 @@ def AlignedRMS(mol1, mol2, atoms):
mol1b = []
mol2b = []
for a in mol1:
mol1b.append([float(x) for x in a[1:]])
mol1b.append([float(x) for x in a])

for a in mol2:
mol2b.append([float(x) for x in a[1:]])
mol2b.append([float(x) for x in a])

(amol1, amol2, w) = AlignMolecules(mol1b, mol2b, atoms)

Expand Down
36 changes: 32 additions & 4 deletions Gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import subprocess
import os
import time
import glob


def SetupNMRCalcs(Isomers, settings):
Expand Down Expand Up @@ -159,6 +158,8 @@ def Converged(Isomers):

def RunNMRCalcs(Isomers, settings):

print('\nRunning Gaussian DFT NMR calculations locally...')

jobdir = os.getcwd()
os.chdir('nmr')

Expand All @@ -179,6 +180,8 @@ def RunNMRCalcs(Isomers, settings):

def RunECalcs(Isomers, settings):

print('\nRunning Gaussian DFT energy calculations locally...')

jobdir = os.getcwd()
os.chdir('e')

Expand All @@ -197,6 +200,28 @@ def RunECalcs(Isomers, settings):
return Isomers


def RunOptCalcs(Isomers, settings):

print('\nRunning Gaussian DFT geometry optimizations locally...')

jobdir = os.getcwd()
os.chdir('opt')

GausJobs = []

for iso in Isomers:
GausJobs.extend([x for x in iso.OptInputFiles if (x[:-4] + '.out') not in iso.OptOutputFiles])

Completed = RunCalcs(GausJobs)

for iso in Isomers:
iso.OptOutputFiles.extend([x[:-4] + '.out' for x in iso.OptInputFiles if (x[:-4] + '.out') in Completed])

os.chdir(jobdir)

return Isomers


def RunCalcs(GausJobs):

NCompleted = 0
Expand Down Expand Up @@ -340,7 +365,7 @@ def ReadEnergies(Isomers, settings):
else:
os.chdir('nmr')

for iso in Isomers:
for i, iso in enumerate(Isomers):

if 'e' in settings.Workflow:
GOutpFiles = iso.EOutputFiles
Expand All @@ -349,7 +374,7 @@ def ReadEnergies(Isomers, settings):
else:
GOutpFiles = iso.NMROutputFiles

DFTenergies = []
DFTEnergies = []
for GOutpFile in GOutpFiles:
gausfile = open(GOutpFile, 'r')
GOutp = gausfile.readlines()
Expand All @@ -361,7 +386,10 @@ def ReadEnergies(Isomers, settings):
end = line.index('A.U.')
energy = float(line[start + 4:end])

iso.DFTEnergies.append(energy)
#iso.DFTEnergies.append(energy)
DFTEnergies.append(energy)

Isomers[i].DFTEnergies = DFTEnergies

os.chdir(jobdir)
return Isomers
Expand Down
4 changes: 3 additions & 1 deletion GaussianDarwin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import Gaussian

MaxConcurrentJobs = 160

SetupNMRCalcs = Gaussian.SetupNMRCalcs

SetupECalcs = Gaussian.SetupECalcs
Expand Down Expand Up @@ -102,7 +104,7 @@ def RunOptCalcs(Isomers, settings):

def RunCalcs(GausJobs, settings):

MaxCon = settings.MaxConcurrentJobs
MaxCon = MaxConcurrentJobs

if len(GausJobs) < MaxCon:
if len(GausJobs) > 0:
Expand Down

0 comments on commit ab9fbea

Please sign in to comment.