Skip to content

Commit 77edebb

Browse files
authored
Merge pull request #2756 from ReactionMechanismGenerator/arkane_e_elect_bug
Fix UnboundLocalError: local variable 'e_electronic_with_corrections' referenced before assignment
2 parents a041fde + 7090358 commit 77edebb

File tree

4 files changed

+1370
-2
lines changed

4 files changed

+1370
-2
lines changed

arkane/statmech.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,8 @@ def create_log(log_path, check_for_errors=True):
575575
# and the zero point energy scaling factor, see https://pubs.acs.org/doi/10.1021/ct100326h Section 3.1.3.
576576
zpe_scale_factor = self.frequencyScaleFactor / 1.014
577577

578+
e_electronic_with_corrections, zpe = 0, 0
579+
578580
logging.debug(' Reading energy...')
579581
if e0 is None:
580582
if e_electronic is None:
@@ -686,7 +688,7 @@ def create_log(log_path, check_for_errors=True):
686688
# Set the difference as the isodesmic EO correction
687689
e_electronic_with_corrections += isodesmic_thermo.value_si - uncorrected_thermo
688690

689-
e0 = e_electronic_with_corrections + zpe
691+
e0 = e_electronic_with_corrections + zpe if e0 is None else e0
690692
logging.debug(' E0 (0 K) = {0:g} kcal/mol'.format(e0 / 4184.))
691693
conformer.E0 = (e0 * 0.001, "kJ/mol")
692694

@@ -711,7 +713,7 @@ def create_log(log_path, check_for_errors=True):
711713
else:
712714
self.supporting_info.append(None)
713715
self.supporting_info.append(e_electronic)
714-
self.supporting_info.append(e_electronic + zpe)
716+
self.supporting_info.append(e_electronic + zpe if e_electronic is not None and zpe is not None else None)
715717
self.supporting_info.append(e0)
716718
self.supporting_info.append(list([symbol_by_number[x] for x in number])) # atom symbols
717719
self.supporting_info.append(coordinates)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env python3
2+
# encoding: utf-8
3+
4+
externalSymmetry = 2
5+
6+
spinMultiplicity = 2
7+
8+
opticalIsomers = 1
9+
10+
energy = (-342.84,'kJ/mol')
11+
12+
geometry = Log('freq.out')
13+
14+
frequencies = Log('freq.out')

0 commit comments

Comments
 (0)