dft_calc_gradient Subroutine

private subroutine dft_calc_gradient(this, fragment, result)

Calculate energy gradient using Kohn-Sham DFT

TODO: Implementation requires: 1. Converged SCF (call calc_energy to get density) 2. Compute gradient contributions: a. One-electron integral derivatives b. Two-electron integral derivatives (or RI-J) c. XC potential derivatives (grid-based) d. Overlap derivative (Pulay force) 3. Optional: dispersion gradient

Type Bound

dft_method_t

Arguments

Type IntentOptional Attributes Name
class(dft_method_t), intent(in) :: this
type(physical_fragment_t), intent(in) :: fragment
type(calculation_result_t), intent(out) :: result

Calls

proc~~dft_calc_gradient~~CallsGraph proc~dft_calc_gradient dft_method_t%dft_calc_gradient proc~dft_calc_energy dft_method_t%dft_calc_energy proc~dft_calc_gradient->proc~dft_calc_energy proc~energy_total energy_t%energy_total proc~dft_calc_energy->proc~energy_total proc~mp2_total mp2_energy_t%mp2_total proc~energy_total->proc~mp2_total

Source Code

   subroutine dft_calc_gradient(this, fragment, result)
      !! Calculate energy gradient using Kohn-Sham DFT
      !!
      !! TODO: Implementation requires:
      !! 1. Converged SCF (call calc_energy to get density)
      !! 2. Compute gradient contributions:
      !!    a. One-electron integral derivatives
      !!    b. Two-electron integral derivatives (or RI-J)
      !!    c. XC potential derivatives (grid-based)
      !!    d. Overlap derivative (Pulay force)
      !! 3. Optional: dispersion gradient
      class(dft_method_t), intent(in) :: this
      type(physical_fragment_t), intent(in) :: fragment
      type(calculation_result_t), intent(out) :: result

      if (this%options%verbose) then
         print *, "DFT: Calculating gradient using ", trim(this%options%functional)
      end if

      ! First get energy (and converged density)
      call this%calc_energy(fragment, result)

      ! Allocate and fill dummy gradient
      allocate (result%gradient(3, fragment%n_atoms))
      result%gradient = 0.0_dp  ! Placeholder
      result%has_gradient = .true.

      if (this%options%verbose) then
         print *, "DFT: [STUB] Gradient computed"
      end if

   end subroutine dft_calc_gradient