Debian Codegraph @

doc/tutorialsexercises/opticalresponse/circular_dichroism/lcao/plot_spectra.py

raw
1 # web-page: spectra.png
2 import numpy as np
3 import matplotlib.pyplot as plt
4
5
6 fig, ax = plt.subplots(figsize=(6, 6 / 1.62))
7 for color, gauge in reversed([('#1b9e77', 'length'), ('#d95f02', 'velocity')]):
8 for basis, dpath, ls in [('aug.dzp', '.', ''), ('dzp', 'dzp', '--')]:
9 data_ej = np.loadtxt(f'{dpath}/rot_spec-{gauge}.dat')
10 ax.plot(data_ej[:, 0], data_ej[:, 1], ls,
11 color=color, label=basis + ' ' + gauge, linewidth=2)
12 ax.spines['right'].set_visible(False)
13 ax.spines['top'].set_visible(False)
14 ax.yaxis.set_ticks_position('left')
15 ax.xaxis.set_ticks_position('bottom')
16 plt.title('Rotatory strength of (R)-methyloxirane')
17 plt.xlabel('Energy (eV)')
18 plt.legend(loc='upper left')
19 plt.ylabel(r'R (10$^{-40}$ cgs eV$^{-1})$')
20 plt.xlim(4, 10)
21 plt.ylim(-80, 80)
22 plt.tight_layout()
23 plt.savefig('spectra.png')