Skip to content

Commit

Permalink
Config file implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristaps Ermanis committed May 9, 2020
1 parent 044cbc4 commit b5591aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions Gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,12 @@ def RunCalcs(GausJobs, settings):
print("There were no jobs to run.")
return Completed

if ('GAUS_EXEDIR' in os.environ) and (settings.GausPath == ''):
if ('GAUS_EXEDIR' in os.environ):
gausdir = os.environ['GAUSS_EXEDIR']
GausPrefix = gausdir + "/g09"
if shutil.which(os.path.join(gausdir, 'g09')) is None:
GausPrefix = os.path.join(gausdir, "g16")
else:
GausPrefix = os.path.join(gausdir, "g09")
else:
GausPrefix = settings.GausPath

Expand Down
5 changes: 3 additions & 2 deletions PyDP4.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,11 +501,12 @@ def NMR_files(NMR_args):
# Read the config file and fill in the corresponding attributes in settings class
def ReadConfig(settings):

if not os.path.exists('settings.cfg'):
cfgpath = os.path.join(getScriptPath(), 'settings.cfg')
if not os.path.exists(cfgpath):
print('settings.cfg is missing!')
return settings

configfile = open('settings.cfg', 'r')
configfile = open(cfgpath, 'r')
config = configfile.readlines()
configfile.close()

Expand Down
4 changes: 2 additions & 2 deletions settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ SCHRODINGER=

# Define the root folder for Tinker software,
# must contain bin/scan and params/mmff.prm for the process to work
TinkerPath=/home/ke291/Downloads/tinker/
TinkerPath=/home/ke291/TINKER/

# Path to nwchem executable. If it's in the path, can be just nwchem
NWChemPath=nwchem

# Path to Gaussian executable. If it's in the path, can be just g09 or g16
# If left empty, it will attempt to use g09 in GAUS_EXEDIR environment variable
GausPath=
GausPath=g16

0 comments on commit b5591aa

Please sign in to comment.