Skip to content

Commit

Permalink
update db function with gulp calculation with fixed code
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhu2017 committed May 30, 2024
1 parent 8bf30c0 commit fcc3634
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pyxtal/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ def update_row_ff_energy(self, ff='reaxff', ids=(None, None), ncpu=1,
if status:
gulp_results.append((id, xtal, eng))
if len(gulp_results) >= write_freq:
self._update_db_gulp(gulp_results)
self._update_db_gulp(gulp_results, ff)
gulp_results = []
else:
if len(ids) < ncpu: ncpu = len(ids)
Expand All @@ -892,11 +892,15 @@ def update_row_ff_energy(self, ff='reaxff', ids=(None, None), ncpu=1,
results = [executor.submit(gulp_opt_par, *p) for p in args_list]
for result in results:
gulp_results.extend(result.result())
self._update_db_gulp(gulp_results)
self._update_db_gulp(gulp_results, ff)

def _update_db_gulp(self, gulp_results):
def _update_db_gulp(self, gulp_results, ff):
"""
Update db with the gulp_results
Args:
gulp_results: list of (id, xtal, eng) tuples
ff (str): forcefield type (e.g., 'reaxff')
"""
print("Wrap up the final results and update db", len(gulp_results))
for gulp_result in gulp_results:
Expand Down

0 comments on commit fcc3634

Please sign in to comment.