示例#1
0
# define some variables
hartree2kcal = 627.509469
palette = {
  'black'    :'#000000', # black
  'dark blue':'#16469D', # dark blue
  'red'      :'#BD202D', # red
  'green'    :'#00A14B', # green
  'blue'     :'#4B96D1', # light blue
  'orange'   :'#F16521', # orange
  'violet'   :'#9F6EAF' # light purple
}
color_cycle = [palette['red'], palette['blue'], palette['orange'], palette['green']]
label_cycle = ['CCSDT', 'CCSDT(Q)', 'ODC-12', 'L-ODC$\lambda_3$']

# build PlotData object
plotdata_obj = PlotData.init_from_file('data.txt')
plotdata_obj.set_reference_series(0) # set 0th column as reference, so the data series are now differences with respect to column 0
plotdata_obj.scale_y(hartree2kcal)   # convert vertical axis from Hartree to kcal mol
plotdata_obj.set_color_cycle(color_cycle, label_cycle=label_cycle)
plotdata_obj.plot_all('-', linewidth=3.0)
plotdata_obj.set_aspect_by_adjusting_width(1.8)

#  matplotlib stuff
plt.rc('text', usetex=True)
plt.rc('font', family='serif', weight='bold', size=20)
plt.margins(y=0.05, x=0.00, tight=True)
plt.ylabel('$\Delta E$ / kcal mol$^{-1}$')
plt.xlabel('$r$ / \AA')
plt.tight_layout()
plt.legend(loc='lower left')
plt.savefig('data.pdf', bbox_inches='tight')
示例#2
0
import numpy as np
from avcscripts.parser  import ParseFile
from avcscripts.plotter import PlotData

pfile = ParseFile('filestoparse/qchem_eom-ee.out')
energies  = pfile.findfloats(r'Excitation energy = (-?\d+.\d+) eV.')
distances = pfile.findfloats(r'H \(  1\)\n\s+ H \(  2\)\s+(\d+\.\d+)')

energies  = energies.reshape((-1,2,12)).transpose(1,2,0)

singlets  = PlotData(distances, energies[0])
triplets  = PlotData(distances, energies[1])

singlets.save_to_file('plotdatafiles/h2singlets.dat', floatfmt='%10.5f')
triplets.save_to_file('plotdatafiles/h2triplets.dat', floatfmt='%10.5f')

示例#3
0
from avcscripts.plotter import PlotData

singlets = PlotData.init_from_file('plotdatafiles/h2singlets.dat')

import matplotlib.pyplot as pp

singlets.plot_all('b-')
pp.savefig('singlets.pdf')