Beispiel #1
0
def get_spectrum(result, n=600, xlim=(0, 4000), width=50):
    '''
	Function to generate a spectrum histogram from results using
	lorentzian line shape.

	results - plams.Results object
	n - size of spectrum
	width - width of lorentzian peaks, defaults to 50cm-1 (same as in ADF)

	I will try to add support for gaussian line shape as well


	##DEPRECATED##
	'''

    freqs, intens = get_freqs_intens(result.KFPATH)
    spectrum = np.zeros(n)

    #project width onto new range
    width = width / (xlim[1] - xlim[0])

    for f, i in zip(freqs, intens):
        #we must project f from [xlim[0], xlim[1]] onto the range [0,1] since the histograms
        #are calculated on that range
        spectrum += hist.lorentzian(n, (f - xlim[0]) /
                                    (xlim[1] - xlim[0]), width) * i

    return spectrum
Beispiel #2
0
def get_spectrum_from_kf(kf, n=600, xlim=(0, 4000), width=50):
    '''
	Same function as above but for paths to kf files.
	'''

    freqs, intens = get_freqs_intens(kf)
    spectrum = np.zeros(n)

    #project width onto new range
    width = width / (xlim[1] - xlim[0])

    for f, i in zip(freqs, intens):
        #we must project f from [xlim[0], xlim[1]] onto the range [0,1] since the histograms
        #are calculated on that range
        spectrum += hist.lorentzian(n, (f - xlim[0]) /
                                    (xlim[1] - xlim[0]), width) * i
        # spectrum += hist.dirac_delta(n, (f-xlim[0])/(xlim[1]-xlim[0])) * i

    return spectrum