Skip to content

Commit

Permalink
Merge pull request #134 from sharc-md/sharc3preview
Browse files Browse the repository at this point in the history
SHARC_ORCA.py: support for TheoDORE >=3.2
  • Loading branch information
maisebastian authored Jul 22, 2024
2 parents 4251c68 + 8b03ec8 commit 9a8660e
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions bin/SHARC_ORCA.py
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,6 @@ def readQMin(QMinfilename):
else:
os.environ['PYTHONPATH'] = os.path.join(QMin['theodir'], 'lib') + os.pathsep + QMin['theodir']


# neglected gradients
QMin['neglected_gradient'] = 'zero'
if 'grad' in QMin:
Expand Down Expand Up @@ -4190,7 +4189,23 @@ def setupWORKDIR_TH(WORKDIR, QMin):
# mkdir the WORKDIR, or clean it if it exists, then copy all necessary files from pwd and savedir

# write dens_ana.in
inputstring = '''rtype='cclib'
if os.path.isfile(os.path.join(THEODIR,'bin','theodore')):
inputstring = '''rtype='orca'
rfile='ORCA.log'
mo_file='ORCA.molden.input'
read_binary=True
jmol_orbitals=False
molden_orbitals=False
Om_formula=2
eh_pop=1
comp_ntos=True
print_OmFrag=True
output_file='tden_summ.txt'
prop_list=%s
at_lists=%s
''' % (str(QMin['template']['theodore_prop']), str(QMin['template']['theodore_fragment']))
else:
inputstring = '''rtype='cclib'
rfile='ORCA.log'
read_binary=True
jmol_orbitals=False
Expand Down Expand Up @@ -4223,7 +4238,10 @@ def setupWORKDIR_TH(WORKDIR, QMin):
def runTHEODORE(WORKDIR, THEODIR):
prevdir = os.getcwd()
os.chdir(WORKDIR)
string = os.path.join(THEODIR, 'bin', 'analyze_tden.py')
if os.path.isfile(os.path.join(THEODIR,'bin','theodore')):
string = os.path.join(THEODIR, 'bin', 'theodore analyze_tden')
else:
string = os.path.join(THEODIR, 'bin', 'analyze_tden.py')
stdoutfile = open(os.path.join(WORKDIR, 'theodore.out'), 'w')
stderrfile = open(os.path.join(WORKDIR, 'theodore.err'), 'w')
if PRINT or DEBUG:
Expand All @@ -4242,6 +4260,8 @@ def runTHEODORE(WORKDIR, THEODIR):
sys.stdout.write('FINISH:\t%s\t%s\tRuntime: %s\tError Code: %i\n' % (shorten_DIR(WORKDIR), endtime, endtime - starttime, runerror))
sys.stdout.flush()
os.chdir(prevdir)
if runerror >0 and os.path.isfile(os.path.join(THEODIR,'bin','theodore')):
sys.stdout.write('Error code is not 0 for TheoDORE 3.x. Please make sure to use at least TheoDORE 3.2 with SHARC_ORCA.py. '
return runerror

# =============================================================================================== #
Expand Down

0 comments on commit 9a8660e

Please sign in to comment.