Skip to content

Commit

Permalink
Introducing a scaling factor for directed docking (#868)
Browse files Browse the repository at this point in the history
* Introducing a scaling factor for directed docking

Signed-off-by: cplett <82893466+cplett@users.noreply.github.com>

* Typo

---------

Signed-off-by: cplett <82893466+cplett@users.noreply.github.com>
Co-authored-by: Marcel Stahn <70513124+MtoLStoN@users.noreply.github.com>
  • Loading branch information
cplett and MtoLStoN committed Sep 21, 2023
1 parent 9e67d6e commit c31a1ca
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/docking/param.f90
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ module xtb_docking_param
integer, parameter :: p_atom_pot = 2
!> Attractive atom-centered potential
integer, parameter :: p_atom_att = 3
!Wall pot for directed docking
!> Wall pot for directed docking (Not used)
integer, parameter :: p_wall_pot = 1
integer :: place_wall_pot
!QCG mode (special treatment of wall potentials)
Expand Down
23 changes: 17 additions & 6 deletions src/docking/set_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ subroutine rdblock_docking2(env,handler,line,id,nat,at,idMap,xyz,err)
character(len=:),allocatable,intent(out) :: line
character(len=:),allocatable :: key
character(len=:),allocatable :: val
integer :: ie
integer :: ie, ia
logical :: exitRun
do
call getline(id,line,err)
Expand All @@ -139,12 +139,18 @@ subroutine rdblock_docking2(env,handler,line,id,nat,at,idMap,xyz,err)

! find the first colon
ie = index(line,colon)
if ((line.eq.'')) cycle
if (ie .eq. 0) then! cycle
ia = index(line,equal)
if ((line == '')) cycle
if (ie == 0 .AND. ia == 0) then !Only if no : or = is in string
call set_logicals(env, line)
else
key = trim(line(:ie-1))
val = trim(adjustl(line(ie+1:)))
else
if (ia /= 0) then
key = trim(line(:ia-1))
val = trim(adjustl(line(ia+1:)))
else
key = trim(line(:ie-1))
val = trim(adjustl(line(ie+1:)))
end if
call handler(env,key,val,nat,at,idMap,xyz)
call env%check(exitRun)
if (exitRun) then
Expand Down Expand Up @@ -242,6 +248,8 @@ subroutine set_directed(env,key,val,nat,at,idMap,xyz)

integer :: narg
character(len=p_str_length),dimension(p_arg_length) :: argv

logical, save :: set1 = .true.

call atl%resize(nat)

Expand All @@ -254,6 +262,9 @@ subroutine set_directed(env,key,val,nat,at,idMap,xyz)
endif
select case(key)
case default ! ignore, don't even think about raising them
case('scaling factor')
if (getValue(env,val,ddum).and.set1) directedset%fc = ddum
set1 = .false.
case('elements')
call atl%new
do idum = 1, narg
Expand Down
5 changes: 4 additions & 1 deletion src/prog/dock.f90
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ subroutine read_userdata_iff(fname,env,mol)
select case(line(2:))
case('directed' )
if (set%verbose) write(env%unit,'(">",1x,a)') line(2:)
directedset%fc = 1.0_wp !Default scaling. Can be changed by user
call rdblock_docking2(env,set_directed,line,id,mol%n,mol%at,idMap,mol%xyz,err)
case default ! unknown keyword -> ignore, we don't raise them
call getline(id,line,err)
Expand Down Expand Up @@ -1031,14 +1032,15 @@ subroutine get_repulsive_pot(env,xyz,comb)
end do
!> Changing the distance to a repulsive potential sitting on every atom other then
! the defined docking atoms. This potentail is a damped exponential increase.
! It is later in the energy calculation and RG screening added in sitance depdence to
! It is later in the energy calculation and RG screening added in distance depdence to
! docked molecule via 1/r²
do i=1, comb%n
if(any(i == directedset%atoms)) cycle !Potential zero for atoms in defined docking region
dist = directedset%val(i)
rep_pot = 0.1*erf(0.07 * dist - 0.28) !Potential starts at distance of 4
if(rep_pot < 0.0_wp) rep_pot = 0.0_wp
directedset%val(i) = rep_pot !Overwrite distance with repulsive Potential
directedset%val(i) = directedset%val(i) * directedset%fc !Scaling if requested
end do
end subroutine get_repulsive_pot

Expand All @@ -1057,6 +1059,7 @@ subroutine get_attractive_pot(env,comb)
do i = 1, comb%n
if(any(i == directedset%atoms)) then
directedset%val(i) = attractive_pot !attractive pot is negative
directedset%val(i) = directedset%val(i) * directedset%fc !Scaling if requested
else
directedset%val(i) = 0.0_wp
end if
Expand Down

0 comments on commit c31a1ca

Please sign in to comment.