CorrelationFunction

Provides typical Bath correlation function types.

Most important types of bath or energy gap correlation functions are provided. Where possible, the correlation function is calculated from the parameters from analytical formulae. Where such formulae are not available, correlation function is calculated by transformation of the spectral density.

Types of correlation function provided

OverdampedBrownian-HighTemperature :
OverdampedBrownian oscillator in high temperature limit
OverdampedBrownian :
General overdampedBrownian oscillator

Examples

>>> from quantarhei import TimeAxis
>>> params = dict(ftype="OverdampedBrownian", cortime=100, reorg=20, T=300)
>>> time = TimeAxis(0.0,1000,1.0)
>>> with energy_units("1/cm"):
...     cf = CorrelationFunction(time,params)
>>> with energy_units("1/cm"):
...     print(cf.get_reorganization_energy())
20.0

Reorganization energy of a correlation function can be calculated from the shape of the spectral density by integrating over it. The accuracy of such estimation depends on numerics, hence the relative tolerance of only 1.0e-4 below

>>> lamb_definition = cf.get_reorganization_energy()
>>> lamb_measured = cf.measure_reorganization_energy()
>>> print(numpy.allclose(lamb_definition, lamb_measured, rtol=1.0e-4))
True

Details of Classes Provided

class quantarhei.qm.corfunctions.correlationfunctions.CorrelationFunction(axis=None, params=None, values=None)[source]

Provides typical Bath correlation function types.

Parameters:
  • axis (TimeAxis) – TimeAxis object specifying the time interval on which the correlation function is defined.
  • params (dictionary) – A dictionary of the correlation function parameters
  • values (optional) – Correlation function can be set by specifying values at all times

Methods

add_to_data(other) Addition of data from a specified CorrelationFunction to this object
add_to_data2(other) Addition of data from a specified CorrelationFunction to this object
apply_to_data(func) Applies a submitted function to the data
at(x[, approx]) Returns the function value at the argument x
change_axis(axis) Replaces the axis object with a compatible one, zero pads or trims the values
copy() Creates a copy of the current correlation function
deepcopy() Returns a deep copy of the self
fit_exponential([guess]) Exponential fit of the function
fit_gaussian([N, guess, Nsvf]) Performs a Gaussian fit of the spectrum based on an initial guess
get_EvenFTCorrelationFunction() Returns a even part of the Fourier transform of correlation function
get_FTCorrelationFunction() Returns a Fourier transform of the correlation function
get_Fourier_transform([window]) Returns Fourier transform of the DFunction
get_OddFTCorrelationFunction() Returns a odd part of the Fourier transform of correlation function
get_SpectralDensity([fa]) Returns a SpectralDensity corresponding to this CorrelationFunction.
get_correlation_time() Returns correlation time associated with the first component of the bath correlation function
get_inverse_Fourier_transform() Returns inverse Fourier transform of the DFunction
get_reorganization_energy() Returns the reorganization energy of the correlation function
get_temperature() Returns the temperature of the correlation function
is_analytical() Returns True if analytical
load(filename[, test]) Loads an object from a file and returns it
load_data(name[, with_axis]) Loads the data in a format determined by the file name extension
loaddir(dirname) Returns a directory of objects saved into a directory
measure_reorganization_energy() Calculates the reorganization energy of the correlation function
plot([fig, title, title_font, axis, vmax, …]) Plotting of the DFunction’s data against the ValueAxis.
reorganization_energy_consistent([rtol]) Checks if the reorganization energy is consistent with the data
save(filename[, comment, test]) Saves the object with all its content into a file
save_data(name[, with_axis]) Saves the data into a format determined by the file name extension
savedir(dirname[, tag, comment, test]) Saves an object into directory containing a file with unique name
savefig(filename) Saves current figure into a file
scopy() Creates a copy of the object by saving and loading it
set_data_protected() Implement this method to put protections on data property
set_data_writable() Implement this method to lift existing protection of data property
convert_energy_2_current_u  
convert_energy_2_internal_u  
convert_length_2_current_u  
convert_length_2_internal_u  
unit_repr  
unit_repr_latex  
add_to_data(other)[source]

Addition of data from a specified CorrelationFunction to this object

add_to_data2(other)[source]

Addition of data from a specified CorrelationFunction to this object

copy()[source]

Creates a copy of the current correlation function

get_EvenFTCorrelationFunction()[source]

Returns a even part of the Fourier transform of correlation function

Returns the even part of a Fourier transform of the correlation function in form of an instance of a special class EvenFTCorrelationFunction

get_FTCorrelationFunction()[source]

Returns a Fourier transform of the correlation function

Returns a Fourier transform of the correlation function in form of an instance of a special class FTCorrelationFunction

get_OddFTCorrelationFunction()[source]

Returns a odd part of the Fourier transform of correlation function

Returns the odd part of a Fourier transform of the correlation function in form of an instance of a special class OddFTCorrelationFunction

get_SpectralDensity(fa=None)[source]

Returns a SpectralDensity corresponding to this CorrelationFunction. If a FrequencyAxis object is included, the SpectralDensity object will be returned with that FrequencyAxis instance as its frequency axis.

get_correlation_time()[source]

Returns correlation time associated with the first component of the bath correlation function

get_reorganization_energy()[source]

Returns the reorganization energy of the correlation function

get_temperature()[source]

Returns the temperature of the correlation function

is_analytical()[source]

Returns True if analytical

Returns True if the CorrelationFunction object is constructed by analytical formula. Returns False if the object was constructed by numerical transformation from spectral density.

measure_reorganization_energy()[source]

Calculates the reorganization energy of the correlation function

Calculates the reorganization energy of the correlation function by integrating its imaginary part.

reorganization_energy_consistent(rtol=0.001)[source]

Checks if the reorganization energy is consistent with the data

Calculates reorganization energy from the data and checks if it is within specified tolerance from the expected value

class quantarhei.qm.corfunctions.correlationfunctions.EvenFTCorrelationFunction(axis, params, values=None)[source]

Even part of the Fourier transform of the correlation function

Numerically calculated even part Fourier transform of the correlation function. Calculated as Fourier transform of the real part of the correlation function.

Parameters:
  • axis (TimeAxis) – Time interval from which the frequency interval is calculated
  • params (dictionary) – Dictionary of the correlation function parameter

Examples

>>> ta = TimeAxis(0.0,1000,1.0)
>>> params = dict(ftype="OverdampedBrownian",reorg=20,cortime=100,T=300)
>>> with energy_units("1/cm"):
...    ecf = EvenFTCorrelationFunction(ta,params)
...    print(numpy.allclose(ecf.at(-100), ecf.at(100)))
True

Methods

apply_to_data(func) Applies a submitted function to the data
at(x[, approx]) Returns the function value at the argument x
change_axis(axis) Replaces the axis object with a compatible one, zero pads or trims the values
copy() Returns a shallow copy of the self
deepcopy() Returns a deep copy of the self
fit_exponential([guess]) Exponential fit of the function
fit_gaussian([N, guess, Nsvf]) Performs a Gaussian fit of the spectrum based on an initial guess
get_Fourier_transform([window]) Returns Fourier transform of the DFunction
get_inverse_Fourier_transform() Returns inverse Fourier transform of the DFunction
load(filename[, test]) Loads an object from a file and returns it
load_data(name[, with_axis]) Loads the data in a format determined by the file name extension
loaddir(dirname) Returns a directory of objects saved into a directory
plot([fig, title, title_font, axis, vmax, …]) Plotting of the DFunction’s data against the ValueAxis.
save(filename[, comment, test]) Saves the object with all its content into a file
save_data(name[, with_axis]) Saves the data into a format determined by the file name extension
savedir(dirname[, tag, comment, test]) Saves an object into directory containing a file with unique name
savefig(filename) Saves current figure into a file
scopy() Creates a copy of the object by saving and loading it
set_data_protected() Implement this method to put protections on data property
set_data_writable() Implement this method to lift existing protection of data property
convert_energy_2_current_u  
convert_energy_2_internal_u  
convert_length_2_current_u  
convert_length_2_internal_u  
unit_repr  
unit_repr_latex  
class quantarhei.qm.corfunctions.correlationfunctions.FTCorrelationFunction(axis, params, values=None)[source]

Fourier transform of the correlation function

Numerically calculated Fourier transform of the correlation function

Parameters:
  • axis (TimeAxis) – Time interval from which the frequency interval is calculated
  • params (dictionary) – Dictionary of the correlation function parameters

Methods

apply_to_data(func) Applies a submitted function to the data
at(x[, approx]) Returns the function value at the argument x
change_axis(axis) Replaces the axis object with a compatible one, zero pads or trims the values
copy() Returns a shallow copy of the self
deepcopy() Returns a deep copy of the self
fit_exponential([guess]) Exponential fit of the function
fit_gaussian([N, guess, Nsvf]) Performs a Gaussian fit of the spectrum based on an initial guess
get_Fourier_transform([window]) Returns Fourier transform of the DFunction
get_inverse_Fourier_transform() Returns inverse Fourier transform of the DFunction
load(filename[, test]) Loads an object from a file and returns it
load_data(name[, with_axis]) Loads the data in a format determined by the file name extension
loaddir(dirname) Returns a directory of objects saved into a directory
plot([fig, title, title_font, axis, vmax, …]) Plotting of the DFunction’s data against the ValueAxis.
save(filename[, comment, test]) Saves the object with all its content into a file
save_data(name[, with_axis]) Saves the data into a format determined by the file name extension
savedir(dirname[, tag, comment, test]) Saves an object into directory containing a file with unique name
savefig(filename) Saves current figure into a file
scopy() Creates a copy of the object by saving and loading it
set_data_protected() Implement this method to put protections on data property
set_data_writable() Implement this method to lift existing protection of data property
convert_energy_2_current_u  
convert_energy_2_internal_u  
convert_length_2_current_u  
convert_length_2_internal_u  
unit_repr  
unit_repr_latex  
class quantarhei.qm.corfunctions.correlationfunctions.OddFTCorrelationFunction(axis, params, values=None)[source]

Odd part of the Fourier transform of the correlation function

Numerically calculated odd part Fourier transform of the correlation function. Calculated as Fourier transform of the imaginary part of the correlation function.

Parameters:
  • axis (TimeAxis) – Time interval from which the frequency interval is calculated
  • params (dictionary) – Dictionary of the correlation function parameter

Examples

>>> ta = TimeAxis(0.0,1000,1.0)
>>> params = dict(ftype="OverdampedBrownian",reorg=20,cortime=100,T=300)
>>> with energy_units("1/cm"):
...    ocf = OddFTCorrelationFunction(ta,params)
...    print(numpy.allclose(ocf.at(-100), -ocf.at(100)))
True

Methods

apply_to_data(func) Applies a submitted function to the data
at(x[, approx]) Returns the function value at the argument x
change_axis(axis) Replaces the axis object with a compatible one, zero pads or trims the values
copy() Returns a shallow copy of the self
deepcopy() Returns a deep copy of the self
fit_exponential([guess]) Exponential fit of the function
fit_gaussian([N, guess, Nsvf]) Performs a Gaussian fit of the spectrum based on an initial guess
get_Fourier_transform([window]) Returns Fourier transform of the DFunction
get_inverse_Fourier_transform() Returns inverse Fourier transform of the DFunction
load(filename[, test]) Loads an object from a file and returns it
load_data(name[, with_axis]) Loads the data in a format determined by the file name extension
loaddir(dirname) Returns a directory of objects saved into a directory
plot([fig, title, title_font, axis, vmax, …]) Plotting of the DFunction’s data against the ValueAxis.
save(filename[, comment, test]) Saves the object with all its content into a file
save_data(name[, with_axis]) Saves the data into a format determined by the file name extension
savedir(dirname[, tag, comment, test]) Saves an object into directory containing a file with unique name
savefig(filename) Saves current figure into a file
scopy() Creates a copy of the object by saving and loading it
set_data_protected() Implement this method to put protections on data property
set_data_writable() Implement this method to lift existing protection of data property
convert_energy_2_current_u  
convert_energy_2_internal_u  
convert_length_2_current_u  
convert_length_2_internal_u  
unit_repr  
unit_repr_latex  
quantarhei.qm.corfunctions.correlationfunctions.c2g(timeaxis, coft)[source]

Converts correlation function to lineshape function

Explicit numerical double integration of the correlation function to form a lineshape function.

Parameters:
  • timeaxis (cu.oqs.time.TimeAxis) – TimeAxis of the correlation function
  • coft (complex numpy array) – Values of correlation function given at points specified in the TimeAxis object
quantarhei.qm.corfunctions.correlationfunctions.c2h(timeaxis, coft)[source]

Integrates correlation function in time with an open upper limit

Explicit numerical integration of the correlation function to form a precursor to the lineshape function.

Parameters:
  • timeaxis (TimeAxis) – TimeAxis of the correlation function
  • coft (complex numpy array) – Values of correlation function given at points specified in the TimeAxis object
quantarhei.qm.corfunctions.correlationfunctions.h2g(timeaxis, coft)[source]

Integrates and integrated correlation function

Explicit numerical integration of the correlation function to form a precursor to the lineshape function.

Parameters:
  • timeaxis (TimeAxis) – TimeAxis of the correlation function
  • coft (complex numpy array) – Values of correlation function given at points specified in the TimeAxis object
quantarhei.qm.corfunctions.correlationfunctions.oscillator_scalled_CorrelationFunction(time, params, omega, target_time, Nmax=5, HR=0.01, silent=True)[source]

Scales reorganization energy of the system-bath interaction

Returns a bath correlation function with reorganization energy called such that it achieves a required relaxation time between the first vibrationally excited and the ground state of an oscillator with a given frequency.

Parameters:
  • time (TimeAxis) – The time axis on which the correlation function is defined
  • params (dictionary) – A dictionary of the correlation function parameters. Requires the “reorg” item.
  • omega (float) – Frequency/energy of the oscillator
  • target_time (float) – The requested relaxation time in fs
  • Nmax (int) – The mumber of harmonic oscillator levels used for the calculation Default is 5.
  • HR (float) – Huang-Rhys factor to be used in the calculation. Default is 0.1.
  • silent (bool) – If silent is not True, some info about internal calculations is printed.

Examples

>>> omega = 200.0
>>> target_time = 100.0

Defining correltion function and time axis

>>> time = TimeAxis(0.0, 1000, 1.0)
>>> params = dict(ftype="OverdampedBrownian", T=300, cortime=30.0,
...          reorg=100.0, matsubara=30)
>>> with energy_units("1/cm"):
...     cf = oscillator_scalled_CorrelationFunction(time, params, omega,
...                                            target_time, Nmax=7, HR=0.3)
>>> print("%10.5f" % params["reorg"])
  32.97806