9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-07 05:53:37 +01:00

added spin density

This commit is contained in:
eginer 2023-02-24 21:38:09 +01:00
parent 4f071a59fb
commit 274e903d3c
5 changed files with 112 additions and 3 deletions

View File

@ -0,0 +1,49 @@
#!/usr/bin/env bats
source $QP_ROOT/tests/bats/common.bats.sh
source $QP_ROOT/quantum_package.rc
function run_Ne() {
qp set_file Ne_tc_scf
qp run cisd
qp run tc_bi_ortho | tee Ne_tc_scf.cisd_tc_bi_ortho.out
eref=-128.77020441279302
energy="$(grep "eigval_right_tc_bi_orth =" Ne_tc_scf.cisd_tc_bi_ortho.out)"
eq $energy $eref 1e-6
}
@test "Ne" {
run_Ne
}
function run_C() {
qp set_file C_tc_scf
qp run cisd
qp run tc_bi_ortho | tee C_tc_scf.cisd_tc_bi_ortho.out
eref=-37.757536149952514
energy="$(grep "eigval_right_tc_bi_orth =" C_tc_scf.cisd_tc_bi_ortho.out)"
eq $energy $eref 1e-6
}
@test "C" {
run_C
}
function run_O() {
qp set_file C_tc_scf
qp run cisd
qp run tc_bi_ortho | tee O_tc_scf.cisd_tc_bi_ortho.out
eref=-74.908518517716161
energy="$(grep "eigval_right_tc_bi_orth =" O_tc_scf.cisd_tc_bi_ortho.out)"
eq $energy $eref 1e-6
}
@test "O" {
run_O
}

View File

@ -0,0 +1,16 @@
program test_spin_dens
implicit none
BEGIN_DOC
! TODO : Reads psi_det in the EZFIO folder and prints out the left- and right-eigenvectors together with the energy. Saves the left-right wave functions at the end.
END_DOC
print *, 'Hello world'
my_grid_becke = .True.
my_n_pt_r_grid = 30
my_n_pt_a_grid = 50
read_wf = .True.
touch read_wf
touch my_grid_becke my_n_pt_r_grid my_n_pt_a_grid
call tc_print_mulliken_sd
! call test
end

View File

@ -7,13 +7,21 @@ BEGIN_PROVIDER [double precision, tc_spin_population, (ao_num,ao_num,N_states)]
! tc_spin_population(i,j) = rho_AO(alpha)(i,j) - rho_AO(beta)(i,j) * <AO_i|AO_j> ! tc_spin_population(i,j) = rho_AO(alpha)(i,j) - rho_AO(beta)(i,j) * <AO_i|AO_j>
END_DOC END_DOC
tc_spin_population = 0.d0 tc_spin_population = 0.d0
do istate = 1, N_states if(only_spin_tc_right)then
do i = 1, ao_num do i = 1, ao_num
do j = 1, ao_num do j = 1, ao_num
tc_spin_population(j,i,istate) = tc_spin_transition_matrix_ao(j,i,istate,istate) * ao_overlap(j,i) tc_spin_population(j,i,1) = tc_spin_dens_right_only(j,i) * ao_overlap(j,i)
enddo enddo
enddo enddo
enddo else
do istate = 1, N_states
do i = 1, ao_num
do j = 1, ao_num
tc_spin_population(j,i,istate) = tc_spin_transition_matrix_ao(j,i,istate,istate) * ao_overlap(j,i)
enddo
enddo
enddo
endif
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, tc_spin_population_angular_momentum, (0:ao_l_max,N_states)] BEGIN_PROVIDER [double precision, tc_spin_population_angular_momentum, (0:ao_l_max,N_states)]

View File

@ -0,0 +1,30 @@
BEGIN_PROVIDER [ double precision, mo_r_coef_normalized, (ao_num,mo_num) ]
implicit none
integer :: i,j,k
double precision :: norm
do i = 1, mo_num
norm = 0.d0
do j = 1, ao_num
do k = 1, ao_num
norm += mo_r_coef(k,i) * mo_r_coef(j,i) * ao_overlap(k,j)
enddo
enddo
norm = 1.d0/dsqrt(norm)
do j = 1, ao_num
mo_r_coef_normalized(j,i) = mo_r_coef(j,i) * norm
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ double precision, tc_spin_dens_right_only, (ao_num, ao_num)]
implicit none
integer :: i,j,k
tc_spin_dens_right_only = 0.d0
do i = elec_beta_num+1, elec_alpha_num
do j = 1, ao_num
do k = 1, ao_num
tc_spin_dens_right_only(k,j) += mo_r_coef_normalized(k,i) * mo_r_coef_normalized(j,i)
enddo
enddo
enddo
END_PROVIDER

View File

@ -183,3 +183,9 @@ type: integer
doc: If :: 1 then you compute the TC-PT2 the old way, :: 2 then you check with the new version but without three-body doc: If :: 1 then you compute the TC-PT2 the old way, :: 2 then you check with the new version but without three-body
interface: ezfio,provider,ocaml interface: ezfio,provider,ocaml
default: -1 default: -1
[only_spin_tc_right]
type: logical
doc: If |true|, only the right part of WF is used to compute spin dens
interface: ezfio,provider,ocaml
default: False