Skip to content

Commit

Permalink
Automatically generate a restart from seed file
Browse files Browse the repository at this point in the history
  • Loading branch information
amarkpayne committed Jul 23, 2019
1 parent 307e195 commit 8cfc3df
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion rmgpy/rmg/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ def makeSeedMech(self,firstTime=False):
q += 1
self.name = name + str(q)

seedDir = os.path.join(self.outputDirectory,'seed')
seedDir = os.path.join(self.outputDirectory, 'seed')
filter_dir = os.path.join(seedDir, 'Filters')
temp_seed_dir = os.path.join(self.outputDirectory, 'seed_tmp')

Expand Down Expand Up @@ -1360,6 +1360,15 @@ def makeSeedMech(self,firstTime=False):
with open(os.path.join(filter_dir, 'family_map.yml'), 'w') as f:
yaml.dump(data=family_map, stream=f)

# Generate a file for restarting from a seed mechanism if this is not a restart job
if firstTime and (not self.restart_seed_path):
with open(self.inputFile, 'r') as f:
input_text = f.readlines()

with open(os.path.join(self.outputDirectory, 'restart_from_seed.py'), 'w') as f:
f.write('restartFromSeed(\n path=\'seed\'\n)\n\n')
f.write(''.join(input_text))

# Finally, delete the seed mechanism from the previous iteration (if it exists)
if os.path.exists(temp_seed_dir):
shutil.rmtree(temp_seed_dir)
Expand Down

0 comments on commit 8cfc3df

Please sign in to comment.