Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(ommp_nonbonded_type), | intent(inout) | :: | vdw |
Nonbonded data structure |
||
logical(kind=lp), | intent(in) | :: | mask_a(vdw%top%mm_atoms) | |||
logical(kind=lp), | intent(in) | :: | mask_b(vdw%top%mm_atoms) | |||
real(kind=rp), | intent(in) | :: | r |
Equilibrium distance for the pair |
||
real(kind=rp), | intent(in) | :: | e |
Depth of the potential |
subroutine vdw_set_pair(vdw, mask_a, mask_b, r, e)
use mod_io, only: ommp_message, fatal_error
use mod_constants, only: OMMP_VERBOSE_LOW
use mod_memory, only: mallocate, mfree
implicit none
type(ommp_nonbonded_type), intent(inout) :: vdw
!! Nonbonded data structure
logical(lp), intent(in) :: mask_a(vdw%top%mm_atoms)
logical(lp), intent(in) :: mask_b(vdw%top%mm_atoms)
real(rp), intent(in) :: r
!! Equilibrium distance for the pair
real(rp), intent(in) :: e
!! Depth of the potential
integer(ip) :: oldsize, newsize
logical(lp), allocatable :: ltmp(:,:)
real(rp), allocatable :: rtmp(:)
character(len=OMMP_STR_CHAR_MAX) :: msg
oldsize = size(vdw%vdw_pair_r)
if(vdw%npair >= oldsize) then
newsize = oldsize + pair_allocation_chunk
call mallocate('vdw_set_pair [rtmp]', oldsize, rtmp)
call mallocate('vdw_set_pair [ltmp]',vdw%top%mm_atoms, oldsize, ltmp)
rtmp = vdw%vdw_pair_r
call mfree('vdw_set_pair [vdw%vdw_pair_r]', vdw%vdw_pair_r)
call mallocate('vdw_set_pair [vdw%vdw_pair_r]', newsize, vdw%vdw_pair_r)
vdw%vdw_pair_r(1:oldsize) = rtmp
rtmp = vdw%vdw_pair_e
call mfree('vdw_set_pair [vdw%vdw_pair_e]', vdw%vdw_pair_e)
call mallocate('vdw_set_pair [vdw%vdw_pair_e]', newsize, vdw%vdw_pair_e)
vdw%vdw_pair_e(1:oldsize) = rtmp
ltmp = vdw%vdw_pair_mask_a
call mfree('vdw_set_pair [vdw_pair_mask_a]', vdw%vdw_pair_mask_a)
call mallocate('vdw_set_pair [vdw_pair_mask_a]', &
vdw%top%mm_atoms, newsize, vdw%vdw_pair_mask_a)
vdw%vdw_pair_mask_a(:,1:oldsize) = ltmp
ltmp = vdw%vdw_pair_mask_b
call mfree('vdw_set_pair [vdw_pair_mask_b]', vdw%vdw_pair_mask_b)
call mallocate('vdw_set_pair [vdw_pair_mask_b]', &
vdw%top%mm_atoms, newsize, vdw%vdw_pair_mask_b)
vdw%vdw_pair_mask_b(:,1:oldsize) = ltmp
call mfree('vdw_set_pair [rtmp]', rtmp)
call mfree('vdw_set_pair [ltmp]', ltmp)
end if
vdw%npair = vdw%npair + 1
vdw%vdw_pair_mask_a(:,vdw%npair) = mask_a
vdw%vdw_pair_mask_b(:,vdw%npair) = mask_b
vdw%vdw_pair_r(vdw%npair) = r
vdw%vdw_pair_e(vdw%npair) = e
end subroutine vdw_set_pair