Skip to content

Unnecessary repeat calculations in dynamics code #5

Description

@cerisola

As part of issue #2 about speeding up dynamics, I have noticed some unnecessary repeated calculations being done in the dynamics code. In particular, when computing the super operator the total Hamiltonian is created and diagonalised multiple times.

For example, in the super operator creation function, the following loop is run:

    for i in 1:dim(n)
        trans = transitions(prm, ang, n, i)
        ωb = trans[1]
        ATr = trans[2]
        len = length(ωb)
        ATot = sum(ATr[j] for j = 1:len)
        χ =/2)*sum(spectral_density_Ohm(ωb[j], prm)[i]*coth((ωb[j])/(2*T))*ATr[j] for j = 1:len) 
        Θ =/2)*sum(spectral_density_Ohm(ωb[j], prm)[i]*ATr[j] for j = 1:len)
        supop += - (ATot)*((χ) - (χ)) + (ATot)*((χ) - (χ)) + (ATot)*((Θ) + (Θ)) - (ATot)*((Θ) + (Θ))
    end

the function transitions is called multiple times. Inside of each call this code is run:

    H = HTot(prm, ang, n)
    A = jump(n)[i]
    d = hspace_size(n)
    table = zeros(d, d)
    bohr_freqs = Float64[]
    jump_ops = Any[]
    eval = eigen(H).values
    evec = eigen(H).vectors

which means that for each call to transitions, the total Hamiltonina is computed and diagonals (twice of each call). This is probably a leading cause for the heavy slowdown when going to more levels in the RCs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions