| 1 |
# web-page: pulse.png |
| 2 |
import numpy as np |
| 3 |
import matplotlib.pyplot as plt |
| 4 |
from gpaw.tddft.units import au_to_fs |
| 5 |
|
| 6 |
plt.figure(figsize=(8, 4)) |
| 7 |
ax = plt.subplot(1, 1, 1) |
| 8 |
|
| 9 |
data_ti = np.loadtxt('dmpulse.dat') |
| 10 |
ax.plot(data_ti[:, 0] * au_to_fs, data_ti[:, 2], 'k') |
| 11 |
ax.spines['top'].set_visible(False) |
| 12 |
ax.yaxis.set_ticks_position('left') |
| 13 |
ax.xaxis.set_ticks_position('bottom') |
| 14 |
plt.ylabel('Dipole moment (atomic units)') |
| 15 |
plt.ylim(np.array([-1, 1]) * np.max(np.abs(plt.ylim()))) |
| 16 |
plt.xlabel('Time (fs)') |
| 17 |
plt.xlim(0, 30) |
| 18 |
|
| 19 |
ax = ax.twinx() |
| 20 |
data_ti = np.loadtxt('pulse.dat') |
| 21 |
ax.plot(data_ti[:, 0] * au_to_fs, data_ti[:, 1], 'g') |
| 22 |
ax.spines['top'].set_visible(False) |
| 23 |
ax.yaxis.set_ticks_position('right') |
| 24 |
ax.tick_params(axis='y', labelcolor='g') |
| 25 |
plt.ylabel('Pulse (atomic units)', color='g') |
| 26 |
plt.ylim(np.array([-1, 1]) * np.max(np.abs(plt.ylim()))) |
| 27 |
|
| 28 |
plt.tight_layout() |
| 29 |
plt.savefig('pulse.png') |