Skip to content

Commit 4cbd3c4

Browse files
committed
fixup! several potential related changes in reaction.py
1 parent e771940 commit 4cbd3c4

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

rmgpy/reaction.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ cdef class Reaction:
8585

8686
cpdef double get_entropy_of_reaction(self, double T)
8787

88-
cpdef double get_free_energy_of_reaction(self, double T, potential=?)
88+
cpdef double get_free_energy_of_reaction(self, double T, double potential=?)
8989

90-
cpdef double get_equilibrium_constant(self, double T, potential=?, str type=?)
90+
cpdef double get_equilibrium_constant(self, double T, double potential=?, str type=?)
9191

9292
cpdef np.ndarray get_enthalpies_of_reaction(self, np.ndarray Tlist)
9393

rmgpy/reaction.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ def get_entropy_of_reaction(self, T):
564564
dSrxn += product.get_entropy(T)
565565
return dSrxn
566566

567-
def get_free_energy_of_reaction(self, T, potential=None):
567+
def get_free_energy_of_reaction(self, T, potential=0):
568568
"""
569569
Return the Gibbs free energy of reaction in J/mol evaluated at
570570
temperature `T` in K and potential in Volts (if applicable)
@@ -573,7 +573,7 @@ def get_free_energy_of_reaction(self, T, potential=None):
573573
dGrxn = 0.0
574574

575575
if self.is_charge_transfer_reaction() and self.V0:
576-
dGrxn = -1 * abs(self.ne) * constants.F * self.V0.value_si # G = -nFE0 in J/mol
576+
dGrxn = -1 * abs(self.ne) * constants.F * self.V0.value_si # G = -nFE0 in J/mol, not sure about sign
577577
else:
578578
for reactant in self.reactants:
579579
if not reactant.is_electron():
@@ -590,12 +590,12 @@ def get_free_energy_of_reaction(self, T, potential=None):
590590
logging.error("Problem with product {!r} in reaction {!s}".format(reactant, self))
591591
raise
592592

593-
if self.is_charge_transfer_reaction() and potential is not None:
594-
dGrxn += (dGrxn - self.ne * constants.F * potential) # Not sure about sign here or equation G = -nFE0 + nF(V0-V)
595-
# where nF(V0-V) is from applied potential
593+
if self.is_charge_transfer_reaction() and potential != 0:
594+
dGrxn -= self.ne * constants.F * potential # Not sure about sign here
595+
596596
return dGrxn
597597

598-
def get_equilibrium_constant(self, T, potential=None, type='Kc'):
598+
def get_equilibrium_constant(self, T, potential=0, type='Kc'):
599599
"""
600600
Return the equilibrium constant for the reaction at the specified
601601
temperature `T` in K and (electrochemical) potential in volts (if applicable).

0 commit comments

Comments
 (0)