Skip to content

Commit

Permalink
reduce redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaebeom-P committed Aug 14, 2024
1 parent 08ae922 commit ab46f3b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/pyEQL/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,12 @@ def gibbs_mix(solution1: Solution, solution2: Solution, activity_correction: boo
term_list = {concentrate: 0, dilute: 0, blend: 0}

# calculate the entropy change and number of moles solute for each solution
if activity_correction is True:
for solution in term_list:
for solute in solution.components:
if solution.get_amount(solute, "fraction") != 0:
for solution in term_list:
for solute in solution.components:
if solution.get_amount(solute, "fraction") != 0:
if activity_correction is True:
term_list[solution] += solution.get_amount(solute, "mol") * np.log(solution.get_activity(solute))
else:
for solution in term_list:
for solute in solution.components:
if solution.get_amount(solute, "fraction") != 0:
else:
term_list[solution] += solution.get_amount(solute, "mol") * np.log(solution.get_amount(solute, "fraction"))

return (ureg.R * blend.temperature.to("K") * (term_list[blend] - term_list[concentrate] - term_list[dilute])).to(
Expand Down

0 comments on commit ab46f3b

Please sign in to comment.