@@ -1120,6 +1120,63 @@ void propagate_electronic(dyn_variables& dyn_var, nHamiltonian* Ham, nHamiltonia
11201120
11211121}
11221122
1123+ void renormalize_hopping_probabilities (vector< vector<double > >& g, vector< vector<vector<double > > >& coherence_factors, vector<int >& act_states){
1124+ /* *
1125+ Scale the hopping probabilities by the factors and ensure the sum of all
1126+ hopping probabilities is still 1
1127+
1128+ g[itraj][i] - hopping probability from the current active state for the trajectory itraj to the state i
1129+
1130+ act_states[itraj] - the active state for the trajectory itraj
1131+
1132+ coherence_factors[itraj][i][j] - the scaling of the hopping probability from state i to state j for the trajectory itraj
1133+
1134+
1135+ Result: the g vector is modified
1136+ */
1137+ int ntraj = g.size ();
1138+ int nstates = coherence_factors[0 ].size ();
1139+
1140+ for (int itraj=0 ; itraj<ntraj; itraj++){
1141+ int a = act_states[itraj];
1142+ double sum = 0.0 ;
1143+ for (int j=0 ;j<nstates; j++){
1144+ if (j!=a){
1145+ double val = g[itraj][j] * coherence_factors[itraj][a][j];
1146+ sum += val;
1147+ g[itraj][j] = val;
1148+ }
1149+ }// for j
1150+ // The self-element:
1151+ g[itraj][a] = 1.0 - sum;
1152+ if (g[itraj][a]<0 ){ g[itraj][a] = 0.0 ; }
1153+
1154+ }// for itraj
1155+
1156+ }
1157+
1158+ void reset_coherence_factors (vector< vector<vector<double > > >& coherence_factors, vector<int >& act_states, vector<int >& old_states){
1159+
1160+ int ntraj = coherence_factors.size ();
1161+ int nstates = coherence_factors[0 ].size ();
1162+
1163+ for (int itraj=0 ; itraj<ntraj; itraj++){
1164+ if ( act_states[itraj] != old_states[itraj]){
1165+ // If the hop has happened for this trajectory, we start
1166+ // new evolution of the wavepackets on all the surfaces
1167+ // so we have to reset all the coherence factors to 1.0
1168+ for (int i=0 ; i<nstates; i++){
1169+ for (int j=0 ; j<nstates; j++){
1170+ coherence_factors[itraj][i][j] = 1.0 ;
1171+ }// for j
1172+ }// for i
1173+
1174+ }// if
1175+ }// for itraj
1176+
1177+ }
1178+
1179+
11231180void compute_dynamics (dyn_variables& dyn_var, bp::dict dyn_params,
11241181 nHamiltonian& ham, nHamiltonian& ham_aux, bp::object py_funct, bp::dict params, Random& rnd,
11251182 vector<Thermostat>& therm){
@@ -1151,7 +1208,7 @@ void compute_dynamics(dyn_variables& dyn_var, bp::dict dyn_params,
11511208
11521209// cout<<"In compute_dynamics\n";
11531210 // ======== General variables =======================
1154- int i, cdof, traj, dof, idof, ntraj1;
1211+ int i, j, cdof, traj, dof, idof, ntraj1;
11551212
11561213 // ========= Control parameters variables ===========
11571214 dyn_control_params prms;
@@ -1378,7 +1435,7 @@ void compute_dynamics(dyn_variables& dyn_var, bp::dict dyn_params,
13781435 }
13791436
13801437 else if (prms.decoherence_times_type ==5 ){
1381- decoherence_rates = Gu_Franco (prms, *dyn_var.ampl_adi );
1438+ decoherence_rates = Gu_Franco (prms, *dyn_var.ampl_adi );
13821439 }
13831440
13841441 // /== Optionally, apply the dephasing-informed correction ==
@@ -1435,7 +1492,19 @@ void compute_dynamics(dyn_variables& dyn_var, bp::dict dyn_params,
14351492 }
14361493
14371494 // DISH, rev2023
1438- if (prms.decoherence_algo ==7 ){ dish_rev2023 (dyn_var, ham, decoherence_rates, prms, rnd); }
1495+ else if (prms.decoherence_algo ==7 ){ dish_rev2023 (dyn_var, ham, decoherence_rates, prms, rnd); }
1496+
1497+ // Simple decoherence
1498+ else if (prms.decoherence_algo ==9 ){
1499+ for (traj=0 ; traj<ntraj; traj++){
1500+ for (i=0 ; i<nadi; i++){
1501+ for (j=0 ; j<nadi; j++){
1502+ double argg = decoherence_rates[traj].get (i,j) * prms.dt ;
1503+ dyn_var.coherence_factors [traj][i][j] *= exp ( - argg * argg );
1504+ }// for j
1505+ }// for i
1506+ }// for traj
1507+ }// simple decoherence
14391508
14401509
14411510 // Update amplitudes and density matrices in response to decoherence corrections
@@ -1467,6 +1536,11 @@ void compute_dynamics(dyn_variables& dyn_var, bp::dict dyn_params,
14671536 vector< vector<double > > g;
14681537 g = hop_proposal_probabilities (prms, dyn_var, ham, ham_aux);
14691538
1539+ // simple decoherence correction
1540+ if (prms.decoherence_algo ==9 ){ // intended only for adiabatic states for now
1541+ renormalize_hopping_probabilities (g, dyn_var.coherence_factors , dyn_var.act_states );
1542+ }
1543+
14701544 // Propose new discrete states for all trajectories
14711545 vector<int > prop_states (ntraj, 0 );
14721546 if (prms.rep_sh ==1 ){
@@ -1511,7 +1585,11 @@ void compute_dynamics(dyn_variables& dyn_var, bp::dict dyn_params,
15111585 prms.instantaneous_decoherence_variant , prms.collapse_option );
15121586 }
15131587 else { cout<<" ERROR: Instantaneous Decoherence requires rep_tdse = 1\n Exiting now...\n " ; exit (0 ); }
1514- }// algo == 6
1588+ }// algo == 8
1589+
1590+ else if (prms.decoherence_algo ==9 ){ // simple decoherence method
1591+ reset_coherence_factors (dyn_var.coherence_factors , act_states, old_states);
1592+ }// algo == 9
15151593
15161594 }
15171595 // DISH - the old one
@@ -1522,6 +1600,7 @@ void compute_dynamics(dyn_variables& dyn_var, bp::dict dyn_params,
15221600 }// DISH
15231601
15241602
1603+
15251604 // ====================== Momenta adjustment after successful/frustrated hops ===================
15261605 // Velocity rescaling: however here we may be changing velocities
15271606 if (prms.rep_sh ==1 ){
0 commit comments