Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose P, Q in orbitals #7

Open
certik opened this issue Nov 13, 2013 · 0 comments
Open

Expose P, Q in orbitals #7

certik opened this issue Nov 13, 2013 · 0 comments

Comments

@certik
Copy link
Owner

certik commented Nov 13, 2013

Make the following change:

diff --git a/src/dft.f90 b/src/dft.f90
index 94db0ee..58a51c6 100644
--- a/src/dft.f90
+++ b/src/dft.f90
@@ -36,7 +36,7 @@ subroutine V2rho(d)
 ! Calculates rho from V by solving Kohn-Sham equations
 type(dft_data_t), intent(inout) :: d

-real(dp), dimension(size(d%R)) :: P, Q, Y
+real(dp), dimension(size(d%R)) :: P, Q, Y2
 integer :: converged, i, n, l, relat
 real(dp) :: Ein, Emin_init, Emax_init

@@ -71,12 +71,12 @@ do i = 1, size(d%no)
         call stop_error("V2rho: Radial eigen problem didn't converge")
     end if
     if (relat == 0) then
-        Y = P / d%R
+        Y2 = (P / d%R)**2
     else
-        Y = sqrt(P**2 + Q**2) / d%R
+        Y2 = (P**2 + Q**2) / d%R**2
     end if
-    d%rho = d%rho + d%fo(i) * Y**2
-    d%orbitals(:, i) = Y
+    d%rho = d%rho + d%fo(i) * Y2
+    d%orbitals(:, i) = Y2
 end do
 d%rho = d%rho / (4*pi)
 end subroutine

and create orbitalsP and orbitalsQ instead of orbitals that would return P and Q directly, so that the user has access to the original wavefunctions. Even better, simply create:

d%orbitalsPQ(:, 1, i) = P
d%orbitalsPQ(:, 2, i) = Q

This can be done in the last iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant