9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-18 11:23:38 +01:00

added mu_of_r.irp.f

This commit is contained in:
eginer 2024-09-09 12:00:24 +02:00
parent 316d81e8cf
commit d07fb685cd
2 changed files with 45 additions and 2 deletions

View File

@ -33,7 +33,7 @@ subroutine generate_cas_space
print *, 'CAS(', n_alpha_act+n_beta_act, ', ', n_act_orb, ')'
print *, ''
n_det_alpha_unique = binom_int(n_act_orb, n_alpha_act)
n_det_alpha_unique = int(binom_int(n_act_orb, n_alpha_act),4)
TOUCH n_det_alpha_unique
n = n_alpha_act
@ -56,7 +56,7 @@ subroutine generate_cas_space
u = ior(t1,t2)
enddo
n_det_beta_unique = binom_int(n_act_orb, n_beta_act)
n_det_beta_unique = int(binom_int(n_act_orb, n_beta_act),4)
TOUCH n_det_beta_unique
n = n_beta_act

43
src/mu_of_r/mu_of_r.irp.f Normal file
View File

@ -0,0 +1,43 @@
subroutine grad_mu_of_r_mean_field(r,mu_mf, dm, grad_mu_mf, grad_dm)
implicit none
BEGIN_DOC
! returns the value and gradients of the mu(r) mean field, together with the HF density and its gradients.
END_DOC
include 'constants.include.F'
double precision, intent(in) :: r(3)
double precision, intent(out):: grad_mu_mf(3), grad_dm(3)
double precision, intent(out):: mu_mf, dm
double precision :: grad_f_mf_ab(3), grad_two_bod_dens(3),grad_dm_a(3), grad_dm_b(3)
double precision :: f_mf_ab,two_bod_dens, dm_a, dm_b
double precision :: dist
call get_grad_f_mf_ab(r,grad_f_mf_ab, grad_two_bod_dens,f_mf_ab,two_bod_dens, dm_a, dm_b,grad_dm_a, grad_dm_b)
dm = dm_a + dm_b
grad_dm(1:3) = grad_dm_a(1:3) + grad_dm_b(1:3)
if(dabs(two_bod_dens).lt.1.d-10)then
mu_mf = 1.d+10
grad_mu_mf = 0.d0
else
if(mu_of_r_tc=="Erfmu")then
mu_mf = 0.3333333333d0 * sqpi * (f_mf_ab/two_bod_dens + 0.25d0)
grad_mu_mf(1:3) = 0.3333333333d0 * sqpi * (grad_f_mf_ab(1:3) * two_bod_dens - f_mf_ab * grad_two_bod_dens(1:3))&
/(two_bod_dens*two_bod_dens)
else if(mu_of_r_tc=="Standard")then
mu_mf = 0.5d0 * sqpi * f_mf_ab/two_bod_dens
grad_mu_mf(1:3) = 0.5d0 * sqpi * (grad_f_mf_ab(1:3) * two_bod_dens - f_mf_ab * grad_two_bod_dens(1:3))&
/(two_bod_dens*two_bod_dens)
else if(mu_of_r_tc=="Erfmugauss")then
mu_mf = (f_mf_ab/two_bod_dens + 0.25d0)/c_mu_gauss_tot
grad_mu_mf(1:3) = 1.d0/c_mu_gauss_tot* (grad_f_mf_ab(1:3) * two_bod_dens - f_mf_ab * grad_two_bod_dens(1:3))&
/(two_bod_dens*two_bod_dens)
else
print*,'Wrong value for mu_of_r_tc !'
stop
endif
endif
end