Debian Codegraph @

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

raw
1 # web-page: spectra_origins.png
2 import numpy as np
3 import matplotlib.pyplot as plt
4
5 fig, ax = plt.subplots(figsize=(6, 6 / 1.62))
6 for ls, gauge in [('r', 'length'), ('b', 'velocity')]:
7 for tag in ['COM', 'COM+x', 'COM+y', 'COM+z', '123']:
8 data_ej = np.loadtxt(f'rot_spec-{tag}_{gauge}.dat')
9 ax.plot(data_ej[:, 0], data_ej[:, 1], ls,
10 label=gauge if tag == 'COM' else None)
11 ax.spines['right'].set_visible(False)
12 ax.spines['top'].set_visible(False)
13 ax.yaxis.set_ticks_position('left')
14 ax.xaxis.set_ticks_position('bottom')
15 plt.title('Rotatory strength of (R)-methyloxirane')
16 plt.xlabel('Energy (eV)')
17 plt.legend(loc='upper left', title='Different origins')
18 plt.ylabel(r'R (10$^{-40}$ cgs eV$^{-1})$')
19 plt.xlim(5, 10)
20 plt.ylim(-90, 90)
21 plt.tight_layout()
22 plt.savefig('spectra_origins.png')