influence_spectrum

class libra_py.influence_spectrum.TestDatautils(methodName='runTest')[source]
test_1()[source]

Tests find_maxima(s, verbose=0, filename=”run.log”)

test_2()[source]

Tests scalar_stat(X)

test_3()[source]

Tests matrix_stat(X)

test_4()[source]

Tests matrix_freqs(X, a, b, dt, prefix, Nfreqs, verbose = [1,1,1], dw = 1.0, wspan = 3000.0, logfile=None)

libra_py.influence_spectrum.compute_all(X, params)[source]

Computes the frequencies with which all matrix elements evolve in time

In particular, we are interested only in the frequencies of the real part of diagonal elements and in frequencies of imaginary part of non-diagonal elements. This is a typical situation for the “vibronic” Hamiltonian data in the NA-MD

Parameters
  • X (list of CMATRIX) – time-series data of complex matrices, e.g. “vibronic” Hamiltonian

  • params (dictionary) – parameters controlling the execution of :funct:`compute_mat_elt` function ..seealso::compute_mat_elt for the full description of the required and allowed parameters and the default values

Returns

freqs, such that

  • freqs[a][b][fr][0] ( double ): frequency of the mode fr for the matrix element X_ab [in 2*pi*a.u.^-1]

  • freqs[a][b][fr][1] ( double ): amplitude of the mode fr in the influence

    spectrum for the matrix element X_ab [arb. units]

  • freqs[a][b][fr][2] ( double ): normalized amplitued of the mode fr for the matrix

    element X_ab [arb.units]

Return type

list[nstates][nstates][nfreqs][3]

libra_py.influence_spectrum.compute_mat_elt(X, a, b, params)[source]

Computes the frequencies with which a given matrix element evolves in time

Parameters
  • X (list of MATRIX) – time-series data

  • a (int) – is the row index of the matrix element to analyze

  • b (int) – is the column index of the matrix element to analyze

  • params (dictionalry) –

    parameters of the simulation. Contain the following keys: * params[“filename”] ( string ): the prefix of the filenames generated. Doesn’t matter

    if do_output == False [default: “influence_spectra_”]

    • params[“logname”] ( string ): the name of the log-file. Doesn’t matter

      if do_output == False [default: “out.log”]

    • params[“nfreqs”] ( int ): the maximal number of frequencies we want to extract [default: 1]

    SeeAlso: recipe1(data, params) for the description of other parameters:

    • dr

    • wspan

    • dw

    • do_output

    • acf_filename

    • spectrum_filename

    • do_center

    • acf_type

    • data_type

Returns

( T, norm_acf, raw_acf, W, J, J2, freqs ), where

freqs ( list of lists ), where

  • freqs[fr][0] - frequency of the mode fr [in 2*pi*a.u.^-1]

  • freqs[fr][1] - amplitude of the mode fr in the influence spectrum [arb. units]

  • freqs[fr][2] - normalized amplitued of the mode fr [arb.units]

SeeAlso: The first 6 outputs are described in the recipe1
  • T

  • norm_acf

  • raw_acf

  • W

  • J

  • J2

Return type

tuple

libra_py.influence_spectrum.recipe1(data, params)[source]

A recipe to compute ACF and its FT for data series

Parameters
  • data (list of MATRIX(ndof, 1) objects) – sequence of real-valued ndof-dimensional vectors

  • params (Python dictionary) –

    controlling the parameters

    • params[“dt”] ( double ): time distance between the adjacent data points [units: fs, default: 1.0]

    • params[“wspan”] ( double ): window of frequencies for the Fourier transform [ units: cm^-1, default: 3000.0 ]

    • params[“dw”] ( double ): grid points spacing in the frequency domain [ units: cm^-1, default: 1.0 ]

    • params[“do_output”] ( Boolean ): whether we print out the data the results into files [ default: False ]

    • params[“acf_filename”] ( string ): the name of the file where to print the ACF [ default: “acf.txt”]

    • params[“spectrum_filename”] ( string ): the name of the file where to print the spectrum [ default: “spectrum.txt” ]

    • params[“do_center”] ( Boolean ): a flag controlling whether to center data (=1) or not (=0)

      Centering means we subtract the average value (over all the data points) from all the data points - this way, we convert values into their fluctuations [default: True ]

    • params[“acf_type”] ( int ): selector of the convention to to compute ACF

      • 0 : the chemist convention, (1/(N-h)) Sum_{t=1,N-h} (Y[t]*Y[t+h]) [ default ]

      • 1 : the statistician convention, (1/N) Sum_{t=1,N-h} (Y[t]*Y[t+h])

    • params[“data_type”] ( int ): what is the format of the data?

      • 0 : list of MATRIX(ndof, 1) [ default ]

      • 1 : list of VECTOR

Returns

(T, norm_acf, raw_acf, W, J, J2), where:

  • T ( list of double ): time axis [ units: fs ]

  • norm_acf ( list of double ): normalized ACF

  • raw_acf ( list of double ): un-normalized ACF

  • W ( list of double ): frequencies axis [ units: cm^-1 ]

  • J ( list of double ): amplitudes of FT

  • J2 ( list of double ): (1/2pi)*|J|^2

Return type

tuple