Skip to content

Commit

Permalink
Writing nacme_all.dat only for inac==0.or.2
Browse files Browse the repository at this point in the history
  • Loading branch information
JanosJiri committed Nov 11, 2024
1 parent 9e4d031 commit 98fac22
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/files.F90
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ subroutine files_init(isbc, phase, ndist, nang, ndih)
open (UPOP, file=chfiles(UPOP), access=chaccess, action='write')
open (UPROB, file=chfiles(UPROB), access=chaccess, action='write')
open (UPES, file=chfiles(UPES), access=chaccess, action='write')
open (UNACME, file=chfiles(UNACME), access=chaccess, action='write')
!note, UNACME is now opened in mod_sh since we don't use it for inac==1
open (UDOTPROD, file=chfiles(UDOTPROD), access=chaccess, action='write')

if (idebug > 1) then
Expand Down Expand Up @@ -230,6 +230,22 @@ subroutine files_init(isbc, phase, ndist, nang, ndih)

end subroutine files_init

subroutine nacmefile_init()
use mod_general, only: irest
character(len=10) :: chaccess

! Here we ensure, that previous files are deleted
if (irest == 0) then
chaccess = 'SEQUENTIAL'
else
chaccess = 'APPEND'
end if

! open file
open (UNACME, file=chfiles(UNACME), access=chaccess, action='write')

end subroutine nacmefile_init

subroutine print_file_headers()
use mod_general, only: ipimd, natom
use mod_system, only: names
Expand Down
4 changes: 4 additions & 0 deletions src/surfacehop.F90
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ subroutine sh_init(x, y, z, vx, vy, vz)
use mod_general, only: irest, natom, pot
use mod_interfaces, only: force_clas
use mod_kinetic, only: ekin_v
use mod_files, only: nacmefile_init
real(DP), intent(inout) :: x(:, :), y(:, :), z(:, :)
real(DP), intent(in) :: vx(:, :), vy(:, :), vz(:, :)
real(DP) :: dum_fx(size(x, 1), size(x, 2))
Expand Down Expand Up @@ -174,6 +175,9 @@ subroutine sh_init(x, y, z, vx, vy, vz)
dum_fx = 0.0D0; dum_fy = 0.0D0; dum_fz = 0.0D0
call force_clas(dum_fx, dum_fy, dum_fz, x, y, z, dum_eclas, pot)

! open nacme_all.dat for all but baeck-an couplings
if (inac /= 1) call nacmefile_init()

! When restarting, initial SH WF was already read from the restart file
if (irest == 0) then
call sh_set_initialwf(istate)
Expand Down

0 comments on commit 98fac22

Please sign in to comment.