GLE for a harmonic oscillator

Contributed by George Trenins and Hannah Bertschi.

tools.gle.wnle_cqq(t: float | ndarray, beta: float, omega: float, tau: float, m: float | None = 1)[source]

Position auto-correlation function for a harmonic oscillator at thermal equilibrium, under the action of a white-noise Langevin equation thermostat (WNLE).

Parameters:
  • t (numpy.ndarray) – time(s) for which to compute the covariance matrix

  • beta (float, optional) – reciprocal temperature \(1/k_B T\)

  • omega (float) – frequency of the harmonic oscillator

  • tau (float) – reciprocal of the friction, \(\tau = 1/\gamma\)

  • mass (float, optional) – mass of the harmonic oscillator

Returns:

covariance matrix

Return type:

numpy.ndarray

tools.gle.gle_cxx(t: float | ndarray, omega: float, Ap: float | ndarray, Cp: float | ndarray | None = None, C0: float | ndarray | None = None, u: float | ndarray | None = 0, beta: float | None = None, mass: float | None = 1.0) ndarray[source]

Calculate the covariance matrix \(\langle \mathbf{v}(0) \mathbf{v}(t)^{\intercal} \rangle\) where \(\mathbf{v}(t)^{\intercal} = (q, p, \mathbf{s}^{\intercal})\) are the position and momentum of a harmonic oscillator + the auxiliary variable coordinates. See https://doi.org/10.1021/ct900563s for the notation.

Parameters:
  • t (numpy.ndarray) – time(s) for which to compute the covariance matrix

  • omega (float) – frequency of the harmonic oscillator

  • Ap (numpy.ndarray) – the momentum + auxiliary variable block of the drift matrix

  • Cp (numpy.ndarray, optional) – this parametrises the random forces; if omitted, the equilibrium thermal distribution is imposed

  • C0 (numpy.ndarray, optional) – Covariance matrix at time 0 (see notes)

  • u (numpy.ndarray, optional) – a second time variable, such that \(\langle \mathbf{v}(s) \mathbf{v}(t)^{\intercal} \rangle\) is returned

  • beta (float, optional) – reciprocal temperature \(1/k_B T\)

  • mass (float, optional) – mass of the harmonic oscillator

Returns:

covariance matrix

Return type:

numpy.ndarray

Note

  • If C0 is not specified, the equilibrium distribution is assumed at \(t = 0\).

  • If a float is supplied, this is assumed to be the position variance, mass-weighted momenta are assumed to have a diagonal covariance \(1/\beta\)

  • If a 2x2 array is supplied, this is assumed to be the position-momentum covariance, auxilliary momenta are assumed to have a diagonal covariance \(1/\beta\)

  • Otherwise, the code expects a full (n+1,n+1) array, where n is the number of rows/columns in Ap.

tools.gle.get_Aqp(Ap: float | ndarray, omega: float) ndarray[source]
Parameters:
  • Ap (numpy.ndarray) – momentum + auxiliary variable block of the drift matrix, shape(n, n)

  • omega (float) – harmonic oscillator frequency

Returns:

full drift matrix, shape(n+1, n+1)

Return type:

numpy.ndarray

tools.gle.get_Dqp(Ap: float | ndarray, Cp: float | ndarray) ndarray[source]
Parameters:
  • Ap (numpy.ndarray) – the momentum + auxiliary variable block of the drift matrix, shape(n, n).

  • Cp (numpy.ndarray) – the corresponding \(\mathbf{C}_p\) matrix

Returns:

\(\mathbf{D}_{qp}\)-matrix [Eq (12) of https://doi.org/10.1021/ct900563s], shape(n+1, n+1).

Return type:

numpy.ndarray

tools.gle.get_Cqp(Aqp: float | ndarray, Dqp: float | ndarray) ndarray[source]

Compute the stationary covariance matrix for mass-weighted variables that solves

\[\mathbf{A}_{qp} \mathbf{C}_{qp} + \mathbf{C}_{qp} \mathbf{A}_{qp}^{\intercal} = \mathbf{B}_{qp} \mathbf{B}_{qp}^{\intercal} = \mathbf{B}_{qp}^{\intercal}\]

(see Appendix D of https://doi.org/20.500.11850/152344 for the algorithm)

Parameters:
  • Aqp (numpy.ndarray) – full drift matrix, shape(n+1, n+1)

  • Dqp (numpy.ndarray) – \(\mathbf{B}_{qp} \mathbf{B}_{qp}^{\intercal}\) where \(\mathbf{B}_{qp}\) is the diffusion matrix, shape(n+1, n+1)

Returns:

full stationary covariance matrix, shape(n+1, n+1)

Return type:

numpy.ndarray

tools.gle.get_Cqp_canonical(beta: float, n: int, omega: float) ndarray[source]

Compute the cacnonical covariance matrix for mass-weighted phase-space variables

Parameters:
  • beta (float) – reciprocal temperature \(1/k_B T\)

  • n (int) – size of the Ap block of the drift matrix (i.e. 1 + number of auxiliary variables)

  • omega (float) – harmonic oscillator frequency

Returns:

covariance matrix for the canonical ensemble, shape(n+1, n+1)

Return type:

numpy.ndarray