예제 #1
0
# 4.0 Compute the mid-point energies and time-overlaps according to the energy ordered SDs.
St_sd = []
E_sd  = []
res_dir_sd = "res_sd"
os.system("rm -r "+res_dir_sd )
os.system("mkdir "+res_dir_sd )
for step in range(finish_time-start_time-1):
    E_sd.append ( 0.5 * (E_sd_sorted[step] + E_sd_sorted[step+1]) )
    St_sd.append( mapping.ovlp_mat_arb( basis_sorted[step], basis_sorted[step+1], St_ks[0][step], use_minimal=False ) )




####################
# 5.0. Apply state reordering and/or phase corrections to the St_sd data
params["do_state_reordering"]    = 2
params["state_reordering_alpha"] = 0.0
step3.apply_state_reordering_general(St_sd, E_sd, params)
step3.apply_phase_correction_general( St_sd )

# 4. Form Hvib_sd
Hvib_sd = []
for step in range(finish_time-start_time-1):
    hvib_sd = E_sd[step] + 0.5j/dt * (St_sd[step] - St_sd[step].H())
    Hvib_sd.append( hvib_sd )
    Hvib_sd[step].real().show_matrix("%s/Hvib_sd_%d_re" % (res_dir_sd, step))
    Hvib_sd[step].imag().show_matrix("%s/Hvib_sd_%d_im" % (res_dir_sd, step))
    St_sd[step].real().show_matrix("%s/St_%d_re" % (res_dir_sd, step))
#sys.exit(0)

SD2CI = step3.make_T_matricies( ci_coefficients, ci_basis_states, spin_components, sd_states_unique_sorted, num_excited_states, istep, fstep, res_dir )
#sys.exit(0)

# 4.3. Transform from single-particle to many-body (CI) basis
S_ci, St_ci  = [], []
for step in range( fstep - istep ):
    s_ci  = SD2CI[step].H() * S_sd[step]  * SD2CI[step]
    S_ci.append(  s_ci  )
for step in range( fstep - istep - 1 ):
    st_ci = SD2CI[step].H() * St_sd[step] * SD2CI[step+1]
    St_ci.append( st_ci )

# 4.4. Apply orthonormalization to the many-body basis, apply state reordering, apply phase corrections
step3.apply_orthonormalization_general( S_ci, St_ci )
params2 = {"do_state_reordering":2, "state_reordering_alpha":0}
step3.apply_state_reordering_general( St_ci, ci_midpoint_energies, params2 )
step3.apply_phase_correction_general( St_ci )

# 4.5. Output many-body basis overlaps and time-overlaps to the res directory
print("Outputting the CI data to the res directory..." )
for step in range( fstep - istep ):
    S_ci[step].real().show_matrix("%s/S_ci_%d_re" % (res_dir, int(istep+step)))
for step in range( fstep - istep - 1 ):
    St_ci[step].real().show_matrix("%s/St_ci_%d_re" % (res_dir, int(istep+step)))

# 4.6. Make the Hvib in the many-body basis
for step in range( fstep - istep - 1 ):
    ci_nacs = (  0.5j / dt ) * CMATRIX ( ( St_ci[step] - St_ci[step].H() ).real() )    
    ci_hvib = ci_midpoint_energies[step] - ci_nacs
    ci_hvib.real().show_matrix("%s/Hvib_ci_%d_re" % (res_dir, int( istep+step )))
    ci_hvib.imag().show_matrix("%s/Hvib_ci_%d_im" % (res_dir, int( istep+step )))