<div dir="ltr"><div>Hello CP2K Developers,</div><div><br></div><div>I am working on calculating electronic coupling element using a transformation of MO sets obtained for two different states A and B (in GPAW formalism). For this purpose I need to pass a modified density, which is non-symmetric, to make one more energy calculation. I am passing the force_env to a separate module from a mixed_energy calculation, where I am doing the following calls with the modified density:<br></div><div><br></div><div>1. CALL qs_rho_get(rho, rho_ao=rho_ao, rho_ao_kp=rho_ao_kp)<br></div><div>2. rho_ao_kp(1:nspins, 1:1) => density_modified(1:nspins)            ! density_modified is a dbcsr_type_no_symmetry matrix<br>3. rho_ao => density_modified<br>4. CALL qs_rho_set(rho, rho_ao=rho_ao, rho_ao_kp=rho_ao_kp)</div><div>5. CALL qs_rho_update_rho(rho, qs_env=qs_env)<br>6. CALL qs_ks_did_change(ks_env, rho_changed=.TRUE., potential_changed=.TRUE.)<br></div><div>7. CALL qs_ks_update_qs_env(qs_env, just_energy=.TRUE., calculate_forces=.FALSE.)<br><br></div><div> I could get the first 6 steps right when I am doing a serial version. First question is whether my approach is correct in order to do another energy calculation with the new modified density?  I am trying to follow the same process as an scf loop update here, and using the qs_env for state B since only the density changes and rest all parameters remain same.<br></div><div><br></div><div>I had a problem with the core matrix trace calculations, which I solved by desymmetrizing <i>matrixkp_h</i> and <i>matrixkp_t </i>before passing to <i>calculate_ptrace()</i>, and that worked well. Now I am having a trouble with hfx calculation, in particular, in <i>hfx_energy_potential.F -> integrate_four_center() -> get_full_density() </i>subroutine. In <i>get_full_density()</i> subroutine, <i>number_of_p_entries</i> doesn't seem to match the new non-symmetric density matrix which results in the <i>sendbuffer (</i><i><i>hfx_communication.F: line 145)</i> </i>going out of bounds. The conditional statement with <i>dbcsr_iterator_blocks_left(iter)</i> is still true and is causing an out of bounds error. Can you please suggest a fix for this?  <br></div><div><br></div><div>Another naive question: Other than this are there any parts of build kohn-sham matrix routine that are resistant to a non-symmetric density matrix?<br></div><div><br></div><div>On a separate note, there is a harmless bug in the <i>write_matrix_gen()</i> subroutine where the string formats are interchanged for the omit_header cases at output (lines 544 and 587) which gives an unformatted transfer error during run-time.  <br></div><div><br></div><div><br></div><div>Thank you very much for your time, and please let me know if the questions are ambiguous, I will try to provide more information.</div><div><br></div><div>Best Regards,</div><div>Pavan.<br></div></div>