def write_ETR(mtx, dt, i):
"""
Save the ETR in human readable format
"""
file_name = "electronTranferRates_fragment_{}.txt".format(i)
header = 'electron_Density electron_ETR(Nonadiabatic Adibatic) hole_density hole_ETR(Nonadiabatic Adibatic)'
# Density of Electron/hole
density_electron = mtx[1:, 0]
density_hole = mtx[1:, 3]
# Integrate the nonadiabatic/adiabatic components of the electron/hole ETR
int_elec_nonadia, int_elec_adia, int_hole_nonadia, int_hole_adia = [
integrate.cumtrapz(mtx[:, k], dx=dt) for k in [1, 2, 4, 5]]
# Join the data
data = np.stack(
(density_electron, int_elec_nonadia, int_elec_adia, density_hole,
int_hole_nonadia, int_hole_adia), axis=1)
# save the data in human readable format
np.savetxt(file_name, data, fmt='{:^3}'.format('%e'), header=header)
评论列表
文章目录