Skip to content

Commit

Permalink
set guards to prevent log(0) call
Browse files Browse the repository at this point in the history
  • Loading branch information
srmnitc committed Feb 20, 2024
1 parent 6ae7875 commit d751893
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions calphy/integrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,10 @@ def get_einstein_crystal_fe(
F_cm = 0

for count, om in enumerate(omega):
F_harm += concentration[count]*np.log((hbar*om)/(kb*calc._temperature))
if cm_correction:
F_cm += np.log((natoms*concentration[count]/vol)*(2*np.pi*kbJ*calc._temperature/(natoms*concentration[count]*k[count]))**1.5)
if concentration[count] > 0:
F_harm += concentration[count]*np.log((hbar*om)/(kb*calc._temperature))
if cm_correction:
F_cm += np.log((natoms*concentration[count]/vol)*(2*np.pi*kbJ*calc._temperature/(natoms*concentration[count]*k[count]))**1.5)
#F_cm = 0
F_harm = 3*kb*calc._temperature*F_harm
F_cm = (kb*calc._temperature/natoms)*F_cm
Expand Down

0 comments on commit d751893

Please sign in to comment.