Write a function, get_wv, which takes a molar bond dissociation energy, D0, in $\mathrm{kJ\,mol^{-1}}$ and returns the wavelength of a photon corresponding to that energy per molecule, in nm. The energy of a photon with wavelength $\lambda$ is $E=hc/\lambda$.
For example,
In [x]: get_wv(497)
Out[x]: 240.69731528286377
Solution P8.1.3
Here is one way to define get_wv:
import scipy.constants as pc
def get_wv(D0):
E = D0 * pc.kilo / pc.N_A # energy per molecule, J
lam = pc.h * pc.c / E # wavelength, m
return lam / pc.nano # return wavelength, nm
if __name__ == "__main__":
D0 = 497
print(
f"The wavelength of a photon to dissociate a bond with dissociation"
f" energy {D0} kJ.mol-1 is {get_wv(D0):.1f} nm."
)
Output:
The wavelength of a photon to dissociate a bond with dissociation
energy 497 kJ.mol-1 is 240.7 nm.