#!/usr/bin/env python
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np

def baule(E, mass):
	mu = (14.001 + 1.008 * 3) / mass

	ET = E * 2.4 * mu / (1 + mu)**2
	stderr = ( ET / 2.4 * 4. - ET )

	return ET

ET_1100K = np.array(
[[74.0, 14.13508908322366],
[87.8, 17.40532657509104],
[102.9, 23.24614972294051],
[119.5, 25.523473701313172]]
)

ET_475K = np.array(
[[102.9, 24.60627401537924],
[119.5, 28.930806270318712]]
)

mpl.rc("text", usetex=True)
fig = plt.figure(figsize=(3.69,3))

plt.plot( [0., 130.], [baule(0., 101.07), baule(130., 101.07)], color='black', linestyle='-' )
plt.plot( ET_475K[:,0], ET_475K[:,1], marker='o', color='b', linestyle='-.', label='475 K' )
plt.plot( ET_1100K[:,0], ET_1100K[:,1], marker='o', color='r', linestyle='-.', label='1100 K' )

plt.legend(loc='upper left', numpoints=1)
plt.xlim(60.,130.)
plt.ylim(0.,50.)
plt.tick_params(length=6, width=1)
plt.ylabel('Energy transfer (kJ/mol)')
plt.xlabel('Incidence energy (kJ/mol)')

plt.tight_layout()
plt.savefig('energytransfer.pdf')
#plt.show()
