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: Any = None, params: Any = None, values: Any = None)[source]#
Bases:
DFunction,UnitsManagedBath (energy-gap) correlation function.
Provides several standard spectral-density models as analytical or numerically evaluated correlation functions. The type is selected via the
'ftype'key ofparams.- Parameters:
axis (TimeAxis) – Time grid on which the correlation function is evaluated.
params (dict or list of dict) – Parameter dictionary (or list of dictionaries for a composite correlation function). Must contain at least
'ftype','reorg', and'T'(temperature in Kelvin).values (numpy.ndarray, optional) – Pre-computed complex values of the correlation function at the time points of
axis. When supplied, the analytical evaluation is skipped.
- allowed_types = ('OverdampedBrownian-HighTemperature', 'OverdampedBrownian', 'OverdampedBrownian_from_Specdens', 'UnderdampedBrownian', 'Underdamped', 'B777', 'CP29', 'Value-defined')#
- analytical_types = ('OverdampedBrownian-HighTemperature', 'OverdampedBrownian')#
- energy_params = ('reorg', 'omega', 'freq', 'fcp', 'g_FWHM', 'l_FWHM', 'freq1', 'freq2', 'gamma')#
- energy_units: str#
- lamb: float | ndarray#
- temperature: float | ndarray#
- add_to_data(other: CorrelationFunction) None[source]#
Addition of data from a specified CorrelationFunction to this object
- add_to_data2(other: CorrelationFunction) None[source]#
Addition of data from a specified CorrelationFunction to this object
- reorganization_energy_consistent(rtol: float = 0.001) bool[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
- is_analytical() bool[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.
- get_reorganization_energy() float | ndarray[source]#
Returns the reorganization energy of the correlation function
- get_correlation_time() float | ndarray[source]#
Returns correlation time associated with the first component of the bath correlation function
- measure_reorganization_energy() float | ndarray[source]#
Calculates the reorganization energy of the correlation function
Calculates the reorganization energy of the correlation function by integrating its imaginary part.
- copy() CorrelationFunction[source]#
Creates a copy of the current correlation function
- get_SpectralDensity(fa: FrequencyAxis | None = None) Any[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_FTCorrelationFunction() 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() 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_EvenFTCorrelationFunction() 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
- class quantarhei.qm.corfunctions.correlationfunctions.LineshapeFunction(axis: Any = None, params: Any = None, values: Any = None, lfactor: int = 1)[source]#
Bases:
DFunction,UnitsManagedLineshape function obtained by double integration of a correlation function.
Computes
g(t) = int_0^t dt' int_0^{t'} dt'' C(t'')numerically, whereCis aCorrelationFunctionbuilt fromparams.- Parameters:
axis (TimeAxis) – Time grid on which the correlation function is defined.
params (dict) – Parameter dictionary for the underlying
CorrelationFunction. Must contain at least"ftype","reorg", and"T".values (numpy.ndarray, optional) – Pre-computed correlation function values; passed through to
CorrelationFunction. Default isNone.lfactor (int, optional) – Length multiplication factor applied to the time axis before integration. Default is
1.
- Raises:
Exception – If
paramsisNone.
- class quantarhei.qm.corfunctions.correlationfunctions.FTCorrelationFunction(axis: Any, params: Any, values: Any = None)[source]#
Bases:
DFunction,UnitsManagedFourier 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
- energy_params = ('reorg', 'omega', 'freq')#
- params: list[Any] | dict[Any, Any]#
- class quantarhei.qm.corfunctions.correlationfunctions.OddFTCorrelationFunction(axis: Any, params: Any, values: Any = None)[source]#
Bases:
DFunction,UnitsManagedOdd 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
- class quantarhei.qm.corfunctions.correlationfunctions.EvenFTCorrelationFunction(axis: Any, params: Any, values: Any = None)[source]#
Bases:
DFunction,UnitsManagedEven 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
- quantarhei.qm.corfunctions.correlationfunctions.c2g(timeaxis: TimeAxis, coft: ndarray) ndarray[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: TimeAxis, coft: ndarray) ndarray[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: TimeAxis, coft: ndarray) ndarray[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: TimeAxis, params: dict, omega: float, target_time: float, Nmax: int = 5, HR: float = 0.01, silent: bool = True) CorrelationFunction[source]#
Scales reorganization energy of the system-bath interaction
Returns a bath correlation function with reorganization energy scalled 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