Skip to content

Commit ab86839

Browse files
chselzChristian Selzer
authored andcommitted
extend --uhf keyword (grimme-lab#1368)
* extend --uhf keyword Signed-off-by: Christian Selzer <cselzer@uni-bonn.de> * fix typo Signed-off-by: Christian Selzer <cselzer@uni-bonn.de> --------- Signed-off-by: Christian Selzer <cselzer@uni-bonn.de> Co-authored-by: Christian Selzer <cselzer@uni-bonn.de> Signed-off-by: lmseidler <seidler118@gmail.com>
1 parent 1d36b52 commit ab86839

4 files changed

Lines changed: 45 additions & 7 deletions

File tree

src/oniom.f90

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,17 @@ subroutine singlepoint(self, env, mol, chk, printlevel, restart, energy, gradien
292292
! define inner region charge !
293293
inner_mol%chrg = real(set%oniom_settings%innerchrg)
294294

295+
! define inner region unpaired electrons
296+
inner_mol%uhf = set%oniom_settings%innerspin
297+
295298
! --cut flag termination !
296299
if (set%oniom_settings%cut_inner) then
297300

298301
write(env%unit,'(a)')
299302
write(env%unit,'(2x,72("-"))')
300303
write(env%unit,'(2x,"|",24x,a,1x,i0,22x,"|")') "INNER REGION CHARGE = ", nint(inner_mol%chrg)
304+
write(env%unit, '(2x,"|",24x,a,1x,i0,10x,"|")') "INNER REGION UNPAIRED ELECTRONS = ", inner_mol%uhf
305+
write(env%unit, '(2x,"|",24x,a,1x,i0,10x,"|")') "WHOLE REGION UNPAIRED ELECTRONS = ", mol%uhf
301306
write(env%unit,'(2x,72("-"))')
302307
write(env%unit,'(a)')
303308
call terminate(0)

src/prog/main.F90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,9 @@ subroutine xtbMain(env, argParser)
694694
if (.not. set%oniom_settings%fixed_chrgs) then
695695
set%oniom_settings%innerchrg = calculateCharge(calc, env, mol, chk)
696696
end if
697-
697+
if (.not. set%oniom_settings%fixed_spin) then
698+
set%oniom_settings%innerspin = mol%uhf
699+
end if
698700
end select
699701
!-------------------------------------------------------------------------
700702
!> DIPRO calculation of coupling integrals for dimers

src/set_module.f90

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,18 +1201,43 @@ end subroutine set_chrg
12011201

12021202

12031203
subroutine set_spin(env,val)
1204+
12041205
implicit none
1206+
12051207
character(len=*), parameter :: source = 'set_spin'
1208+
12061209
type(TEnvironment), intent(inout) :: env
1210+
12071211
character(len=*),intent(in) :: val
1212+
12081213
integer :: err
12091214
integer :: idum
1215+
integer :: ind, idum1, idum2
12101216
logical,save :: set1 = .true.
1217+
12111218
if (set1) then
1212-
if (getValue(env,val,idum)) then
1213-
set%nalphabeta = idum
1214-
else
1215-
call env%error('Spin could not be read from your argument',source)
1219+
1220+
ind = index(val,":")
1221+
1222+
if (ind.ne.0) then
1223+
if ( getValue(env, val(:ind-1), idum1) .and. &
1224+
& getValue(env, val(ind+1:), idum2)) then
1225+
set%oniom_settings%fixed_spin = .true.
1226+
set%oniom_settings%innerspin = idum1
1227+
set%nalphabeta = idum2
1228+
else
1229+
call env%error('Spin could not be read from your argument', source)
1230+
1231+
end if
1232+
1233+
! conventional
1234+
else
1235+
1236+
if (getValue(env,val,idum)) then
1237+
set%nalphabeta = idum
1238+
else
1239+
call env%error('Spin could not be read from your argument',source)
1240+
endif
12161241
endif
12171242
endif
12181243
set1 = .false.

src/setparam.f90

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ module xtb_setparam
106106

107107
!> inner region charge
108108
integer :: innerchrg
109+
110+
!> explicit charges (inner:outer)
111+
logical :: fixed_chrgs= .false.
109112

110113
!> cut high order(>1) covalent bonds
111114
logical :: ignore_topo = .false.
@@ -116,8 +119,11 @@ module xtb_setparam
116119
!> dummy execution to check inner region geo and chrg
117120
logical :: cut_inner = .false.
118121

119-
!> explicite charges (inner:outer)
120-
logical :: fixed_chrgs= .false.
122+
!> explicit spin (inner:outer)
123+
logical :: fixed_spin = .false.
124+
125+
!> inner region spin
126+
integer :: innerspin
121127

122128
!> mute external output (ORCA,TURBOMOLE)
123129
logical :: silent = .false.

0 commit comments

Comments
 (0)