1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2025-04-01 14:31:31 +02:00

Sort indices for faster access in RDM

This commit is contained in:
Anthony Scemama 2025-02-25 18:09:45 +01:00
parent 371fb7bcfa
commit 4c460e6967
12 changed files with 36 additions and 129 deletions

View File

@ -1,5 +1,5 @@
program export_integrals_mo
PROVIDE mo_two_e_integrals_in_map
PROVIDE all_mo_integrals
call run
end

View File

@ -9,6 +9,7 @@ end
subroutine run
implicit none
integer :: istate
PROVIDE all_mo_integrals
do istate=1,N_states
print *, '', istate
print *, 'State ', istate
@ -38,10 +39,9 @@ subroutine run
print *,''
print '(''|'',A6,''|'',5(A20,''|''))', 'E(mu)', '<W>', 'E(mu) + <W>', 'E(mu) + \alpha_0<W>', &
'E(mu) + \alpha_0<W>_s + \alpha_1<W>_t', 'E(mu) + \alpha_0_r<W>_s + \alpha_1_r<W>_t'
print '(''|'',F6.2,''|'',5(F20.15,''|''))', mu_erf, energy_mu(istate), energy_mu(istate) + correction_mu(istate), energy_mu(istate) + &
correction_alpha_0(istate), energy_mu(istate) + correction_alpha_1(istate), energy_mu(istate) + &
correction_alpha_1_r(istate)
print '(''|'',A6,''|'',5(A25,''|''))', 'mu', 'E(mu)', 'E(mu) + <W>', 'E(mu) + a_0<W>', &
'E(mu) + a_0<W>_s + a_1<W>_t'
print '(''|'',F6.2,''|'',5(F25.15,''|''))', mu_erf, energy_mu(istate), energy_mu(istate) + correction_mu(istate), energy_mu(istate) + &
correction_alpha_0(istate), energy_mu(istate) + correction_alpha_1(istate)
enddo
end

59
stable/mp2/.gitignore vendored
View File

@ -1,59 +0,0 @@
IRPF90_temp/
IRPF90_man/
build.ninja
irpf90.make
ezfio_interface.irp.f
irpf90_entities
tags
Makefile
ao_basis
ao_one_e_ints
ao_two_e_erf_ints
ao_two_e_ints
aux_quantities
becke_numerical_grid
bitmask
cis
cisd
cipsi
davidson
davidson_dressed
davidson_undressed
density_for_dft
determinants
dft_keywords
dft_utils_in_r
dft_utils_one_e
dft_utils_two_body
dressing
dummy
electrons
ezfio_files
fci
generators_cas
generators_full
hartree_fock
iterations
kohn_sham
kohn_sham_rs
mo_basis
mo_guess
mo_one_e_ints
mo_two_e_erf_ints
mo_two_e_ints
mpi
mrpt_utils
nuclei
perturbation
pseudo
psiref_cas
psiref_utils
scf_utils
selectors_cassd
selectors_full
selectors_utils
single_ref_method
slave
tools
utils
zmq

View File

@ -1,15 +0,0 @@
use bitmasks
BEGIN_SHELL [ /usr/bin/env python3 ]
from generate_h_apply import *
from perturbation import perturbations
s = H_apply("mp2")
s.set_perturbation("Moller_plesset")
#s.set_perturbation("epstein_nesbet")
print(s)
s = H_apply("mp2_selection")
s.set_selection_pt2("Moller_Plesset")
print(s)
END_SHELL

View File

@ -1,6 +0,0 @@
generators_full
selectors_full
determinants
davidson
davidson_undressed
perturbation

View File

@ -1,4 +0,0 @@
===
mp2
===

View File

@ -1,21 +0,0 @@
program mp2
call run
end
subroutine run
implicit none
double precision, allocatable :: pt2(:), norm_pert(:)
double precision :: H_pert_diag, E_old
integer :: N_st, iter
PROVIDE Fock_matrix_diag_mo H_apply_buffer_allocated
N_st = N_states
allocate (pt2(N_st), norm_pert(N_st))
E_old = HF_energy
call H_apply_mp2(pt2, norm_pert, H_pert_diag, N_st)
print *, 'N_det = ', N_det
print *, 'N_states = ', N_states
print *, 'MP2 = ', pt2
print *, 'E = ', E_old
print *, 'E+MP2 = ', E_old+pt2
deallocate(pt2,norm_pert)
end

View File

@ -4,3 +4,9 @@ doc: Threshold on the CI coefficients as computed in QMCChem
interface: ezfio,provider,ocaml
default: 1.e-8
[do_frozen_core]
type: logical
doc: If true, save data for a frozen core calculation
interface: ezfio,provider,ocaml
default: False

View File

@ -2,10 +2,10 @@ program e_curve
use bitmasks
implicit none
integer :: i,j,k, nab, m, l
double precision :: norm
double precision :: norm
integer, allocatable :: iorder(:)
double precision , allocatable :: norm_sort(:)
PROVIDE mo_two_e_integrals_in_map mo_one_e_integrals
PROVIDE all_mo_integrals
if (.not.read_wf) then
@ -92,7 +92,7 @@ program e_curve
N_det = m-1
TOUCH psi_det psi_coef N_det
! Avoid providing psi_energy
! Avoid providing psi_energy
if (.True.) then
double precision :: cost0, cost
cost0 = elec_alpha_num**3 + elec_beta_num**3

View File

@ -5,7 +5,7 @@ program e_curve
double precision :: norm, E, hij, num, ci, cj
double precision :: e_0(N_states)
double precision, allocatable :: psi_save(:)
PROVIDE mo_two_e_integrals_in_map mo_one_e_integrals
PROVIDE all_mo_integrals
if (.not.read_wf) then
stop 'Please set read_wf to true'

View File

@ -1,28 +1,28 @@
program save_for_qmc
implicit none
BEGIN_DOC
! Export data for QMC=Chem
END_DOC
integer :: iunit
logical :: exists
double precision :: e_ref
! Determinants
read_wf = .True.
TOUCH read_wf
print *, "N_det = ", N_det
call write_spindeterminants
! Reference Energy
if (do_pseudo) then
call write_pseudopotential
endif
call system( &
'mkdir -p '//trim(ezfio_filename)//'/simulation ;' // &
'cp '//trim(ezfio_filename)//'/.version '//trim(ezfio_filename)//'/simulation/.version ; ' // &
'mkdir -p '//trim(ezfio_filename)//'/properties ;' // &
'cp '//trim(ezfio_filename)//'/.version '//trim(ezfio_filename)//'/properties/.version ; ' // &
'echo T > '//trim(ezfio_filename)//'/properties/e_loc' &
)
iunit = 13
open(unit=iunit,file=trim(ezfio_filename)//'/simulation/e_ref',action='write')
call ezfio_has_fci_energy_pt2(exists)
if (exists) then
call ezfio_get_fci_energy_pt2(e_ref)
@ -39,9 +39,15 @@ program save_for_qmc
endif
endif
endif
write(iunit,*) e_ref
close(iunit)
call ezfio_set_simulation_e_ref(e_ref)
if (do_frozen_core) then
call ezfio_set_pseudo_core_fock_operator(core_fock_operator)
call ezfio_set_simulation_do_frozen_core(.True.)
endif
! call ezfio_set_qmcchem_proj_potential_num(proj_num)
! call ezfio_set_qmcchem_proj_potential(proj_potential)
call export_trexio(.True., .True.)
end

View File

@ -13,7 +13,7 @@ subroutine run
double precision , allocatable :: norm_sort(:)
double precision :: e_0(N_states)
PROVIDE mo_two_e_integrals_in_map H_apply_buffer_allocated
PROVIDE all_mo_integrals H_apply_buffer_allocated
nab = n_det_alpha_unique+n_det_beta_unique
allocate ( norm_sort(0:nab), iorder(0:nab) )
@ -30,17 +30,17 @@ subroutine run
norm_sort(i) = det_alpha_norm(i)
iorder(i) = i
enddo
do i=1,n_det_beta_unique
norm_sort(i+n_det_alpha_unique) = det_beta_norm(i)
iorder(i+n_det_alpha_unique) = -i
enddo
call dsort(norm_sort(1),iorder(1),nab)
PROVIDE psi_bilinear_matrix_values psi_bilinear_matrix_rows psi_bilinear_matrix_columns
PROVIDE nuclear_repulsion
PROVIDE nuclear_repulsion
print *, ''
do j=0,nab
i = iorder(j)
@ -104,7 +104,7 @@ subroutine run
v_0, &
size(v_0, 1), &
N_states, N_det)
double precision, external :: u_dot_u, u_dot_v
do i=1,N_states
e_0(i) = u_dot_v(u_0(1,i),v_0(1,i),N_det)/u_dot_u(u_0(1,i),N_det)