Skip to content

Commit

Permalink
remove average potential
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-24 committed Nov 13, 2023
1 parent 3750e50 commit 846ebd1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ec_interface/ec_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ def estimate_active_fraction(self, shift: float = .0) -> float:

work_function = self.vacuum_potentials - self.fermi_energies + shift
dnelect = self.nelects - self.ne_zc
fee = self.free_energies - dnelect * self.fermi_energies
index_0 = numpy.where(dnelect == .0)[0][0]
fee = self.free_energies - dnelect * self.fermi_energies - self.average_potentials[index_0]

fit_1 = numpy.polyfit(work_function, dnelect, 1) # charge vs work function
cap_1 = -fit_1[0]
Expand Down Expand Up @@ -242,12 +243,10 @@ def compute_fee_hbm(self, alpha: float, shift: float = .0):
dnelect[b0:b1]
))

fee = fe0 + alpha * (self.free_energies - fe0 + dnelect * work_function - integ_average_pot)

# get fee:
return numpy.array([
dnelect,
work_function,
fe0 + alpha * (self.free_energies - fe0 + dnelect * work_function - integ_average_pot)
]).T
return numpy.array([dnelect, work_function, fee - self.average_potentials[index_0]]).T

def compute_fee_hbm_fermi(self, shift: float = .0):
"""Compute the Free electrochemical energy (grand potential) assuming a homogeneous background method
Expand All @@ -257,8 +256,9 @@ def compute_fee_hbm_fermi(self, shift: float = .0):
work_function = self.vacuum_potentials - self.fermi_energies + shift
dnelect = self.nelects - self.ne_zc
fee = self.free_energies - dnelect * self.fermi_energies
index_0 = numpy.where(dnelect == .0)[0][0]

return numpy.array([dnelect, work_function, fee]).T
return numpy.array([dnelect, work_function, fee - self.average_potentials[index_0]]).T

def compute_fee_pbm(self, shift: float = .0) -> NDArray:
"""Compute the Free electrochemical energy (grand potential) assuming a Poisson-Boltzmann method
Expand All @@ -267,5 +267,6 @@ def compute_fee_pbm(self, shift: float = .0) -> NDArray:
work_function = self.vacuum_potentials - self.fermi_energies + shift
dnelect = self.nelects - self.ne_zc
fee = self.free_energies + dnelect * work_function
index_0 = numpy.where(dnelect == .0)[0][0]

return numpy.array([dnelect, work_function, fee]).T
return numpy.array([dnelect, work_function, fee - self.average_potentials[index_0]]).T

0 comments on commit 846ebd1

Please sign in to comment.