Skip to content

Commit

Permalink
Merge pull request #1450 from ReactionMechanismGenerator/collision_lo…
Browse files Browse the repository at this point in the history
…g_path

Adjust file paths for the collision violators log
  • Loading branch information
alongd authored Aug 15, 2018
2 parents 4515bee + 619c5ed commit 40a1649
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions rmgpy/rmg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,17 +976,19 @@ def check_model(self):
violators.extend(violator_list)
num_rxn_violators += 1
# Whether or not violators were found, rename 'collision_rate_violators.log' if it exists
if os.path.isfile('collision_rate_violators.log'):
new_file = os.path.join(self.outputDirectory, 'collision_rate_violators.log')
old_file = os.path.join(self.outputDirectory, 'collision_rate_violators_OLD.log')
if os.path.isfile(new_file):
# If there are no violators, yet the violators log exists (probably from a previous run
# in the same folder), rename it.
if os.path.isfile('collision_rate_violators_OLD.log'):
os.remove('collision_rate_violators_OLD.log')
os.rename('collision_rate_violators.log', 'collision_rate_violators_OLD.log')
if os.path.isfile(old_file):
os.remove(old_file)
os.rename(new_file, old_file)
if violators:
logging.info("\n")
logging.warning("{0} CORE reactions violate the collision rate limit!"
"\nSee the 'collision_rate_violators.log' for details.\n\n".format(num_rxn_violators))
with open('collision_rate_violators.log', 'w') as violators_f:
with open(new_file, 'w') as violators_f:
violators_f.write('*** Collision rate limit violators report ***\n'
'"Violation factor" is the ratio of the rate coefficient to the collision limit'
' rate at the relevant conditions\n\n')
Expand Down

0 comments on commit 40a1649

Please sign in to comment.