In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
Use the HCEPDB file to create a single 4x4 composite plot (not 4 separate figures). The plots should contain the following data
You should make the plots the highest quality possible and, in your judgement, ready for inclusion in a formal report or publication.
In the cell after you are finished making the plot add a markdown cell and add the following information
There are five terms above from the HCEPDB that relate to photovoltaic materials - define them as they pertain to molecules that could be used for energy conversion applications
Briefly explain the changes you made from the default plot and why you made them
In [2]:
data = pd.read_csv('HCEPD_100K.csv')
In [3]:
data.head()
Out[3]:
In [4]:
#create a single 4x4 composite plot
#ref: https://plot.ly/matplotlib/subplots/
fig = plt.figure()
fig.set_figheight(10)
fig.set_figwidth(10)
ax1 = fig.add_subplot(221)
ax1.plot(data['voc'],data['pce'],',')
ax1.set_xlabel('VOC')
ax1.set_ylabel('PCE')
ax1.set_title('PCE vs VOC')
ax1.set_ylim([-0.5,12])
ax1.grid()
ax2 = fig.add_subplot(222)
ax2.plot(data['jsc'],data['pce'],',')
ax2.set_xlabel('JSC')
ax2.set_ylabel('PCE')
ax2.set_title('PCE vs JSC')
ax2.set_ylim([-0.5,12])
ax2.grid()
ax3 = fig.add_subplot(223)
ax3.plot(data['voc'],data['e_homo_alpha'],',')
ax3.set_xlabel('VOC')
ax3.set_ylabel('$E_{HOMO}$')
ax3.set_title('$E_{HOMO}$ vs VOC')
ax3.set_xlim([-0.1,1.8])
ax3.grid()
ax4 = fig.add_subplot(224)
ax4.plot(data['pce'],data['e_lumo_alpha'],',')
ax4.set_xlabel('VOC')
ax4.set_ylabel('$E_{LUMO}$')
ax4.set_title('$E_{LUMO}$ vs VOC')
ax4.set_xlim([-0.5,12])
ax4.grid()
Five Terms:
Changes I made:
In [5]:
#Read the file first.
data2 = pd.read_csv('ALA2fes.dat', delim_whitespace=True, comment='#', names=['phi','psi','file.free','der_phi','der_psi'])
In [6]:
#Take a look at the data.
data2.head()
Out[6]:
In [7]:
#We should know how many columns there are before doing contour plot.
data2.shape
Out[7]:
In [8]:
#Because it has 2500 columns, shape the data into 50x50 matrix.
N = 50
M = 50
X = np.reshape(data2.psi,[N,M])
Y = np.reshape(data2.phi,[N,M])
Z = np.reshape(data2['file.free']-data2['file.free'].min(),[N,M])
#I change unit from kJ/mol to kT, and it is appromately to time 2.5, so I pick this as spacer.
#Levels should contain all the FES, so I pick lines=42.
spacer = 2.5
lines = 42
levels = np.linspace(0,lines*spacer,num=(lines+1),endpoint=True)
fig2 = plt.figure(figsize=(5,5))
axes = fig.add_subplot(111)
plt.contour(X,Y,Z,levels)
#Give plot title and labels.
plt.title('$\Phi$ vs $\Psi$ on free energy surface')
plt.xlabel('$\Psi$')
plt.ylabel('$\Phi$')
plt.colorbar().ax.set_ylabel('FES (kT)')
Out[8]:
In [ ]:
Use the program Avogadro to create a 3D visualization of the ALA2 molecule (hint: I showed it in one of my lecture slides and labeled the relevant angles)
Show the molecule frmo at least two orientations.
Use the program Avogadro to create a 3D visualization of the unit cell of anatase titanium dioxide. If possible create it in a slab form showing several unit cells in x/y plane
Embed the image in a markdown cell and write out a list of concise instructions in a numbered markdown list - it should be clear enough an undergrad science major can follow the instructions and succeed.
Instructions:
In [ ]: