def compute_tnacs(hvib):
    """
    Computes the time-averaged nonadiabatic couplings for a given hvib.
        hvib ( list of list of matrices ): The vibronic hamiltonian for all timesteps
    returns: a matrix of time-averaged nonadiabatic couplings between all electronic states
             in meV
    """
    nstates = hvib[0].num_of_rows
    nacs = data_stat.cmat_stat2(hvib, 2)
    mb_tnacs = []
    for i in range(nstates):
        mb_tnacs.append([])
        for j in range(nstates):
            mb_tnacs[i].append(nacs.get(i, j).imag * 1000.0 / units.ev2Ha)
    return np.array(mb_tnacs)
    Hvib, 1.053
)  # this rescaling (of NACs) is performed as the SLG did get thermalized aroung 260-280K rather than 300K

# shifting the energy levels
data_conv.scissor(
    Hvib, 0, -1.00 / 27.2114
)  # all SD state energies are lowered by -1.06 eV as a result of lowering energy of ZnPc's H state by -1.06 eV
data_conv.scissor(
    Hvib, 2, -0.40 / 27.2114
)  # energies of  2 and 3 SD states are lowered more by -0.33 eV as a result of lowering energies of ZnPc's L and L+1 states by -0.33 eV

# """  # to switch on and off the shifting/rescaling

# Compute tNAC map
opt = 2
Hvib_ave = data_stat.cmat_stat2(Hvib[0], opt)
data_outs.show_matrix_splot((1000.0 / units.ev2Ha) * Hvib_ave.imag(),
                            "_tnac_61_pc1sr1.txt",
                            set_diag_to_zero=0)

#  calculations of the decoherence times

tau, rates = decoherence_times.decoherence_times_ave(Hvib, [0],
                                                     params["fsnap"], 0)
avg_deco = tau * units.au2fs
avg_deco.show_matrix()

# Compute average band gap:
# avg_gap = decoherence_times.energy_gaps_ave(Hvib, [0], nsteps)

# 5. Nonadiabatic Dynamics