Skip to content

Add 'ignore_state' in Launda-Zener hopping #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 12, 2024
Merged

Conversation

danielhollas
Copy link
Contributor

@danielhollas danielhollas commented Nov 6, 2024

Another small bug (or perhaps rather a missing feature) found by Jack Taylor. Sometimes we want to calculate more electronic state (e.g. to make CASSCF more stable) but do not want to consider them in hoping algorithms. A prototypical example is simulating ethylene with SA3-CAS(2,2) starting from S1 and wanting to prevent hops to S2.

Also a minor refactoring to make more LZ stuff private to the mod_lz module.

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 84.21053% with 6 lines in your changes missing coverage. Please review.

Project coverage is 91.87%. Comparing base (094ba89) to head (48d32f9).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/landau_zener.F90 86.66% 4 Missing ⚠️
src/surfacehop.F90 50.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #185      +/-   ##
==========================================
- Coverage   91.90%   91.87%   -0.03%     
==========================================
  Files          47       47              
  Lines        6743     6758      +15     
  Branches      757      761       +4     
==========================================
+ Hits         6197     6209      +12     
- Misses        534      537       +3     
  Partials       12       12              
Flag Coverage Δ
unittests 20.37% <0.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/abin.F90 93.70% <ø> (-0.15%) ⬇️
src/force_abin.F90 94.15% <100.00%> (+0.19%) ⬆️
src/init.F90 90.76% <100.00%> (+0.25%) ⬆️
src/surfacehop.F90 95.44% <50.00%> (-0.38%) ⬇️
src/landau_zener.F90 89.70% <86.66%> (-0.34%) ⬇️

@danielhollas danielhollas changed the title Fix: Respect 'ignore_state' in Launda-Zener hopping Add 'ignore_state' in Launda-Zener hopping Nov 6, 2024
@@ -68,12 +68,6 @@ program abin
write (stdout, '(A)') 'Job started at: '//trim(get_formatted_date_and_time(time_start))
write (stdout, *) ''

! LZ warning for too many states
if (ipimd == 5 .and. (nsinglet_lz > 2 .or. ntriplet_lz > 2)) then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this check to lz_init

@@ -68,31 +68,6 @@ subroutine write_sh_data(nstate, tocalc)
close (u)
end subroutine write_sh_data

subroutine write_lz_data(nstate, nsinglet, ntriplet, tocalc)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to mod_lz so that nsinglet_lz and ntriplet_lz can be private

@@ -177,7 +241,8 @@ subroutine lz_hop(x, y, z, vx, vy, vz, fxc, fyc, fzc, amt, dt, eclas, chpot)

do ist1 = ibeg, iend
if (ist1 == ist) cycle
! only closest states are considered for hopping
if (ist1 == ignore_state) cycle
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the important bit!

if [[ -e input.in2 ]];then
$ABINEXE -i input.in2 >> $ABINOUT 2>&1 || true
# for testing restart, only execute if previous run did not fail
if [[ -f input.in2 && $? -eq 0 ]]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was annoying that even if a test failed, we were still running this second simulation (which is bound to fail as well)

Copy link
Contributor

@JanosJiri JanosJiri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good, I don't see any problems.

Copy link
Contributor

@suchanj suchanj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a clever feature!

@danielhollas danielhollas merged commit 0d137a5 into master Nov 12, 2024
18 checks passed
@danielhollas danielhollas deleted the lz-ignore-state branch November 12, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants