diff --git a/src/files.F90 b/src/files.F90 index c35032b7..21409cc7 100644 --- a/src/files.F90 +++ b/src/files.F90 @@ -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 @@ -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 diff --git a/src/surfacehop.F90 b/src/surfacehop.F90 index 6ebcb4a4..840d8407 100644 --- a/src/surfacehop.F90 +++ b/src/surfacehop.F90 @@ -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)) @@ -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)