Skip to content

Commit

Permalink
Merge pull request #155 from sharc-md/sharc3preview
Browse files Browse the repository at this point in the history
Sharc3preview
  • Loading branch information
maisebastian authored Oct 11, 2024
2 parents 5f317e7 + 59e8cb2 commit ca9a7bb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
6 changes: 5 additions & 1 deletion bin/SHARC_MOLCAS.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,9 @@ def getcienergy(out, mult, state, version, method, dkh):
energystring = 'Total MC-PDFT energy for state'
stateindex = 5
enindex = 6
if version >= 24.06:
stateindex += 1
enindex += 1
elif method == 4:
modulestring = '&MCPDFT'
spinstring = 'Spin quantum number'
Expand Down Expand Up @@ -3334,7 +3337,8 @@ def setupWORKDIR(WORKDIR, tasks, QMin):
copyfiles.append(('MOLCAS.OrdInt', 'ORDINT'))

if QMin['method'] in [3,4,5]:
copyfiles.append(('GRIDFILE','GRIDFILE'))
if QMin['version'] < 24.06:
copyfiles.append(('GRIDFILE','GRIDFILE'))
copyfiles.append(('MOLCAS.NqGrid','MOLCAS.NqGrid'))

for ifile in copyfiles:
Expand Down
19 changes: 18 additions & 1 deletion source/qm.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,7 @@ subroutine Adjust_phases(traj,ctrl)
integer :: istate, jstate, ixyz
complex*16:: scalarProd(ctrl%nstates,ctrl%nstates)
complex*16 :: Utemp(ctrl%nstates,ctrl%nstates), Htemp(ctrl%nstates,ctrl%nstates)
logical :: all_unit_norm

! if phases were not found in the QM output, try to obtain it
if (traj%phases_found.eqv..false.) then
Expand Down Expand Up @@ -1551,6 +1552,16 @@ subroutine Adjust_phases(traj,ctrl)
endif ! if (ctrl%calc_overlap==1) then
endif

! check if phases have all norm 1
! all_unit_norm = .true.
do istate=1,ctrl%nstates
if ( (abs(traj%phases_s(istate)) - 1.d0) > 1.d-6 ) traj%phases_s(istate) = dcmplx(1.d0,0.d0)
enddo
! if (.not.all_unit_norm) then
! write(u_log,*) 'Not all phases have unit norm. Abort.'
! stop 1
! endif

! Patch phases for Hamiltonian, DM matrix ,NACs, Overlap
! Bra
do istate=1,ctrl%nstates
Expand Down Expand Up @@ -2127,6 +2138,7 @@ subroutine QM_processing(traj,ctrl)
endif
traj%overlaps_ss(istate,istate)=sqrt(1.d0-overlap_sum)
enddo
call lowdin(ctrl%nstates, traj%overlaps_ss)

if (printlevel>3) then
call matwrite(ctrl%nstates,traj%overlaps_ss,u_log,'Approximated overlap matrix from TDC (MCH basis)','F12.9')
Expand Down Expand Up @@ -2246,14 +2258,19 @@ subroutine NAC_processing(traj,ctrl)
! 3. projection variables
real*8 :: NACtmp_MCH(3*ctrl%natom), pNACtmp_MCH(3*ctrl%natom)
complex*16 :: NACtmp_diag(3*ctrl%natom), pNACtmp_diag(3*ctrl%natom)
complex*16 :: ctrans_rot_P(3*ctrl%natom,3*ctrl%natom)
complex*16, allocatable :: ctrans_rot_P(:,:) ! only allocate sometimes
! 5. Patch gmatrix
complex*16 :: Gmatrix_ss(ctrl%nstates,ctrl%nstates)
! 6. hopping direction and frustared hop velocity reflection vector variables
real*8 :: hopping_tmp(3*ctrl%natom), phopping_tmp(3*ctrl%natom)

character(255) :: string

! allocate only if needed for projection
if (allocated(traj%trans_rot_P)) then
allocate(ctrans_rot_P(3*ctrl%natom,3*ctrl%natom))
endif

if (printlevel>3) then
write(u_log,*) '============================================================='
write(u_log,*) ' NAC and Gradient processing'
Expand Down

0 comments on commit ca9a7bb

Please sign in to comment.