Skip to content

Commit

Permalink
Changing mom_adjust to velocity_rescaling
Browse files Browse the repository at this point in the history
  • Loading branch information
JanosJiri committed Nov 30, 2024
1 parent 4e3e36d commit f1cc175
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion sample_inputs/input.in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ inose=0, ! NVE ensemble (thermostat turned OFF)
istate_init=2, ! initial electronic state (1 is ground state)
nstate=3, ! number of electronic states
couplings='analytic', ! non-adiabatic coupling terms 'analytic', 'baeck-an', 'none'
mom_adjust='nac' ! momentum adjustment along either 'nac' or 'velocity'
velocity_rescaling='nac_then_velocity' ! momentum adjustment along either 'nac_then_velocity' or 'velocity'
deltaE=2.0, ! maximum energy difference (eV) between states for which we calculate NA coupling
PopThr=0.001, ! minimum population of either state, for which we compute NA coupling
EnergyDifThr=0.50, ! maximum energy difference between two consecutive steps
Expand Down
24 changes: 12 additions & 12 deletions src/surfacehop.F90
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ module mod_sh
integer :: nohop = 0

! How to adjust velocity after hop:
! mom_adjust = 'nac' (adjmom=0) - Adjust velocity along the NAC vector (default)
! mom_adjust = 'velocity' (adjmom=1) - Simple velocity rescale
! NOTE: Simple v-rescale is invoked as a fallback
! if there is not enough momentum along the NAC vector.
! velocity_rescaling = 'nac_then_velocity' (adjmom=0) - Adjust velocity along the NAC vector, if not possible,
! try the velocity vector (default)
! velocity_rescaling = 'velocity' (adjmom=1) - Rescale along the velocity vector
integer :: adjmom = 0 ! for working within the code
character(len=50) :: mom_adjust = 'nac' ! for reading the input file
character(len=50) :: velocity_rescaling = 'nac_then_velocity' ! for reading the input file
! 1 - Reverse momentum direction after frustrated hop
integer :: revmom = 0

Expand Down Expand Up @@ -100,7 +99,7 @@ module mod_sh
integer :: ignore_state = 0

namelist /sh/ istate_init, nstate, substep, deltae, integ, couplings, nohop, phase, decoh_alpha, popthr, ignore_state, &
nac_accu1, nac_accu2, popsumthr, energydifthr, energydriftthr, mom_adjust, revmom, &
nac_accu1, nac_accu2, popsumthr, energydifthr, energydriftthr, velocity_rescaling, revmom, &
dE_S0S1_thr, correct_decoherence
save

Expand Down Expand Up @@ -259,23 +258,24 @@ subroutine check_sh_parameters()
error = .true.
end select

! converting input 'mom_adjust' into inac which is used in the code
select case (mom_adjust)
case ('nac')
! converting input 'velocity_rescaling' into inac which is used in the code
select case (velocity_rescaling)
case ('nac_then_velocity')
adjmom = 0
write (stdout, '(A)') 'Rescaling velocity along the NAC vector after hop.'
write (stdout, '(A)') 'If there is not enough energy, try rescaling along the velocity vector.'
case ('velocity')
adjmom = 1
write (stdout, '(A)') 'Rescaling velocity along the momentum vector after hop.'
case default
write (stderr, '(A)') 'Parameter "mom_adjust" must be "nac" or "velocity".'
write (stderr, '(A)') 'Parameter "velocity_rescaling" must be "nac_then_velocity" or "velocity".'

Check warning on line 271 in src/surfacehop.F90

View check run for this annotation

Codecov / codecov/patch

src/surfacehop.F90#L271

Added line #L271 was not covered by tests
error = .true.
end select

if (adjmom == 0 .and. inac == 1) then
write (stderr, '(A)') 'Combination of adjmom=0 and couplings="baeck-an" is not possible.'
write (stderr, '(A)') 'Combination of velocity_rescaling="nac_then_velocity" and couplings="baeck-an" is not possible.'
write (stderr, '(A)') 'Velocity cannot be rescaled along NAC when using Baeck-An.'
write (stderr, '(A)') 'Change adjmom=1 to rescale along momentum vector.'
write (stderr, '(A)') 'Change velocity_rescaling="velocity" to rescale along the velocity vector.'
error = .true.
end if

Expand Down
2 changes: 1 addition & 1 deletion tests/INIT/input.in.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ inose=0,
nstate=100
istate_init=101
integ='invalid'
mom_adjust='nac'
velocity_rescaling='nac_then_velocity' ! momentum adjustment along either 'nac_then_velocity' or 'velocity'
couplings='baeck-an'
nac_accu1=7
nac_accu2=8
Expand Down
2 changes: 1 addition & 1 deletion tests/SH_BAECK-AN/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PopThr=0.00001, ! minimum population of either state, for which we compu
EnergyDifThr=0.01, ! maximum energy difference between two consecutive steps
EnergyDriftThr=0.01, ! maximum energy drift from initial total energy
couplings='baeck-an'
mom_adjust='velocity'
velocity_rescaling='velocity'
/

&system
Expand Down
2 changes: 1 addition & 1 deletion tests/SH_FRUSTRATED/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ inose=0,
/

&sh
mom_adjust='nac'
velocity_rescaling='nac_then_velocity' ! momentum adjustment along either 'nac_then_velocity' or 'velocity'
revmom=1, ! Reverse momentum after frustrated hop
istate_init=2, ! initial electronic state
nstate=3, ! number of electronic states
Expand Down
2 changes: 1 addition & 1 deletion tests/SH_FRUSTRATED/input.in2
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ inose=0,
/

&sh
mom_adjust='nac'
velocity_rescaling='nac_then_velocity' ! momentum adjustment along either 'nac_then_velocity' or 'velocity'
istate_init=3, ! initial electronic state
nstate=3, ! number of electronic states
substep=100, ! number of substeps for solving ESCH
Expand Down
2 changes: 1 addition & 1 deletion tests/SH_SIMPLE_RESCALE/input.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ inose=0,
/

&sh
mom_adjust='velocity'
velocity_rescaling='velocity'
istate_init=3, ! initial electronic state
nstate=3, ! number of electronic states
substep=100, ! number of substeps for solving ESCH
Expand Down
2 changes: 1 addition & 1 deletion tests/SH_SIMPLE_RESCALE/input.in2
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ inose=0,
/

&sh
mom_adjust='velocity'
velocity_rescaling='velocity'
istate_init=3, ! initial electronic state
nstate=3, ! number of electronic states
substep=100, ! number of substeps for solving ESCH
Expand Down

0 comments on commit f1cc175

Please sign in to comment.