Dice Fortran Backend Documentation
solvers Module Reference

Contains local energy and transition probability solvers for available problems. More...

Functions/Subroutines

real(real64) function qho_prob (alpha, x_current, x_next)
 Calculates transition probability for quantum harmonic oscillator problem. More...
 
real(real64) function qho_energy (alpha, x)
 Calculates local energy for quantum harmonic oscillator problem. More...
 
real(real64) function h1s_wfn (r_elec, R_nuc)
 Calculates value of the wavefunction of a hydrogen 1s orbital. More...
 
real(real64) function h2s_wfn (r_elec, R_nuc)
 [DEPRECATED] Calculates value of the wavefunction of a hydrogen 2s orbital. More...
 
real(real64) function h_2_plus_wfn (c, r, R_a, R_b)
 Calculates trial wavefunction for the \( H_{2}^{+} \) problem. More...
 
real(real64) function h_2_plus_prob (c, r_current, r_next, R_a, R_b)
 Calculates transition probability for the \( H_{2}^{+} \) problem. More...
 
subroutine h_2_plus_energy (c, r, R_a, R_b, E_loc, gradient)
 Calculates local energy for the \( H_{2}^{+} \) problem. More...
 
subroutine h_2_plus_update_c (c_old, gradient, c_new)
 Updates the \( c \) parameter in the \( H_{2}^{+} \) problem by dampened steepest descent. More...
 
real(real64) function h_2_cusp (s)
 Calculates a value for a given the bond length s by Newton-Raphson iteration. More...
 
real(real64) function h_2_wfn (a, beta, r_1, r_2, R_a, R_b)
 Calculates trial wavefunction for the \( H_{2} \) problem. More...
 
real(real64) function h_2_prob (a, beta, r_1_current, r_2_current, r_1_next, r_2_next, R_a, R_b)
 Calculates transition probability for the \( H_{2} \) problem. More...
 
subroutine h_2_energy (a, beta, r_1, r_2, R_a, R_b, E_loc, DphiDbeta)
 {UPDATE ME} Calculates local energy for the \( H_{2} \) problem. More...
 
subroutine h_2_update_beta (beta_old, gradient, beta_new)
 Updates the \( \beta \) parameter in the \( H_{2}^{+} \) problem by dampened steepest descent. More...
 

Detailed Description

Contains local energy and transition probability solvers for available problems.

Module containing quantum mechanical solvers for local energy and Metropolis algorithm probability. Contains solvers for quantum harmonic oscillator (QHO), hydrogen ion (H_2_plus) and hydrogen molecule (H_2), as well as dampened steepest descent optimisers for the parameters in the latter two problems.

Function/Subroutine Documentation

◆ qho_prob()

real(real64) function solvers::qho_prob ( real(real64), intent(in)  alpha,
real(real64), intent(in)  x_current,
real(real64), intent(in)  x_next 
)

Calculates transition probability for quantum harmonic oscillator problem.

Computes

\[ \frac{P(x_{i+1})}{P(x)} = \frac{\psi^{\alpha}_{T}(x_{i+1})}{\psi^{\alpha}_{T}(x)} = e^{-2\alpha(x^{2}_{i+1}-x^{2}_{i})} \]

Parameters
[in]alphaParameter
[in]x_currentCurrent position of walker
[in]x_nextProposed position of walker
Return values
ProbTransition probability

Definition at line 47 of file quantum_solvers.f90.

48 
49  implicit none
50 
51  real(real64), intent(in) :: alpha
52  real(real64), intent(in) :: x_current, x_next
53 
54  real(real64) :: Prob
55 
56  prob = exp(-2*alpha*(x_next*x_next - x_current*x_current))
57 
+ Here is the caller graph for this function:

◆ qho_energy()

real(real64) function solvers::qho_energy ( real(real64), intent(in)  alpha,
real(real64), intent(in)  x 
)

Calculates local energy for quantum harmonic oscillator problem.

Computes

\[ E^{\alpha}_{L}(x) = \frac{\hat{H}\psi^{\alpha}_{T}(x)}{\psi^{\alpha}_{T}(x)} = \alpha+x^{2}\left ( \frac{1}{2}-2\alpha^{2} \right ) \]

Parameters
[in]alphaParameter
[in]xPosition of walker
Return values
E_locLocal energy

Definition at line 76 of file quantum_solvers.f90.

77 
78  implicit none
79 
80  real(real64), intent(in) :: alpha
81  real(real64), intent(in) :: x
82 
83  real(real64) :: E_loc
84 
85  e_loc = alpha + (x*x)*(0.5 - (2*alpha*alpha))
86 
+ Here is the caller graph for this function:

◆ h1s_wfn()

real(real64) function solvers::h1s_wfn ( real(real64), dimension(3), intent(in)  r_elec,
real(real64), dimension(3), intent(in)  R_nuc 
)

Calculates value of the wavefunction of a hydrogen 1s orbital.

Function to calculate the wavefunction of an electron at position \( \mathbf{r} \) in a hydrogenic 1s atomic orbital, centred on nuclear position \( \mathbf{R}_{nuc}. \) Computes

\[ \phi_{1s}^{A}(\mathbf{r}) = \frac{1}{\sqrt{\pi}}e^{-\left |\mathbf{r-\mathbf{R}_{nuc}} \right |} \]

Parameters
[in]r_elecElectron position
[in]R_nucNuclear position
Return values
H1s_wfnValue of wavefunction

Definition at line 111 of file quantum_solvers.f90.

112 
113  implicit none
114 
115  real(real64), dimension(3), intent(in) :: r_elec, R_nuc
116 
117  real(real64) :: H1s_wfn, expfac
118 
119  expfac = -norm2(r_elec - r_nuc)
120 
121  h1s_wfn = pi_dash * exp(expfac)
122 
+ Here is the caller graph for this function:

◆ h2s_wfn()

real(real64) function solvers::h2s_wfn ( real(real64), dimension(3), intent(in)  r_elec,
real(real64), dimension(3), intent(in)  R_nuc 
)

[DEPRECATED] Calculates value of the wavefunction of a hydrogen 2s orbital.

Function to calculate the wavefunction of an electron at position \( \mathbf{r} \) in a hydrogenic 2s atomic orbital, centred on nuclear position \( \mathbf{R}_{nuc}. \)

Computes

\[ \psi^{A}_{2s} = \frac{1}{4\sqrt{2\pi}}\left [ 2 - \left |\mathbf{r-\mathbf{R}_{nuc}} \right | \right ] e^{-\frac{\left |\mathbf{r-\mathbf{R}_{nuc}} \right |}{2}} \]

Remarks
NOTE - this function is now deprecated, and has been left here in case it is needed again in the future.
Parameters
[in]r_elecElectron position
[in]R_nucNuclear position
Return values
H2s_wfnValue of wavefunction

Definition at line 149 of file quantum_solvers.f90.

150 
151  implicit none
152 
153  real(real64), dimension(3), intent(in) :: r_elec, R_nuc
154 
155  real(real64) :: H2s_wfn, prefac, expfac, r_norm
156 
157  r_norm = norm2(r_elec - r_nuc)
158  prefac = pi_dash_2 * (2 - r_norm)
159  expfac = -(r_norm / 2)
160 
161  h2s_wfn = prefac * exp(expfac)
162 
+ Here is the caller graph for this function:

◆ h_2_plus_wfn()

real(real64) function solvers::h_2_plus_wfn ( real(real64), intent(in)  c,
real(real64), dimension(3), intent(in)  r,
real(real64), dimension(3), intent(in)  R_a,
real(real64), dimension(3), intent(in)  R_b 
)

Calculates trial wavefunction for the \( H_{2}^{+} \) problem.

Function to calculate the wavefunction of an electron at position \( \mathbf{r} \) in the hydrogen molecular ion \( H_{2}^{+} \). Computes

\[ \psi^{c}_{T}(\mathbf{r}) = c\phi_{1s}^{A}(\mathbf{r}) + \sqrt{1-c^{2}}\phi_{1s}^{B}(\mathbf{r}) \]

for a given value of the parameter \( c \).

Parameters
[in]cParameter of trial wavefunction
[in]rElectron position
[in]R_aPosition of hydrogen atom A
[in]R_bPosition of hydrogen atom B
Return values
wfnValue of trial wavefunction

Definition at line 190 of file quantum_solvers.f90.

191 
192  implicit none
193 
194  real(real64), intent(in) :: c
195  real(real64), dimension(3), intent(in) :: r
196  real(real64), dimension(3), intent(in) :: R_a, R_b
197 
198  real(real64) :: wfn
199 
200  wfn = (c * h1s_wfn(r, r_a)) + (sqrt(1 - (c*c)) * h1s_wfn(r, r_b))
201 
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ h_2_plus_prob()

real(real64) function solvers::h_2_plus_prob ( real(real64), intent(in)  c,
real(real64), dimension(3), intent(in)  r_current,
real(real64), dimension(3), intent(in)  r_next,
real(real64), dimension(3), intent(in)  R_a,
real(real64), dimension(3), intent(in)  R_b 
)

Calculates transition probability for the \( H_{2}^{+} \) problem.

Function to calculate transition probability for walkers in the \( H_{2}^{+} \) problem. Computes

\[ \frac{P(x_{i+1})}{P(x)} = \left (\frac{\psi^{c}_{T}(\mathbf{r}_{i+1})} {\psi^{c}_{T}(\mathbf{r})} \right ) ^{2} \]

Parameters
[in]cParameter of trial wavefunction
[in]r_currentCurrent position of walker
[in]r_nextProposed position of walker
[in]R_aPosition of hydrogen atom A
[in]R_bPosition of hydrogen atom B
Return values
ProbTransition probability

Definition at line 225 of file quantum_solvers.f90.

226 
227  implicit none
228 
229  real(real64), intent(in) :: c
230  real(real64), dimension(3), intent(in) :: r_current, r_next
231  real(real64), dimension(3), intent(in) :: R_a, R_b
232 
233  real(real64) :: Prob
234 
235  prob = (h_2_plus_wfn(c, r_next, r_a, r_b) / &
236  h_2_plus_wfn(c, r_current, r_a, r_b))**2
237 
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ h_2_plus_energy()

subroutine solvers::h_2_plus_energy ( real(real64), intent(in)  c,
real(real64), dimension(3), intent(in)  r,
real(real64), dimension(3), intent(in)  R_a,
real(real64), dimension(3), intent(in)  R_b,
real(real64), intent(out)  E_loc,
real(real64), intent(out)  gradient 
)

Calculates local energy for the \( H_{2}^{+} \) problem.

Function to calculate the local energy of a walker in the \( H_{2}^{+} \) problem.

Computes

\[ E^{c}_{L}(\mathbf{r}) = \frac{\hat{H}\psi^{c}_{T}(\mathbf{r})}{\psi^{c}_{T}(\mathbf{r})} \]

where

\[ \hat{H} = -\frac{1}{2}\nabla^{2} - \frac{1}{\left | \mathbf{r}-\mathbf{R}_{A} \right |} - \frac{1}{\left | \mathbf{r}-\mathbf{R}_{B} \right |} \]

by means of a second order central difference calculation.

Also calculates the gradient with respect to the parameter value c by means of a first order central difference calculation, provided auto_params for this problem is set to TRUE.

Finite difference step sizes for the calculation of both E_loc and gradient can be controlled by setting H2plus%ham_fdstep and H2plus%c_fdstep respectively, by giving them a value in the params.txt input file.

Parameters
[in]cParameter of trial wavefunction
[in]rPosition of walker
[in]R_aPosition of hydrogen atom A
[in]R_bPosition of hydrogen atom B
[out]E_locLocal energy
[out]gradientGradient wrt parameter c

Definition at line 277 of file quantum_solvers.f90.

278 
279  implicit none
280 
281  real(real64), intent(in) :: c
282  real(real64), dimension(3), intent(in) :: r
283  real(real64), dimension(3), intent(in) :: R_a, R_b
284 
285  real(real64), intent(out) :: E_loc
286  real(real64), intent(out) :: gradient
287 
288  real(real64), dimension(2, 3) :: r_diffs ! Wavefunction finite differences wrt position
289  real(real64), dimension(2) :: c_diffs ! Wavefunction finite differences wrt parameter
290  real(real64), dimension(3) :: r_temp ! Temporary position for finite differences
291  real(real64) :: laplacian ! 2nd derivative of trial wavefunction
292  real(real64) :: coulomb ! Coulomb terms of Hamiltonian
293  real(real64) :: c_temp ! Temporary parameter value for finite differences
294  real(real64) :: wfn, wfnx2 ! Wavefunction at current walker position
295  integer :: i ! Loop integer
296 
297  ! Calculate trial wavefunction at provided point.
298  wfn = h_2_plus_wfn(c, r, r_a, r_b)
299  wfnx2 = 2 * wfn
300 
301  ! Calculate trial wavefunction in finite difference directions.
302  do i = 1, 3
303  r_temp(:) = r(:)
304  r_temp(i) = r(i) - h2plus%ham_fdstep
305  r_diffs(1, i) = h_2_plus_wfn(c, r_temp, r_a, r_b)
306 
307  r_temp(i) = r(i) + h2plus%ham_fdstep
308  r_diffs(2, i) = h_2_plus_wfn(c, r_temp, r_a, r_b)
309  end do
310 
311  ! Assemble Hamiltonian
312  laplacian = ((r_diffs(1, 1) - wfnx2 + r_diffs(2, 1)) + &
313  (r_diffs(1, 2) - wfnx2 + r_diffs(2, 2)) + &
314  (r_diffs(1, 3) - wfnx2 + r_diffs(2, 3))) / (h2plus%ham_fdstep**2)
315  laplacian = laplacian * (-0.5_real64)
316 
317  coulomb = -(1 / norm2(r - r_a))*wfn - (1 / norm2(r - r_b))*wfn
318 
319  e_loc = ((laplacian + coulomb) / wfn) + (1 / norm2(r_a - r_b))
320 
321  ! Check if gradient is needed
322  if (h2plus%auto_params) then
323  ! Calculate wavefunction gradient wrt c by central difference.
324  c_temp = c - h2plus%c_fdstep
325  c_diffs(1) = h_2_plus_wfn(c_temp, r, r_a, r_b)
326 
327  c_temp = c + h2plus%c_fdstep
328  c_diffs(2) = h_2_plus_wfn(c_temp, r, r_a, r_b)
329 
330  gradient = (c_diffs(2) - c_diffs(1)) / (2.0_real64 * h2plus%c_fdstep)
331  else
332  gradient = 0.0_real64
333  end if
334 
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ h_2_plus_update_c()

subroutine solvers::h_2_plus_update_c ( real(real64), intent(in)  c_old,
real(real64), intent(in)  gradient,
real(real64), intent(out)  c_new 
)

Updates the \( c \) parameter in the \( H_{2}^{+} \) problem by dampened steepest descent.

Uses the gradient calculated by h_2_plus_energy to propose a new value for the parameter c, based on its current value. Step size can be adjusted by modifying the damping variable.

Parameters
[in]c_oldParameter to be updated
[in]gradientGradient at current parameter
[out]c_newNew updated parameter

Definition at line 354 of file quantum_solvers.f90.

355 
356  implicit none
357 
358  real(real64), intent(in) :: c_old
359  real(real64), intent(in) :: gradient
360  real(real64), intent(out) :: c_new
361 
362  real(real64) :: damping = 1.0_real64
363 
364  ! Update c by dampened steepest descent.
365  c_new = c_old - (damping * gradient)
366 
+ Here is the caller graph for this function:

◆ h_2_cusp()

real(real64) function solvers::h_2_cusp ( real(real64), intent(in)  s)

Calculates a value for a given the bond length s by Newton-Raphson iteration.

Solves the Coulomb cusp condition of electron-proton approach for the \( H_{2} \) wavefunction, which is defined by the equation

\[ a \left ( 1 + e^{-\frac{s}{a}} \right ) = 1 \]

where s is the H-H bond length and a is a parameter of the wavefunction.

The value of this parameter is found by Newton-Raphson iteration over the resulting product log equation

\[ \frac{1}{1 + e^{-\frac{s}{a}}} - a = 0 \]

Parameters
[in]sBond length
Return values
aOptimised wavefunction parameter

Definition at line 394 of file quantum_solvers.f90.

395 
396  implicit none
397 
398  real(real64), intent(in) :: s
399 
400  real(real64) :: a
401 
402  real(real64) :: f ! Value of function at current iteration
403  real(real64) :: f_dash ! Value of derivative at current iteration
404  real(real64) :: emsoa ! e^(-s/a)
405  real(real64) :: tol ! Tolerance for stopping iteration
406  integer :: maxiter ! Maximum number of iterations
407  integer :: k ! Loop integer
408 
409  a = 0.5_real64 ! guess based on s=0 solution
410  maxiter = 100
411  tol = 1e-5_real64
412 
413  if (i_log) then
414  write(logid, "('Starting Newton-Raphson search for parameter a...')")
415  write(logid, *) 'a abs(f)'
416  end if
417 
418  ! Calculate initial value of function based on guess
419  f = (1.0_real64 / (1.0_real64 + exp(-s/a))) - a
420  ! Iterate until converged
421  do k = 1, maxiter
422 
423  if (abs(f) .lt. tol) then
424  if (i_log) then
425  write(logid, "('Value of parameter a converged.')")
426  write(logid, "('')")
427  end if
428  exit
429  end if
430 
431  ! Calculate new values
432  emsoa = exp(-s/a)
433  f = (1.0_real64 / (1.0_real64 + emsoa)) - a
434  f_dash = (-s * emsoa) / ((1.0_real64 + emsoa*emsoa * a*a)) - 1
435 
436  ! Update value of a
437  a = a - (f / f_dash)
438 
439  if (i_log) then
440  write(logid, "(F12.8, ' ', F12.8)") a, abs(f)
441  end if
442 
443  end do
444 
445  ! Crash out if not converged
446  if (k .ge. maxiter) then
447  error stop "Newton-Raphson search for parameter a has failed to converge."
448  end if
449 
+ Here is the caller graph for this function:

◆ h_2_wfn()

real(real64) function solvers::h_2_wfn ( real(real64), intent(in)  a,
real(real64), intent(in)  beta,
real(real64), dimension(3), intent(in)  r_1,
real(real64), dimension(3), intent(in)  r_2,
real(real64), dimension(3), intent(in)  R_a,
real(real64), dimension(3), intent(in)  R_b 
)

Calculates trial wavefunction for the \( H_{2} \) problem.

Function to calculate the wavefunction of two electrons at positions \( \mathbf{r}_{1} \) and \( \mathbf{r}_{2} \) in the hydrogen molecule \( H_{2} \).

Takes the functional form

\[ \Psi_{T}(\mathbf{r}_1, \mathbf{r}_{2}) = \phi(\mathbf{r}_{1}) \phi(\mathbf{r}_{2}) \psi(\mathbf{r}_1, \mathbf{r}_{2}) \]

where

\[ \phi(\mathbf{r}_{1}) = e^{-\frac{\left | \mathbf{r}_{1A} \right |}{a}} + e^{-\frac{\left | \mathbf{r}_{1B} \right |}{a}} = \phi_{1A} + \phi_{1B} \]

\[ \phi(\mathbf{r}_{2}) = e^{-\frac{\left | \mathbf{r}_{2A} \right |}{a}} + e^{-\frac{\left | \mathbf{r}_{2B} \right |}{a}} = \phi_{2A} + \phi_{2B} \]

and \( \psi(\mathbf{r}_1, \mathbf{r}_{2}) \) is the Jastrow function with the form

\[ \psi(\mathbf{r}_1, \mathbf{r}_{2}) = e^{\frac{\left | \mathbf{r}_{12} \right |} {\alpha \left ( 1 + \beta \left | \mathbf{r}_{12} \right | \right )}} \]

Here, \( \alpha \) is taken to have a value of 2.0, as defined by the electron-electron approach Coulomb cusp condition.

Parameters
[in]aParameter \( a \) of trial wavefunction
[in]betaParameter \( \beta \) of trial wavefunction
[in]r_1Position of electron 1
[in]r_2Position of electron 2
[in]R_aPosition of hydrogen atom A
[in]R_bPosition of hydrogen atom B
Return values
wfnValue of trial wavefunction

Definition at line 488 of file quantum_solvers.f90.

489 
490  implicit none
491 
492  real(real64), intent(in) :: a
493  real(real64), intent(in) :: beta
494  real(real64), dimension(3), intent(in) :: r_1, r_2
495  real(real64), dimension(3), intent(in) :: R_a, R_b
496 
497  real(real64) :: wfn
498 
499  real(real64) :: s ! Bond length
500  real(real64) :: alpha ! Wavefunction parameter, set to 2
501  real(real64) :: phi_r1, phi_r2, jastrow ! Wavefunction components
502 
503  s = norm2(r_a - r_b)
504  alpha = 2.0_real64
505 
506  phi_r1 = exp(-norm2(r_1 - r_a) / a) + exp(-norm2(r_1 - r_b) / a)
507  phi_r2 = exp(-norm2(r_2 - r_a) / a) + exp(-norm2(r_2 - r_b) / a)
508 
509  jastrow = exp(norm2(r_1 - r_2) / (alpha * (1.0_real64 + beta*norm2(r_1 - r_2))))
510 
511  wfn = phi_r1 * phi_r2 * jastrow
512 
+ Here is the caller graph for this function:

◆ h_2_prob()

real(real64) function solvers::h_2_prob ( real(real64), intent(in)  a,
real(real64), intent(in)  beta,
real(real64), dimension(3), intent(in)  r_1_current,
real(real64), dimension(3), intent(in)  r_2_current,
real(real64), dimension(3), intent(in)  r_1_next,
real(real64), dimension(3), intent(in)  r_2_next,
real(real64), dimension(3), intent(in)  R_a,
real(real64), dimension(3), intent(in)  R_b 
)

Calculates transition probability for the \( H_{2} \) problem.

Function to calculate transition probability for walkers in the \( H_{2} \) problem. Computes

\[\frac{P(x_{i+1})}{P(x)} = \left (\frac{\psi^{c}_{T}(\mathbf{r}_{1}^{i+1}, \mathbf{r}_{2}^{i+1})} {\psi^{c}_{T}(\mathbf{r}_{1}^{i}, \mathbf{r}_{2}^{i})} \right )^{2} \]

Parameters
[in]aParameter \( a \) of trial wavefunction
[in]betaParameter \( \beta \) of trial wavefunction
[in]r_1_currentCurrent position of walker 1
[in]r_2_currentCurrent position of walker 2
[in]r_1_nextProposed position of walker 1
[in]r_2_nextProposed position of walker 2
[in]R_aPosition of hydrogen atom A
[in]R_bPosition of hydrogen atom B
Return values
ProbTransition probability

Definition at line 539 of file quantum_solvers.f90.

541 
542  implicit none
543 
544  real(real64), intent(in) :: a
545  real(real64), intent(in) :: beta
546  real(real64), dimension(3), intent(in) :: r_1_current, r_2_current
547  real(real64), dimension(3), intent(in) :: r_1_next, r_2_next
548  real(real64), dimension(3), intent(in) :: R_a, R_b
549 
550  real(real64) :: Prob
551 
552  prob = (h_2_wfn(a, beta, r_1_next, r_2_next, r_a, r_b) / &
553  h_2_wfn(a, beta, r_1_current, r_2_current, r_a, r_b))**2
554 
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ h_2_energy()

subroutine solvers::h_2_energy ( real(real64), intent(in)  a,
real(real64), intent(in)  beta,
real(real64), dimension(3), intent(in)  r_1,
real(real64), dimension(3), intent(in)  r_2,
real(real64), dimension(3), intent(in)  R_a,
real(real64), dimension(3), intent(in)  R_b,
real(real64), intent(out)  E_loc,
real(real64), intent(out)  DphiDbeta 
)

{UPDATE ME} Calculates local energy for the \( H_{2} \) problem.

Function to calculate the local energy of two walkers in the \( H_{2} \) problem. Computes

\[ E_{L} = -\frac{1}{a^{2}} + \frac{1}{a\phi_{1}}\left ( \frac{\phi_{1A}}{r_{1A}} + \frac{\phi_{1B}}{r_{1B}} \right ) + \frac{1}{a\phi_{2}}\left ( \frac{\phi_{2A}}{r_{2A}} + \frac{\phi_{2B}}{r_{2B}} \right ) - \left ( \frac{1}{r_{1A}} + \frac{1}{r_{1B}} + \frac{1}{r_{2A}} + \frac{1}{r_{2B}} \right ) + \frac{1}{r_{12}} + \left ( \frac{\phi_{1A}\hat{r}_{1A} + \phi_{1B}\hat{r}_{1B}}{\phi_{1}} - \frac{\phi_{2A}\hat{r}_{2A} + \phi_{2B}\hat{r}_{2B}}{\phi_{2}} \right )\cdot \frac{\hat{r}_{12}}{2a\left ( 1+\beta r_{12} \right )^{2}} - \frac{\left ( 4\beta+1 \right )r_{12} + 4}{4\left ( 1+\beta r_{12} \right )^{4} r_{12}} + \frac{1}{r_{AB}} \]

Also calculates the gradient with respect to the parameter \( \beta \), provided auto_params for this problem is set to TRUE.

Parameters
[in]aParameter \( a \) of trial wavefunction
[in]betaParameter \( \beta \) of trial wavefunction
[in]r_1Position of walker 1
[in]r_2Position of walker 2
[in]R_aPosition of hydrogen atom A
[in]R_bPosition of hydrogen atom B
[out]E_locLocal energy
[out]DphiDbetaWavefunction gradient with respect to \( \beta \)

Definition at line 591 of file quantum_solvers.f90.

592 
593  implicit none
594 
595  real(real64), intent(in) :: a
596  real(real64), intent(in) :: beta
597  real(real64), dimension(3), intent(in) :: r_1, r_2
598  real(real64), dimension(3), intent(in) :: R_a, R_b
599 
600  real(real64), intent(out) :: E_loc
601  real(real64), intent(out) :: DphiDbeta
602 
603  real(real64) :: E1, E2, E3, E4, E5, E6, E7, E8
604  real(real64) :: phi_1a, phi_1b, phi_1
605  real(real64) :: phi_2a, phi_2b, phi_2
606  real(real64) :: r_1a, r_1b, r_2a, r_2b, r_12
607  real(real64), dimension(3) :: r_1a_hat, r_1b_hat, r_2a_hat, r_2b_hat, r_12_hat
608 
609  r_1a = norm2(r_1 - r_a)
610  r_1b = norm2(r_1 - r_b)
611  r_2a = norm2(r_2 - r_a)
612  r_2b = norm2(r_2 - r_b)
613  r_12 = norm2(r_1 - r_2)
614 
615  r_1a_hat = (r_1 - r_a) / spread(r_1a, 1, 3)
616  r_1b_hat = (r_1 - r_b) / spread(r_1b, 1, 3)
617  r_2a_hat = (r_2 - r_a) / spread(r_2a, 1, 3)
618  r_2b_hat = (r_2 - r_b) / spread(r_2b, 1, 3)
619  r_12_hat = (r_1 - r_2) / spread(r_12, 1, 3)
620 
621  phi_1a = exp(-r_1a / a)
622  phi_1b = exp(-r_1b / a)
623  phi_2a = exp(-r_2a / a)
624  phi_2b = exp(-r_2b / a)
625 
626  phi_1 = phi_1a + phi_1b
627  phi_2 = phi_2a + phi_2b
628 
629  e1 = 1.0_real64 / (a*a)
630  e2 = ((phi_1a / r_1a) + (phi_1b / r_1b)) / (a * phi_1)
631  e3 = ((phi_2a / r_2a) + (phi_2b / r_2b)) / (a * phi_2)
632  e4 = (1.0_real64 / r_1a) + (1.0_real64 / r_1b) + (1.0_real64 / r_2a) + (1.0_real64 / r_2b)
633  e5 = 1.0_real64 / r_12
634  e6 = ((((phi_1a * sum(r_1a_hat * r_12_hat, dim=1)) + (phi_1b * sum(r_1b_hat * r_12_hat, dim=1))) / phi_1) &
635  - (((phi_2a * sum(r_2a_hat * r_12_hat, dim=1)) + (phi_2b * sum(r_2b_hat * r_12_hat, dim=1))) / phi_2)) &
636  / (2.0_real64 * a * (1.0_real64 + beta*r_12)**2)
637  e7 = (((4.0_real64*beta + 1.0_real64) * r_12) + 4.0_real64) &
638  / (4.0_real64 * r_12 * (1.0_real64 + beta*r_12)**4)
639  e8 = (1.0_real64 / norm2(r_a - r_b))
640 
641  e_loc = -e1 + e2 + e3 - e4 + e5 + e6 - e7 + e8
642 
643  dphidbeta = -(r_12*r_12) / (2.0_real64*(1.0_real64 + beta*r_12)**2)
644 
+ Here is the caller graph for this function:

◆ h_2_update_beta()

subroutine solvers::h_2_update_beta ( real(real64), intent(in)  beta_old,
real(real64), intent(in)  gradient,
real(real64), intent(out)  beta_new 
)

Updates the \( \beta \) parameter in the \( H_{2}^{+} \) problem by dampened steepest descent.

Uses the gradient calculated by H_2_energy to propose a new value for the parameter \( \beta \), based on its current value. Step size can be adjusted by modifying the damping variable.

Parameters
[in]c_oldParameter to be updated
[in]gradientGradient at current parameter
[out]c_newNew updated parameter

Definition at line 664 of file quantum_solvers.f90.

665 
666  implicit none
667 
668  real(real64), intent(in) :: beta_old
669  real(real64), intent(in) :: gradient
670  real(real64), intent(out) :: beta_new
671 
672  real(real64) :: damping = 1.0_real64
673 
674  beta_new = beta_old - (damping * gradient)
675 
+ Here is the caller graph for this function: