Skip to content

SH: Remove NSTMAX#125

Merged
danielhollas merged 5 commits intomasterfrom
refactor-sh
May 9, 2022
Merged

SH: Remove NSTMAX#125
danielhollas merged 5 commits intomasterfrom
refactor-sh

Conversation

@danielhollas
Copy link
Copy Markdown
Contributor

Allocate all SH arrays dynamically based on the number of states.

@danielhollas danielhollas added the refactor No functional changes, just refactoring or cleaning up the code. label Apr 28, 2022
@danielhollas danielhollas self-assigned this Apr 28, 2022
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2022

Codecov Report

Merging #125 (4ef1b3d) into master (e93cd97) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #125      +/-   ##
==========================================
+ Coverage   94.31%   94.33%   +0.02%     
==========================================
  Files          42       42              
  Lines        5841     5862      +21     
==========================================
+ Hits         5509     5530      +21     
  Misses        332      332              
Flag Coverage Δ
unittests 25.92% <0.00%> (-0.10%) ⬇️

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

Impacted Files Coverage Δ
src/forces.F90 98.33% <ø> (ø)
src/init.F90 90.98% <ø> (ø)
src/modules.F90 100.00% <ø> (ø)
src/nosehoover.F90 96.52% <ø> (ø)
src/force_terash.F90 94.85% <100.00%> (+0.03%) ⬆️
src/landau_zener.F90 88.66% <100.00%> (+0.13%) ⬆️
src/sh_integ.F90 98.03% <100.00%> (+0.17%) ⬆️
src/surfacehop.F90 95.13% <100.00%> (-0.06%) ⬇️

@danielhollas danielhollas requested a review from suchanj April 28, 2022 13:09
Comment thread src/landau_zener.F90 Outdated
real(DP), allocatable :: px_temp(:, :), py_temp(:, :), pz_temp(:, :)
real(DP), allocatable :: x_prev(:, :), y_prev(:, :), z_prev(:, :), &
vx_prev(:, :), vy_prev(:, :), vz_prev(:, :)
! TODO: Is this array needed? Are we not computing gradients for only one state?
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@suchanj I am wondering, in LZ do you ever compute gradients for more than one state?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No, not right now, however we might if J. Janoš implements his PES by gradient integration method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, great, I'll remove this comment then.

Comment thread src/modules.F90
! mod_array_size contains various array limits.
! Modify here if you need larger arrays.
! Most of the other arrays are allocated dynamically.
module mod_array_size
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🎉

Comment thread src/surfacehop.F90

! Initial electronic state
integer :: istate_init = 1
integer :: istate_init = -1
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have changed the default to invalid number so that users don't forget to set initial state.

@danielhollas danielhollas marked this pull request as ready for review April 28, 2022 13:26
Comment thread src/landau_zener.F90
!Initial state
istate_lz = initstate_lz

allocate (tocalc_lz(nstate_lz))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing deallocate in finalize routine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks good catch. While we're here, could you check in lz_finalize that at least one of the arrays is indeed allocated? Otherwise if lz_fibalize is called before lz_init we'd get runtime error.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yep, good idea, done.

@danielhollas danielhollas merged commit 805950e into master May 9, 2022
@danielhollas danielhollas deleted the refactor-sh branch May 9, 2022 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor No functional changes, just refactoring or cleaning up the code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants