params["nsteps"] = params["nfiles"]  # The length of the NA-MD trajectory
params["init_times"] = [0]  # starting points for sub-trajectories
params["do_output"] = True  # request to print the results into a file
params[
    "do_return"] = False  # request to not store the date in the operating memory

# For running NA-MD
start = time.time()
Hvib = step4.get_Hvib2(
    params)  # get the Hvib for all data sets, Hvib is a lists of lists
init_time = params["init_times"][0]
end = time.time()
print("Time to read / assemble data = ", end - start)

# Compute average decoherence time over entire trajectory
tau, rates = decoherence_times.decoherence_times_ave(
    Hvib, [init_time], params["nfiles"] - init_time, 0)
avg_deco = tau / units.fs2au
avg_deco.show_matrix()
"""
#====================== One case =====================
# Looking on the "SH" populations - NBRA-TSH approach
params["gap_min_exception"]  = 0
params["Boltz_opt"]          = 1                     # Option for the frustrated hops acceptance/rejection
params["Boltz_opt_BL"]       = 0                     # Option to incorporate hte frustrated hops into BL probabilities
params["outfile"]            = "_out_TSH_.txt"       # output file
params["evolve_Markov"]      = False                 # don't propagate Markov
params["evolve_TSH"]         = True                  # Rely on propagating trajectories
params["ntraj"]              = 100                   # how many stochastic trajectories
start = time.time()
res = lz.run(Hvib, params)
end = time.time()
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
params = {}

params["nfiles"] = 5997  # ex # of Hvib files to read for a given traj

for i in [0, 2, 3]:
    for j in [2, 3]:

        params[