sharc-md / sharc

The SHARC molecular dynamics (MD) program suite is an ab initio MD software package developed to study the excited-state dynamics of molecules.
https://www.sharc-md.org
GNU General Public License v3.0
59 stars 31 forks source link

Gradient equals 0 after hop #112

Closed MartinPeschel closed 1 month ago

MartinPeschel commented 2 months ago

Hi Sebastian,

I encountered a problem when running a trajectory with only singlet states. Directly after a hop, the gradient is 0, which leads to a jump in energy one timestep later.

output lis: 8 4.00000 3 3 1.260918 9.031719 10.292637 0.090558 2.506170 1.000000 0.963331 0.000000 11 9 4.50000 3 3 1.409317 8.872143 10.281460 0.095653 2.927508 1.000000 1.054694 0.000000 10 \# Surface Hop/Pointer State Switch: new state= 2 old state= 3 randnum= 0.807863438 10 5.00000 2 2 1.600459 8.681001 10.281460 0.104715 0.000000 1.000000 0.000000 0.000000 19 11 5.50000 2 2 1.648644 8.552143 10.200787 0.105798 1.427625 1.000000 1.223413 0.000000 11

I appended an example that illustrates the problem when using the ORCA interface, but at least on a surface-level look, the problem appears with other interfaces as well (although I can not test them all). Thus, it seems that the issue lies with SHARC and not the interface.

Could you have a look at it?

Best, Martin

TRAJ_00001.zip

maisebastian commented 2 months ago

Hi Martin, this indeed seems to be a bug that appears with gradient selection. Apparently, some of the gradient processing code was moved in SHARC 3, and thus not executed after SHARC fetched the extra gradient needed after the hop.

The bug is now fixed in the main branch (the commit is called "sharc.x/pysharc: fixed zero gradient after some hops").

Note that for some interfaces/methods, the expectation value of the dipole moment (in output.lis) after a hop will still be zero. This will happen for methods that only provide a state dipole moment if the excited-state gradient is calculated (all TDDFT and ADC(2) interfaces). This is because after the hop, only the extra gradients are fetched, but the dipole moment matrices are not re-requested.

Best, Sebastian

MartinPeschel commented 1 month ago

Hi Sebastian,

i installed the bugfix and it works. I am closing the issue.

Best, Martin