Skip to content

Instantly share code, notes, and snippets.

@CoryKornowicz
Last active May 7, 2023 12:39
Show Gist options
  • Save CoryKornowicz/b9c758e286e952730e69b3345353818c to your computer and use it in GitHub Desktop.
Save CoryKornowicz/b9c758e286e952730e69b3345353818c to your computer and use it in GitHub Desktop.
Kd to deltaG. For comparing Binding Affinity to expected calculated Kd
import math
# deltaG = -RT*ln(Kd)
def Kd_to_dG(Kd):
Kd = float(Kd)
# R T
dG = -0.0019872036*298*math.log(Kd)
print('{} Kcal/mol'.format(round(dG, 2)))
def dG_to_Kd(dG):
dG = float(dG)
# R T
Kd = math.e**(dG/(0.0019872036*298))
print('{:0.2e} dG'.format(Kd))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment