Commit 3dacb8af authored by Tuomas Rossi's avatar Tuomas Rossi

Finetune TCM plots and documentation

parent 4560cf63
......@@ -285,7 +285,8 @@ Note that the sum over the decomposition (the printed total absorption)
equals to the value of the photoabsorption spectrum at the particular
frequency in question.
We obtain the following transition contributions:
We obtain the following transition contributions for the resonances
(presented both as tables and TCMs):
.. literalinclude:: lcaotddft_Na8/table_1.12.txt
:language: none
......
......@@ -52,7 +52,9 @@ def do(w):
y = x + freq.freq * au_to_eV
ax_tcm.plot(x, y, c='k')
# Show the plot
ax_occ_dos.set_title('Photoabsorption TCM of Na8 at %.2f eV' % frequency)
# Save the plot
plt.savefig('tcm_%.2f.png' % frequency)
do(0)
......
# -*- coding: utf-8 -*-
import numpy as np
from ase.units import Hartree, Bohr
......@@ -131,8 +132,6 @@ class KohnShamDecomposition(object):
tri2full(dm_MM) # TODO: do not use this
dm_vMM.append(dm_MM)
print 'Dipole moment matrix done'
C0_nM = self.C0_unM[u]
dm_vnn = []
for v in range(3):
......@@ -348,6 +347,7 @@ class KohnShamDecomposition(object):
occ_energy_min, occ_energy_max,
unocc_energy_min, unocc_energy_max,
delta_energy, sigma, zero_fermilevel=True,
spectrum=False,
vmax='80%'):
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
......@@ -377,7 +377,10 @@ class KohnShamDecomposition(object):
ax_occ_dos = plt.subplot(gs[0])
ax_unocc_dos = plt.subplot(gs[3])
ax_tcm = plt.subplot(gs[2])
ax_spec = plt.subplot(get_gs(hspace=0.8, wspace=0.8)[1])
if spectrum:
ax_spec = plt.subplot(get_gs(hspace=0.8, wspace=0.8)[1])
else:
ax_spec = None
# Plot TCM
ax = ax_tcm
......@@ -385,7 +388,6 @@ class KohnShamDecomposition(object):
if isinstance(vmax, str):
assert vmax[-1] == '%'
tcmmax = max(np.max(tcm_ou), -np.min(tcm_ou))
print tcmmax
vmax = tcmmax * float(vmax[:-1]) / 100.0
vmin = -vmax
cmap = 'seismic'
......@@ -416,12 +418,17 @@ class KohnShamDecomposition(object):
fill_between = ax.fill_betweenx
set_energy_lim = ax.set_ylim
set_dos_lim = ax.set_xlim
def plot(x, y, *args, **kwargs):
return ax.plot(y, x, *args, **kwargs)
else:
set_label = ax.set_ylabel
fill_between = ax.fill_between
set_energy_lim = ax.set_xlim
set_dos_lim = ax.set_ylim
fill_between(energy_e, 0, dos_e, color='b')
def plot(x, y, *args, **kwargs):
return ax.plot(x, y, *args, **kwargs)
fill_between(energy_e, 0, dos_e, color='0.8')
plot(energy_e, dos_e, 'k')
set_label('DOS', labelpad=0)
set_energy_lim(energy_min, energy_max)
set_dos_lim(dos_min, dos_max)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment