Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révisionLes deux révisions suivantes | ||
teaching:progappchim:matplotlib_gallery:potentiel_energy_surface [2015/05/08 11:01] – villersd | teaching:progappchim:matplotlib_gallery:potentiel_energy_surface [2016/05/10 13:00] – villersd | ||
---|---|---|---|
Ligne 32: | Ligne 32: | ||
==== Programme ==== | ==== Programme ==== | ||
- | ==== Sorties graphiques ==== | + | <sxh python; title : PES-contour-01.py> |
+ | # | ||
+ | # -*- coding: utf-8 -*- | ||
+ | """ | ||
+ | Tracés de lignes de niveau ou isolignes | ||
+ | Application : Potentiel Energy Surface de la réaction | ||
+ | H + H2 --> H2 + H | ||
+ | """ | ||
+ | # ref : http:// | ||
+ | |||
+ | import matplotlib.pyplot as plt # directive d' | ||
+ | import numpy as np # directive d' | ||
+ | from mpl_toolkits.mplot3d import Axes3D | ||
+ | |||
+ | def Ebond(rAB): | ||
+ | return D_e * (np.exp(-2.*beta*(rAB-r_e)) - 2.*np.exp(-beta*(rAB-r_e))) | ||
+ | def Eant(rAB): | ||
+ | return 0.5 * D_e * (np.exp(-2.*beta*(rAB-r_e)) + 2.*np.exp(-beta*(rAB-r_e))) | ||
+ | def Q(rAB): | ||
+ | return 0.5 * ((1.+k)*Ebond(rAB) + (1.-k)*Eant(rAB)) | ||
+ | def a(rAB): | ||
+ | return 0.5 * ((1.+k)*Ebond(rAB) - (1.-k)*Eant(rAB)) | ||
+ | |||
+ | beta=19.3E-3 # pm-1 | ||
+ | r_e=74.1 # pm | ||
+ | D_e = .76 # E-18 J | ||
+ | k=0.18 | ||
+ | rmin=10. | ||
+ | rmax=400. | ||
+ | num=100 | ||
+ | x_1d = np.linspace(rmin, | ||
+ | print x_1d.shape, x_1d.dtype, x_1d.ndim | ||
+ | y_1d = np.linspace(rmin, | ||
+ | print y_1d.shape, y_1d.dtype, y_1d.ndim | ||
+ | X, Y = np.meshgrid(x_1d, | ||
+ | print X.shape, X.dtype, X.ndim, Y.shape, Y.dtype, Y.ndim | ||
+ | E=(Q(X)+Q(Y)+Q(X+Y)-np.sqrt(2.*((a(X)-a(Y))**2.+(a(Y)-a(X+Y))**2.+(a(X+Y)-a(X))**2.)))/ | ||
+ | print np.min(E) | ||
+ | |||
+ | fig = plt.figure(figsize=(12, | ||
+ | ax = fig.add_subplot(111) | ||
+ | # cf. http:// | ||
+ | ax.set_aspect(" | ||
+ | levels = np.linspace(-1.7, | ||
+ | CS1 = plt.contour(X, | ||
+ | plt.clabel(CS1, | ||
+ | CS2 = plt.contourf(X, | ||
+ | # | ||
+ | |||
+ | plt.title(' | ||
+ | plt.xlabel(' | ||
+ | plt.ylabel(' | ||
+ | |||
+ | fig = plt.figure(2, | ||
+ | ax = Axes3D(fig) | ||
+ | ax.plot_surface(X, | ||
+ | ax.set_xlabel(' | ||
+ | ax.set_ylabel(' | ||
+ | ax.set_zlabel(' | ||
+ | plt.show() | ||
+ | </ | ||
+ | |||
+ | Avec les paramètres essayés, la valeur minimale de E est environ -1.603 | ||
+ | ==== Sorties graphiques ==== | ||
=== Lignes de contour === | === Lignes de contour === | ||
+ | |||
+ | {{: | ||
+ | |||
+ | === Surface 3D === | ||
+ | |||
+ | {{: | ||
===== Références ===== | ===== Références ===== | ||
Ligne 46: | Ligne 115: | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | Voir aussi : | ||
+ | * [[http:// | ||
+ | * [[http:// | ||