Skip to content

Commit

Permalink
set guards to prevent div by 0 in integration
Browse files Browse the repository at this point in the history
  • Loading branch information
srmnitc committed Feb 20, 2024
1 parent d751893 commit 7f03691
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions calphy/integrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ def integrate_path(calc,
bdur = np.zeros(len(bdui))

for i in range(calc.n_elements):
fdur += concentration[i]*fdata[i+1]/natoms[i]
bdur += concentration[i]*bdata[i+1]/natoms[i]
if natoms[i] > 0:
fdur += concentration[i]*fdata[i+1]/natoms[i]
bdur += concentration[i]*bdata[i+1]/natoms[i]

flambda = fdata[calc.n_elements+1]
blambda = bdata[calc.n_elements+1]
Expand Down

0 comments on commit 7f03691

Please sign in to comment.