new_d3_model Subroutine

public subroutine new_d3_model(self, mol, wf)

Create new dispersion model from molecular structure input

Arguments

Type IntentOptional Attributes Name
type(d3_model), intent(out) :: self

Instance of the dispersion model

class(structure_type), intent(in) :: mol

Molecular structure data

real(kind=wp), intent(in), optional :: wf

Weighting factor for coordination number interpolation


Source Code

subroutine new_d3_model(self, mol, wf)

   !> Instance of the dispersion model
   type(d3_model), intent(out) :: self

   !> Molecular structure data
   class(structure_type), intent(in) :: mol

   !> Weighting factor for coordination number interpolation
   real(wp), intent(in), optional :: wf

   integer :: isp, izp, iref, jsp, jzp, jref
   integer :: mref

   call init_reference_c6

   if (present(wf)) then
      self%wf = wf
   else
      self%wf = wf_default
   end if

   allocate(self%ref(mol%nid))
   self%ref(:) = number_of_references(mol%num)
   mref = maxval(self%ref)

   allocate(self%rcov(mol%nid))
   do isp = 1, mol%nid
      izp = mol%num(isp)
      self%rcov(isp) = get_covalent_rad(izp)
   end do

   allocate(self%r4r2(mol%nid))
   do isp = 1, mol%nid
      izp = mol%num(isp)
      self%r4r2(isp) = get_r4r2_val(izp)
   end do

   allocate(self%rvdw(mol%nid, mol%nid))
   do isp = 1, mol%nid
      izp = mol%num(isp)
      do jsp = 1, isp
         jzp = mol%num(jsp)
         self%rvdw(jsp, isp) = get_vdw_rad(jzp, izp)
         self%rvdw(isp, jsp) = self%rvdw(jsp, isp)
      end do
   end do

   allocate(self%cn(mref, mol%nid), source=0.0_wp)
   do isp = 1, mol%nid
      izp = mol%num(isp)
      do iref = 1, self%ref(isp)
         self%cn(iref, isp) = reference_cn(iref, izp)
      end do
   end do

   allocate(self%c6(mref, mref, mol%nid, mol%nid), source=0.0_wp)
   do isp = 1, mol%nid
      izp = mol%num(isp)
      do jsp = 1, isp
         jzp = mol%num(jsp)
         do iref = 1, self%ref(isp)
            do jref = 1, self%ref(jsp)
               self%c6(jref, iref, jsp, isp) = get_c6(jref, iref, jzp, izp)
               self%c6(iref, jref, isp, jsp) = self%c6(jref, iref, jsp, isp)
            end do
         end do
      end do
   end do

end subroutine new_d3_model