mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-06-14 00:25:17 +02:00
Merge branch 'dev' of github.com:QuantumPackage/qp2 into dev
This commit is contained in:
commit
284abacfdf
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -5,7 +5,10 @@ build.ninja
|
|||
.ninja_deps
|
||||
bin/
|
||||
lib/
|
||||
lib64/
|
||||
libexec/
|
||||
config/qp_create_ninja.pickle
|
||||
src/*/.gitignore
|
||||
ezfio_interface.irp.f
|
||||
share
|
||||
*.swp
|
||||
|
|
|
@ -4,90 +4,100 @@
|
|||
|
||||
** Changes
|
||||
|
||||
- Python3 replaces Python2
|
||||
- Travis CI uses 3 jobs
|
||||
- Moved Travis scripts into ~travis~ directory
|
||||
- IRPF90 and EZFIO are now git submodules
|
||||
- Now basis sets should be downloaded from basis-set-exchange website
|
||||
- Added ~bse~ in the installable tools
|
||||
- Documentation in ~src/README.rst~
|
||||
- Added two-body reduced density matrix
|
||||
- Added basis set correction
|
||||
- Added CAS-based on-top density functional
|
||||
- Improve PT2 computation for excited-states: Mostly 2x2
|
||||
diagonalization, and some (n+1)x(n+1) diagonalizations
|
||||
- Error bars for stochastic variance and norm of the perturbed wave function
|
||||
- Improve PT2-matching for excited-states
|
||||
- Compute the overlap of PT2 excited states
|
||||
- Renamed SOP into CFG
|
||||
- Improved parallelism in PT2 by splitting tasks
|
||||
- Use max in multi-state PT2 instead of sum for the selection weight
|
||||
- Added seniority
|
||||
- Added excitation_max
|
||||
- More tasks for distribueted Davidson
|
||||
- Random guess vectors in Davidson have zeros to preserve symmetry
|
||||
- Disk-based Davidson when too much memory is required
|
||||
- Fixed bug in DIIS
|
||||
- Fixed bug in molden (Au -> Angs)
|
||||
- Fixed bug with non-contiguous MOs in active space and deleter MOs
|
||||
- Complete network-free installation
|
||||
- Fixed bug in selection when computing full PT2
|
||||
- Updated version of f77-zmq
|
||||
- Python3 replaces Python2
|
||||
- Travis CI uses 3 jobs
|
||||
- Moved Travis scripts into ~travis~ directory
|
||||
- IRPF90 and EZFIO are now git submodules
|
||||
- Now basis sets should be downloaded from basis-set-exchange website
|
||||
- Added ~bse~ in the installable tools
|
||||
- Documentation in ~src/README.rst~
|
||||
- Added two-body reduced density matrix
|
||||
- Added basis set correction
|
||||
- Added GTOs with complex exponent
|
||||
- Added many types of integrals
|
||||
- Added CAS-based on-top density functional
|
||||
- Improve PT2 computation for excited-states: Mostly 2x2
|
||||
diagonalization, and some (n+1)x(n+1) diagonalizations
|
||||
- Error bars for stochastic variance and norm of the perturbed wave function
|
||||
- Improve PT2-matching for excited-states
|
||||
- Compute the overlap of PT2 excited states
|
||||
- Renamed SOP into CFG
|
||||
- Improved parallelism in PT2 by splitting tasks
|
||||
- Use max in multi-state PT2 instead of sum for the selection weight
|
||||
- Added seniority
|
||||
- Added excitation_max
|
||||
- More tasks for distribueted Davidson
|
||||
- Random guess vectors in Davidson have zeros to preserve symmetry
|
||||
- Disk-based Davidson when too much memory is required
|
||||
- Fixed bug in DIIS
|
||||
- Fixed bug in molden (Au -> Angs)
|
||||
- Fixed bug with non-contiguous MOs in active space and deleter MOs
|
||||
- Complete network-free installation
|
||||
- Fixed bug in selection when computing full PT2
|
||||
- Updated version of f77-zmq
|
||||
- Added transcorrelated SCF
|
||||
- Added transcorrelated CIPSI
|
||||
- Started to introduce shells in AOs
|
||||
- Added ECMD UEG functional
|
||||
- Introduced DFT-based basis set correction
|
||||
- General davidson algorithm
|
||||
|
||||
*** User interface
|
||||
** User interface
|
||||
|
||||
- Added ~qp_basis~ script to install a basis set from the ~bse~
|
||||
command-line tool
|
||||
- Introduced ~n_det_qp_edit~, ~psi_det_qp_edit~, and
|
||||
~psi_coef_qp_edit~ to accelerate the opening of qp_edit with
|
||||
large wave functions
|
||||
- Removed ~etc/ninja.rc~
|
||||
- Added flag to specify if the AOs are normalized
|
||||
- Added flag to specify if the primitive Gaussians are normalized
|
||||
- Added ~lin_dep_cutoff~, the cutoff for linear dependencies
|
||||
- Davidson convergence threshold can be adapted from PT2
|
||||
- In ~density_for_dft~, ~no_core_density~ is now a logical
|
||||
- Default for ~weight_selection~ has changed from 2 to 1
|
||||
- Nullify_small_elements in matrices to keep symmetry
|
||||
- Default of density functional changed from LDA to PBE
|
||||
- Added ~no_vvvv_integrals~ flag
|
||||
- Added ~pt2_min_parallel_tasks~ to control parallelism in PT2
|
||||
- Added ~print_energy~
|
||||
- Added ~print_hamiltonian~
|
||||
- Added input for two body RDM
|
||||
- Added keyword ~save_wf_after_selection~
|
||||
- Added a ~restore_symm~ flag to enforce the restoration of
|
||||
symmetry in matrices
|
||||
- qp_export_as_tgz exports also plugin codes
|
||||
- Added a basis module containing basis set information
|
||||
- Added qp_run truncate_wf
|
||||
- Added ~qp_basis~ script to install a basis set from the ~bse~
|
||||
command-line tool
|
||||
- Introduced ~n_det_qp_edit~, ~psi_det_qp_edit~, and
|
||||
~psi_coef_qp_edit~ to accelerate the opening of qp_edit with
|
||||
large wave functions
|
||||
- Removed ~etc/ninja.rc~
|
||||
- Added flag to specify if the AOs are normalized
|
||||
- Added flag to specify if the primitive Gaussians are normalized
|
||||
- Added ~lin_dep_cutoff~, the cutoff for linear dependencies
|
||||
- Davidson convergence threshold can be adapted from PT2
|
||||
- In ~density_for_dft~, ~no_core_density~ is now a logical
|
||||
- Default for ~weight_selection~ has changed from 2 to 1
|
||||
- Nullify_small_elements in matrices to keep symmetry
|
||||
- Default of density functional changed from LDA to PBE
|
||||
- Added ~no_vvvv_integrals~ flag
|
||||
- Added ~pt2_min_parallel_tasks~ to control parallelism in PT2
|
||||
- Added ~print_energy~
|
||||
- Added ~print_hamiltonian~
|
||||
- Added input for two body RDM
|
||||
- Added keyword ~save_wf_after_selection~
|
||||
- Added a ~restore_symm~ flag to enforce the restoration of
|
||||
symmetry in matrices
|
||||
- qp_export_as_tgz exports also plugin codes
|
||||
- Added a basis module containing basis set information
|
||||
- Added qp_run truncate_wf
|
||||
|
||||
*** Code
|
||||
** Code
|
||||
|
||||
- Many bug fixes
|
||||
- Changed electron-nucleus from ~e_n~ to ~n_e~ in names of variables
|
||||
- Changed ~occ_pattern~ to ~configuration~
|
||||
- Replaced ~List.map~ by a tail-recursive version ~Qputils.list_map~
|
||||
- Added possible imaginary part in OCaml MO coefficients
|
||||
- Added ~qp_clean_source_files.sh~ to remove non-ascii characters
|
||||
- Added flag ~is_periodic~ for periodic systems
|
||||
- Possibilities to handle complex integrals and complex MOs
|
||||
- Moved pseuodpotential integrals out of ~ao_one_e_integrals~
|
||||
- Removed Schwarz test and added logical functions
|
||||
~ao_two_e_integral_zero~ and ~ao_one_e_integral_zero~
|
||||
- Introduced type for ~pt2_data~
|
||||
- Banned excitations are used with far apart localized MOs
|
||||
- S_z2_Sz is now included in S2
|
||||
- S^2 in single precision
|
||||
- Added Shank function
|
||||
- Added utilities for periodic calculations
|
||||
- Added ~V_ne_psi_energy~
|
||||
- Added ~h_core_guess~ routine
|
||||
- Fixed Laplacians in real space (indices)
|
||||
- Added LIB file to add extra libs in plugin
|
||||
- Using Intel IPP for sorting when using Intel compiler
|
||||
- Removed parallelism in sorting
|
||||
- Compute banned_excitations from exchange integrals to accelerate with local MOs
|
||||
- Many bug fixes
|
||||
- Changed electron-nucleus from ~e_n~ to ~n_e~ in names of variables
|
||||
- Changed ~occ_pattern~ to ~configuration~
|
||||
- Replaced ~List.map~ by a tail-recursive version ~Qputils.list_map~
|
||||
- Added possible imaginary part in OCaml MO coefficients
|
||||
- Added ~qp_clean_source_files.sh~ to remove non-ascii characters
|
||||
- Added flag ~is_periodic~ for periodic systems
|
||||
- Possibilities to handle complex integrals and complex MOs
|
||||
- Moved pseuodpotential integrals out of ~ao_one_e_integrals~
|
||||
- Removed Schwarz test and added logical functions
|
||||
~ao_two_e_integral_zero~ and ~ao_one_e_integral_zero~
|
||||
- Introduced type for ~pt2_data~
|
||||
- Banned excitations are used with far apart localized MOs
|
||||
- S_z2_Sz is now included in S2
|
||||
- S^2 in single precision
|
||||
- Added Shank function
|
||||
- Added utilities for periodic calculations
|
||||
- Added ~V_ne_psi_energy~
|
||||
- Added ~h_core_guess~ routine
|
||||
- Fixed Laplacians in real space (indices)
|
||||
- Added LIB file to add extra libs in plugin
|
||||
- Using Intel IPP for sorting when using Intel compiler
|
||||
- Removed parallelism in sorting
|
||||
- Compute banned_excitations from exchange integrals to accelerate with local MOs
|
||||
- Updated OCaml for 4.13
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
21
configure
vendored
21
configure
vendored
|
@ -246,7 +246,7 @@ EOF
|
|||
execute << EOF
|
||||
cd "\${QP_ROOT}"/external
|
||||
tar --gunzip --extract --file qp2-dependencies/bse-v0.8.11.tar.gz
|
||||
pip install -e basis_set_exchange-*
|
||||
python3 -m pip install -e basis_set_exchange-*
|
||||
EOF
|
||||
|
||||
elif [[ ${PACKAGE} = zlib ]] ; then
|
||||
|
@ -303,6 +303,25 @@ fi
|
|||
|
||||
ZEROMQ=$(find_lib -lzmq)
|
||||
if [[ ${ZEROMQ} = $(not_found) ]] ; then
|
||||
|
||||
MAKE=$(find_exe make)
|
||||
if [[ ${MAKE} = $(not_found) ]] ; then
|
||||
error "make is not installed."
|
||||
fail
|
||||
fi
|
||||
|
||||
M4=$(find_exe autoreconf)
|
||||
if [[ ${M4} = $(not_found) ]] ; then
|
||||
error "autoreconf is not installed."
|
||||
fail
|
||||
fi
|
||||
|
||||
M4=$(find_exe m4)
|
||||
if [[ ${M4} = $(not_found) ]] ; then
|
||||
error "m4 preprocesssor is not installed."
|
||||
fail
|
||||
fi
|
||||
|
||||
error "ZeroMQ (zeromq) is not installed."
|
||||
fail
|
||||
fi
|
||||
|
|
|
@ -80,6 +80,8 @@ function qp()
|
|||
if [[ -d $NAME ]] ; then
|
||||
[[ -d $EZFIO_FILE ]] && ezfio unset_file
|
||||
ezfio set_file $NAME
|
||||
else
|
||||
qp_create_ezfio -h | more
|
||||
fi
|
||||
unset _ARGS
|
||||
;;
|
||||
|
|
2
external/.gitignore
vendored
2
external/.gitignore
vendored
|
@ -1,2 +1,2 @@
|
|||
#*
|
||||
*
|
||||
|
||||
|
|
1
external/Python/.gitignore
vendored
1
external/Python/.gitignore
vendored
|
@ -0,0 +1 @@
|
|||
docopt.py
|
8
include/.gitignore
vendored
8
include/.gitignore
vendored
|
@ -1,7 +1 @@
|
|||
zmq.h
|
||||
gmp.h
|
||||
zconf.h
|
||||
zconf.h
|
||||
zlib.h
|
||||
zmq_utils.h
|
||||
f77_zmq_free.h
|
||||
*
|
||||
|
|
|
@ -29,7 +29,7 @@ tests: $(ALL_TESTS)
|
|||
.gitignore: $(MLFILES) $(MLIFILES)
|
||||
@for i in .gitignore ezfio.ml element_create_db Qptypes.ml Git.ml *.byte *.native _build $(ALL_EXE) $(ALL_TESTS) \
|
||||
$(patsubst %.ml,%,$(wildcard test_*.ml)) $(patsubst %.ml,%,$(wildcard qp_*.ml)) \
|
||||
$(shell grep Input Input_auto_generated.ml | awk '{print $$2 ".ml"}') \
|
||||
Input_*.ml \
|
||||
qp_edit.ml qp_edit qp_edit.native Input_auto_generated.ml;\
|
||||
do \
|
||||
echo $$i ; \
|
||||
|
|
|
@ -10,7 +10,7 @@ type t =
|
|||
next : float;
|
||||
}
|
||||
|
||||
let init ?(bar_length=20) ?(start_value=0.) ?(end_value=1.) ~title =
|
||||
let init ?(bar_length=20) ?(start_value=0.) ?(end_value=1.) title =
|
||||
{ title ; start_value ; end_value ; bar_length ; cur_value=start_value ;
|
||||
init_time= Unix.time () ; dirty = false ; next = Unix.time () }
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ let new_job msg program_state rep_socket pair_socket =
|
|||
~start_value:0.
|
||||
~end_value:1.
|
||||
~bar_length:20
|
||||
~title:(Message.State.to_string state)
|
||||
(Message.State.to_string state)
|
||||
in
|
||||
|
||||
let result =
|
||||
|
|
3
scripts/.gitignore
vendored
3
scripts/.gitignore
vendored
|
@ -2,3 +2,6 @@
|
|||
*.pyo
|
||||
docopt.py
|
||||
resultsFile/
|
||||
verif_omp/a.out
|
||||
src/*/Makefile
|
||||
src/*/*/
|
||||
|
|
|
@ -99,9 +99,20 @@ def ninja_create_env_variable(pwd_config_file):
|
|||
l_string = ["builddir = {0}".format(os.path.dirname(ROOT_BUILD_NINJA)),
|
||||
""]
|
||||
|
||||
|
||||
for flag in ["FC", "FCFLAGS", "IRPF90", "IRPF90_FLAGS"]:
|
||||
str_ = "{0} = {1}".format(flag, get_compilation_option(pwd_config_file,
|
||||
flag))
|
||||
for directory in [real_join(QP_SRC, m) for m in sorted(os.listdir(QP_SRC))]:
|
||||
includefile = real_join(directory, flag)
|
||||
try:
|
||||
content = ""
|
||||
with open(includefile,'r') as f:
|
||||
content = f.read()
|
||||
str_ += " "+content
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
l_string.append(str_)
|
||||
|
||||
lib_lapack = get_compilation_option(pwd_config_file, "LAPACK_LIB")
|
||||
|
@ -110,17 +121,20 @@ def ninja_create_env_variable(pwd_config_file):
|
|||
str_lib = " ".join([lib_lapack, EZFIO_LIB, ZMQ_LIB, LIB, lib_usr])
|
||||
|
||||
# Read all LIB files in modules
|
||||
libfile = "LIB"
|
||||
try:
|
||||
content = ""
|
||||
with open(libfile,'r') as f:
|
||||
content = f.read()
|
||||
str_lib += " "+content
|
||||
except IOError:
|
||||
pass
|
||||
for directory in [real_join(QP_SRC, m) for m in sorted(os.listdir(QP_SRC))]:
|
||||
libfile = real_join(directory, "LIB")
|
||||
try:
|
||||
content = ""
|
||||
with open(libfile,'r') as f:
|
||||
content = f.read()
|
||||
str_lib += " "+content
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
l_string.append("LIB = {0} ".format(str_lib))
|
||||
|
||||
|
||||
l_string.append("CONFIG_FILE = {0}".format(pwd_config_file))
|
||||
l_string.append("")
|
||||
|
||||
return l_string
|
||||
|
|
11
src/.gitignore
vendored
Normal file
11
src/.gitignore
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
*
|
||||
!README.rst
|
||||
!*/
|
||||
*/*
|
||||
!*/*.*
|
||||
*/*.o
|
||||
*/build.ninja
|
||||
*/ezfio_interface.irp.f
|
||||
*/.gitignore
|
||||
*/*.swp
|
||||
|
|
@ -17,7 +17,7 @@ interface: ezfio, provider
|
|||
[ao_prim_num_max]
|
||||
type: integer
|
||||
doc: Maximum number of primitives
|
||||
default: =maxval(ao_basis.ao_prim_num)
|
||||
#default: =maxval(ao_basis.ao_prim_num)
|
||||
interface: ezfio
|
||||
|
||||
[ao_nucl]
|
||||
|
@ -67,4 +67,3 @@ doc: Use normalized primitive functions
|
|||
interface: ezfio, provider
|
||||
default: true
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ BEGIN_PROVIDER [ integer, ao_shell, (ao_num) ]
|
|||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_coef , (ao_num,ao_prim_num_max) ]
|
||||
BEGIN_PROVIDER [ double precision, ao_coef , (ao_num,ao_prim_num_max) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_expo , (ao_num,ao_prim_num_max) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
|
|
|
@ -12,21 +12,21 @@ double precision function ao_value(i,r)
|
|||
integer :: power_ao(3)
|
||||
double precision :: accu,dx,dy,dz,r2
|
||||
num_ao = ao_nucl(i)
|
||||
! power_ao(1:3)= ao_power(i,1:3)
|
||||
! center_ao(1:3) = nucl_coord(num_ao,1:3)
|
||||
! dx = (r(1) - center_ao(1))
|
||||
! dy = (r(2) - center_ao(2))
|
||||
! dz = (r(3) - center_ao(3))
|
||||
! r2 = dx*dx + dy*dy + dz*dz
|
||||
! dx = dx**power_ao(1)
|
||||
! dy = dy**power_ao(2)
|
||||
! dz = dz**power_ao(3)
|
||||
power_ao(1:3)= ao_power(i,1:3)
|
||||
center_ao(1:3) = nucl_coord(num_ao,1:3)
|
||||
dx = (r(1) - center_ao(1))
|
||||
dy = (r(2) - center_ao(2))
|
||||
dz = (r(3) - center_ao(3))
|
||||
r2 = dx*dx + dy*dy + dz*dz
|
||||
dx = dx**power_ao(1)
|
||||
dy = dy**power_ao(2)
|
||||
dz = dz**power_ao(3)
|
||||
|
||||
accu = 0.d0
|
||||
! do m=1,ao_prim_num(i)
|
||||
! beta = ao_expo_ordered_transp(m,i)
|
||||
! accu += ao_coef_normalized_ordered_transp(m,i) * dexp(-beta*r2)
|
||||
! enddo
|
||||
do m=1,ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
accu += ao_coef_normalized_ordered_transp(m,i) * dexp(-beta*r2)
|
||||
enddo
|
||||
ao_value = accu * dx * dy * dz
|
||||
|
||||
end
|
||||
|
|
5
src/ao_many_one_e_ints/NEED
Normal file
5
src/ao_many_one_e_ints/NEED
Normal file
|
@ -0,0 +1,5 @@
|
|||
ao_one_e_ints
|
||||
ao_two_e_ints
|
||||
becke_numerical_grid
|
||||
mo_one_e_ints
|
||||
dft_utils_in_r
|
25
src/ao_many_one_e_ints/README.rst
Normal file
25
src/ao_many_one_e_ints/README.rst
Normal file
|
@ -0,0 +1,25 @@
|
|||
==================
|
||||
ao_many_one_e_ints
|
||||
==================
|
||||
|
||||
This module contains A LOT of one-electron integrals of the type
|
||||
A_ij( r ) = \int dr' phi_i(r') w(r,r') phi_j(r')
|
||||
where r is a point in real space.
|
||||
|
||||
+) ao_gaus_gauss.irp.f: w(r,r') is a exp(-(r-r')^2) , and can be multiplied by x/y/z
|
||||
+) ao_erf_gauss.irp.f : w(r,r') is a exp(-(r-r')^2) erf(mu * |r-r'|)/|r-r'| , and can be multiplied by x/y/z
|
||||
+) ao_erf_gauss_grad.irp.f: w(r,r') is a exp(-(r-r')^2) erf(mu * |r-r'|)/|r-r'| , and can be multiplied by x/y/z, but evaluated with also one gradient of an AO function.
|
||||
|
||||
Fit of a Slater function and corresponding integrals
|
||||
----------------------------------------------------
|
||||
The file fit_slat_gauss.irp.f contains many useful providers/routines to fit a Slater function with 20 gaussian.
|
||||
+) coef_fit_slat_gauss : coefficients of the gaussians to fit e^(-x)
|
||||
+) expo_fit_slat_gauss : exponents of the gaussians to fit e^(-x)
|
||||
|
||||
Integrals involving Slater functions : stg_gauss_int.irp.f
|
||||
|
||||
Taylor expansion of full correlation factor
|
||||
-------------------------------------------
|
||||
In taylor_exp.irp.f you might find interesting integrals of the type
|
||||
\int dr' exp( e^{-alpha |r-r|' - beta |r-r'|^2}) phi_i(r') phi_j(r')
|
||||
evaluated as a Taylor expansion of the exponential.
|
561
src/ao_many_one_e_ints/ao_erf_gauss.irp.f
Normal file
561
src/ao_many_one_e_ints/ao_erf_gauss.irp.f
Normal file
|
@ -0,0 +1,561 @@
|
|||
|
||||
! ---
|
||||
|
||||
subroutine phi_j_erf_mu_r_xyz_phi(i,j,mu_in, C_center, xyz_ints)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! xyz_ints(1/2/3) = int dr phi_j(r) [erf(mu |r - C|)/|r-C|] x/y/z phi_i(r)
|
||||
!
|
||||
! where phi_i and phi_j are AOs
|
||||
END_DOC
|
||||
integer, intent(in) :: i,j
|
||||
double precision, intent(in) :: mu_in, C_center(3)
|
||||
double precision, intent(out):: xyz_ints(3)
|
||||
integer :: num_A,power_A(3), num_b, power_B(3),power_B_tmp(3)
|
||||
double precision :: alpha, beta, A_center(3), B_center(3),contrib,NAI_pol_mult_erf
|
||||
integer :: n_pt_in,l,m,mm
|
||||
xyz_ints = 0.d0
|
||||
if(ao_overlap_abs(j,i).lt.1.d-12)then
|
||||
return
|
||||
endif
|
||||
n_pt_in = n_pt_max_integrals
|
||||
! j
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3)= ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
! i
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3)= ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l=1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
do m=1,ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
do mm = 1, 3
|
||||
! (x phi_i ) * phi_j
|
||||
! x * (x - B_x)^b_x = b_x (x - B_x)^b_x + 1 * (x - B_x)^{b_x+1}
|
||||
!
|
||||
! first contribution :: B_x (x - B_x)^b_x :: usual integral multiplied by B_x
|
||||
power_B_tmp = power_B
|
||||
contrib = NAI_pol_mult_erf(A_center,B_center,power_A,power_B_tmp,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
xyz_ints(mm) += contrib * B_center(mm) * ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i)
|
||||
! second contribution :: 1 * (x - B_x)^(b_x+1) :: integral with b_x=>b_x+1
|
||||
power_B_tmp(mm) += 1
|
||||
contrib = NAI_pol_mult_erf(A_center,B_center,power_A,power_B_tmp,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
xyz_ints(mm) += contrib * 1.d0 * ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
double precision function phi_j_erf_mu_r_phi(i, j, mu_in, C_center)
|
||||
|
||||
BEGIN_DOC
|
||||
! phi_j_erf_mu_r_phi = int dr phi_j(r) [erf(mu |r - C|)/|r-C|] phi_i(r)
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: i,j
|
||||
double precision, intent(in) :: mu_in, C_center(3)
|
||||
|
||||
integer :: num_A, power_A(3), num_b, power_B(3)
|
||||
integer :: n_pt_in, l, m
|
||||
double precision :: alpha, beta, A_center(3), B_center(3), contrib
|
||||
|
||||
double precision :: NAI_pol_mult_erf
|
||||
|
||||
phi_j_erf_mu_r_phi = 0.d0
|
||||
|
||||
if(ao_overlap_abs(j,i).lt.1.d-12) then
|
||||
return
|
||||
endif
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
! j
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
! i
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
contrib = NAI_pol_mult_erf(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in, mu_in)
|
||||
|
||||
phi_j_erf_mu_r_phi += contrib * ao_coef_normalized_ordered_transp(l,j) * ao_coef_normalized_ordered_transp(m,i)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end function phi_j_erf_mu_r_phi
|
||||
|
||||
! ---
|
||||
|
||||
subroutine erfc_mu_gauss_xyz_ij_ao(i, j, mu, C_center, delta, gauss_ints)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! gauss_ints(m) = \int dr exp(-delta (r - C)^2 ) x/y/z * ( 1 - erf(mu |r-r'|))/ |r-r'| * AO_i(r') * AO_j(r')
|
||||
!
|
||||
! with m = 1 ==> x, m = 2, m = 3 ==> z
|
||||
!
|
||||
! m = 4 ==> no x/y/z
|
||||
END_DOC
|
||||
integer, intent(in) :: i,j
|
||||
double precision, intent(in) :: mu, C_center(3),delta
|
||||
double precision, intent(out):: gauss_ints(4)
|
||||
|
||||
integer :: num_A,power_A(3), num_b, power_B(3)
|
||||
double precision :: alpha, beta, A_center(3), B_center(3),contrib,NAI_pol_mult_erf
|
||||
double precision :: xyz_ints(4)
|
||||
integer :: n_pt_in,l,m,mm
|
||||
gauss_ints = 0.d0
|
||||
if(ao_overlap_abs(j,i).lt.1.d-12)then
|
||||
return
|
||||
endif
|
||||
n_pt_in = n_pt_max_integrals
|
||||
! j
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3)= ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
! i
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3)= ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
gauss_ints = 0.d0
|
||||
do l=1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
do m=1,ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
call erfc_mu_gauss_xyz(C_center,delta,mu,A_center,B_center,power_A,power_B,alpha,beta,n_pt_in,xyz_ints)
|
||||
do mm = 1, 4
|
||||
gauss_ints(mm) += xyz_ints(mm) * ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
subroutine erf_mu_gauss_ij_ao(i, j, mu, C_center, delta, gauss_ints)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! gauss_ints = \int dr exp(-delta (r - C)^2) * erf(mu |r-C|) / |r-C| * AO_i(r) * AO_j(r)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: i, j
|
||||
double precision, intent(in) :: mu, C_center(3), delta
|
||||
double precision, intent(out) :: gauss_ints
|
||||
|
||||
integer :: n_pt_in, l, m
|
||||
integer :: num_A, power_A(3), num_b, power_B(3)
|
||||
double precision :: alpha, beta, A_center(3), B_center(3), coef
|
||||
double precision :: integral
|
||||
|
||||
double precision :: erf_mu_gauss
|
||||
|
||||
gauss_ints = 0.d0
|
||||
|
||||
if(ao_overlap_abs(j,i).lt.1.d-12) then
|
||||
return
|
||||
endif
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
! j
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
! i
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
coef = ao_coef_normalized_ordered_transp(l,j) * ao_coef_normalized_ordered_transp(m,i)
|
||||
|
||||
if(dabs(coef) .lt. 1.d-12) cycle
|
||||
|
||||
integral = erf_mu_gauss(C_center, delta, mu, A_center, B_center, power_A, power_B, alpha, beta, n_pt_in)
|
||||
|
||||
gauss_ints += integral * coef
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end subroutine erf_mu_gauss_ij_ao
|
||||
|
||||
! ---
|
||||
|
||||
subroutine NAI_pol_x_mult_erf_ao(i_ao, j_ao, mu_in, C_center, ints)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr x * \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr y * \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr z * \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i_ao, j_ao
|
||||
double precision, intent(in) :: mu_in, C_center(3)
|
||||
double precision, intent(out) :: ints(3)
|
||||
|
||||
integer :: i, j, num_A, num_B, power_A(3), power_B(3), n_pt_in, power_xA(3), m
|
||||
double precision :: A_center(3), B_center(3), integral, alpha, beta, coef
|
||||
|
||||
double precision :: NAI_pol_mult_erf
|
||||
|
||||
ints = 0.d0
|
||||
if(ao_overlap_abs(j_ao,i_ao).lt.1.d-12) then
|
||||
return
|
||||
endif
|
||||
|
||||
num_A = ao_nucl(i_ao)
|
||||
power_A(1:3) = ao_power(i_ao,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
num_B = ao_nucl(j_ao)
|
||||
power_B(1:3) = ao_power(j_ao,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
do i = 1, ao_prim_num(i_ao)
|
||||
alpha = ao_expo_ordered_transp(i,i_ao)
|
||||
|
||||
do m = 1, 3
|
||||
|
||||
power_xA = power_A
|
||||
! x * phi_i(r) = x * (x-Ax)**ax = (x-Ax)**(ax+1) + Ax * (x-Ax)**ax
|
||||
power_xA(m) += 1
|
||||
|
||||
do j = 1, ao_prim_num(j_ao)
|
||||
beta = ao_expo_ordered_transp(j,j_ao)
|
||||
coef = ao_coef_normalized_ordered_transp(j,j_ao) * ao_coef_normalized_ordered_transp(i,i_ao)
|
||||
|
||||
! First term = (x-Ax)**(ax+1)
|
||||
integral = NAI_pol_mult_erf(A_center, B_center, power_xA, power_B, alpha, beta, C_center, n_pt_in, mu_in)
|
||||
ints(m) += integral * coef
|
||||
|
||||
! Second term = Ax * (x-Ax)**(ax)
|
||||
integral = NAI_pol_mult_erf(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in, mu_in)
|
||||
ints(m) += A_center(m) * integral * coef
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end subroutine NAI_pol_x_mult_erf_ao
|
||||
|
||||
! ---
|
||||
subroutine NAI_pol_x_mult_erf_ao_v(i_ao, j_ao, mu_in, C_center, ints, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr x * \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr y * \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr z * \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i_ao, j_ao, n_points
|
||||
double precision, intent(in) :: mu_in, C_center(n_points,3)
|
||||
double precision, intent(out) :: ints(n_points,3)
|
||||
|
||||
integer :: i, j, num_A, num_B, power_A(3), power_B(3), n_pt_in
|
||||
integer :: power_xA(3), m, ipoint
|
||||
double precision :: A_center(3), B_center(3), alpha, beta, coef
|
||||
double precision, allocatable :: integral(:)
|
||||
double precision :: NAI_pol_mult_erf
|
||||
|
||||
ints = 0.d0
|
||||
if(ao_overlap_abs(j_ao,i_ao).lt.1.d-12) then
|
||||
return
|
||||
endif
|
||||
|
||||
num_A = ao_nucl(i_ao)
|
||||
power_A(1:3) = ao_power(i_ao,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
num_B = ao_nucl(j_ao)
|
||||
power_B(1:3) = ao_power(j_ao,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
allocate(integral(n_points))
|
||||
do i = 1, ao_prim_num(i_ao)
|
||||
alpha = ao_expo_ordered_transp(i,i_ao)
|
||||
|
||||
do m = 1, 3
|
||||
|
||||
power_xA = power_A
|
||||
! x * phi_i(r) = x * (x-Ax)**ax = (x-Ax)**(ax+1) + Ax * (x-Ax)**ax
|
||||
power_xA(m) += 1
|
||||
|
||||
do j = 1, ao_prim_num(j_ao)
|
||||
beta = ao_expo_ordered_transp(j,j_ao)
|
||||
coef = ao_coef_normalized_ordered_transp(j,j_ao) * ao_coef_normalized_ordered_transp(i,i_ao)
|
||||
|
||||
! First term = (x-Ax)**(ax+1)
|
||||
call NAI_pol_mult_erf_v(A_center, B_center, power_xA, power_B, alpha, beta, C_center, n_pt_in, mu_in, integral, n_points)
|
||||
do ipoint=1,n_points
|
||||
ints(ipoint,m) += integral(ipoint) * coef
|
||||
enddo
|
||||
|
||||
! Second term = Ax * (x-Ax)**(ax)
|
||||
call NAI_pol_mult_erf_v(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in, mu_in, integral, n_points)
|
||||
do ipoint=1,n_points
|
||||
ints(ipoint,m) += A_center(m) * integral(ipoint) * coef
|
||||
enddo
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(integral)
|
||||
|
||||
end subroutine NAI_pol_x_mult_erf_ao_v
|
||||
|
||||
! ---
|
||||
subroutine NAI_pol_x_mult_erf_ao_with1s(i_ao, j_ao, beta, B_center, mu_in, C_center, ints)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr x * \chi_i(r) \chi_j(r) e^{-\beta (r - B_center)^2} \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr y * \chi_i(r) \chi_j(r) e^{-\beta (r - B_center)^2} \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr z * \chi_i(r) \chi_j(r) e^{-\beta (r - B_center)^2} \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i_ao, j_ao
|
||||
double precision, intent(in) :: beta, B_center(3), mu_in, C_center(3)
|
||||
double precision, intent(out) :: ints(3)
|
||||
|
||||
integer :: i, j, power_Ai(3), power_Aj(3), n_pt_in, power_xA(3), m
|
||||
double precision :: Ai_center(3), Aj_center(3), integral, alphai, alphaj, coef, coefi
|
||||
|
||||
double precision, external :: NAI_pol_mult_erf_with1s
|
||||
|
||||
ASSERT(beta .ge. 0.d0)
|
||||
if(beta .lt. 1d-10) then
|
||||
call NAI_pol_x_mult_erf_ao(i_ao, j_ao, mu_in, C_center, ints)
|
||||
return
|
||||
endif
|
||||
|
||||
ints = 0.d0
|
||||
if(ao_overlap_abs(j_ao,i_ao) .lt. 1.d-12) then
|
||||
return
|
||||
endif
|
||||
|
||||
power_Ai(1:3) = ao_power(i_ao,1:3)
|
||||
power_Aj(1:3) = ao_power(j_ao,1:3)
|
||||
|
||||
Ai_center(1:3) = nucl_coord(ao_nucl(i_ao),1:3)
|
||||
Aj_center(1:3) = nucl_coord(ao_nucl(j_ao),1:3)
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
do i = 1, ao_prim_num(i_ao)
|
||||
alphai = ao_expo_ordered_transp (i,i_ao)
|
||||
coefi = ao_coef_normalized_ordered_transp(i,i_ao)
|
||||
|
||||
do m = 1, 3
|
||||
|
||||
! x * phi_i(r) = x * (x-Ax)**ax = (x-Ax)**(ax+1) + Ax * (x-Ax)**ax
|
||||
power_xA = power_Ai
|
||||
power_xA(m) += 1
|
||||
|
||||
do j = 1, ao_prim_num(j_ao)
|
||||
alphaj = ao_expo_ordered_transp (j,j_ao)
|
||||
coef = coefi * ao_coef_normalized_ordered_transp(j,j_ao)
|
||||
|
||||
! First term = (x-Ax)**(ax+1)
|
||||
integral = NAI_pol_mult_erf_with1s( Ai_center, Aj_center, power_xA, power_Aj, alphai, alphaj &
|
||||
, beta, B_center, C_center, n_pt_in, mu_in )
|
||||
ints(m) += integral * coef
|
||||
|
||||
! Second term = Ax * (x-Ax)**(ax)
|
||||
integral = NAI_pol_mult_erf_with1s( Ai_center, Aj_center, power_Ai, power_Aj, alphai, alphaj &
|
||||
, beta, B_center, C_center, n_pt_in, mu_in )
|
||||
ints(m) += Ai_center(m) * integral * coef
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end subroutine NAI_pol_x_mult_erf_ao_with1s
|
||||
|
||||
!--
|
||||
|
||||
subroutine NAI_pol_x_mult_erf_ao_with1s_v(i_ao, j_ao, beta, B_center, mu_in, C_center, ints, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr x * \chi_i(r) \chi_j(r) e^{-\beta (r - B_center)^2} \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr y * \chi_i(r) \chi_j(r) e^{-\beta (r - B_center)^2} \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
! $\int_{-\infty}^{infty} dr z * \chi_i(r) \chi_j(r) e^{-\beta (r - B_center)^2} \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i_ao, j_ao, n_points
|
||||
double precision, intent(in) :: beta, B_center(n_points,3), mu_in, C_center(n_points,3)
|
||||
double precision, intent(out) :: ints(n_points,3)
|
||||
|
||||
integer :: i, j, power_Ai(3), power_Aj(3), n_pt_in, power_xA(3), m
|
||||
double precision :: Ai_center(3), Aj_center(3), alphai, alphaj, coef, coefi
|
||||
|
||||
integer :: ipoint
|
||||
double precision, allocatable :: integral(:)
|
||||
|
||||
if(beta .lt. 1d-10) then
|
||||
call NAI_pol_x_mult_erf_ao_v(i_ao, j_ao, mu_in, C_center, ints, n_points)
|
||||
return
|
||||
endif
|
||||
|
||||
ints(:,:) = 0.d0
|
||||
if(ao_overlap_abs(j_ao,i_ao) .lt. 1.d-12) then
|
||||
return
|
||||
endif
|
||||
|
||||
power_Ai(1:3) = ao_power(i_ao,1:3)
|
||||
power_Aj(1:3) = ao_power(j_ao,1:3)
|
||||
|
||||
Ai_center(1:3) = nucl_coord(ao_nucl(i_ao),1:3)
|
||||
Aj_center(1:3) = nucl_coord(ao_nucl(j_ao),1:3)
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
allocate(integral(n_points))
|
||||
do i = 1, ao_prim_num(i_ao)
|
||||
alphai = ao_expo_ordered_transp (i,i_ao)
|
||||
coefi = ao_coef_normalized_ordered_transp(i,i_ao)
|
||||
|
||||
do m = 1, 3
|
||||
|
||||
! x * phi_i(r) = x * (x-Ax)**ax = (x-Ax)**(ax+1) + Ax * (x-Ax)**ax
|
||||
power_xA = power_Ai
|
||||
power_xA(m) += 1
|
||||
|
||||
do j = 1, ao_prim_num(j_ao)
|
||||
alphaj = ao_expo_ordered_transp (j,j_ao)
|
||||
coef = coefi * ao_coef_normalized_ordered_transp(j,j_ao)
|
||||
|
||||
! First term = (x-Ax)**(ax+1)
|
||||
call NAI_pol_mult_erf_with1s_v( Ai_center, Aj_center, power_xA, power_Aj, alphai, &
|
||||
alphaj, beta, B_center, C_center, n_pt_in, mu_in, integral, n_points)
|
||||
do ipoint = 1, n_points
|
||||
ints(ipoint,m) += integral(ipoint) * coef
|
||||
enddo
|
||||
|
||||
! Second term = Ax * (x-Ax)**(ax)
|
||||
call NAI_pol_mult_erf_with1s_v( Ai_center, Aj_center, power_Ai, power_Aj, alphai, &
|
||||
alphaj, beta, B_center, C_center, n_pt_in, mu_in, integral, n_points)
|
||||
do ipoint = 1, n_points
|
||||
ints(ipoint,m) += Ai_center(m) * integral(ipoint) * coef
|
||||
enddo
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(integral)
|
||||
|
||||
end subroutine NAI_pol_x_mult_erf_ao_with1s
|
||||
|
||||
|
||||
! ---
|
||||
|
||||
subroutine NAI_pol_x_specify_mult_erf_ao(i_ao,j_ao,mu_in,C_center,m,ints)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
! $\int_{-\infty}^{infty} dr X(m) * \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
! if m == 1 X(m) = x, m == 1 X(m) = y, m == 1 X(m) = z
|
||||
END_DOC
|
||||
include 'utils/constants.include.F'
|
||||
integer, intent(in) :: i_ao,j_ao,m
|
||||
double precision, intent(in) :: mu_in, C_center(3)
|
||||
double precision, intent(out):: ints
|
||||
double precision :: A_center(3), B_center(3),integral, alpha,beta
|
||||
double precision :: NAI_pol_mult_erf
|
||||
integer :: i,j,num_A,num_B, power_A(3), power_B(3), n_pt_in, power_xA(3)
|
||||
ints = 0.d0
|
||||
if(ao_overlap_abs(j_ao,i_ao).lt.1.d-12)then
|
||||
return
|
||||
endif
|
||||
num_A = ao_nucl(i_ao)
|
||||
power_A(1:3)= ao_power(i_ao,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
num_B = ao_nucl(j_ao)
|
||||
power_B(1:3)= ao_power(j_ao,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
do i = 1, ao_prim_num(i_ao)
|
||||
alpha = ao_expo_ordered_transp(i,i_ao)
|
||||
power_xA = power_A
|
||||
! x * phi_i(r) = x * (x-Ax)**ax = (x-Ax)**(ax+1) + Ax * (x-Ax)**ax
|
||||
power_xA(m) += 1
|
||||
do j = 1, ao_prim_num(j_ao)
|
||||
beta = ao_expo_ordered_transp(j,j_ao)
|
||||
! First term = (x-Ax)**(ax+1)
|
||||
integral = NAI_pol_mult_erf(A_center,B_center,power_xA,power_B,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
ints += integral * ao_coef_normalized_ordered_transp(j,j_ao)*ao_coef_normalized_ordered_transp(i,i_ao)
|
||||
! Second term = Ax * (x-Ax)**(ax)
|
||||
integral = NAI_pol_mult_erf(A_center,B_center,power_A,power_B,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
ints += A_center(m) * integral * ao_coef_normalized_ordered_transp(j,j_ao)*ao_coef_normalized_ordered_transp(i,i_ao)
|
||||
enddo
|
||||
enddo
|
||||
end
|
||||
|
||||
! ---
|
||||
|
150
src/ao_many_one_e_ints/ao_erf_gauss_grad.irp.f
Normal file
150
src/ao_many_one_e_ints/ao_erf_gauss_grad.irp.f
Normal file
|
@ -0,0 +1,150 @@
|
|||
subroutine phi_j_erf_mu_r_dxyz_phi(i,j,mu_in, C_center, dxyz_ints)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! dxyz_ints(1/2/3) = int dr phi_i(r) [erf(mu |r - C|)/|r-C|] d/d(x/y/z) phi_i(r)
|
||||
END_DOC
|
||||
integer, intent(in) :: i,j
|
||||
double precision, intent(in) :: mu_in, C_center(3)
|
||||
double precision, intent(out):: dxyz_ints(3)
|
||||
integer :: num_A,power_A(3), num_b, power_B(3),power_B_tmp(3)
|
||||
double precision :: alpha, beta, A_center(3), B_center(3),contrib,NAI_pol_mult_erf,coef,thr
|
||||
integer :: n_pt_in,l,m,mm
|
||||
thr = 1.d-12
|
||||
dxyz_ints = 0.d0
|
||||
if(ao_overlap_abs(j,i).lt.thr)then
|
||||
return
|
||||
endif
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
! j
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3)= ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
! i
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3)= ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l=1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
do m=1,ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
coef = ao_coef_normalized_ordered_transp(l,j) * ao_coef_normalized_ordered_transp(m,i)
|
||||
if(dabs(coef).lt.thr)cycle
|
||||
do mm = 1, 3
|
||||
! (d/dx phi_i ) * phi_j
|
||||
! d/dx * (x - B_x)^b_x exp(-beta * (x -B_x)^2)= [b_x * (x - B_x)^(b_x - 1) - 2 beta * (x - B_x)^(b_x + 1)] exp(-beta * (x -B_x)^2)
|
||||
!
|
||||
! first contribution :: b_x (x - B_x)^(b_x-1) :: integral with b_x=>b_x-1 multiplied by b_x
|
||||
power_B_tmp = power_B
|
||||
power_B_tmp(mm) += -1
|
||||
contrib = NAI_pol_mult_erf(A_center,B_center,power_A,power_B_tmp,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
dxyz_ints(mm) += contrib * dble(power_B(mm)) * coef
|
||||
|
||||
! second contribution :: - 2 beta * (x - B_x)^(b_x + 1) :: integral with b_x=> b_x+1 multiplied by -2 * beta
|
||||
power_B_tmp = power_B
|
||||
power_B_tmp(mm) += 1
|
||||
contrib = NAI_pol_mult_erf(A_center,B_center,power_A,power_B_tmp,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
dxyz_ints(mm) += contrib * (-2.d0 * beta ) * coef
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
subroutine phi_j_erf_mu_r_dxyz_phi_bis(i,j,mu_in, C_center, dxyz_ints)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! dxyz_ints(1/2/3) = int dr phi_j(r) [erf(mu |r - C|)/|r-C|] d/d(x/y/z) phi_i(r)
|
||||
END_DOC
|
||||
integer, intent(in) :: i,j
|
||||
double precision, intent(in) :: mu_in, C_center(3)
|
||||
double precision, intent(out):: dxyz_ints(3)
|
||||
integer :: num_A,power_A(3), num_b, power_B(3),power_B_tmp(3)
|
||||
double precision :: alpha, beta, A_center(3), B_center(3),contrib,NAI_pol_mult_erf
|
||||
double precision :: thr, coef
|
||||
integer :: n_pt_in,l,m,mm,kk
|
||||
thr = 1.d-12
|
||||
dxyz_ints = 0.d0
|
||||
if(ao_overlap_abs(j,i).lt.thr)then
|
||||
return
|
||||
endif
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
! j == A
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3)= ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
! i == B
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3)= ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
dxyz_ints = 0.d0
|
||||
do l=1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
do m=1,ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
do kk = 1, 2 ! loop over the extra terms induced by the d/dx/y/z * AO(i)
|
||||
do mm = 1, 3
|
||||
power_B_tmp = power_B
|
||||
power_B_tmp(mm) = power_ord_grad_transp(kk,mm,i)
|
||||
coef = ao_coef_normalized_ordered_transp(l,j) * ao_coef_ord_grad_transp(kk,mm,m,i)
|
||||
if(dabs(coef).lt.thr)cycle
|
||||
contrib = NAI_pol_mult_erf(A_center,B_center,power_A,power_B_tmp,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
dxyz_ints(mm) += contrib * coef
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
end
|
||||
|
||||
subroutine phi_j_erf_mu_r_xyz_dxyz_phi(i,j,mu_in, C_center, dxyz_ints)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! dxyz_ints(1/2/3) = int dr phi_j(r) x/y/z [erf(mu |r - C|)/|r-C|] d/d(x/y/z) phi_i(r)
|
||||
END_DOC
|
||||
integer, intent(in) :: i,j
|
||||
double precision, intent(in) :: mu_in, C_center(3)
|
||||
double precision, intent(out):: dxyz_ints(3)
|
||||
integer :: num_A,power_A(3), num_b, power_B(3),power_B_tmp(3)
|
||||
double precision :: alpha, beta, A_center(3), B_center(3),contrib,NAI_pol_mult_erf
|
||||
double precision :: thr, coef
|
||||
integer :: n_pt_in,l,m,mm,kk
|
||||
thr = 1.d-12
|
||||
dxyz_ints = 0.d0
|
||||
if(ao_overlap_abs(j,i).lt.thr)then
|
||||
return
|
||||
endif
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
! j == A
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3)= ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
! i == B
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3)= ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
dxyz_ints = 0.d0
|
||||
do l=1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
do m=1,ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
do kk = 1, 4 ! loop over the extra terms induced by the x/y/z * d dx/y/z AO(i)
|
||||
do mm = 1, 3
|
||||
power_B_tmp = power_B
|
||||
power_B_tmp(mm) = power_ord_xyz_grad_transp(kk,mm,i)
|
||||
coef = ao_coef_normalized_ordered_transp(l,j) * ao_coef_ord_xyz_grad_transp(kk,mm,m,i)
|
||||
if(dabs(coef).lt.thr)cycle
|
||||
contrib = NAI_pol_mult_erf(A_center,B_center,power_A,power_B_tmp,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
dxyz_ints(mm) += contrib * coef
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
end
|
372
src/ao_many_one_e_ints/ao_gaus_gauss.irp.f
Normal file
372
src/ao_many_one_e_ints/ao_gaus_gauss.irp.f
Normal file
|
@ -0,0 +1,372 @@
|
|||
subroutine overlap_gauss_xyz_r12_ao(D_center,delta,i,j,gauss_ints)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! gauss_ints(m) = \int dr AO_i(r) AO_j(r) x/y/z e^{-delta |r-D_center|^2}
|
||||
!
|
||||
! with m == 1 ==> x, m == 2 ==> y, m == 3 ==> z
|
||||
END_DOC
|
||||
integer, intent(in) :: i,j
|
||||
double precision, intent(in) :: D_center(3), delta
|
||||
double precision, intent(out) :: gauss_ints(3)
|
||||
|
||||
integer :: num_a,num_b,power_A(3), power_B(3),l,k,m
|
||||
double precision :: A_center(3), B_center(3),overlap_gauss_r12,alpha,beta,gauss_ints_tmp(3)
|
||||
gauss_ints = 0.d0
|
||||
if(ao_overlap_abs(j,i).lt.1.d-12)then
|
||||
return
|
||||
endif
|
||||
num_A = ao_nucl(i)
|
||||
power_A(1:3)= ao_power(i,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
num_B = ao_nucl(j)
|
||||
power_B(1:3)= ao_power(j,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
do l=1,ao_prim_num(i)
|
||||
alpha = ao_expo_ordered_transp(l,i)
|
||||
do k=1,ao_prim_num(j)
|
||||
beta = ao_expo_ordered_transp(k,j)
|
||||
call overlap_gauss_xyz_r12(D_center,delta,A_center,B_center,power_A,power_B,alpha,beta,gauss_ints_tmp)
|
||||
do m = 1, 3
|
||||
gauss_ints(m) += gauss_ints_tmp(m) * ao_coef_normalized_ordered_transp(l,i) &
|
||||
* ao_coef_normalized_ordered_transp(k,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
end
|
||||
|
||||
|
||||
|
||||
double precision function overlap_gauss_xyz_r12_ao_specific(D_center,delta,i,j,mx)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! \int dr AO_i(r) AO_j(r) x/y/z e^{-delta |r-D_center|^2}
|
||||
!
|
||||
! with mx == 1 ==> x, mx == 2 ==> y, mx == 3 ==> z
|
||||
END_DOC
|
||||
integer, intent(in) :: i,j,mx
|
||||
double precision, intent(in) :: D_center(3), delta
|
||||
|
||||
integer :: num_a,num_b,power_A(3), power_B(3),l,k
|
||||
double precision :: gauss_int
|
||||
double precision :: A_center(3), B_center(3),overlap_gauss_r12,alpha,beta
|
||||
double precision :: overlap_gauss_xyz_r12_specific
|
||||
overlap_gauss_xyz_r12_ao_specific = 0.d0
|
||||
if(ao_overlap_abs(j,i).lt.1.d-12)then
|
||||
return
|
||||
endif
|
||||
num_A = ao_nucl(i)
|
||||
power_A(1:3)= ao_power(i,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
num_B = ao_nucl(j)
|
||||
power_B(1:3)= ao_power(j,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
do l=1,ao_prim_num(i)
|
||||
alpha = ao_expo_ordered_transp(l,i)
|
||||
do k=1,ao_prim_num(j)
|
||||
beta = ao_expo_ordered_transp(k,j)
|
||||
gauss_int = overlap_gauss_xyz_r12_specific(D_center,delta,A_center,B_center,power_A,power_B,alpha,beta,mx)
|
||||
overlap_gauss_xyz_r12_ao_specific = gauss_int * ao_coef_normalized_ordered_transp(l,i) &
|
||||
* ao_coef_normalized_ordered_transp(k,j)
|
||||
enddo
|
||||
enddo
|
||||
end
|
||||
|
||||
|
||||
subroutine overlap_gauss_r12_all_ao(D_center,delta,aos_ints)
|
||||
implicit none
|
||||
double precision, intent(in) :: D_center(3), delta
|
||||
double precision, intent(out):: aos_ints(ao_num,ao_num)
|
||||
|
||||
integer :: num_a,num_b,power_A(3), power_B(3),l,k,i,j
|
||||
double precision :: A_center(3), B_center(3),overlap_gauss_r12,alpha,beta,analytical_j
|
||||
aos_ints = 0.d0
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
if(ao_overlap_abs(j,i).lt.1.d-12)cycle
|
||||
num_A = ao_nucl(i)
|
||||
power_A(1:3)= ao_power(i,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
num_B = ao_nucl(j)
|
||||
power_B(1:3)= ao_power(j,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
do l=1,ao_prim_num(i)
|
||||
alpha = ao_expo_ordered_transp(l,i)
|
||||
do k=1,ao_prim_num(j)
|
||||
beta = ao_expo_ordered_transp(k,j)
|
||||
analytical_j = overlap_gauss_r12(D_center,delta,A_center,B_center,power_A,power_B,alpha,beta)
|
||||
aos_ints(j,i) += analytical_j * ao_coef_normalized_ordered_transp(l,i) &
|
||||
* ao_coef_normalized_ordered_transp(k,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
! TODO :: PUT CYCLES IN LOOPS
|
||||
double precision function overlap_gauss_r12_ao(D_center, delta, i, j)
|
||||
|
||||
BEGIN_DOC
|
||||
! \int dr AO_i(r) AO_j(r) e^{-delta |r-D_center|^2}
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: i, j
|
||||
double precision, intent(in) :: D_center(3), delta
|
||||
|
||||
integer :: power_A(3), power_B(3), l, k
|
||||
double precision :: A_center(3), B_center(3), alpha, beta, coef, coef1, analytical_j
|
||||
|
||||
double precision, external :: overlap_gauss_r12
|
||||
|
||||
overlap_gauss_r12_ao = 0.d0
|
||||
|
||||
if(ao_overlap_abs(j,i).lt.1.d-12) then
|
||||
return
|
||||
endif
|
||||
|
||||
power_A(1:3) = ao_power(i,1:3)
|
||||
power_B(1:3) = ao_power(j,1:3)
|
||||
|
||||
A_center(1:3) = nucl_coord(ao_nucl(i),1:3)
|
||||
B_center(1:3) = nucl_coord(ao_nucl(j),1:3)
|
||||
|
||||
do l = 1, ao_prim_num(i)
|
||||
alpha = ao_expo_ordered_transp (l,i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(l,i)
|
||||
|
||||
do k = 1, ao_prim_num(j)
|
||||
beta = ao_expo_ordered_transp(k,j)
|
||||
coef = coef1 * ao_coef_normalized_ordered_transp(k,j)
|
||||
|
||||
if(dabs(coef) .lt. 1d-12) cycle
|
||||
|
||||
analytical_j = overlap_gauss_r12(D_center, delta, A_center, B_center, power_A, power_B, alpha, beta)
|
||||
|
||||
overlap_gauss_r12_ao += coef * analytical_j
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end function overlap_gauss_r12_ao
|
||||
|
||||
! --
|
||||
|
||||
subroutine overlap_gauss_r12_ao_v(D_center, delta, i, j, resv, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
! \int dr AO_i(r) AO_j(r) e^{-delta |r-D_center|^2}
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: i, j, n_points
|
||||
double precision, intent(in) :: D_center(n_points,3), delta
|
||||
double precision, intent(out) :: resv(n_points)
|
||||
|
||||
integer :: power_A(3), power_B(3), l, k
|
||||
double precision :: A_center(3), B_center(3), alpha, beta, coef, coef1
|
||||
double precision, allocatable :: analytical_j(:)
|
||||
|
||||
double precision, external :: overlap_gauss_r12
|
||||
integer :: ipoint
|
||||
|
||||
resv(:) = 0.d0
|
||||
if(ao_overlap_abs(j,i).lt.1.d-12) then
|
||||
return
|
||||
endif
|
||||
|
||||
power_A(1:3) = ao_power(i,1:3)
|
||||
power_B(1:3) = ao_power(j,1:3)
|
||||
|
||||
A_center(1:3) = nucl_coord(ao_nucl(i),1:3)
|
||||
B_center(1:3) = nucl_coord(ao_nucl(j),1:3)
|
||||
|
||||
allocate(analytical_j(n_points))
|
||||
do l = 1, ao_prim_num(i)
|
||||
alpha = ao_expo_ordered_transp (l,i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(l,i)
|
||||
|
||||
do k = 1, ao_prim_num(j)
|
||||
beta = ao_expo_ordered_transp(k,j)
|
||||
coef = coef1 * ao_coef_normalized_ordered_transp(k,j)
|
||||
|
||||
if(dabs(coef) .lt. 1d-12) cycle
|
||||
|
||||
call overlap_gauss_r12_v(D_center, delta, A_center, B_center, power_A, power_B, alpha, beta, analytical_j, n_points)
|
||||
do ipoint=1, n_points
|
||||
resv(ipoint) = resv(ipoint) + coef*analytical_j(ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(analytical_j)
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
double precision function overlap_gauss_r12_ao_with1s(B_center, beta, D_center, delta, i, j)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! \int dr AO_i(r) AO_j(r) e^{-beta |r-B_center^2|} e^{-delta |r-D_center|^2}
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: i, j
|
||||
double precision, intent(in) :: B_center(3), beta, D_center(3), delta
|
||||
|
||||
integer :: power_A1(3), power_A2(3), l, k
|
||||
double precision :: A1_center(3), A2_center(3), alpha1, alpha2, coef1, coef12, analytical_j
|
||||
double precision :: G_center(3), gama, fact_g, gama_inv
|
||||
|
||||
double precision, external :: overlap_gauss_r12, overlap_gauss_r12_ao
|
||||
|
||||
if(beta .lt. 1d-10) then
|
||||
overlap_gauss_r12_ao_with1s = overlap_gauss_r12_ao(D_center, delta, i, j)
|
||||
return
|
||||
endif
|
||||
|
||||
overlap_gauss_r12_ao_with1s = 0.d0
|
||||
|
||||
if(ao_overlap_abs(j,i) .lt. 1.d-12) then
|
||||
return
|
||||
endif
|
||||
|
||||
! e^{-beta |r-B_center^2|} e^{-delta |r-D_center|^2} = fact_g e^{-gama |r - G|^2}
|
||||
|
||||
gama = beta + delta
|
||||
gama_inv = 1.d0 / gama
|
||||
G_center(1) = (beta * B_center(1) + delta * D_center(1)) * gama_inv
|
||||
G_center(2) = (beta * B_center(2) + delta * D_center(2)) * gama_inv
|
||||
G_center(3) = (beta * B_center(3) + delta * D_center(3)) * gama_inv
|
||||
fact_g = beta * delta * gama_inv * ( (B_center(1) - D_center(1)) * (B_center(1) - D_center(1)) &
|
||||
+ (B_center(2) - D_center(2)) * (B_center(2) - D_center(2)) &
|
||||
+ (B_center(3) - D_center(3)) * (B_center(3) - D_center(3)) )
|
||||
if(fact_g .gt. 10d0) return
|
||||
fact_g = dexp(-fact_g)
|
||||
|
||||
! ---
|
||||
|
||||
power_A1(1:3) = ao_power(i,1:3)
|
||||
power_A2(1:3) = ao_power(j,1:3)
|
||||
|
||||
A1_center(1:3) = nucl_coord(ao_nucl(i),1:3)
|
||||
A2_center(1:3) = nucl_coord(ao_nucl(j),1:3)
|
||||
|
||||
do l = 1, ao_prim_num(i)
|
||||
alpha1 = ao_expo_ordered_transp (l,i)
|
||||
coef1 = fact_g * ao_coef_normalized_ordered_transp(l,i)
|
||||
if(dabs(coef1) .lt. 1d-12) cycle
|
||||
|
||||
do k = 1, ao_prim_num(j)
|
||||
alpha2 = ao_expo_ordered_transp (k,j)
|
||||
coef12 = coef1 * ao_coef_normalized_ordered_transp(k,j)
|
||||
if(dabs(coef12) .lt. 1d-12) cycle
|
||||
|
||||
analytical_j = overlap_gauss_r12(G_center, gama, A1_center, A2_center, power_A1, power_A2, alpha1, alpha2)
|
||||
|
||||
overlap_gauss_r12_ao_with1s += coef12 * analytical_j
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end function overlap_gauss_r12_ao_with1s
|
||||
|
||||
! ---
|
||||
|
||||
subroutine overlap_gauss_r12_ao_with1s_v(B_center, beta, D_center, delta, i, j, resv, n_points)
|
||||
BEGIN_DOC
|
||||
!
|
||||
! \int dr AO_i(r) AO_j(r) e^{-beta |r-B_center^2|} e^{-delta |r-D_center|^2}
|
||||
! using an array of D_centers.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: i, j, n_points
|
||||
double precision, intent(in) :: B_center(3), beta, D_center(n_points,3), delta
|
||||
double precision, intent(out) :: resv(n_points)
|
||||
|
||||
integer :: power_A1(3), power_A2(3), l, k
|
||||
double precision :: A1_center(3), A2_center(3), alpha1, alpha2, coef1
|
||||
double precision :: coef12, coef12f
|
||||
double precision :: gama, gama_inv
|
||||
double precision :: bg, dg, bdg
|
||||
|
||||
integer :: ipoint
|
||||
|
||||
double precision, allocatable :: fact_g(:), G_center(:,:), analytical_j(:)
|
||||
|
||||
if(ao_overlap_abs(j,i) .lt. 1.d-12) then
|
||||
return
|
||||
endif
|
||||
|
||||
ASSERT(beta .gt. 0.d0)
|
||||
|
||||
if(beta .lt. 1d-10) then
|
||||
call overlap_gauss_r12_ao_v(D_center, delta, i, j, resv, n_points)
|
||||
return
|
||||
endif
|
||||
|
||||
resv(:) = 0.d0
|
||||
|
||||
! e^{-beta |r-B_center^2|} e^{-delta |r-D_center|^2} = fact_g e^{-gama |r - G|^2}
|
||||
|
||||
gama = beta + delta
|
||||
gama_inv = 1.d0 / gama
|
||||
|
||||
power_A1(1:3) = ao_power(i,1:3)
|
||||
power_A2(1:3) = ao_power(j,1:3)
|
||||
|
||||
A1_center(1:3) = nucl_coord(ao_nucl(i),1:3)
|
||||
A2_center(1:3) = nucl_coord(ao_nucl(j),1:3)
|
||||
|
||||
allocate (fact_g(n_points), G_center(n_points,3), analytical_j(n_points) )
|
||||
|
||||
bg = beta * gama_inv
|
||||
dg = delta * gama_inv
|
||||
bdg = bg * delta
|
||||
do ipoint=1,n_points
|
||||
G_center(ipoint,1) = bg * B_center(1) + dg * D_center(ipoint,1)
|
||||
G_center(ipoint,2) = bg * B_center(2) + dg * D_center(ipoint,2)
|
||||
G_center(ipoint,3) = bg * B_center(3) + dg * D_center(ipoint,3)
|
||||
fact_g(ipoint) = bdg * ( &
|
||||
(B_center(1) - D_center(ipoint,1)) * (B_center(1) - D_center(ipoint,1)) &
|
||||
+ (B_center(2) - D_center(ipoint,2)) * (B_center(2) - D_center(ipoint,2)) &
|
||||
+ (B_center(3) - D_center(ipoint,3)) * (B_center(3) - D_center(ipoint,3)) )
|
||||
|
||||
if(fact_g(ipoint) < 10d0) then
|
||||
fact_g(ipoint) = dexp(-fact_g(ipoint))
|
||||
else
|
||||
fact_g(ipoint) = 0.d0
|
||||
endif
|
||||
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
do l = 1, ao_prim_num(i)
|
||||
alpha1 = ao_expo_ordered_transp (l,i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(l,i)
|
||||
|
||||
do k = 1, ao_prim_num(j)
|
||||
alpha2 = ao_expo_ordered_transp (k,j)
|
||||
coef12 = coef1 * ao_coef_normalized_ordered_transp(k,j)
|
||||
if(dabs(coef12) .lt. 1d-12) cycle
|
||||
|
||||
call overlap_gauss_r12_v(G_center, gama, A1_center,&
|
||||
A2_center, power_A1, power_A2, alpha1, alpha2, analytical_j, n_points)
|
||||
|
||||
do ipoint=1,n_points
|
||||
coef12f = coef12 * fact_g(ipoint)
|
||||
resv(ipoint) += coef12f * analytical_j(ipoint)
|
||||
end do
|
||||
|
||||
enddo
|
||||
enddo
|
||||
deallocate (fact_g, G_center, analytical_j )
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
94
src/ao_many_one_e_ints/fit_slat_gauss.irp.f
Normal file
94
src/ao_many_one_e_ints/fit_slat_gauss.irp.f
Normal file
|
@ -0,0 +1,94 @@
|
|||
BEGIN_PROVIDER [integer, n_max_fit_slat]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! number of gaussian to fit exp(-x)
|
||||
!
|
||||
! I took 20 gaussians from the program bassto.f
|
||||
END_DOC
|
||||
n_max_fit_slat = 20
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, coef_fit_slat_gauss, (n_max_fit_slat)]
|
||||
&BEGIN_PROVIDER [double precision, expo_fit_slat_gauss, (n_max_fit_slat)]
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
BEGIN_DOC
|
||||
! fit the exp(-x) as
|
||||
!
|
||||
! \sum_{i = 1, n_max_fit_slat} coef_fit_slat_gauss(i) * exp(-expo_fit_slat_gauss(i) * x**2)
|
||||
!
|
||||
! The coefficient are taken from the program bassto.f
|
||||
END_DOC
|
||||
|
||||
|
||||
expo_fit_slat_gauss(01)=30573.77073000000
|
||||
coef_fit_slat_gauss(01)=0.00338925525
|
||||
expo_fit_slat_gauss(02)=5608.45238100000
|
||||
coef_fit_slat_gauss(02)=0.00536433869
|
||||
expo_fit_slat_gauss(03)=1570.95673400000
|
||||
coef_fit_slat_gauss(03)=0.00818702846
|
||||
expo_fit_slat_gauss(04)=541.39785110000
|
||||
coef_fit_slat_gauss(04)=0.01202047655
|
||||
expo_fit_slat_gauss(05)=212.43469630000
|
||||
coef_fit_slat_gauss(05)=0.01711289568
|
||||
expo_fit_slat_gauss(06)=91.31444574000
|
||||
coef_fit_slat_gauss(06)=0.02376001022
|
||||
expo_fit_slat_gauss(07)=42.04087246000
|
||||
coef_fit_slat_gauss(07)=0.03229121736
|
||||
expo_fit_slat_gauss(08)=20.43200443000
|
||||
coef_fit_slat_gauss(08)=0.04303646818
|
||||
expo_fit_slat_gauss(09)=10.37775161000
|
||||
coef_fit_slat_gauss(09)=0.05624657578
|
||||
expo_fit_slat_gauss(10)=5.46880754500
|
||||
coef_fit_slat_gauss(10)=0.07192311571
|
||||
expo_fit_slat_gauss(11)=2.97373529200
|
||||
coef_fit_slat_gauss(11)=0.08949389001
|
||||
expo_fit_slat_gauss(12)=1.66144190200
|
||||
coef_fit_slat_gauss(12)=0.10727599240
|
||||
expo_fit_slat_gauss(13)=0.95052560820
|
||||
coef_fit_slat_gauss(13)=0.12178961750
|
||||
expo_fit_slat_gauss(14)=0.55528683970
|
||||
coef_fit_slat_gauss(14)=0.12740141870
|
||||
expo_fit_slat_gauss(15)=0.33043360020
|
||||
coef_fit_slat_gauss(15)=0.11759168160
|
||||
expo_fit_slat_gauss(16)=0.19982303230
|
||||
coef_fit_slat_gauss(16)=0.08953504394
|
||||
expo_fit_slat_gauss(17)=0.12246840760
|
||||
coef_fit_slat_gauss(17)=0.05066721317
|
||||
expo_fit_slat_gauss(18)=0.07575825322
|
||||
coef_fit_slat_gauss(18)=0.01806363869
|
||||
expo_fit_slat_gauss(19)=0.04690146243
|
||||
coef_fit_slat_gauss(19)=0.00305632563
|
||||
expo_fit_slat_gauss(20)=0.02834749861
|
||||
coef_fit_slat_gauss(20)=0.00013317513
|
||||
|
||||
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
double precision function slater_fit_gam(x,gam)
|
||||
implicit none
|
||||
double precision, intent(in) :: x,gam
|
||||
BEGIN_DOC
|
||||
! fit of the function exp(-gam * x) with gaussian functions
|
||||
END_DOC
|
||||
integer :: i
|
||||
slater_fit_gam = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
slater_fit_gam += coef_fit_slat_gauss(i) * dexp(-expo_fit_slat_gauss(i) * gam * gam * x * x)
|
||||
enddo
|
||||
end
|
||||
|
||||
subroutine expo_fit_slater_gam(gam,expos)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! returns the array of the exponents of the gaussians to fit exp(-gam*x)
|
||||
END_DOC
|
||||
double precision, intent(in) :: gam
|
||||
double precision, intent(out) :: expos(n_max_fit_slat)
|
||||
integer :: i
|
||||
do i = 1, n_max_fit_slat
|
||||
expos(i) = expo_fit_slat_gauss(i) * gam * gam
|
||||
enddo
|
||||
end
|
||||
|
378
src/ao_many_one_e_ints/grad2_jmu_modif.irp.f
Normal file
378
src/ao_many_one_e_ints/grad2_jmu_modif.irp.f
Normal file
|
@ -0,0 +1,378 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, int2_grad1u2_grad2u2_j1b2, (ao_num, ao_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! -\frac{1}{4} x int dr2 phi_i(r2) phi_j(r2) 1s_j1b(r2)^2 [1 - erf(mu r12)]^2
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint, i_1s, i_fit
|
||||
double precision :: r(3), expo_fit, coef_fit
|
||||
double precision :: coef, beta, B_center(3)
|
||||
double precision :: tmp
|
||||
double precision :: wall0, wall1
|
||||
|
||||
double precision, allocatable :: int_fit_v(:)
|
||||
double precision, external :: overlap_gauss_r12_ao_with1s
|
||||
|
||||
provide mu_erf final_grid_points_transp j1b_pen
|
||||
call wall_time(wall0)
|
||||
|
||||
int2_grad1u2_grad2u2_j1b2(:,:,:) = 0.d0
|
||||
|
||||
!$OMP PARALLEL DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint, i, j, i_1s, i_fit, r, coef, beta, B_center,&
|
||||
!$OMP coef_fit, expo_fit, int_fit_v, tmp) &
|
||||
!$OMP SHARED (n_points_final_grid, ao_num, List_all_comb_b3_size,&
|
||||
!$OMP final_grid_points_transp, n_max_fit_slat, &
|
||||
!$OMP expo_gauss_1_erf_x_2, coef_gauss_1_erf_x_2, &
|
||||
!$OMP List_all_comb_b3_coef, List_all_comb_b3_expo, &
|
||||
!$OMP List_all_comb_b3_cent, int2_grad1u2_grad2u2_j1b2,&
|
||||
!$OMP ao_overlap_abs)
|
||||
|
||||
allocate(int_fit_v(n_points_final_grid))
|
||||
!$OMP DO SCHEDULE(dynamic)
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
|
||||
if(ao_overlap_abs(j,i) .lt. 1.d-12) then
|
||||
cycle
|
||||
endif
|
||||
|
||||
do i_1s = 1, List_all_comb_b3_size
|
||||
|
||||
coef = List_all_comb_b3_coef (i_1s)
|
||||
beta = List_all_comb_b3_expo (i_1s)
|
||||
B_center(1) = List_all_comb_b3_cent(1,i_1s)
|
||||
B_center(2) = List_all_comb_b3_cent(2,i_1s)
|
||||
B_center(3) = List_all_comb_b3_cent(3,i_1s)
|
||||
|
||||
do i_fit = 1, n_max_fit_slat
|
||||
|
||||
expo_fit = expo_gauss_1_erf_x_2(i_fit)
|
||||
coef_fit = -0.25d0 * coef_gauss_1_erf_x_2(i_fit) * coef
|
||||
|
||||
call overlap_gauss_r12_ao_with1s_v(B_center, beta, final_grid_points_transp, &
|
||||
expo_fit, i, j, int_fit_v, n_points_final_grid)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
int2_grad1u2_grad2u2_j1b2(j,i,ipoint) += coef_fit * int_fit_v(ipoint)
|
||||
enddo
|
||||
|
||||
enddo
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
deallocate(int_fit_v)
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 2, ao_num
|
||||
do j = 1, i-1
|
||||
int2_grad1u2_grad2u2_j1b2(j,i,ipoint) = int2_grad1u2_grad2u2_j1b2(i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print*, ' wall time for int2_grad1u2_grad2u2_j1b2', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, int2_u2_j1b2, (ao_num, ao_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int dr2 phi_i(r2) phi_j(r2) 1s_j1b(r2)^2 [u_12^mu]^2
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint, i_1s, i_fit
|
||||
double precision :: r(3), expo_fit, coef_fit
|
||||
double precision :: coef, beta, B_center(3), tmp
|
||||
double precision :: wall0, wall1
|
||||
double precision, allocatable :: int_fit_v(:)
|
||||
|
||||
double precision, external :: overlap_gauss_r12_ao_with1s
|
||||
|
||||
provide mu_erf final_grid_points_transp j1b_pen
|
||||
call wall_time(wall0)
|
||||
|
||||
int2_u2_j1b2(:,:,:) = 0.d0
|
||||
|
||||
!$OMP PARALLEL DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint, i, j, i_1s, i_fit, r, coef, beta, B_center,&
|
||||
!$OMP coef_fit, expo_fit, int_fit_v) &
|
||||
!$OMP SHARED (n_points_final_grid, ao_num, List_all_comb_b3_size,&
|
||||
!$OMP final_grid_points_transp, n_max_fit_slat, &
|
||||
!$OMP expo_gauss_j_mu_x_2, coef_gauss_j_mu_x_2, &
|
||||
!$OMP List_all_comb_b3_coef, List_all_comb_b3_expo, &
|
||||
!$OMP List_all_comb_b3_cent, int2_u2_j1b2)
|
||||
allocate(int_fit_v(n_points_final_grid))
|
||||
!$OMP DO SCHEDULE(dynamic)
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
|
||||
do i_1s = 1, List_all_comb_b3_size
|
||||
|
||||
coef = List_all_comb_b3_coef (i_1s)
|
||||
beta = List_all_comb_b3_expo (i_1s)
|
||||
B_center(1) = List_all_comb_b3_cent(1,i_1s)
|
||||
B_center(2) = List_all_comb_b3_cent(2,i_1s)
|
||||
B_center(3) = List_all_comb_b3_cent(3,i_1s)
|
||||
|
||||
do i_fit = 1, n_max_fit_slat
|
||||
|
||||
expo_fit = expo_gauss_j_mu_x_2(i_fit)
|
||||
coef_fit = coef_gauss_j_mu_x_2(i_fit) * coef
|
||||
|
||||
call overlap_gauss_r12_ao_with1s_v(B_center, beta, final_grid_points_transp, &
|
||||
expo_fit, i, j, int_fit_v, n_points_final_grid)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
int2_u2_j1b2(j,i,ipoint) += coef_fit * int_fit_v(ipoint)
|
||||
enddo
|
||||
|
||||
enddo
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
deallocate(int_fit_v)
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 2, ao_num
|
||||
do j = 1, i-1
|
||||
int2_u2_j1b2(j,i,ipoint) = int2_u2_j1b2(i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print*, ' wall time for int2_u2_j1b2', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, int2_u_grad1u_x_j1b2, (3, ao_num, ao_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int dr2 phi_i(r2) phi_j(r2) 1s_j1b(r2)^2 u_12^mu [\grad_1 u_12^mu] r2
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint, i_1s, i_fit
|
||||
double precision :: r(3), expo_fit, coef_fit
|
||||
double precision :: coef, beta, B_center(3)
|
||||
double precision :: alpha_1s, alpha_1s_inv, expo_coef_1s, coef_tmp
|
||||
double precision :: tmp_x, tmp_y, tmp_z
|
||||
double precision :: wall0, wall1
|
||||
double precision, allocatable :: int_fit_v(:,:), dist(:), centr_1s(:,:)
|
||||
|
||||
provide mu_erf final_grid_points_transp j1b_pen
|
||||
call wall_time(wall0)
|
||||
|
||||
allocate(dist(n_points_final_grid), centr_1s(n_points_final_grid,3))
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points_transp(ipoint,1)
|
||||
r(2) = final_grid_points_transp(ipoint,2)
|
||||
r(3) = final_grid_points_transp(ipoint,3)
|
||||
|
||||
dist(ipoint) = (B_center(1) - r(1)) * (B_center(1) - r(1)) &
|
||||
+ (B_center(2) - r(2)) * (B_center(2) - r(2)) &
|
||||
+ (B_center(3) - r(3)) * (B_center(3) - r(3))
|
||||
enddo
|
||||
|
||||
int2_u_grad1u_x_j1b2(:,:,:,:) = 0.d0
|
||||
|
||||
!$OMP PARALLEL DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint, i, j, i_1s, i_fit, r, coef, beta, B_center,&
|
||||
!$OMP coef_fit, expo_fit, int_fit_v, alpha_1s, &
|
||||
!$OMP alpha_1s_inv, centr_1s, expo_coef_1s, coef_tmp, &
|
||||
!$OMP tmp_x, tmp_y, tmp_z) &
|
||||
!$OMP SHARED (n_points_final_grid, ao_num, List_all_comb_b3_size,&
|
||||
!$OMP final_grid_points_transp, n_max_fit_slat, dist, &
|
||||
!$OMP expo_gauss_j_mu_1_erf, coef_gauss_j_mu_1_erf, &
|
||||
!$OMP List_all_comb_b3_coef, List_all_comb_b3_expo, &
|
||||
!$OMP List_all_comb_b3_cent, int2_u_grad1u_x_j1b2)
|
||||
allocate(int_fit_v(n_points_final_grid,3))
|
||||
|
||||
do i_1s = 1, List_all_comb_b3_size
|
||||
|
||||
coef = List_all_comb_b3_coef (i_1s)
|
||||
beta = List_all_comb_b3_expo (i_1s)
|
||||
B_center(1) = List_all_comb_b3_cent(1,i_1s)
|
||||
B_center(2) = List_all_comb_b3_cent(2,i_1s)
|
||||
B_center(3) = List_all_comb_b3_cent(3,i_1s)
|
||||
|
||||
do i_fit = 1, n_max_fit_slat
|
||||
|
||||
expo_fit = expo_gauss_j_mu_1_erf(i_fit)
|
||||
coef_fit = coef_gauss_j_mu_1_erf(i_fit) * coef
|
||||
|
||||
alpha_1s = beta + expo_fit
|
||||
alpha_1s_inv = 1.d0 / alpha_1s
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points_transp(ipoint,1)
|
||||
r(2) = final_grid_points_transp(ipoint,2)
|
||||
r(3) = final_grid_points_transp(ipoint,3)
|
||||
|
||||
centr_1s(ipoint,1) = alpha_1s_inv * (beta * B_center(1) + expo_fit * r(1))
|
||||
centr_1s(ipoint,2) = alpha_1s_inv * (beta * B_center(2) + expo_fit * r(2))
|
||||
centr_1s(ipoint,3) = alpha_1s_inv * (beta * B_center(3) + expo_fit * r(3))
|
||||
enddo
|
||||
|
||||
expo_coef_1s = beta * expo_fit * alpha_1s_inv
|
||||
!$OMP BARRIER
|
||||
!$OMP DO SCHEDULE(dynamic)
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
call NAI_pol_x_mult_erf_ao_with1s_v(i, j, alpha_1s, centr_1s,&
|
||||
1.d+9, final_grid_points_transp, int_fit_v, n_points_final_grid)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
coef_tmp = coef_fit * dexp(-expo_coef_1s* dist(ipoint))
|
||||
int2_u_grad1u_x_j1b2(1,j,i,ipoint) = &
|
||||
int2_u_grad1u_x_j1b2(1,j,i,ipoint) + coef_tmp * int_fit_v(ipoint,1)
|
||||
int2_u_grad1u_x_j1b2(2,j,i,ipoint) = &
|
||||
int2_u_grad1u_x_j1b2(2,j,i,ipoint) + coef_tmp * int_fit_v(ipoint,2)
|
||||
int2_u_grad1u_x_j1b2(3,j,i,ipoint) = &
|
||||
int2_u_grad1u_x_j1b2(3,j,i,ipoint) + coef_tmp * int_fit_v(ipoint,3)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO NOWAIT
|
||||
|
||||
enddo
|
||||
enddo
|
||||
deallocate(int_fit_v)
|
||||
!$OMP END PARALLEL
|
||||
|
||||
deallocate(dist)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 2, ao_num
|
||||
do j = 1, i-1
|
||||
int2_u_grad1u_x_j1b2(1,j,i,ipoint) = int2_u_grad1u_x_j1b2(1,i,j,ipoint)
|
||||
int2_u_grad1u_x_j1b2(2,j,i,ipoint) = int2_u_grad1u_x_j1b2(2,i,j,ipoint)
|
||||
int2_u_grad1u_x_j1b2(3,j,i,ipoint) = int2_u_grad1u_x_j1b2(3,i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print*, ' wall time for int2_u_grad1u_x_j1b2', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, int2_u_grad1u_j1b2, (ao_num, ao_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int dr2 phi_i(r2) phi_j(r2) 1s_j1b(r2)^2 u_12^mu [\grad_1 u_12^mu]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint, i_1s, i_fit
|
||||
double precision :: r(3), int_fit, expo_fit, coef_fit, coef_tmp
|
||||
double precision :: coef, beta, B_center(3), dist
|
||||
double precision :: alpha_1s, alpha_1s_inv, centr_1s(3), expo_coef_1s, tmp
|
||||
double precision :: wall0, wall1
|
||||
double precision, external :: NAI_pol_mult_erf_ao_with1s
|
||||
|
||||
provide mu_erf final_grid_points j1b_pen
|
||||
call wall_time(wall0)
|
||||
|
||||
int2_u_grad1u_j1b2 = 0.d0
|
||||
|
||||
!$OMP PARALLEL DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint, i, j, i_1s, i_fit, r, coef, beta, B_center, &
|
||||
!$OMP coef_fit, expo_fit, int_fit, tmp, alpha_1s, dist, &
|
||||
!$OMP alpha_1s_inv, centr_1s, expo_coef_1s, coef_tmp) &
|
||||
!$OMP SHARED (n_points_final_grid, ao_num, List_all_comb_b3_size, &
|
||||
!$OMP final_grid_points, n_max_fit_slat, &
|
||||
!$OMP expo_gauss_j_mu_1_erf, coef_gauss_j_mu_1_erf, &
|
||||
!$OMP List_all_comb_b3_coef, List_all_comb_b3_expo, &
|
||||
!$OMP List_all_comb_b3_cent, int2_u_grad1u_j1b2)
|
||||
!$OMP DO
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
tmp = 0.d0
|
||||
do i_1s = 1, List_all_comb_b3_size
|
||||
|
||||
coef = List_all_comb_b3_coef (i_1s)
|
||||
beta = List_all_comb_b3_expo (i_1s)
|
||||
B_center(1) = List_all_comb_b3_cent(1,i_1s)
|
||||
B_center(2) = List_all_comb_b3_cent(2,i_1s)
|
||||
B_center(3) = List_all_comb_b3_cent(3,i_1s)
|
||||
dist = (B_center(1) - r(1)) * (B_center(1) - r(1)) &
|
||||
+ (B_center(2) - r(2)) * (B_center(2) - r(2)) &
|
||||
+ (B_center(3) - r(3)) * (B_center(3) - r(3))
|
||||
|
||||
do i_fit = 1, n_max_fit_slat
|
||||
|
||||
expo_fit = expo_gauss_j_mu_1_erf(i_fit)
|
||||
coef_fit = coef_gauss_j_mu_1_erf(i_fit)
|
||||
|
||||
alpha_1s = beta + expo_fit
|
||||
alpha_1s_inv = 1.d0 / alpha_1s
|
||||
centr_1s(1) = alpha_1s_inv * (beta * B_center(1) + expo_fit * r(1))
|
||||
centr_1s(2) = alpha_1s_inv * (beta * B_center(2) + expo_fit * r(2))
|
||||
centr_1s(3) = alpha_1s_inv * (beta * B_center(3) + expo_fit * r(3))
|
||||
|
||||
expo_coef_1s = beta * expo_fit * alpha_1s_inv * dist
|
||||
!if(expo_coef_1s .gt. 80.d0) cycle
|
||||
coef_tmp = coef * coef_fit * dexp(-expo_coef_1s)
|
||||
!if(dabs(coef_tmp) .lt. 1d-10) cycle
|
||||
|
||||
int_fit = NAI_pol_mult_erf_ao_with1s(i, j, alpha_1s, centr_1s, 1.d+9, r)
|
||||
|
||||
tmp += coef_tmp * int_fit
|
||||
enddo
|
||||
enddo
|
||||
|
||||
int2_u_grad1u_j1b2(j,i,ipoint) = tmp
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 2, ao_num
|
||||
do j = 1, i-1
|
||||
int2_u_grad1u_j1b2(j,i,ipoint) = int2_u_grad1u_j1b2(i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print*, ' wall time for int2_u_grad1u_j1b2', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
264
src/ao_many_one_e_ints/grad_lapl_jmu_modif.irp.f
Normal file
264
src/ao_many_one_e_ints/grad_lapl_jmu_modif.irp.f
Normal file
|
@ -0,0 +1,264 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, v_ij_erf_rk_cst_mu_j1b, (ao_num, ao_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int dr phi_i(r) phi_j(r) 1s_j1b(r) (erf(mu(R) |r - R| - 1) / |r - R|
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint, i_1s
|
||||
double precision :: r(3), int_mu, int_coulomb
|
||||
double precision :: coef, beta, B_center(3)
|
||||
double precision :: tmp
|
||||
double precision :: wall0, wall1
|
||||
double precision, external :: NAI_pol_mult_erf_ao_with1s
|
||||
|
||||
provide mu_erf final_grid_points j1b_pen
|
||||
call wall_time(wall0)
|
||||
|
||||
v_ij_erf_rk_cst_mu_j1b = 0.d0
|
||||
|
||||
!$OMP PARALLEL DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint, i, j, i_1s, r, coef, beta, B_center, int_mu, int_coulomb, tmp) &
|
||||
!$OMP SHARED (n_points_final_grid, ao_num, List_all_comb_b2_size, final_grid_points, &
|
||||
!$OMP List_all_comb_b2_coef, List_all_comb_b2_expo, List_all_comb_b2_cent, &
|
||||
!$OMP v_ij_erf_rk_cst_mu_j1b, mu_erf)
|
||||
!$OMP DO
|
||||
!do ipoint = 1, 10
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
|
||||
tmp = 0.d0
|
||||
do i_1s = 1, List_all_comb_b2_size
|
||||
|
||||
coef = List_all_comb_b2_coef (i_1s)
|
||||
beta = List_all_comb_b2_expo (i_1s)
|
||||
B_center(1) = List_all_comb_b2_cent(1,i_1s)
|
||||
B_center(2) = List_all_comb_b2_cent(2,i_1s)
|
||||
B_center(3) = List_all_comb_b2_cent(3,i_1s)
|
||||
|
||||
int_mu = NAI_pol_mult_erf_ao_with1s(i, j, beta, B_center, mu_erf, r)
|
||||
int_coulomb = NAI_pol_mult_erf_ao_with1s(i, j, beta, B_center, 1.d+9, r)
|
||||
|
||||
tmp += coef * (int_mu - int_coulomb)
|
||||
enddo
|
||||
|
||||
v_ij_erf_rk_cst_mu_j1b(j,i,ipoint) = tmp
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 2, ao_num
|
||||
do j = 1, i-1
|
||||
v_ij_erf_rk_cst_mu_j1b(j,i,ipoint) = v_ij_erf_rk_cst_mu_j1b(i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print*, ' wall time for v_ij_erf_rk_cst_mu_j1b', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, x_v_ij_erf_rk_cst_mu_j1b, (ao_num, ao_num, n_points_final_grid, 3)]
|
||||
|
||||
BEGIN_DOC
|
||||
! int dr x phi_i(r) phi_j(r) 1s_j1b(r) (erf(mu(R) |r - R|) - 1)/|r - R|
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
x_v_ij_erf_rk_cst_mu_j1b(j,i,ipoint,1) = x_v_ij_erf_rk_cst_mu_tmp_j1b(1,j,i,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu_j1b(j,i,ipoint,2) = x_v_ij_erf_rk_cst_mu_tmp_j1b(2,j,i,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu_j1b(j,i,ipoint,3) = x_v_ij_erf_rk_cst_mu_tmp_j1b(3,j,i,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print*, ' wall time for x_v_ij_erf_rk_cst_mu_j1b', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, x_v_ij_erf_rk_cst_mu_tmp_j1b, (3, ao_num, ao_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
! int dr x phi_i(r) phi_j(r) 1s_j1b(r) (erf(mu(R) |r - R|) - 1)/|r - R|
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint, i_1s
|
||||
double precision :: coef, beta, B_center(3), r(3), ints(3), ints_coulomb(3)
|
||||
double precision :: tmp_x, tmp_y, tmp_z
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
|
||||
x_v_ij_erf_rk_cst_mu_tmp_j1b = 0.d0
|
||||
|
||||
!$OMP PARALLEL DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint, i, j, i_1s, r, coef, beta, B_center, ints, ints_coulomb, &
|
||||
!$OMP tmp_x, tmp_y, tmp_z) &
|
||||
!$OMP SHARED (n_points_final_grid, ao_num, List_all_comb_b2_size, final_grid_points,&
|
||||
!$OMP List_all_comb_b2_coef, List_all_comb_b2_expo, List_all_comb_b2_cent, &
|
||||
!$OMP x_v_ij_erf_rk_cst_mu_tmp_j1b, mu_erf)
|
||||
!$OMP DO
|
||||
!do ipoint = 1, 10
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
|
||||
tmp_x = 0.d0
|
||||
tmp_y = 0.d0
|
||||
tmp_z = 0.d0
|
||||
do i_1s = 1, List_all_comb_b2_size
|
||||
|
||||
coef = List_all_comb_b2_coef (i_1s)
|
||||
beta = List_all_comb_b2_expo (i_1s)
|
||||
B_center(1) = List_all_comb_b2_cent(1,i_1s)
|
||||
B_center(2) = List_all_comb_b2_cent(2,i_1s)
|
||||
B_center(3) = List_all_comb_b2_cent(3,i_1s)
|
||||
|
||||
call NAI_pol_x_mult_erf_ao_with1s(i, j, beta, B_center, mu_erf, r, ints )
|
||||
call NAI_pol_x_mult_erf_ao_with1s(i, j, beta, B_center, 1.d+9, r, ints_coulomb)
|
||||
|
||||
tmp_x += coef * (ints(1) - ints_coulomb(1))
|
||||
tmp_y += coef * (ints(2) - ints_coulomb(2))
|
||||
tmp_z += coef * (ints(3) - ints_coulomb(3))
|
||||
enddo
|
||||
|
||||
x_v_ij_erf_rk_cst_mu_tmp_j1b(1,j,i,ipoint) = tmp_x
|
||||
x_v_ij_erf_rk_cst_mu_tmp_j1b(2,j,i,ipoint) = tmp_y
|
||||
x_v_ij_erf_rk_cst_mu_tmp_j1b(3,j,i,ipoint) = tmp_z
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 2, ao_num
|
||||
do j = 1, i-1
|
||||
x_v_ij_erf_rk_cst_mu_tmp_j1b(1,j,i,ipoint) = x_v_ij_erf_rk_cst_mu_tmp_j1b(1,i,j,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu_tmp_j1b(2,j,i,ipoint) = x_v_ij_erf_rk_cst_mu_tmp_j1b(2,i,j,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu_tmp_j1b(3,j,i,ipoint) = x_v_ij_erf_rk_cst_mu_tmp_j1b(3,i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print*, ' wall time for x_v_ij_erf_rk_cst_mu_tmp_j1b', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
! TODO analytically
|
||||
BEGIN_PROVIDER [ double precision, v_ij_u_cst_mu_j1b, (ao_num, ao_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int dr2 phi_i(r2) phi_j(r2) 1s_j1b(r2) u(mu, r12)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint, i_1s, i_fit
|
||||
double precision :: r(3), int_fit, expo_fit, coef_fit
|
||||
double precision :: coef, beta, B_center(3)
|
||||
double precision :: tmp
|
||||
double precision :: wall0, wall1
|
||||
|
||||
double precision, external :: overlap_gauss_r12_ao_with1s
|
||||
|
||||
provide mu_erf final_grid_points j1b_pen
|
||||
call wall_time(wall0)
|
||||
|
||||
v_ij_u_cst_mu_j1b = 0.d0
|
||||
|
||||
!$OMP PARALLEL DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint, i, j, i_1s, i_fit, r, coef, beta, B_center, &
|
||||
!$OMP coef_fit, expo_fit, int_fit, tmp) &
|
||||
!$OMP SHARED (n_points_final_grid, ao_num, List_all_comb_b2_size, &
|
||||
!$OMP final_grid_points, n_max_fit_slat, &
|
||||
!$OMP expo_gauss_j_mu_x, coef_gauss_j_mu_x, &
|
||||
!$OMP List_all_comb_b2_coef, List_all_comb_b2_expo, &
|
||||
!$OMP List_all_comb_b2_cent, v_ij_u_cst_mu_j1b)
|
||||
!$OMP DO
|
||||
!do ipoint = 1, 10
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
|
||||
tmp = 0.d0
|
||||
do i_1s = 1, List_all_comb_b2_size
|
||||
|
||||
coef = List_all_comb_b2_coef (i_1s)
|
||||
beta = List_all_comb_b2_expo (i_1s)
|
||||
B_center(1) = List_all_comb_b2_cent(1,i_1s)
|
||||
B_center(2) = List_all_comb_b2_cent(2,i_1s)
|
||||
B_center(3) = List_all_comb_b2_cent(3,i_1s)
|
||||
|
||||
do i_fit = 1, n_max_fit_slat
|
||||
|
||||
expo_fit = expo_gauss_j_mu_x(i_fit)
|
||||
coef_fit = coef_gauss_j_mu_x(i_fit)
|
||||
int_fit = overlap_gauss_r12_ao_with1s(B_center, beta, r, expo_fit, i, j)
|
||||
|
||||
tmp += coef * coef_fit * int_fit
|
||||
enddo
|
||||
enddo
|
||||
|
||||
v_ij_u_cst_mu_j1b(j,i,ipoint) = tmp
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 2, ao_num
|
||||
do j = 1, i-1
|
||||
v_ij_u_cst_mu_j1b(j,i,ipoint) = v_ij_u_cst_mu_j1b(i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print*, ' wall time for v_ij_u_cst_mu_j1b', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
417
src/ao_many_one_e_ints/grad_related_ints.irp.f
Normal file
417
src/ao_many_one_e_ints/grad_related_ints.irp.f
Normal file
|
@ -0,0 +1,417 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, v_ij_erf_rk_cst_mu, (ao_num, ao_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int dr phi_i(r) phi_j(r) (erf(mu(R) |r - R| - 1) / |r - R|
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: r(3)
|
||||
double precision :: int_mu, int_coulomb
|
||||
double precision :: wall0, wall1
|
||||
|
||||
double precision :: NAI_pol_mult_erf_ao
|
||||
|
||||
provide mu_erf final_grid_points
|
||||
call wall_time(wall0)
|
||||
|
||||
v_ij_erf_rk_cst_mu = 0.d0
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, ipoint, r, int_mu, int_coulomb) &
|
||||
!$OMP SHARED (ao_num, n_points_final_grid, v_ij_erf_rk_cst_mu, final_grid_points, mu_erf)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
|
||||
int_mu = NAI_pol_mult_erf_ao(i, j, mu_erf, r)
|
||||
int_coulomb = NAI_pol_mult_erf_ao(i, j, 1.d+9, r)
|
||||
|
||||
v_ij_erf_rk_cst_mu(j,i,ipoint) = int_mu - int_coulomb
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 2, ao_num
|
||||
do j = 1, i-1
|
||||
v_ij_erf_rk_cst_mu(j,i,ipoint) = v_ij_erf_rk_cst_mu(i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print*, ' wall time for v_ij_erf_rk_cst_mu ', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, v_ij_erf_rk_cst_mu_transp, (n_points_final_grid, ao_num, ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
! int dr phi_i(r) phi_j(r) (erf(mu(R) |r - R| - 1)/|r - R|
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: r(3)
|
||||
double precision :: int_mu, int_coulomb
|
||||
double precision :: wall0, wall1
|
||||
double precision :: NAI_pol_mult_erf_ao
|
||||
|
||||
provide mu_erf final_grid_points
|
||||
call wall_time(wall0)
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,ipoint,r,int_mu,int_coulomb) &
|
||||
!$OMP SHARED (ao_num,n_points_final_grid,v_ij_erf_rk_cst_mu_transp,final_grid_points,mu_erf)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
int_mu = NAI_pol_mult_erf_ao(i, j, mu_erf, r)
|
||||
int_coulomb = NAI_pol_mult_erf_ao(i, j, 1.d+9, r)
|
||||
|
||||
v_ij_erf_rk_cst_mu_transp(ipoint,j,i) = int_mu - int_coulomb
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do i = 2, ao_num
|
||||
do j = 1, i-1
|
||||
do ipoint = 1, n_points_final_grid
|
||||
v_ij_erf_rk_cst_mu_transp(ipoint,j,i) = v_ij_erf_rk_cst_mu_transp(ipoint,i,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for v_ij_erf_rk_cst_mu_transp ', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, x_v_ij_erf_rk_cst_mu_tmp, (3, ao_num, ao_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
! int dr x * phi_i(r) phi_j(r) (erf(mu(R) |r - R|) - 1)/|r - R|
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: r(3), ints(3), ints_coulomb(3)
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,ipoint,r,ints,ints_coulomb) &
|
||||
!$OMP SHARED (ao_num,n_points_final_grid,x_v_ij_erf_rk_cst_mu_tmp,final_grid_points,mu_erf)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = i, ao_num
|
||||
|
||||
call NAI_pol_x_mult_erf_ao(i, j, mu_erf, r, ints )
|
||||
call NAI_pol_x_mult_erf_ao(i, j, 1.d+9 , r, ints_coulomb)
|
||||
|
||||
x_v_ij_erf_rk_cst_mu_tmp(1,j,i,ipoint) = ints(1) - ints_coulomb(1)
|
||||
x_v_ij_erf_rk_cst_mu_tmp(2,j,i,ipoint) = ints(2) - ints_coulomb(2)
|
||||
x_v_ij_erf_rk_cst_mu_tmp(3,j,i,ipoint) = ints(3) - ints_coulomb(3)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 2, ao_num
|
||||
do j = 1, i-1
|
||||
x_v_ij_erf_rk_cst_mu_tmp(1,j,i,ipoint) = x_v_ij_erf_rk_cst_mu_tmp(1,i,j,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu_tmp(2,j,i,ipoint) = x_v_ij_erf_rk_cst_mu_tmp(2,i,j,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu_tmp(3,j,i,ipoint) = x_v_ij_erf_rk_cst_mu_tmp(3,i,j,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print*, ' wall time for x_v_ij_erf_rk_cst_mu_tmp', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, x_v_ij_erf_rk_cst_mu, (ao_num, ao_num,n_points_final_grid,3)]
|
||||
|
||||
BEGIN_DOC
|
||||
! int dr x * phi_i(r) phi_j(r) (erf(mu(R) |r - R|) - 1)/|r - R|
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
x_v_ij_erf_rk_cst_mu(j,i,ipoint,1) = x_v_ij_erf_rk_cst_mu_tmp(1,j,i,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu(j,i,ipoint,2) = x_v_ij_erf_rk_cst_mu_tmp(2,j,i,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu(j,i,ipoint,3) = x_v_ij_erf_rk_cst_mu_tmp(3,j,i,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for x_v_ij_erf_rk_cst_mu', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, x_v_ij_erf_rk_cst_mu_transp, (ao_num, ao_num,3,n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
! int dr x * phi_i(r) phi_j(r) (erf(mu(R) |r - R|) - 1)/|r - R|
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
x_v_ij_erf_rk_cst_mu_transp(j,i,1,ipoint) = x_v_ij_erf_rk_cst_mu_tmp(1,j,i,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu_transp(j,i,2,ipoint) = x_v_ij_erf_rk_cst_mu_tmp(2,j,i,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu_transp(j,i,3,ipoint) = x_v_ij_erf_rk_cst_mu_tmp(3,j,i,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for x_v_ij_erf_rk_cst_mu_transp', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, x_v_ij_erf_rk_cst_mu_transp_bis, (n_points_final_grid,ao_num, ao_num,3)]
|
||||
|
||||
BEGIN_DOC
|
||||
! int dr x * phi_i(r) phi_j(r) (erf(mu(R) |r - R|) - 1)/|r - R|
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
x_v_ij_erf_rk_cst_mu_transp_bis(ipoint,j,i,1) = x_v_ij_erf_rk_cst_mu_tmp(1,j,i,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu_transp_bis(ipoint,j,i,2) = x_v_ij_erf_rk_cst_mu_tmp(2,j,i,ipoint)
|
||||
x_v_ij_erf_rk_cst_mu_transp_bis(ipoint,j,i,3) = x_v_ij_erf_rk_cst_mu_tmp(3,j,i,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for x_v_ij_erf_rk_cst_mu_transp_bis', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, d_dx_v_ij_erf_rk_cst_mu_tmp, (3, n_points_final_grid, ao_num, ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
! d_dx_v_ij_erf_rk_cst_mu_tmp(m,R,j,i) = int dr phi_j(r)) (erf(mu(R) |r - R|) - 1)/|r - R| d/dx (phi_i(r)
|
||||
!
|
||||
! with m == 1 -> d/dx , m == 2 -> d/dy , m == 3 -> d/dz
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: r(3), ints(3), ints_coulomb(3)
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,ipoint,r,ints,ints_coulomb) &
|
||||
!$OMP SHARED (ao_num,n_points_final_grid,d_dx_v_ij_erf_rk_cst_mu_tmp,final_grid_points,mu_erf)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
call phi_j_erf_mu_r_dxyz_phi(j, i, mu_erf, r, ints)
|
||||
call phi_j_erf_mu_r_dxyz_phi(j, i, 1.d+9, r, ints_coulomb)
|
||||
|
||||
d_dx_v_ij_erf_rk_cst_mu_tmp(1,ipoint,j,i) = ints(1) - ints_coulomb(1)
|
||||
d_dx_v_ij_erf_rk_cst_mu_tmp(2,ipoint,j,i) = ints(2) - ints_coulomb(2)
|
||||
d_dx_v_ij_erf_rk_cst_mu_tmp(3,ipoint,j,i) = ints(3) - ints_coulomb(3)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for d_dx_v_ij_erf_rk_cst_mu_tmp', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, d_dx_v_ij_erf_rk_cst_mu, (n_points_final_grid, ao_num, ao_num, 3)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! d_dx_v_ij_erf_rk_cst_mu_tmp(j,i,R,m) = int dr phi_j(r)) (erf(mu(R) |r - R|) - 1)/|r - R| d/dx (phi_i(r)
|
||||
!
|
||||
! with m == 1 -> d/dx , m == 2 -> d/dy , m == 3 -> d/dz
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
d_dx_v_ij_erf_rk_cst_mu(ipoint,j,i,1) = d_dx_v_ij_erf_rk_cst_mu_tmp(1,ipoint,j,i)
|
||||
d_dx_v_ij_erf_rk_cst_mu(ipoint,j,i,2) = d_dx_v_ij_erf_rk_cst_mu_tmp(2,ipoint,j,i)
|
||||
d_dx_v_ij_erf_rk_cst_mu(ipoint,j,i,3) = d_dx_v_ij_erf_rk_cst_mu_tmp(3,ipoint,j,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for d_dx_v_ij_erf_rk_cst_mu', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, x_d_dx_v_ij_erf_rk_cst_mu_tmp, (3, n_points_final_grid, ao_num, ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! x_d_dx_v_ij_erf_rk_cst_mu_tmp(m,j,i,R) = int dr x phi_j(r)) (erf(mu(R) |r - R|) - 1)/|r - R| d/dx (phi_i(r)
|
||||
!
|
||||
! with m == 1 -> d/dx , m == 2 -> d/dy , m == 3 -> d/dz
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: r(3), ints(3), ints_coulomb(3)
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,ipoint,r,ints,ints_coulomb) &
|
||||
!$OMP SHARED (ao_num,n_points_final_grid,x_d_dx_v_ij_erf_rk_cst_mu_tmp,final_grid_points,mu_erf)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,ipoint)
|
||||
r(2) = final_grid_points(2,ipoint)
|
||||
r(3) = final_grid_points(3,ipoint)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
call phi_j_erf_mu_r_xyz_dxyz_phi(j, i, mu_erf, r, ints)
|
||||
call phi_j_erf_mu_r_xyz_dxyz_phi(j, i, 1.d+9, r, ints_coulomb)
|
||||
|
||||
x_d_dx_v_ij_erf_rk_cst_mu_tmp(1,ipoint,j,i) = ints(1) - ints_coulomb(1)
|
||||
x_d_dx_v_ij_erf_rk_cst_mu_tmp(2,ipoint,j,i) = ints(2) - ints_coulomb(2)
|
||||
x_d_dx_v_ij_erf_rk_cst_mu_tmp(3,ipoint,j,i) = ints(3) - ints_coulomb(3)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for x_d_dx_v_ij_erf_rk_cst_mu_tmp', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, x_d_dx_v_ij_erf_rk_cst_mu, (n_points_final_grid,ao_num, ao_num,3)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! x_d_dx_v_ij_erf_rk_cst_mu_tmp(j,i,R,m) = int dr x phi_j(r)) (erf(mu(R) |r - R|) - 1)/|r - R| d/dx (phi_i(r)
|
||||
!
|
||||
! with m == 1 -> d/dx , m == 2 -> d/dy , m == 3 -> d/dz
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
x_d_dx_v_ij_erf_rk_cst_mu(ipoint,j,i,1) = x_d_dx_v_ij_erf_rk_cst_mu_tmp(1,ipoint,j,i)
|
||||
x_d_dx_v_ij_erf_rk_cst_mu(ipoint,j,i,2) = x_d_dx_v_ij_erf_rk_cst_mu_tmp(2,ipoint,j,i)
|
||||
x_d_dx_v_ij_erf_rk_cst_mu(ipoint,j,i,3) = x_d_dx_v_ij_erf_rk_cst_mu_tmp(3,ipoint,j,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for x_d_dx_v_ij_erf_rk_cst_mu', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
|
226
src/ao_many_one_e_ints/listj1b.irp.f
Normal file
226
src/ao_many_one_e_ints/listj1b.irp.f
Normal file
|
@ -0,0 +1,226 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ integer, List_all_comb_b2_size]
|
||||
|
||||
implicit none
|
||||
|
||||
List_all_comb_b2_size = 2**nucl_num
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ integer, List_all_comb_b2, (nucl_num, List_all_comb_b2_size)]
|
||||
|
||||
implicit none
|
||||
integer :: i, j
|
||||
|
||||
if(nucl_num .gt. 32) then
|
||||
print *, ' nucl_num = ', nucl_num, '> 32'
|
||||
stop
|
||||
endif
|
||||
|
||||
List_all_comb_b2 = 0
|
||||
|
||||
do i = 0, List_all_comb_b2_size-1
|
||||
do j = 0, nucl_num-1
|
||||
if (btest(i,j)) then
|
||||
List_all_comb_b2(j+1,i+1) = 1
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, List_all_comb_b2_coef, ( List_all_comb_b2_size)]
|
||||
&BEGIN_PROVIDER [ double precision, List_all_comb_b2_expo, ( List_all_comb_b2_size)]
|
||||
&BEGIN_PROVIDER [ double precision, List_all_comb_b2_cent, (3, List_all_comb_b2_size)]
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, phase
|
||||
double precision :: tmp_alphaj, tmp_alphak
|
||||
double precision :: tmp_cent_x, tmp_cent_y, tmp_cent_z
|
||||
|
||||
provide j1b_pen
|
||||
|
||||
List_all_comb_b2_coef = 0.d0
|
||||
List_all_comb_b2_expo = 0.d0
|
||||
List_all_comb_b2_cent = 0.d0
|
||||
|
||||
do i = 1, List_all_comb_b2_size
|
||||
|
||||
tmp_cent_x = 0.d0
|
||||
tmp_cent_y = 0.d0
|
||||
tmp_cent_z = 0.d0
|
||||
do j = 1, nucl_num
|
||||
tmp_alphaj = dble(List_all_comb_b2(j,i)) * j1b_pen(j)
|
||||
List_all_comb_b2_expo(i) += tmp_alphaj
|
||||
tmp_cent_x += tmp_alphaj * nucl_coord(j,1)
|
||||
tmp_cent_y += tmp_alphaj * nucl_coord(j,2)
|
||||
tmp_cent_z += tmp_alphaj * nucl_coord(j,3)
|
||||
enddo
|
||||
|
||||
if(List_all_comb_b2_expo(i) .lt. 1d-10) cycle
|
||||
|
||||
List_all_comb_b2_cent(1,i) = tmp_cent_x / List_all_comb_b2_expo(i)
|
||||
List_all_comb_b2_cent(2,i) = tmp_cent_y / List_all_comb_b2_expo(i)
|
||||
List_all_comb_b2_cent(3,i) = tmp_cent_z / List_all_comb_b2_expo(i)
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
do i = 1, List_all_comb_b2_size
|
||||
|
||||
do j = 2, nucl_num, 1
|
||||
tmp_alphaj = dble(List_all_comb_b2(j,i)) * j1b_pen(j)
|
||||
do k = 1, j-1, 1
|
||||
tmp_alphak = dble(List_all_comb_b2(k,i)) * j1b_pen(k)
|
||||
|
||||
List_all_comb_b2_coef(i) += tmp_alphaj * tmp_alphak * ( (nucl_coord(j,1) - nucl_coord(k,1)) * (nucl_coord(j,1) - nucl_coord(k,1)) &
|
||||
+ (nucl_coord(j,2) - nucl_coord(k,2)) * (nucl_coord(j,2) - nucl_coord(k,2)) &
|
||||
+ (nucl_coord(j,3) - nucl_coord(k,3)) * (nucl_coord(j,3) - nucl_coord(k,3)) )
|
||||
enddo
|
||||
enddo
|
||||
|
||||
if(List_all_comb_b2_expo(i) .lt. 1d-10) cycle
|
||||
|
||||
List_all_comb_b2_coef(i) = List_all_comb_b2_coef(i) / List_all_comb_b2_expo(i)
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
do i = 1, List_all_comb_b2_size
|
||||
|
||||
phase = 0
|
||||
do j = 1, nucl_num
|
||||
phase += List_all_comb_b2(j,i)
|
||||
enddo
|
||||
|
||||
List_all_comb_b2_coef(i) = (-1.d0)**dble(phase) * dexp(-List_all_comb_b2_coef(i))
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ integer, List_all_comb_b3_size]
|
||||
|
||||
implicit none
|
||||
|
||||
List_all_comb_b3_size = 3**nucl_num
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ integer, List_all_comb_b3, (nucl_num, List_all_comb_b3_size)]
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ii, jj
|
||||
integer, allocatable :: M(:,:), p(:)
|
||||
|
||||
if(nucl_num .gt. 32) then
|
||||
print *, ' nucl_num = ', nucl_num, '> 32'
|
||||
stop
|
||||
endif
|
||||
|
||||
List_all_comb_b3(:,:) = 0
|
||||
List_all_comb_b3(:,List_all_comb_b3_size) = 2
|
||||
|
||||
allocate(p(nucl_num))
|
||||
p = 0
|
||||
|
||||
do i = 2, List_all_comb_b3_size-1
|
||||
do j = 1, nucl_num
|
||||
|
||||
ii = 0
|
||||
do jj = 1, j-1, 1
|
||||
ii = ii + p(jj) * 3**(jj-1)
|
||||
enddo
|
||||
p(j) = modulo(i-1-ii, 3**j) / 3**(j-1)
|
||||
|
||||
List_all_comb_b3(j,i) = p(j)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, List_all_comb_b3_coef, ( List_all_comb_b3_size)]
|
||||
&BEGIN_PROVIDER [ double precision, List_all_comb_b3_expo, ( List_all_comb_b3_size)]
|
||||
&BEGIN_PROVIDER [ double precision, List_all_comb_b3_cent, (3, List_all_comb_b3_size)]
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, phase
|
||||
double precision :: tmp_alphaj, tmp_alphak, facto
|
||||
|
||||
provide j1b_pen
|
||||
|
||||
List_all_comb_b3_coef = 0.d0
|
||||
List_all_comb_b3_expo = 0.d0
|
||||
List_all_comb_b3_cent = 0.d0
|
||||
|
||||
do i = 1, List_all_comb_b3_size
|
||||
|
||||
do j = 1, nucl_num
|
||||
tmp_alphaj = dble(List_all_comb_b3(j,i)) * j1b_pen(j)
|
||||
print*,List_all_comb_b3(j,i),j1b_pen(j)
|
||||
List_all_comb_b3_expo(i) += tmp_alphaj
|
||||
List_all_comb_b3_cent(1,i) += tmp_alphaj * nucl_coord(j,1)
|
||||
List_all_comb_b3_cent(2,i) += tmp_alphaj * nucl_coord(j,2)
|
||||
List_all_comb_b3_cent(3,i) += tmp_alphaj * nucl_coord(j,3)
|
||||
|
||||
enddo
|
||||
|
||||
if(List_all_comb_b3_expo(i) .lt. 1d-10) cycle
|
||||
ASSERT(List_all_comb_b3_expo(i) .gt. 0d0)
|
||||
|
||||
List_all_comb_b3_cent(1,i) = List_all_comb_b3_cent(1,i) / List_all_comb_b3_expo(i)
|
||||
List_all_comb_b3_cent(2,i) = List_all_comb_b3_cent(2,i) / List_all_comb_b3_expo(i)
|
||||
List_all_comb_b3_cent(3,i) = List_all_comb_b3_cent(3,i) / List_all_comb_b3_expo(i)
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
do i = 1, List_all_comb_b3_size
|
||||
|
||||
do j = 2, nucl_num, 1
|
||||
tmp_alphaj = dble(List_all_comb_b3(j,i)) * j1b_pen(j)
|
||||
do k = 1, j-1, 1
|
||||
tmp_alphak = dble(List_all_comb_b3(k,i)) * j1b_pen(k)
|
||||
|
||||
List_all_comb_b3_coef(i) += tmp_alphaj * tmp_alphak * ( (nucl_coord(j,1) - nucl_coord(k,1)) * (nucl_coord(j,1) - nucl_coord(k,1)) &
|
||||
+ (nucl_coord(j,2) - nucl_coord(k,2)) * (nucl_coord(j,2) - nucl_coord(k,2)) &
|
||||
+ (nucl_coord(j,3) - nucl_coord(k,3)) * (nucl_coord(j,3) - nucl_coord(k,3)) )
|
||||
enddo
|
||||
enddo
|
||||
|
||||
if(List_all_comb_b3_expo(i) .lt. 1d-10) cycle
|
||||
|
||||
List_all_comb_b3_coef(i) = List_all_comb_b3_coef(i) / List_all_comb_b3_expo(i)
|
||||
enddo
|
||||
|
||||
! ---
|
||||
|
||||
do i = 1, List_all_comb_b3_size
|
||||
|
||||
facto = 1.d0
|
||||
phase = 0
|
||||
do j = 1, nucl_num
|
||||
tmp_alphaj = dble(List_all_comb_b3(j,i))
|
||||
|
||||
facto *= 2.d0 / (gamma(tmp_alphaj+1.d0) * gamma(3.d0-tmp_alphaj))
|
||||
phase += List_all_comb_b3(j,i)
|
||||
enddo
|
||||
|
||||
List_all_comb_b3_coef(i) = (-1.d0)**dble(phase) * facto * dexp(-List_all_comb_b3_coef(i))
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
195
src/ao_many_one_e_ints/prim_int_erf_gauss.irp.f
Normal file
195
src/ao_many_one_e_ints/prim_int_erf_gauss.irp.f
Normal file
|
@ -0,0 +1,195 @@
|
|||
double precision function NAI_pol_mult_erf_gauss_r12(D_center,delta,A_center,B_center,power_A,power_B,alpha,beta,C_center,mu)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral R^3 :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
! \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$ exp(-delta (r - D)^2 ).
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
double precision, intent(in) :: D_center(3), delta ! pure gaussian "D"
|
||||
double precision, intent(in) :: C_center(3),mu ! coulomb center "C" and "mu" in the erf(mu*x)/x function
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
|
||||
double precision :: NAI_pol_mult_erf
|
||||
! First you multiply the usual gaussian "A" with the gaussian exp(-delta (r - D)^2 )
|
||||
double precision :: A_new(0:max_dim,3)! new polynom
|
||||
double precision :: A_center_new(3) ! new center
|
||||
integer :: iorder_a_new(3) ! i_order(i) = order of the new polynom ==> should be equal to power_A
|
||||
double precision :: alpha_new ! new exponent
|
||||
double precision :: fact_a_new ! constant factor
|
||||
double precision :: accu,coefx,coefy,coefz,coefxy,coefxyz,thr
|
||||
integer :: d(3),i,lx,ly,lz,iorder_tmp(3)
|
||||
thr = 1.d-10
|
||||
d = 0 ! order of the polynom for the gaussian exp(-delta (r - D)^2 ) == 0
|
||||
|
||||
! New gaussian/polynom defined by :: new pol new center new expo cst fact new order
|
||||
call give_explicit_poly_and_gaussian(A_new , A_center_new , alpha_new, fact_a_new , iorder_a_new , &
|
||||
delta,alpha,d,power_A,D_center,A_center,n_pt_max_integrals)
|
||||
! The new gaussian exp(-delta (r - D)^2 ) (x-A_x)^a \exp(-\alpha (x-A_x)^2
|
||||
accu = 0.d0
|
||||
do lx = 0, iorder_a_new(1)
|
||||
coefx = A_new(lx,1)
|
||||
if(dabs(coefx).lt.thr)cycle
|
||||
iorder_tmp(1) = lx
|
||||
do ly = 0, iorder_a_new(2)
|
||||
coefy = A_new(ly,2)
|
||||
coefxy = coefx * coefy
|
||||
if(dabs(coefxy).lt.thr)cycle
|
||||
iorder_tmp(2) = ly
|
||||
do lz = 0, iorder_a_new(3)
|
||||
coefz = A_new(lz,3)
|
||||
coefxyz = coefxy * coefz
|
||||
if(dabs(coefxyz).lt.thr)cycle
|
||||
iorder_tmp(3) = lz
|
||||
accu += coefxyz * NAI_pol_mult_erf(A_center_new,B_center,iorder_tmp,power_B,alpha_new,beta,C_center,n_pt_max_integrals,mu)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
NAI_pol_mult_erf_gauss_r12 = fact_a_new * accu
|
||||
end
|
||||
|
||||
subroutine erfc_mu_gauss_xyz(D_center,delta,mu,A_center,B_center,power_A,power_B,alpha,beta,n_pt_in,xyz_ints)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr exp(-delta (r - D)^2 ) x/y/z * (1 - erf(mu |r-r'|))/ |r-r'| * (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
!
|
||||
! xyz_ints(1) = x , xyz_ints(2) = y, xyz_ints(3) = z, xyz_ints(4) = x^0
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
double precision, intent(in) :: D_center(3), delta,mu ! pure gaussian "D" and mu parameter
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3),n_pt_in
|
||||
double precision, intent(out) :: xyz_ints(4)
|
||||
|
||||
double precision :: NAI_pol_mult_erf
|
||||
! First you multiply the usual gaussian "A" with the gaussian exp(-delta (r - D)^2 )
|
||||
double precision :: A_new(0:max_dim,3)! new polynom
|
||||
double precision :: A_center_new(3) ! new center
|
||||
integer :: iorder_a_new(3) ! i_order(i) = order of the new polynom ==> should be equal to power_A
|
||||
double precision :: alpha_new ! new exponent
|
||||
double precision :: fact_a_new ! constant factor
|
||||
double precision :: accu,coefx,coefy,coefz,coefxy,coefxyz,thr,contrib,contrib_inf,mu_inf
|
||||
integer :: d(3),i,lx,ly,lz,iorder_tmp(3),dim1,mm
|
||||
integer :: power_B_tmp(3)
|
||||
dim1=100
|
||||
mu_inf = 1.d+10
|
||||
thr = 1.d-10
|
||||
d = 0 ! order of the polynom for the gaussian exp(-delta (r - D)^2 ) == 0
|
||||
|
||||
! New gaussian/polynom defined by :: new pol new center new expo cst fact new order
|
||||
call give_explicit_poly_and_gaussian(A_new , A_center_new , alpha_new, fact_a_new , iorder_a_new , &
|
||||
delta,alpha,d,power_A,D_center,A_center,n_pt_max_integrals)
|
||||
! The new gaussian exp(-delta (r - D)^2 ) (x-A_x)^a \exp(-\alpha (x-A_x)^2
|
||||
xyz_ints = 0.d0
|
||||
do lx = 0, iorder_a_new(1)
|
||||
coefx = A_new(lx,1)
|
||||
if(dabs(coefx).lt.thr)cycle
|
||||
iorder_tmp(1) = lx
|
||||
do ly = 0, iorder_a_new(2)
|
||||
coefy = A_new(ly,2)
|
||||
coefxy = coefx * coefy
|
||||
if(dabs(coefxy).lt.thr)cycle
|
||||
iorder_tmp(2) = ly
|
||||
do lz = 0, iorder_a_new(3)
|
||||
coefz = A_new(lz,3)
|
||||
coefxyz = coefxy * coefz
|
||||
if(dabs(coefxyz).lt.thr)cycle
|
||||
iorder_tmp(3) = lz
|
||||
power_B_tmp = power_B
|
||||
contrib = NAI_pol_mult_erf(A_center_new,B_center,iorder_tmp,power_B_tmp,alpha_new,beta,D_center,n_pt_in,mu)
|
||||
contrib_inf = NAI_pol_mult_erf(A_center_new,B_center,iorder_tmp,power_B_tmp,alpha_new,beta,D_center,n_pt_in,mu_inf)
|
||||
xyz_ints(4) += (contrib_inf - contrib) * coefxyz ! usual term with no x/y/z
|
||||
|
||||
do mm = 1, 3
|
||||
! (x phi_i ) * phi_j
|
||||
! x * (x - B_x)^b_x = B_x (x - B_x)^b_x + 1 * (x - B_x)^{b_x+1}
|
||||
|
||||
!
|
||||
! first contribution :: B_x (x - B_x)^b_x :: usual integral multiplied by B_x
|
||||
power_B_tmp = power_B
|
||||
contrib_inf = NAI_pol_mult_erf(A_center_new,B_center,iorder_tmp,power_B_tmp,alpha_new,beta,D_center,n_pt_in,mu_inf)
|
||||
contrib = NAI_pol_mult_erf(A_center_new,B_center,iorder_tmp,power_B_tmp,alpha_new,beta,D_center,n_pt_in,mu)
|
||||
xyz_ints(mm) += (contrib_inf - contrib) * B_center(mm) * coefxyz
|
||||
|
||||
!
|
||||
! second contribution :: (x - B_x)^(b_x+1) :: integral with b_x=>b_x+1
|
||||
power_B_tmp(mm) += 1
|
||||
contrib = NAI_pol_mult_erf(A_center_new,B_center,iorder_tmp,power_B_tmp,alpha_new,beta,D_center,n_pt_in,mu)
|
||||
contrib_inf = NAI_pol_mult_erf(A_center_new,B_center,iorder_tmp,power_B_tmp,alpha_new,beta,D_center,n_pt_in,mu_inf)
|
||||
xyz_ints(mm) += (contrib_inf - contrib) * coefxyz
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
xyz_ints *= fact_a_new
|
||||
end
|
||||
|
||||
|
||||
double precision function erf_mu_gauss(D_center,delta,mu,A_center,B_center,power_A,power_B,alpha,beta,n_pt_in)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr exp(-delta (r - D)^2 ) erf(mu*|r-r'|)/ |r-r'| * (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
double precision, intent(in) :: D_center(3), delta,mu ! pure gaussian "D" and mu parameter
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3),n_pt_in
|
||||
|
||||
double precision :: NAI_pol_mult_erf
|
||||
! First you multiply the usual gaussian "A" with the gaussian exp(-delta (r - D)^2 )
|
||||
double precision :: A_new(0:max_dim,3)! new polynom
|
||||
double precision :: A_center_new(3) ! new center
|
||||
integer :: iorder_a_new(3) ! i_order(i) = order of the new polynom ==> should be equal to power_A
|
||||
double precision :: alpha_new ! new exponent
|
||||
double precision :: fact_a_new ! constant factor
|
||||
double precision :: accu,coefx,coefy,coefz,coefxy,coefxyz,thr,contrib,contrib_inf,mu_inf
|
||||
integer :: d(3),i,lx,ly,lz,iorder_tmp(3),dim1,mm
|
||||
dim1=100
|
||||
mu_inf = 1.d+10
|
||||
thr = 1.d-10
|
||||
d = 0 ! order of the polynom for the gaussian exp(-delta (r - D)^2 ) == 0
|
||||
|
||||
! New gaussian/polynom defined by :: new pol new center new expo cst fact new order
|
||||
call give_explicit_poly_and_gaussian(A_new , A_center_new , alpha_new, fact_a_new , iorder_a_new , &
|
||||
delta,alpha,d,power_A,D_center,A_center,n_pt_max_integrals)
|
||||
! The new gaussian exp(-delta (r - D)^2 ) (x-A_x)^a \exp(-\alpha (x-A_x)^2
|
||||
erf_mu_gauss = 0.d0
|
||||
do lx = 0, iorder_a_new(1)
|
||||
coefx = A_new(lx,1)
|
||||
if(dabs(coefx).lt.thr)cycle
|
||||
iorder_tmp(1) = lx
|
||||
do ly = 0, iorder_a_new(2)
|
||||
coefy = A_new(ly,2)
|
||||
coefxy = coefx * coefy
|
||||
if(dabs(coefxy).lt.thr)cycle
|
||||
iorder_tmp(2) = ly
|
||||
do lz = 0, iorder_a_new(3)
|
||||
coefz = A_new(lz,3)
|
||||
coefxyz = coefxy * coefz
|
||||
if(dabs(coefxyz).lt.thr)cycle
|
||||
iorder_tmp(3) = lz
|
||||
contrib = NAI_pol_mult_erf(A_center_new,B_center,iorder_tmp,power_B,alpha_new,beta,D_center,n_pt_in,mu)
|
||||
erf_mu_gauss += contrib * coefxyz
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
erf_mu_gauss *= fact_a_new
|
||||
end
|
||||
|
263
src/ao_many_one_e_ints/prim_int_gauss_gauss.irp.f
Normal file
263
src/ao_many_one_e_ints/prim_int_gauss_gauss.irp.f
Normal file
|
@ -0,0 +1,263 @@
|
|||
double precision function overlap_gauss_r12(D_center,delta,A_center,B_center,power_A,power_B,alpha,beta)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math ::
|
||||
!
|
||||
! \int dr exp(-delta (r - D)^2 ) (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
double precision, intent(in) :: D_center(3), delta ! pure gaussian "D"
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
|
||||
double precision :: overlap_x,overlap_y,overlap_z,overlap
|
||||
! First you multiply the usual gaussian "A" with the gaussian exp(-delta (r - D)^2 )
|
||||
double precision :: A_new(0:max_dim,3)! new polynom
|
||||
double precision :: A_center_new(3) ! new center
|
||||
integer :: iorder_a_new(3) ! i_order(i) = order of the new polynom ==> should be equal to power_A
|
||||
double precision :: alpha_new ! new exponent
|
||||
double precision :: fact_a_new ! constant factor
|
||||
double precision :: accu,coefx,coefy,coefz,coefxy,coefxyz,thr
|
||||
integer :: d(3),i,lx,ly,lz,iorder_tmp(3),dim1
|
||||
dim1=100
|
||||
thr = 1.d-10
|
||||
d(:) = 0 ! order of the polynom for the gaussian exp(-delta (r - D)^2 ) == 0
|
||||
|
||||
! New gaussian/polynom defined by :: new pol new center new expo cst fact new order
|
||||
call give_explicit_poly_and_gaussian(A_new , A_center_new , alpha_new, fact_a_new , iorder_a_new ,&
|
||||
delta,alpha,d,power_A,D_center,A_center,n_pt_max_integrals)
|
||||
! The new gaussian exp(-delta (r - D)^2 ) (x-A_x)^a \exp(-\alpha (x-A_x)^2
|
||||
accu = 0.d0
|
||||
do lx = 0, iorder_a_new(1)
|
||||
coefx = A_new(lx,1)
|
||||
if(dabs(coefx).lt.thr)cycle
|
||||
iorder_tmp(1) = lx
|
||||
do ly = 0, iorder_a_new(2)
|
||||
coefy = A_new(ly,2)
|
||||
coefxy = coefx * coefy
|
||||
if(dabs(coefxy).lt.thr)cycle
|
||||
iorder_tmp(2) = ly
|
||||
do lz = 0, iorder_a_new(3)
|
||||
coefz = A_new(lz,3)
|
||||
coefxyz = coefxy * coefz
|
||||
if(dabs(coefxyz).lt.thr)cycle
|
||||
iorder_tmp(3) = lz
|
||||
call overlap_gaussian_xyz(A_center_new,B_center,alpha_new,beta,iorder_tmp,power_B,overlap_x,overlap_y,overlap_z,overlap,dim1)
|
||||
accu += coefxyz * overlap
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
overlap_gauss_r12 = fact_a_new * accu
|
||||
end
|
||||
|
||||
!---
|
||||
|
||||
subroutine overlap_gauss_r12_v(D_center,delta,A_center,B_center,power_A,power_B,alpha,beta,rvec,n_points)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math ::
|
||||
!
|
||||
! \int dr exp(-delta (r - D)^2 ) (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
! using an array of D_centers
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
integer, intent(in) :: n_points
|
||||
double precision, intent(in) :: D_center(n_points,3), delta ! pure gaussian "D"
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
double precision, intent(out) :: rvec(n_points)
|
||||
|
||||
double precision, allocatable :: overlap(:)
|
||||
double precision :: overlap_x, overlap_y, overlap_z
|
||||
|
||||
integer :: maxab
|
||||
integer, allocatable :: iorder_a_new(:)
|
||||
double precision, allocatable :: A_new(:,:,:), A_center_new(:,:)
|
||||
double precision, allocatable :: fact_a_new(:)
|
||||
double precision :: alpha_new
|
||||
double precision :: accu,thr, coefxy
|
||||
integer :: d(3),i,lx,ly,lz,iorder_tmp(3),dim1, ipoint
|
||||
|
||||
dim1=100
|
||||
thr = 1.d-10
|
||||
d(:) = 0
|
||||
|
||||
maxab = maxval(power_A(1:3))
|
||||
|
||||
allocate (A_new(n_points, 0:maxab, 3), A_center_new(n_points, 3), &
|
||||
fact_a_new(n_points), iorder_a_new(3), overlap(n_points) )
|
||||
|
||||
call give_explicit_poly_and_gaussian_v(A_new, maxab, A_center_new, &
|
||||
alpha_new, fact_a_new, iorder_a_new , delta, alpha, d, power_A, &
|
||||
D_center, A_center, n_points)
|
||||
|
||||
do ipoint=1,n_points
|
||||
rvec(ipoint) = 0.d0
|
||||
enddo
|
||||
|
||||
do lx = 0, iorder_a_new(1)
|
||||
iorder_tmp(1) = lx
|
||||
do ly = 0, iorder_a_new(2)
|
||||
iorder_tmp(2) = ly
|
||||
do lz = 0, iorder_a_new(3)
|
||||
iorder_tmp(3) = lz
|
||||
call overlap_gaussian_xyz_v(A_center_new,B_center,alpha_new,beta,iorder_tmp,power_B,overlap,dim1,n_points)
|
||||
do ipoint=1,n_points
|
||||
rvec(ipoint) = rvec(ipoint) + A_new(ipoint,lx,1) * &
|
||||
A_new(ipoint,ly,2) * &
|
||||
A_new(ipoint,lz,3) * overlap(ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
do ipoint=1,n_points
|
||||
rvec(ipoint) = rvec(ipoint) * fact_a_new(ipoint)
|
||||
enddo
|
||||
deallocate(A_new, A_center_new, fact_a_new, iorder_a_new, overlap)
|
||||
end
|
||||
|
||||
!---
|
||||
!---
|
||||
|
||||
subroutine overlap_gauss_xyz_r12(D_center,delta,A_center,B_center,power_A,power_B,alpha,beta,gauss_ints)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! gauss_ints(m) = \int dr exp(-delta (r - D)^2 ) * x/y/z (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
!
|
||||
! with m == 1 ==> x, m == 2 ==> y, m == 3 ==> z
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
double precision, intent(in) :: D_center(3), delta ! pure gaussian "D"
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
double precision, intent(out) :: gauss_ints(3)
|
||||
|
||||
double precision :: overlap_x,overlap_y,overlap_z,overlap
|
||||
! First you multiply the usual gaussian "A" with the gaussian exp(-delta (r - D)^2 )
|
||||
double precision :: A_new(0:max_dim,3)! new polynom
|
||||
double precision :: A_center_new(3) ! new center
|
||||
integer :: iorder_a_new(3) ! i_order(i) = order of the new polynom ==> should be equal to power_A
|
||||
integer :: power_B_new(3)
|
||||
double precision :: alpha_new ! new exponent
|
||||
double precision :: fact_a_new ! constant factor
|
||||
double precision :: coefx,coefy,coefz,coefxy,coefxyz,thr
|
||||
integer :: d(3),i,lx,ly,lz,iorder_tmp(3),dim1,m
|
||||
dim1=100
|
||||
thr = 1.d-10
|
||||
d = 0 ! order of the polynom for the gaussian exp(-delta (r - D)^2 ) == 0
|
||||
|
||||
! New gaussian/polynom defined by :: new pol new center new expo cst fact new order
|
||||
call give_explicit_poly_and_gaussian(A_new , A_center_new , alpha_new, fact_a_new , iorder_a_new , &
|
||||
delta,alpha,d,power_A,D_center,A_center,n_pt_max_integrals)
|
||||
! The new gaussian exp(-delta (r - D)^2 ) (x-A_x)^a \exp(-\alpha (x-A_x)^2
|
||||
gauss_ints = 0.d0
|
||||
do lx = 0, iorder_a_new(1)
|
||||
coefx = A_new(lx,1)
|
||||
if(dabs(coefx).lt.thr)cycle
|
||||
iorder_tmp(1) = lx
|
||||
do ly = 0, iorder_a_new(2)
|
||||
coefy = A_new(ly,2)
|
||||
coefxy = coefx * coefy
|
||||
if(dabs(coefxy).lt.thr)cycle
|
||||
iorder_tmp(2) = ly
|
||||
do lz = 0, iorder_a_new(3)
|
||||
coefz = A_new(lz,3)
|
||||
coefxyz = coefxy * coefz
|
||||
if(dabs(coefxyz).lt.thr)cycle
|
||||
iorder_tmp(3) = lz
|
||||
do m = 1, 3
|
||||
! change (x-Bx)^bx --> (x-Bx)^(bx+1) + Bx(x-Bx)^bx
|
||||
power_B_new = power_B
|
||||
power_B_new(m) += 1 ! (x-Bx)^(bx+1)
|
||||
call overlap_gaussian_xyz(A_center_new,B_center,alpha_new,beta,iorder_tmp,power_B_new,overlap_x,overlap_y,overlap_z,overlap,dim1)
|
||||
gauss_ints(m) += coefxyz * overlap
|
||||
|
||||
power_B_new = power_B
|
||||
call overlap_gaussian_xyz(A_center_new,B_center,alpha_new,beta,iorder_tmp,power_B_new,overlap_x,overlap_y,overlap_z,overlap,dim1)
|
||||
gauss_ints(m) += coefxyz * overlap * B_center(m) ! Bx (x-Bx)^(bx)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
gauss_ints *= fact_a_new
|
||||
end
|
||||
|
||||
double precision function overlap_gauss_xyz_r12_specific(D_center,delta,A_center,B_center,power_A,power_B,alpha,beta,mx)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr exp(-delta (r - D)^2 ) * x/y/z (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
!
|
||||
! with mx == 1 ==> x, mx == 2 ==> y, mx == 3 ==> z
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
double precision, intent(in) :: D_center(3), delta ! pure gaussian "D"
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3),mx
|
||||
|
||||
double precision :: overlap_x,overlap_y,overlap_z,overlap
|
||||
! First you multiply the usual gaussian "A" with the gaussian exp(-delta (r - D)^2 )
|
||||
double precision :: A_new(0:max_dim,3)! new polynom
|
||||
double precision :: A_center_new(3) ! new center
|
||||
integer :: iorder_a_new(3) ! i_order(i) = order of the new polynom ==> should be equal to power_A
|
||||
integer :: power_B_new(3)
|
||||
double precision :: alpha_new ! new exponent
|
||||
double precision :: fact_a_new ! constant factor
|
||||
double precision :: coefx,coefy,coefz,coefxy,coefxyz,thr
|
||||
integer :: d(3),i,lx,ly,lz,iorder_tmp(3),dim1,m
|
||||
dim1=100
|
||||
thr = 1.d-10
|
||||
d = 0 ! order of the polynom for the gaussian exp(-delta (r - D)^2 ) == 0
|
||||
|
||||
! New gaussian/polynom defined by :: new pol new center new expo cst fact new order
|
||||
call give_explicit_poly_and_gaussian(A_new , A_center_new , alpha_new, fact_a_new , iorder_a_new , &
|
||||
delta,alpha,d,power_A,D_center,A_center,n_pt_max_integrals)
|
||||
! The new gaussian exp(-delta (r - D)^2 ) (x-A_x)^a \exp(-\alpha (x-A_x)^2
|
||||
overlap_gauss_xyz_r12_specific = 0.d0
|
||||
do lx = 0, iorder_a_new(1)
|
||||
coefx = A_new(lx,1)
|
||||
if(dabs(coefx).lt.thr)cycle
|
||||
iorder_tmp(1) = lx
|
||||
do ly = 0, iorder_a_new(2)
|
||||
coefy = A_new(ly,2)
|
||||
coefxy = coefx * coefy
|
||||
if(dabs(coefxy).lt.thr)cycle
|
||||
iorder_tmp(2) = ly
|
||||
do lz = 0, iorder_a_new(3)
|
||||
coefz = A_new(lz,3)
|
||||
coefxyz = coefxy * coefz
|
||||
if(dabs(coefxyz).lt.thr)cycle
|
||||
iorder_tmp(3) = lz
|
||||
m = mx
|
||||
! change (x-Bx)^bx --> (x-Bx)^(bx+1) + Bx(x-Bx)^bx
|
||||
power_B_new = power_B
|
||||
power_B_new(m) += 1 ! (x-Bx)^(bx+1)
|
||||
call overlap_gaussian_xyz(A_center_new,B_center,alpha_new,beta,iorder_tmp,power_B_new,overlap_x,overlap_y,overlap_z,overlap,dim1)
|
||||
overlap_gauss_xyz_r12_specific += coefxyz * overlap
|
||||
|
||||
power_B_new = power_B
|
||||
call overlap_gaussian_xyz(A_center_new,B_center,alpha_new,beta,iorder_tmp,power_B_new,overlap_x,overlap_y,overlap_z,overlap,dim1)
|
||||
overlap_gauss_xyz_r12_specific += coefxyz * overlap * B_center(m) ! Bx (x-Bx)^(bx)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
overlap_gauss_xyz_r12_specific *= fact_a_new
|
||||
end
|
121
src/ao_many_one_e_ints/stg_gauss_int.irp.f
Normal file
121
src/ao_many_one_e_ints/stg_gauss_int.irp.f
Normal file
|
@ -0,0 +1,121 @@
|
|||
double precision function ovlp_stg_gauss_int_phi_ij(D_center,gam,delta,A_center,B_center,power_A,power_B,alpha,beta)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr exp(-gam (r - D)) exp(-delta * (r -D)^2) (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: D_center(3), gam ! pure Slater "D" in r-r_D
|
||||
double precision, intent(in) :: delta ! gaussian in r-r_D
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
|
||||
integer :: i
|
||||
double precision :: integral,gama_gauss
|
||||
double precision, allocatable :: expos_slat(:)
|
||||
allocate(expos_slat(n_max_fit_slat))
|
||||
double precision :: overlap_gauss_r12
|
||||
ovlp_stg_gauss_int_phi_ij = 0.d0
|
||||
call expo_fit_slater_gam(gam,expos_slat)
|
||||
do i = 1, n_max_fit_slat
|
||||
gama_gauss = expos_slat(i)+delta
|
||||
integral = overlap_gauss_r12(D_center,gama_gauss,A_center,B_center,power_A,power_B,alpha,beta)
|
||||
ovlp_stg_gauss_int_phi_ij += coef_fit_slat_gauss(i) * integral
|
||||
enddo
|
||||
end
|
||||
|
||||
|
||||
double precision function erf_mu_stg_gauss_int_phi_ij(D_center,gam,delta,A_center,B_center,power_A,power_B,alpha,beta,C_center,mu)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr exp(-gam(r - D)-delta(r - D)^2) (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
! \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
double precision, intent(in) :: D_center(3), gam ! pure Slater "D" in r-r_D
|
||||
double precision, intent(in) :: delta ! gaussian in r-r_D
|
||||
double precision, intent(in) :: C_center(3),mu ! coulomb center "C" and "mu" in the erf(mu*x)/x function
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
|
||||
integer :: i
|
||||
double precision :: NAI_pol_mult_erf_gauss_r12
|
||||
double precision :: integral,gama_gauss
|
||||
double precision, allocatable :: expos_slat(:)
|
||||
allocate(expos_slat(n_max_fit_slat))
|
||||
erf_mu_stg_gauss_int_phi_ij = 0.d0
|
||||
call expo_fit_slater_gam(gam,expos_slat)
|
||||
do i = 1, n_max_fit_slat
|
||||
gama_gauss = expos_slat(i) + delta
|
||||
integral = NAI_pol_mult_erf_gauss_r12(D_center,gama_gauss,A_center,B_center,power_A,power_B,alpha,beta,C_center,mu)
|
||||
erf_mu_stg_gauss_int_phi_ij += coef_fit_slat_gauss(i) * integral
|
||||
enddo
|
||||
end
|
||||
|
||||
double precision function overlap_stg_gauss(D_center,gam,A_center,B_center,power_A,power_B,alpha,beta)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr exp(-gam (r - D)) (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: D_center(3), gam ! pure Slater "D"
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
|
||||
integer :: i
|
||||
double precision :: expos_slat(n_max_fit_slat),integral,delta
|
||||
double precision :: overlap_gauss_r12
|
||||
overlap_stg_gauss = 0.d0
|
||||
call expo_fit_slater_gam(gam,expos_slat)
|
||||
do i = 1, n_max_fit_slat
|
||||
delta = expos_slat(i)
|
||||
integral = overlap_gauss_r12(D_center,delta,A_center,B_center,power_A,power_B,alpha,beta)
|
||||
overlap_stg_gauss += coef_fit_slat_gauss(i) * integral
|
||||
enddo
|
||||
end
|
||||
|
||||
double precision function erf_mu_stg_gauss(D_center,gam,A_center,B_center,power_A,power_B,alpha,beta,C_center,mu)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr exp(-gam(r - D)) (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
! \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
double precision, intent(in) :: D_center(3), gam ! pure Slater "D"
|
||||
double precision, intent(in) :: C_center(3),mu ! coulomb center "C" and "mu" in the erf(mu*x)/x function
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
|
||||
|
||||
integer :: i
|
||||
double precision :: expos_slat(n_max_fit_slat),integral,delta
|
||||
double precision :: NAI_pol_mult_erf_gauss_r12
|
||||
erf_mu_stg_gauss = 0.d0
|
||||
call expo_fit_slater_gam(gam,expos_slat)
|
||||
do i = 1, n_max_fit_slat
|
||||
delta = expos_slat(i)
|
||||
integral = NAI_pol_mult_erf_gauss_r12(D_center,delta,A_center,B_center,power_A,power_B,alpha,beta,C_center,mu)
|
||||
erf_mu_stg_gauss += coef_fit_slat_gauss(i) * integral
|
||||
enddo
|
||||
end
|
101
src/ao_many_one_e_ints/taylor_exp.irp.f
Normal file
101
src/ao_many_one_e_ints/taylor_exp.irp.f
Normal file
|
@ -0,0 +1,101 @@
|
|||
double precision function exp_dl(x,n)
|
||||
implicit none
|
||||
double precision, intent(in) :: x
|
||||
integer , intent(in) :: n
|
||||
integer :: i
|
||||
exp_dl = 1.d0
|
||||
do i = 1, n
|
||||
exp_dl += fact_inv(i) * x**dble(i)
|
||||
enddo
|
||||
end
|
||||
|
||||
subroutine exp_dl_rout(x,n, array)
|
||||
implicit none
|
||||
double precision, intent(in) :: x
|
||||
integer , intent(in) :: n
|
||||
double precision, intent(out):: array(0:n)
|
||||
integer :: i
|
||||
double precision :: accu
|
||||
accu = 1.d0
|
||||
array(0) = 1.d0
|
||||
do i = 1, n
|
||||
accu += fact_inv(i) * x**dble(i)
|
||||
array(i) = accu
|
||||
enddo
|
||||
end
|
||||
|
||||
subroutine exp_dl_ovlp_stg_phi_ij(zeta,D_center,gam,delta,A_center,B_center,power_A,power_B,alpha,beta,n_taylor,array_ints,integral_taylor,exponent_exp)
|
||||
BEGIN_DOC
|
||||
! Computes the following integrals :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! array(i) = \int dr EXP{exponent_exp * [exp(-gam*i (r - D)) exp(-delta*i * (r -D)^2)] (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
!
|
||||
!
|
||||
! and gives back the Taylor expansion of the exponential in integral_taylor
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: zeta ! prefactor of the argument of the exp(-zeta*x)
|
||||
integer, intent(in) :: n_taylor ! order of the Taylor expansion of the exponential
|
||||
double precision, intent(in) :: D_center(3), gam ! pure Slater "D" in r-r_D
|
||||
double precision, intent(in) :: delta ! gaussian in r-r_D
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
double precision, intent(in) :: exponent_exp
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
double precision, intent(out) :: array_ints(0:n_taylor),integral_taylor
|
||||
|
||||
integer :: i,dim1
|
||||
double precision :: delta_exp,gam_exp,ovlp_stg_gauss_int_phi_ij
|
||||
double precision :: overlap_x,overlap_y,overlap_z,overlap
|
||||
dim1=100
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_x,overlap_y,overlap_z,overlap,dim1)
|
||||
array_ints(0) = overlap
|
||||
integral_taylor = array_ints(0)
|
||||
do i = 1, n_taylor
|
||||
delta_exp = dble(i) * delta
|
||||
gam_exp = dble(i) * gam
|
||||
array_ints(i) = ovlp_stg_gauss_int_phi_ij(D_center,gam_exp,delta_exp,A_center,B_center,power_A,power_B,alpha,beta)
|
||||
integral_taylor += (-zeta*exponent_exp)**dble(i) * fact_inv(i) * array_ints(i)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
subroutine exp_dl_erf_stg_phi_ij(zeta,D_center,gam,delta,A_center,B_center,power_A,power_B,alpha,beta,C_center,mu,n_taylor,array_ints,integral_taylor)
|
||||
BEGIN_DOC
|
||||
! Computes the following integrals :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! array(i) = \int dr exp(-gam*i (r - D)) exp(-delta*i * (r -D)^2) (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
! \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
!
|
||||
!
|
||||
! and gives back the Taylor expansion of the exponential in integral_taylor
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_taylor ! order of the Taylor expansion of the exponential
|
||||
double precision, intent(in) :: zeta ! prefactor of the argument of the exp(-zeta*x)
|
||||
double precision, intent(in) :: D_center(3), gam ! pure Slater "D" in r-r_D
|
||||
double precision, intent(in) :: delta ! gaussian in r-r_D
|
||||
double precision, intent(in) :: C_center(3),mu ! coulomb center "C" and "mu" in the erf(mu*x)/x function
|
||||
double precision, intent(in) :: A_center(3),B_center(3),alpha,beta ! gaussian/polynoms "A" and "B"
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
double precision, intent(out) :: array_ints(0:n_taylor),integral_taylor
|
||||
|
||||
integer :: i,dim1
|
||||
double precision :: delta_exp,gam_exp,NAI_pol_mult_erf,erf_mu_stg_gauss_int_phi_ij
|
||||
dim1=100
|
||||
|
||||
array_ints(0) = NAI_pol_mult_erf(A_center,B_center,power_A,power_B,alpha,beta,C_center,n_pt_max_integrals,mu)
|
||||
integral_taylor = array_ints(0)
|
||||
do i = 1, n_taylor
|
||||
delta_exp = dble(i) * delta
|
||||
gam_exp = dble(i) * gam
|
||||
array_ints(i) = erf_mu_stg_gauss_int_phi_ij(D_center,gam_exp,delta_exp,A_center,B_center,power_A,power_B,alpha,beta,C_center,mu)
|
||||
integral_taylor += (-zeta)**dble(i) * fact_inv(i) * array_ints(i)
|
||||
enddo
|
||||
|
||||
end
|
343
src/ao_many_one_e_ints/xyz_grad_xyz_ao_pol.irp.f
Normal file
343
src/ao_many_one_e_ints/xyz_grad_xyz_ao_pol.irp.f
Normal file
|
@ -0,0 +1,343 @@
|
|||
BEGIN_PROVIDER [double precision, coef_xyz_ao, (2,3,ao_num)]
|
||||
&BEGIN_PROVIDER [integer, power_xyz_ao, (2,3,ao_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! coefficient for the basis function :: (x * phi_i(r), y * phi_i(r), * z_phi(r))
|
||||
!
|
||||
! x * (x - A_x)^a_x = A_x (x - A_x)^a_x + 1 * (x - A_x)^{a_x+1}
|
||||
END_DOC
|
||||
integer :: i,j,k,num_ao,power_ao(1:3)
|
||||
double precision :: center_ao(1:3)
|
||||
do i = 1, ao_num
|
||||
power_ao(1:3)= ao_power(i,1:3)
|
||||
num_ao = ao_nucl(i)
|
||||
center_ao(1:3) = nucl_coord(num_ao,1:3)
|
||||
do j = 1, 3
|
||||
coef_xyz_ao(1,j,i) = center_ao(j) ! A_x (x - A_x)^a_x
|
||||
power_xyz_ao(1,j,i)= power_ao(j)
|
||||
coef_xyz_ao(2,j,i) = 1.d0 ! 1 * (x - A_x)^a_{x+1}
|
||||
power_xyz_ao(2,j,i)= power_ao(j) + 1
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_coef_ord_grad_transp, (2,3,ao_prim_num_max,ao_num) ]
|
||||
&BEGIN_PROVIDER [ integer, power_ord_grad_transp, (2,3,ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! grad AO in terms of polynoms and coefficients
|
||||
!
|
||||
! WARNING !!!! SOME polynoms might be negative !!!!!
|
||||
!
|
||||
! WHEN IT IS THE CASE, coefficients are ZERO
|
||||
END_DOC
|
||||
integer :: i,j,power_ao(3), m,kk
|
||||
do j=1, ao_num
|
||||
power_ao(1:3)= ao_power(j,1:3)
|
||||
do m = 1, 3
|
||||
power_ord_grad_transp(1,m,j) = power_ao(m) - 1
|
||||
power_ord_grad_transp(2,m,j) = power_ao(m) + 1
|
||||
enddo
|
||||
do i=1, ao_prim_num_max
|
||||
do m = 1, 3
|
||||
ao_coef_ord_grad_transp(1,m,i,j) = ao_coef_normalized_ordered(j,i) * dble(power_ao(m)) ! a_x * c_i
|
||||
ao_coef_ord_grad_transp(2,m,i,j) = -2.d0 * ao_coef_normalized_ordered(j,i) * ao_expo_ordered_transp(i,j) ! -2 * c_i * alpha_i
|
||||
do kk = 1, 2
|
||||
if(power_ord_grad_transp(kk,m,j).lt.0)then
|
||||
ao_coef_ord_grad_transp(kk,m,i,j) = 0.d0
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_coef_ord_xyz_grad_transp, (4,3,ao_prim_num_max,ao_num) ]
|
||||
&BEGIN_PROVIDER [ integer, power_ord_xyz_grad_transp, (4,3,ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! x * d/dx of an AO in terms of polynoms and coefficients
|
||||
!
|
||||
! WARNING !!!! SOME polynoms might be negative !!!!!
|
||||
!
|
||||
! WHEN IT IS THE CASE, coefficients are ZERO
|
||||
END_DOC
|
||||
integer :: i,j,power_ao(3), m,num_ao,kk
|
||||
double precision :: center_ao(1:3)
|
||||
do j=1, ao_num
|
||||
power_ao(1:3)= ao_power(j,1:3)
|
||||
num_ao = ao_nucl(j)
|
||||
center_ao(1:3) = nucl_coord(num_ao,1:3)
|
||||
do m = 1, 3
|
||||
power_ord_xyz_grad_transp(1,m,j) = power_ao(m) - 1
|
||||
power_ord_xyz_grad_transp(2,m,j) = power_ao(m)
|
||||
power_ord_xyz_grad_transp(3,m,j) = power_ao(m) + 1
|
||||
power_ord_xyz_grad_transp(4,m,j) = power_ao(m) + 2
|
||||
do kk = 1, 4
|
||||
if(power_ord_xyz_grad_transp(kk,m,j).lt.0)then
|
||||
power_ord_xyz_grad_transp(kk,m,j) = -1
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
do i=1, ao_prim_num_max
|
||||
do m = 1, 3
|
||||
ao_coef_ord_xyz_grad_transp(1,m,i,j) = dble(power_ao(m)) * ao_coef_normalized_ordered(j,i) * center_ao(m)
|
||||
ao_coef_ord_xyz_grad_transp(2,m,i,j) = dble(power_ao(m)) * ao_coef_normalized_ordered(j,i)
|
||||
ao_coef_ord_xyz_grad_transp(3,m,i,j) = -2.d0 * ao_coef_normalized_ordered(j,i) * ao_expo_ordered_transp(i,j) * center_ao(m)
|
||||
ao_coef_ord_xyz_grad_transp(4,m,i,j) = -2.d0 * ao_coef_normalized_ordered(j,i) * ao_expo_ordered_transp(i,j)
|
||||
do kk = 1, 4
|
||||
if(power_ord_xyz_grad_transp(kk,m,j).lt.0)then
|
||||
ao_coef_ord_xyz_grad_transp(kk,m,i,j) = 0.d0
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
subroutine xyz_grad_phi_ao(r,i_ao,xyz_grad_phi)
|
||||
implicit none
|
||||
integer, intent(in) :: i_ao
|
||||
double precision, intent(in) :: r(3)
|
||||
double precision, intent(out):: xyz_grad_phi(3) ! x * d/dx phi i, y * d/dy phi_i, z * d/dz phi_
|
||||
double precision :: center_ao(3),beta
|
||||
double precision :: accu(3,4),dr(3),r2,pol_usual(3)
|
||||
integer :: m,power_ao(3),num_ao,j_prim
|
||||
power_ao(1:3)= ao_power(i_ao,1:3)
|
||||
num_ao = ao_nucl(i_ao)
|
||||
center_ao(1:3) = nucl_coord(num_ao,1:3)
|
||||
dr(1) = (r(1) - center_ao(1))
|
||||
dr(2) = (r(2) - center_ao(2))
|
||||
dr(3) = (r(3) - center_ao(3))
|
||||
r2 = 0.d0
|
||||
do m = 1, 3
|
||||
r2 += dr(m)*dr(m)
|
||||
enddo
|
||||
! computes the gaussian part
|
||||
accu = 0.d0
|
||||
do j_prim =1,ao_prim_num(i_ao)
|
||||
beta = ao_expo_ordered_transp(j_prim,i_ao)
|
||||
if(dabs(beta*r2).gt.50.d0)cycle
|
||||
do m = 1, 3
|
||||
accu(m,1) += ao_coef_ord_xyz_grad_transp(1,m,j_prim,i_ao) * dexp(-beta*r2)
|
||||
accu(m,2) += ao_coef_ord_xyz_grad_transp(2,m,j_prim,i_ao) * dexp(-beta*r2)
|
||||
accu(m,3) += ao_coef_ord_xyz_grad_transp(3,m,j_prim,i_ao) * dexp(-beta*r2)
|
||||
accu(m,4) += ao_coef_ord_xyz_grad_transp(4,m,j_prim,i_ao) * dexp(-beta*r2)
|
||||
enddo
|
||||
enddo
|
||||
! computes the polynom part
|
||||
pol_usual = 0.d0
|
||||
pol_usual(1) = dr(2)**dble(power_ao(2)) * dr(3)**dble(power_ao(3))
|
||||
pol_usual(2) = dr(1)**dble(power_ao(1)) * dr(3)**dble(power_ao(3))
|
||||
pol_usual(3) = dr(1)**dble(power_ao(1)) * dr(2)**dble(power_ao(2))
|
||||
|
||||
xyz_grad_phi = 0.d0
|
||||
do m = 1, 3
|
||||
xyz_grad_phi(m) += accu(m,2) * pol_usual(m) * dr(m)**dble(power_ord_xyz_grad_transp(2,m,i_ao))
|
||||
xyz_grad_phi(m) += accu(m,3) * pol_usual(m) * dr(m)**dble(power_ord_xyz_grad_transp(3,m,i_ao))
|
||||
xyz_grad_phi(m) += accu(m,4) * pol_usual(m) * dr(m)**dble(power_ord_xyz_grad_transp(4,m,i_ao))
|
||||
if(power_ord_xyz_grad_transp(1,m,i_ao).lt.0)cycle
|
||||
xyz_grad_phi(m) += accu(m,1) * pol_usual(m) * dr(m)**dble(power_ord_xyz_grad_transp(1,m,i_ao))
|
||||
enddo
|
||||
end
|
||||
|
||||
subroutine grad_phi_ao(r,i_ao,grad_xyz_phi)
|
||||
implicit none
|
||||
integer, intent(in) :: i_ao
|
||||
double precision, intent(in) :: r(3)
|
||||
double precision, intent(out):: grad_xyz_phi(3) ! x * phi i, y * phi_i, z * phi_
|
||||
double precision :: center_ao(3),beta
|
||||
double precision :: accu(3,2),dr(3),r2,pol_usual(3)
|
||||
integer :: m,power_ao(3),num_ao,j_prim
|
||||
power_ao(1:3)= ao_power(i_ao,1:3)
|
||||
num_ao = ao_nucl(i_ao)
|
||||
center_ao(1:3) = nucl_coord(num_ao,1:3)
|
||||
dr(1) = (r(1) - center_ao(1))
|
||||
dr(2) = (r(2) - center_ao(2))
|
||||
dr(3) = (r(3) - center_ao(3))
|
||||
r2 = 0.d0
|
||||
do m = 1, 3
|
||||
r2 += dr(m)*dr(m)
|
||||
enddo
|
||||
! computes the gaussian part
|
||||
accu = 0.d0
|
||||
do j_prim =1,ao_prim_num(i_ao)
|
||||
beta = ao_expo_ordered_transp(j_prim,i_ao)
|
||||
if(dabs(beta*r2).gt.50.d0)cycle
|
||||
do m = 1, 3
|
||||
accu(m,1) += ao_coef_ord_grad_transp(1,m,j_prim,i_ao) * dexp(-beta*r2)
|
||||
accu(m,2) += ao_coef_ord_grad_transp(2,m,j_prim,i_ao) * dexp(-beta*r2)
|
||||
enddo
|
||||
enddo
|
||||
! computes the polynom part
|
||||
pol_usual = 0.d0
|
||||
pol_usual(1) = dr(2)**dble(power_ao(2)) * dr(3)**dble(power_ao(3))
|
||||
pol_usual(2) = dr(1)**dble(power_ao(1)) * dr(3)**dble(power_ao(3))
|
||||
pol_usual(3) = dr(1)**dble(power_ao(1)) * dr(2)**dble(power_ao(2))
|
||||
do m = 1, 3
|
||||
grad_xyz_phi(m) = accu(m,2) * pol_usual(m) * dr(m)**dble(power_ord_grad_transp(2,m,i_ao))
|
||||
if(power_ao(m)==0)cycle
|
||||
grad_xyz_phi(m) += accu(m,1) * pol_usual(m) * dr(m)**dble(power_ord_grad_transp(1,m,i_ao))
|
||||
enddo
|
||||
end
|
||||
|
||||
subroutine xyz_phi_ao(r,i_ao,xyz_phi)
|
||||
implicit none
|
||||
integer, intent(in) :: i_ao
|
||||
double precision, intent(in) :: r(3)
|
||||
double precision, intent(out):: xyz_phi(3) ! x * phi i, y * phi_i, z * phi_i
|
||||
double precision :: center_ao(3),beta
|
||||
double precision :: accu,dr(3),r2,pol_usual(3)
|
||||
integer :: m,power_ao(3),num_ao
|
||||
power_ao(1:3)= ao_power(i_ao,1:3)
|
||||
num_ao = ao_nucl(i_ao)
|
||||
center_ao(1:3) = nucl_coord(num_ao,1:3)
|
||||
dr(1) = (r(1) - center_ao(1))
|
||||
dr(2) = (r(2) - center_ao(2))
|
||||
dr(3) = (r(3) - center_ao(3))
|
||||
r2 = 0.d0
|
||||
do m = 1, 3
|
||||
r2 += dr(m)*dr(m)
|
||||
enddo
|
||||
! computes the gaussian part
|
||||
accu = 0.d0
|
||||
do m=1,ao_prim_num(i_ao)
|
||||
beta = ao_expo_ordered_transp(m,i_ao)
|
||||
if(dabs(beta*r2).gt.50.d0)cycle
|
||||
accu += ao_coef_normalized_ordered_transp(m,i_ao) * dexp(-beta*r2)
|
||||
enddo
|
||||
! computes the polynom part
|
||||
pol_usual = 0.d0
|
||||
pol_usual(1) = dr(2)**dble(power_ao(2)) * dr(3)**dble(power_ao(3))
|
||||
pol_usual(2) = dr(1)**dble(power_ao(1)) * dr(3)**dble(power_ao(3))
|
||||
pol_usual(3) = dr(1)**dble(power_ao(1)) * dr(2)**dble(power_ao(2))
|
||||
do m = 1, 3
|
||||
xyz_phi(m) = accu * pol_usual(m) * dr(m)**(dble(power_ao(m))) * ( coef_xyz_ao(1,m,i_ao) + coef_xyz_ao(2,m,i_ao) * dr(m) )
|
||||
enddo
|
||||
end
|
||||
|
||||
|
||||
subroutine test_pol_xyz
|
||||
implicit none
|
||||
integer :: ipoint,i,j,m,jpoint
|
||||
double precision :: r1(3),derf_mu_x
|
||||
double precision :: weight1,r12,xyz_phi(3),grad_phi(3),xyz_grad_phi(3)
|
||||
double precision, allocatable :: aos_array(:),aos_grad_array(:,:)
|
||||
double precision :: num_xyz_phi(3),num_grad_phi(3),num_xyz_grad_phi(3)
|
||||
double precision :: accu_xyz_phi(3),accu_grad_phi(3),accu_xyz_grad_phi(3)
|
||||
double precision :: meta_accu_xyz_phi(3),meta_accu_grad_phi(3),meta_accu_xyz_grad_phi(3)
|
||||
allocate(aos_array(ao_num),aos_grad_array(3,ao_num))
|
||||
meta_accu_xyz_phi = 0.d0
|
||||
meta_accu_grad_phi = 0.d0
|
||||
meta_accu_xyz_grad_phi= 0.d0
|
||||
do i = 1, ao_num
|
||||
accu_xyz_phi = 0.d0
|
||||
accu_grad_phi = 0.d0
|
||||
accu_xyz_grad_phi= 0.d0
|
||||
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r1(:) = final_grid_points(:,ipoint)
|
||||
weight1 = final_weight_at_r_vector(ipoint)
|
||||
call give_all_aos_and_grad_at_r(r1,aos_array,aos_grad_array)
|
||||
do m = 1, 3
|
||||
num_xyz_phi(m) = r1(m) * aos_array(i)
|
||||
num_grad_phi(m) = aos_grad_array(m,i)
|
||||
num_xyz_grad_phi(m) = r1(m) * aos_grad_array(m,i)
|
||||
enddo
|
||||
call xyz_phi_ao(r1,i,xyz_phi)
|
||||
call grad_phi_ao(r1,i,grad_phi)
|
||||
call xyz_grad_phi_ao(r1,i,xyz_grad_phi)
|
||||
do m = 1, 3
|
||||
accu_xyz_phi(m) += weight1 * dabs(num_xyz_phi(m) - xyz_phi(m) )
|
||||
accu_grad_phi(m) += weight1 * dabs(num_grad_phi(m) - grad_phi(m) )
|
||||
accu_xyz_grad_phi(m) += weight1 * dabs(num_xyz_grad_phi(m) - xyz_grad_phi(m))
|
||||
enddo
|
||||
enddo
|
||||
print*,''
|
||||
print*,''
|
||||
print*,'i,',i
|
||||
print*,''
|
||||
do m = 1, 3
|
||||
! print*, 'm, accu_xyz_phi(m) ' ,m, accu_xyz_phi(m)
|
||||
! print*, 'm, accu_grad_phi(m) ' ,m, accu_grad_phi(m)
|
||||
print*, 'm, accu_xyz_grad_phi' ,m, accu_xyz_grad_phi(m)
|
||||
enddo
|
||||
do m = 1, 3
|
||||
meta_accu_xyz_phi(m) += dabs(accu_xyz_phi(m))
|
||||
meta_accu_grad_phi(m) += dabs(accu_grad_phi(m))
|
||||
meta_accu_xyz_grad_phi(m) += dabs(accu_xyz_grad_phi(m))
|
||||
enddo
|
||||
enddo
|
||||
do m = 1, 3
|
||||
! print*, 'm, meta_accu_xyz_phi(m) ' ,m, meta_accu_xyz_phi(m)
|
||||
! print*, 'm, meta_accu_grad_phi(m) ' ,m, meta_accu_grad_phi(m)
|
||||
print*, 'm, meta_accu_xyz_grad_phi' ,m, meta_accu_xyz_grad_phi(m)
|
||||
enddo
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
subroutine test_ints_semi_bis
|
||||
implicit none
|
||||
integer :: ipoint,i,j,m
|
||||
double precision :: r1(3), aos_grad_array_r1(3, ao_num), aos_array_r1(ao_num)
|
||||
double precision :: C_center(3), weight1,mu_in,r12,derf_mu_x,dxyz_ints(3),NAI_pol_mult_erf_ao
|
||||
double precision :: ao_mat(ao_num,ao_num),ao_xmat(3,ao_num,ao_num),accu1, accu2(3)
|
||||
mu_in = 0.5d0
|
||||
C_center = 0.d0
|
||||
C_center(1) = 0.25d0
|
||||
C_center(3) = 1.12d0
|
||||
C_center(2) = -1.d0
|
||||
ao_mat = 0.d0
|
||||
ao_xmat = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r1(1) = final_grid_points(1,ipoint)
|
||||
r1(2) = final_grid_points(2,ipoint)
|
||||
r1(3) = final_grid_points(3,ipoint)
|
||||
call give_all_aos_and_grad_at_r(r1,aos_array_r1,aos_grad_array_r1)
|
||||
weight1 = final_weight_at_r_vector(ipoint)
|
||||
r12 = (r1(1) - C_center(1))**2.d0 + (r1(2) - C_center(2))**2.d0 + (r1(3) - C_center(3))**2.d0
|
||||
r12 = dsqrt(r12)
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
ao_mat(j,i) += aos_array_r1(i) * aos_array_r1(j) * weight1 * derf_mu_x(mu_in,r12)
|
||||
do m = 1, 3
|
||||
ao_xmat(m,j,i) += r1(m) * aos_array_r1(j) * aos_grad_array_r1(m,i) * weight1 * derf_mu_x(mu_in,r12)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
accu1 = 0.d0
|
||||
accu2 = 0.d0
|
||||
accu1relat = 0.d0
|
||||
accu2relat = 0.d0
|
||||
double precision :: accu1relat, accu2relat(3)
|
||||
double precision :: contrib(3)
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
call phi_j_erf_mu_r_xyz_dxyz_phi(i,j,mu_in, C_center, dxyz_ints)
|
||||
print*,''
|
||||
print*,'i,j',i,j
|
||||
print*,dxyz_ints(:)
|
||||
print*,ao_xmat(:,j,i)
|
||||
do m = 1, 3
|
||||
contrib(m) = dabs(ao_xmat(m,j,i) - dxyz_ints(m))
|
||||
accu2(m) += contrib(m)
|
||||
if(dabs(ao_xmat(m,j,i)).gt.1.d-10)then
|
||||
accu2relat(m) += dabs(ao_xmat(m,j,i) - dxyz_ints(m))/dabs(ao_xmat(m,j,i))
|
||||
endif
|
||||
enddo
|
||||
print*,contrib
|
||||
enddo
|
||||
print*,''
|
||||
enddo
|
||||
print*,'accu2relat = '
|
||||
print*, accu2relat /dble(ao_num * ao_num)
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
ao_basis
|
||||
pseudo
|
||||
cosgtos_ao_int
|
||||
|
|
|
@ -1,75 +1,99 @@
|
|||
BEGIN_PROVIDER [ double precision, ao_overlap,(ao_num,ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_overlap_x,(ao_num,ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_overlap_y,(ao_num,ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_overlap_z,(ao_num,ao_num) ]
|
||||
implicit none
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_overlap , (ao_num, ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_overlap_x, (ao_num, ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_overlap_y, (ao_num, ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_overlap_z, (ao_num, ao_num) ]
|
||||
|
||||
BEGIN_DOC
|
||||
! Overlap between atomic basis functions:
|
||||
!
|
||||
! :math:`\int \chi_i(r) \chi_j(r) dr`
|
||||
! Overlap between atomic basis functions:
|
||||
!
|
||||
! :math:`\int \chi_i(r) \chi_j(r) dr`
|
||||
END_DOC
|
||||
integer :: i,j,n,l
|
||||
double precision :: f
|
||||
integer :: dim1
|
||||
|
||||
implicit none
|
||||
integer :: i, j, n, l, dim1, power_A(3), power_B(3)
|
||||
double precision :: overlap, overlap_x, overlap_y, overlap_z
|
||||
double precision :: alpha, beta, c
|
||||
double precision :: A_center(3), B_center(3)
|
||||
integer :: power_A(3), power_B(3)
|
||||
ao_overlap = 0.d0
|
||||
|
||||
ao_overlap = 0.d0
|
||||
ao_overlap_x = 0.d0
|
||||
ao_overlap_y = 0.d0
|
||||
ao_overlap_z = 0.d0
|
||||
if (read_ao_integrals_overlap) then
|
||||
call ezfio_get_ao_one_e_ints_ao_integrals_overlap(ao_overlap(1:ao_num, 1:ao_num))
|
||||
print *, 'AO overlap integrals read from disk'
|
||||
|
||||
if(read_ao_integrals_overlap) then
|
||||
|
||||
call ezfio_get_ao_one_e_ints_ao_integrals_overlap(ao_overlap(1:ao_num, 1:ao_num))
|
||||
print *, 'AO overlap integrals read from disk'
|
||||
|
||||
else
|
||||
|
||||
dim1=100
|
||||
!$OMP PARALLEL DO SCHEDULE(GUIDED) &
|
||||
!$OMP DEFAULT(NONE) &
|
||||
!$OMP PRIVATE(A_center,B_center,power_A,power_B,&
|
||||
!$OMP overlap_x,overlap_y, overlap_z, overlap, &
|
||||
!$OMP alpha, beta,i,j,c) &
|
||||
!$OMP SHARED(nucl_coord,ao_power,ao_prim_num, &
|
||||
!$OMP ao_overlap_x,ao_overlap_y,ao_overlap_z,ao_overlap,ao_num,ao_coef_normalized_ordered_transp,ao_nucl, &
|
||||
!$OMP ao_expo_ordered_transp,dim1)
|
||||
do j=1,ao_num
|
||||
A_center(1) = nucl_coord( ao_nucl(j), 1 )
|
||||
A_center(2) = nucl_coord( ao_nucl(j), 2 )
|
||||
A_center(3) = nucl_coord( ao_nucl(j), 3 )
|
||||
power_A(1) = ao_power( j, 1 )
|
||||
power_A(2) = ao_power( j, 2 )
|
||||
power_A(3) = ao_power( j, 3 )
|
||||
do i= 1,ao_num
|
||||
B_center(1) = nucl_coord( ao_nucl(i), 1 )
|
||||
B_center(2) = nucl_coord( ao_nucl(i), 2 )
|
||||
B_center(3) = nucl_coord( ao_nucl(i), 3 )
|
||||
power_B(1) = ao_power( i, 1 )
|
||||
power_B(2) = ao_power( i, 2 )
|
||||
power_B(3) = ao_power( i, 3 )
|
||||
do n = 1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(n,j)
|
||||
do l = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(l,i)
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_x,overlap_y,overlap_z,overlap,dim1)
|
||||
c = ao_coef_normalized_ordered_transp(n,j) * ao_coef_normalized_ordered_transp(l,i)
|
||||
ao_overlap(i,j) += c * overlap
|
||||
if(isnan(ao_overlap(i,j)))then
|
||||
print*,'i,j',i,j
|
||||
print*,'l,n',l,n
|
||||
print*,'c,overlap',c,overlap
|
||||
print*,overlap_x,overlap_y,overlap_z
|
||||
stop
|
||||
endif
|
||||
ao_overlap_x(i,j) += c * overlap_x
|
||||
ao_overlap_y(i,j) += c * overlap_y
|
||||
ao_overlap_z(i,j) += c * overlap_z
|
||||
if(use_cosgtos) then
|
||||
!print*, ' use_cosgtos for ao_overlap ?', use_cosgtos
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
ao_overlap (i,j) = ao_overlap_cosgtos (i,j)
|
||||
ao_overlap_x(i,j) = ao_overlap_cosgtos_x(i,j)
|
||||
ao_overlap_y(i,j) = ao_overlap_cosgtos_y(i,j)
|
||||
ao_overlap_z(i,j) = ao_overlap_cosgtos_z(i,j)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
dim1=100
|
||||
!$OMP PARALLEL DO SCHEDULE(GUIDED) &
|
||||
!$OMP DEFAULT(NONE) &
|
||||
!$OMP PRIVATE(A_center,B_center,power_A,power_B,&
|
||||
!$OMP overlap_x,overlap_y, overlap_z, overlap, &
|
||||
!$OMP alpha, beta,i,j,c) &
|
||||
!$OMP SHARED(nucl_coord,ao_power,ao_prim_num, &
|
||||
!$OMP ao_overlap_x,ao_overlap_y,ao_overlap_z,ao_overlap,ao_num,ao_coef_normalized_ordered_transp,ao_nucl, &
|
||||
!$OMP ao_expo_ordered_transp,dim1)
|
||||
do j=1,ao_num
|
||||
A_center(1) = nucl_coord( ao_nucl(j), 1 )
|
||||
A_center(2) = nucl_coord( ao_nucl(j), 2 )
|
||||
A_center(3) = nucl_coord( ao_nucl(j), 3 )
|
||||
power_A(1) = ao_power( j, 1 )
|
||||
power_A(2) = ao_power( j, 2 )
|
||||
power_A(3) = ao_power( j, 3 )
|
||||
do i= 1,ao_num
|
||||
B_center(1) = nucl_coord( ao_nucl(i), 1 )
|
||||
B_center(2) = nucl_coord( ao_nucl(i), 2 )
|
||||
B_center(3) = nucl_coord( ao_nucl(i), 3 )
|
||||
power_B(1) = ao_power( i, 1 )
|
||||
power_B(2) = ao_power( i, 2 )
|
||||
power_B(3) = ao_power( i, 3 )
|
||||
do n = 1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(n,j)
|
||||
do l = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(l,i)
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_x,overlap_y,overlap_z,overlap,dim1)
|
||||
c = ao_coef_normalized_ordered_transp(n,j) * ao_coef_normalized_ordered_transp(l,i)
|
||||
ao_overlap(i,j) += c * overlap
|
||||
if(isnan(ao_overlap(i,j)))then
|
||||
print*,'i,j',i,j
|
||||
print*,'l,n',l,n
|
||||
print*,'c,overlap',c,overlap
|
||||
print*,overlap_x,overlap_y,overlap_z
|
||||
stop
|
||||
endif
|
||||
ao_overlap_x(i,j) += c * overlap_x
|
||||
ao_overlap_y(i,j) += c * overlap_y
|
||||
ao_overlap_z(i,j) += c * overlap_z
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END PARALLEL DO
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
if (write_ao_integrals_overlap) then
|
||||
call ezfio_set_ao_one_e_ints_ao_integrals_overlap(ao_overlap(1:ao_num, 1:ao_num))
|
||||
print *, 'AO overlap integrals written to disk'
|
||||
|
@ -77,6 +101,8 @@
|
|||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_overlap_imag, (ao_num, ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
|
@ -85,6 +111,8 @@ BEGIN_PROVIDER [ double precision, ao_overlap_imag, (ao_num, ao_num) ]
|
|||
ao_overlap_imag = 0.d0
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ complex*16, ao_overlap_complex, (ao_num, ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
|
@ -98,37 +126,39 @@ BEGIN_PROVIDER [ complex*16, ao_overlap_complex, (ao_num, ao_num) ]
|
|||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_overlap_abs, (ao_num, ao_num) ]
|
||||
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_overlap_abs,(ao_num,ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Overlap between absolute values of atomic basis functions:
|
||||
!
|
||||
! :math:`\int |\chi_i(r)| |\chi_j(r)| dr`
|
||||
! Overlap between absolute values of atomic basis functions:
|
||||
!
|
||||
! :math:`\int |\chi_i(r)| |\chi_j(r)| dr`
|
||||
END_DOC
|
||||
integer :: i,j,n,l
|
||||
double precision :: f
|
||||
integer :: dim1
|
||||
double precision :: overlap, overlap_x, overlap_y, overlap_z
|
||||
|
||||
implicit none
|
||||
integer :: i, j, n, l, dim1, power_A(3), power_B(3)
|
||||
double precision :: overlap_x, overlap_y, overlap_z
|
||||
double precision :: alpha, beta
|
||||
double precision :: A_center(3), B_center(3)
|
||||
integer :: power_A(3), power_B(3)
|
||||
double precision :: lower_exp_val, dx
|
||||
if (is_periodic) then
|
||||
do j=1,ao_num
|
||||
do i= 1,ao_num
|
||||
ao_overlap_abs(i,j)= cdabs(ao_overlap_complex(i,j))
|
||||
|
||||
if(is_periodic) then
|
||||
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
ao_overlap_abs(i,j) = cdabs(ao_overlap_complex(i,j))
|
||||
enddo
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
dim1=100
|
||||
lower_exp_val = 40.d0
|
||||
!$OMP PARALLEL DO SCHEDULE(GUIDED) &
|
||||
!$OMP DEFAULT(NONE) &
|
||||
!$OMP PRIVATE(A_center,B_center,power_A,power_B, &
|
||||
!$OMP overlap_x,overlap_y, overlap_z, overlap, &
|
||||
!$OMP overlap_x,overlap_y, overlap_z, &
|
||||
!$OMP alpha, beta,i,j,dx) &
|
||||
!$OMP SHARED(nucl_coord,ao_power,ao_prim_num, &
|
||||
!$OMP ao_overlap_abs,ao_num,ao_coef_normalized_ordered_transp,ao_nucl,&
|
||||
|
@ -161,9 +191,13 @@ BEGIN_PROVIDER [ double precision, ao_overlap_abs,(ao_num,ao_num) ]
|
|||
enddo
|
||||
enddo
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, S_inv,(ao_num,ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
BEGIN_PROVIDER [ double precision, ao_deriv2_x,(ao_num,ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_deriv2_y,(ao_num,ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_deriv2_z,(ao_num,ao_num) ]
|
||||
implicit none
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_deriv2_x, (ao_num, ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_deriv2_y, (ao_num, ao_num) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_deriv2_z, (ao_num, ao_num) ]
|
||||
|
||||
BEGIN_DOC
|
||||
! Second derivative matrix elements in the |AO| basis.
|
||||
!
|
||||
|
@ -11,114 +14,131 @@
|
|||
! \langle \chi_i(x,y,z) | \frac{\partial^2}{\partial x^2} |\chi_j (x,y,z) \rangle
|
||||
!
|
||||
END_DOC
|
||||
integer :: i,j,n,l
|
||||
double precision :: f
|
||||
integer :: dim1
|
||||
|
||||
implicit none
|
||||
integer :: i, j, n, l, dim1, power_A(3), power_B(3)
|
||||
double precision :: overlap, overlap_y, overlap_z
|
||||
double precision :: overlap_x0, overlap_y0, overlap_z0
|
||||
double precision :: alpha, beta, c
|
||||
double precision :: A_center(3), B_center(3)
|
||||
integer :: power_A(3), power_B(3)
|
||||
double precision :: d_a_2,d_2
|
||||
dim1=100
|
||||
|
||||
! -- Dummy call to provide everything
|
||||
A_center(:) = 0.d0
|
||||
B_center(:) = 1.d0
|
||||
alpha = 1.d0
|
||||
beta = .1d0
|
||||
power_A = 1
|
||||
power_B = 0
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_y,d_a_2,overlap_z,overlap,dim1)
|
||||
! --
|
||||
if(use_cosgtos) then
|
||||
!print*, 'use_cosgtos for ao_kinetic_integrals ?', use_cosgtos
|
||||
|
||||
!$OMP PARALLEL DO SCHEDULE(GUIDED) &
|
||||
!$OMP DEFAULT(NONE) &
|
||||
!$OMP PRIVATE(A_center,B_center,power_A,power_B,&
|
||||
!$OMP overlap_y, overlap_z, overlap, &
|
||||
!$OMP alpha, beta,i,j,c,d_a_2,d_2,deriv_tmp, &
|
||||
!$OMP overlap_x0,overlap_y0,overlap_z0) &
|
||||
!$OMP SHARED(nucl_coord,ao_power,ao_prim_num, &
|
||||
!$OMP ao_deriv2_x,ao_deriv2_y,ao_deriv2_z,ao_num,ao_coef_normalized_ordered_transp,ao_nucl, &
|
||||
!$OMP ao_expo_ordered_transp,dim1)
|
||||
do j=1,ao_num
|
||||
A_center(1) = nucl_coord( ao_nucl(j), 1 )
|
||||
A_center(2) = nucl_coord( ao_nucl(j), 2 )
|
||||
A_center(3) = nucl_coord( ao_nucl(j), 3 )
|
||||
power_A(1) = ao_power( j, 1 )
|
||||
power_A(2) = ao_power( j, 2 )
|
||||
power_A(3) = ao_power( j, 3 )
|
||||
do i= 1,ao_num
|
||||
ao_deriv2_x(i,j)= 0.d0
|
||||
ao_deriv2_y(i,j)= 0.d0
|
||||
ao_deriv2_z(i,j)= 0.d0
|
||||
B_center(1) = nucl_coord( ao_nucl(i), 1 )
|
||||
B_center(2) = nucl_coord( ao_nucl(i), 2 )
|
||||
B_center(3) = nucl_coord( ao_nucl(i), 3 )
|
||||
power_B(1) = ao_power( i, 1 )
|
||||
power_B(2) = ao_power( i, 2 )
|
||||
power_B(3) = ao_power( i, 3 )
|
||||
do n = 1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(n,j)
|
||||
do l = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(l,i)
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_x0,overlap_y0,overlap_z0,overlap,dim1)
|
||||
c = ao_coef_normalized_ordered_transp(n,j) * ao_coef_normalized_ordered_transp(l,i)
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
ao_deriv2_x(i,j) = ao_deriv2_cosgtos_x(i,j)
|
||||
ao_deriv2_y(i,j) = ao_deriv2_cosgtos_y(i,j)
|
||||
ao_deriv2_z(i,j) = ao_deriv2_cosgtos_z(i,j)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
power_A(1) = power_A(1)-2
|
||||
if (power_A(1)>-1) then
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,d_a_2,overlap_y,overlap_z,overlap,dim1)
|
||||
else
|
||||
d_a_2 = 0.d0
|
||||
endif
|
||||
power_A(1) = power_A(1)+4
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,d_2,overlap_y,overlap_z,overlap,dim1)
|
||||
power_A(1) = power_A(1)-2
|
||||
else
|
||||
|
||||
double precision :: deriv_tmp
|
||||
deriv_tmp = (-2.d0 * alpha * (2.d0 * power_A(1) +1.d0) * overlap_x0 &
|
||||
+power_A(1) * (power_A(1)-1.d0) * d_a_2 &
|
||||
+4.d0 * alpha * alpha * d_2 )*overlap_y0*overlap_z0
|
||||
dim1=100
|
||||
|
||||
ao_deriv2_x(i,j) += c*deriv_tmp
|
||||
power_A(2) = power_A(2)-2
|
||||
if (power_A(2)>-1) then
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_y,d_a_2,overlap_z,overlap,dim1)
|
||||
else
|
||||
d_a_2 = 0.d0
|
||||
endif
|
||||
power_A(2) = power_A(2)+4
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_y,d_2,overlap_z,overlap,dim1)
|
||||
power_A(2) = power_A(2)-2
|
||||
! -- Dummy call to provide everything
|
||||
A_center(:) = 0.d0
|
||||
B_center(:) = 1.d0
|
||||
alpha = 1.d0
|
||||
beta = .1d0
|
||||
power_A = 1
|
||||
power_B = 0
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_y,d_a_2,overlap_z,overlap,dim1)
|
||||
! --
|
||||
|
||||
deriv_tmp = (-2.d0 * alpha * (2.d0 * power_A(2) +1.d0 ) * overlap_y0 &
|
||||
+power_A(2) * (power_A(2)-1.d0) * d_a_2 &
|
||||
+4.d0 * alpha * alpha * d_2 )*overlap_x0*overlap_z0
|
||||
ao_deriv2_y(i,j) += c*deriv_tmp
|
||||
!$OMP PARALLEL DO SCHEDULE(GUIDED) &
|
||||
!$OMP DEFAULT(NONE) &
|
||||
!$OMP PRIVATE(A_center,B_center,power_A,power_B,&
|
||||
!$OMP overlap_y, overlap_z, overlap, &
|
||||
!$OMP alpha, beta,i,j,c,d_a_2,d_2,deriv_tmp, &
|
||||
!$OMP overlap_x0,overlap_y0,overlap_z0) &
|
||||
!$OMP SHARED(nucl_coord,ao_power,ao_prim_num, &
|
||||
!$OMP ao_deriv2_x,ao_deriv2_y,ao_deriv2_z,ao_num,ao_coef_normalized_ordered_transp,ao_nucl, &
|
||||
!$OMP ao_expo_ordered_transp,dim1)
|
||||
do j=1,ao_num
|
||||
A_center(1) = nucl_coord( ao_nucl(j), 1 )
|
||||
A_center(2) = nucl_coord( ao_nucl(j), 2 )
|
||||
A_center(3) = nucl_coord( ao_nucl(j), 3 )
|
||||
power_A(1) = ao_power( j, 1 )
|
||||
power_A(2) = ao_power( j, 2 )
|
||||
power_A(3) = ao_power( j, 3 )
|
||||
do i= 1,ao_num
|
||||
ao_deriv2_x(i,j)= 0.d0
|
||||
ao_deriv2_y(i,j)= 0.d0
|
||||
ao_deriv2_z(i,j)= 0.d0
|
||||
B_center(1) = nucl_coord( ao_nucl(i), 1 )
|
||||
B_center(2) = nucl_coord( ao_nucl(i), 2 )
|
||||
B_center(3) = nucl_coord( ao_nucl(i), 3 )
|
||||
power_B(1) = ao_power( i, 1 )
|
||||
power_B(2) = ao_power( i, 2 )
|
||||
power_B(3) = ao_power( i, 3 )
|
||||
do n = 1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(n,j)
|
||||
do l = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(l,i)
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_x0,overlap_y0,overlap_z0,overlap,dim1)
|
||||
c = ao_coef_normalized_ordered_transp(n,j) * ao_coef_normalized_ordered_transp(l,i)
|
||||
|
||||
power_A(3) = power_A(3)-2
|
||||
if (power_A(3)>-1) then
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_y,overlap_z,d_a_2,overlap,dim1)
|
||||
else
|
||||
d_a_2 = 0.d0
|
||||
endif
|
||||
power_A(3) = power_A(3)+4
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_y,overlap_z,d_2,overlap,dim1)
|
||||
power_A(3) = power_A(3)-2
|
||||
power_A(1) = power_A(1)-2
|
||||
if (power_A(1)>-1) then
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,d_a_2,overlap_y,overlap_z,overlap,dim1)
|
||||
else
|
||||
d_a_2 = 0.d0
|
||||
endif
|
||||
power_A(1) = power_A(1)+4
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,d_2,overlap_y,overlap_z,overlap,dim1)
|
||||
power_A(1) = power_A(1)-2
|
||||
|
||||
deriv_tmp = (-2.d0 * alpha * (2.d0 * power_A(3) +1.d0 ) * overlap_z0 &
|
||||
+power_A(3) * (power_A(3)-1.d0) * d_a_2 &
|
||||
+4.d0 * alpha * alpha * d_2 )*overlap_x0*overlap_y0
|
||||
ao_deriv2_z(i,j) += c*deriv_tmp
|
||||
double precision :: deriv_tmp
|
||||
deriv_tmp = (-2.d0 * alpha * (2.d0 * power_A(1) +1.d0) * overlap_x0 &
|
||||
+power_A(1) * (power_A(1)-1.d0) * d_a_2 &
|
||||
+4.d0 * alpha * alpha * d_2 )*overlap_y0*overlap_z0
|
||||
|
||||
ao_deriv2_x(i,j) += c*deriv_tmp
|
||||
power_A(2) = power_A(2)-2
|
||||
if (power_A(2)>-1) then
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_y,d_a_2,overlap_z,overlap,dim1)
|
||||
else
|
||||
d_a_2 = 0.d0
|
||||
endif
|
||||
power_A(2) = power_A(2)+4
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_y,d_2,overlap_z,overlap,dim1)
|
||||
power_A(2) = power_A(2)-2
|
||||
|
||||
deriv_tmp = (-2.d0 * alpha * (2.d0 * power_A(2) +1.d0 ) * overlap_y0 &
|
||||
+power_A(2) * (power_A(2)-1.d0) * d_a_2 &
|
||||
+4.d0 * alpha * alpha * d_2 )*overlap_x0*overlap_z0
|
||||
ao_deriv2_y(i,j) += c*deriv_tmp
|
||||
|
||||
power_A(3) = power_A(3)-2
|
||||
if (power_A(3)>-1) then
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_y,overlap_z,d_a_2,overlap,dim1)
|
||||
else
|
||||
d_a_2 = 0.d0
|
||||
endif
|
||||
power_A(3) = power_A(3)+4
|
||||
call overlap_gaussian_xyz(A_center,B_center,alpha,beta,power_A,power_B,overlap_y,overlap_z,d_2,overlap,dim1)
|
||||
power_A(3) = power_A(3)-2
|
||||
|
||||
deriv_tmp = (-2.d0 * alpha * (2.d0 * power_A(3) +1.d0 ) * overlap_z0 &
|
||||
+power_A(3) * (power_A(3)-1.d0) * d_a_2 &
|
||||
+4.d0 * alpha * alpha * d_2 )*overlap_x0*overlap_y0
|
||||
ao_deriv2_z(i,j) += c*deriv_tmp
|
||||
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END PARALLEL DO
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, ao_kinetic_integrals, (ao_num,ao_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
|
||||
! ---
|
||||
|
||||
subroutine give_all_erf_kl_ao(integrals_ao,mu_in,C_center)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
|
@ -15,142 +18,542 @@ subroutine give_all_erf_kl_ao(integrals_ao,mu_in,C_center)
|
|||
enddo
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
double precision function NAI_pol_mult_erf_ao(i_ao, j_ao, mu_in, C_center)
|
||||
|
||||
double precision function NAI_pol_mult_erf_ao(i_ao,j_ao,mu_in,C_center)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$.
|
||||
!
|
||||
END_DOC
|
||||
integer, intent(in) :: i_ao,j_ao
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: i_ao, j_ao
|
||||
double precision, intent(in) :: mu_in, C_center(3)
|
||||
integer :: i,j,num_A,num_B, power_A(3), power_B(3), n_pt_in
|
||||
double precision :: A_center(3), B_center(3),integral, alpha,beta
|
||||
|
||||
integer :: i, j, num_A, num_B, power_A(3), power_B(3), n_pt_in
|
||||
double precision :: A_center(3), B_center(3), integral, alpha, beta
|
||||
|
||||
double precision :: NAI_pol_mult_erf
|
||||
num_A = ao_nucl(i_ao)
|
||||
power_A(1:3)= ao_power(i_ao,1:3)
|
||||
|
||||
num_A = ao_nucl(i_ao)
|
||||
power_A(1:3) = ao_power(i_ao,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
num_B = ao_nucl(j_ao)
|
||||
power_B(1:3)= ao_power(j_ao,1:3)
|
||||
num_B = ao_nucl(j_ao)
|
||||
power_B(1:3) = ao_power(j_ao,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
NAI_pol_mult_erf_ao = 0.d0
|
||||
do i = 1, ao_prim_num(i_ao)
|
||||
alpha = ao_expo_ordered_transp(i,i_ao)
|
||||
do j = 1, ao_prim_num(j_ao)
|
||||
beta = ao_expo_ordered_transp(j,j_ao)
|
||||
integral = NAI_pol_mult_erf(A_center,B_center,power_A,power_B,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
NAI_pol_mult_erf_ao += integral * ao_coef_normalized_ordered_transp(j,j_ao)*ao_coef_normalized_ordered_transp(i,i_ao)
|
||||
|
||||
integral = NAI_pol_mult_erf(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in,mu_in)
|
||||
|
||||
NAI_pol_mult_erf_ao += integral * ao_coef_normalized_ordered_transp(j,j_ao) * ao_coef_normalized_ordered_transp(i,i_ao)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end
|
||||
end function NAI_pol_mult_erf_ao
|
||||
|
||||
! ---
|
||||
|
||||
double precision function NAI_pol_mult_erf_ao_with1s(i_ao, j_ao, beta, B_center, mu_in, C_center)
|
||||
|
||||
double precision function NAI_pol_mult_erf(A_center,B_center,power_A,power_B,alpha,beta,C_center,n_pt_in,mu_in)
|
||||
BEGIN_DOC
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
! \frac{\erf(\mu | r - R_C | )}{ | r - R_C | }$.
|
||||
! Computes the following integral :
|
||||
! $\int_{-\infty}^{infty} dr \chi_i(r) \chi_j(r) e^{-\beta (r - B_center)^2} \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in
|
||||
double precision,intent(in) :: C_center(3),A_center(3),B_center(3),alpha,beta,mu_in
|
||||
integer, intent(in) :: power_A(3),power_B(3)
|
||||
integer :: i,j,k,l,n_pt
|
||||
double precision :: P_center(3)
|
||||
integer, intent(in) :: i_ao, j_ao
|
||||
double precision, intent(in) :: beta, B_center(3)
|
||||
double precision, intent(in) :: mu_in, C_center(3)
|
||||
|
||||
integer :: i, j, power_A1(3), power_A2(3), n_pt_in
|
||||
double precision :: A1_center(3), A2_center(3), alpha1, alpha2, coef12, coef1, integral
|
||||
|
||||
double precision, external :: NAI_pol_mult_erf_with1s, NAI_pol_mult_erf_ao
|
||||
|
||||
ASSERT(beta .ge. 0.d0)
|
||||
if(beta .lt. 1d-10) then
|
||||
NAI_pol_mult_erf_ao_with1s = NAI_pol_mult_erf_ao(i_ao, j_ao, mu_in, C_center)
|
||||
return
|
||||
endif
|
||||
|
||||
power_A1(1:3) = ao_power(i_ao,1:3)
|
||||
power_A2(1:3) = ao_power(j_ao,1:3)
|
||||
|
||||
A1_center(1:3) = nucl_coord(ao_nucl(i_ao),1:3)
|
||||
A2_center(1:3) = nucl_coord(ao_nucl(j_ao),1:3)
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
NAI_pol_mult_erf_ao_with1s = 0.d0
|
||||
do i = 1, ao_prim_num(i_ao)
|
||||
alpha1 = ao_expo_ordered_transp (i,i_ao)
|
||||
coef1 = ao_coef_normalized_ordered_transp(i,i_ao)
|
||||
|
||||
do j = 1, ao_prim_num(j_ao)
|
||||
alpha2 = ao_expo_ordered_transp(j,j_ao)
|
||||
coef12 = coef1 * ao_coef_normalized_ordered_transp(j,j_ao)
|
||||
if(dabs(coef12) .lt. 1d-14) cycle
|
||||
|
||||
integral = NAI_pol_mult_erf_with1s( A1_center, A2_center, power_A1, power_A2, alpha1, alpha2 &
|
||||
, beta, B_center, C_center, n_pt_in, mu_in )
|
||||
|
||||
NAI_pol_mult_erf_ao_with1s += integral * coef12
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end function NAI_pol_mult_erf_ao_with1s
|
||||
|
||||
! ---
|
||||
|
||||
double precision function NAI_pol_mult_erf(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in, mu_in)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
! \frac{\erf(\mu |r - R_C |)}{| r - R_C |}$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
double precision :: d(0:n_pt_in),pouet,coeff,dist,const,pouet_2,factor
|
||||
double precision :: I_n_special_exact,integrate_bourrin,I_n_bibi
|
||||
double precision :: V_e_n,const_factor,dist_integral,tmp
|
||||
double precision :: accu,rint,p_inv,p,rho,p_inv_2
|
||||
integer :: n_pt_out,lmax
|
||||
include 'utils/constants.include.F'
|
||||
p = alpha + beta
|
||||
p_inv = 1.d0/p
|
||||
p_inv_2 = 0.5d0 * p_inv
|
||||
rho = alpha * beta * p_inv
|
||||
|
||||
dist = 0.d0
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in
|
||||
integer, intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: C_center(3), A_center(3), B_center(3), alpha, beta, mu_in
|
||||
|
||||
integer :: i, n_pt, n_pt_out
|
||||
double precision :: P_center(3)
|
||||
double precision :: d(0:n_pt_in), coeff, dist, const, factor
|
||||
double precision :: const_factor, dist_integral
|
||||
double precision :: accu, p_inv, p, rho, p_inv_2
|
||||
double precision :: p_new
|
||||
|
||||
double precision :: rint
|
||||
|
||||
p = alpha + beta
|
||||
p_inv = 1.d0 / p
|
||||
p_inv_2 = 0.5d0 * p_inv
|
||||
rho = alpha * beta * p_inv
|
||||
|
||||
dist = 0.d0
|
||||
dist_integral = 0.d0
|
||||
do i = 1, 3
|
||||
P_center(i) = (alpha * A_center(i) + beta * B_center(i)) * p_inv
|
||||
dist += (A_center(i) - B_center(i))*(A_center(i) - B_center(i))
|
||||
dist_integral += (P_center(i) - C_center(i))*(P_center(i) - C_center(i))
|
||||
P_center(i) = (alpha * A_center(i) + beta * B_center(i)) * p_inv
|
||||
dist += (A_center(i) - B_center(i)) * (A_center(i) - B_center(i))
|
||||
dist_integral += (P_center(i) - C_center(i)) * (P_center(i) - C_center(i))
|
||||
enddo
|
||||
const_factor = dist*rho
|
||||
if(const_factor > 80.d0)then
|
||||
const_factor = dist * rho
|
||||
if(const_factor > 80.d0) then
|
||||
NAI_pol_mult_erf = 0.d0
|
||||
return
|
||||
endif
|
||||
double precision :: p_new
|
||||
p_new = mu_in/dsqrt(p+ mu_in * mu_in)
|
||||
factor = dexp(-const_factor)
|
||||
coeff = dtwo_pi * factor * p_inv * p_new
|
||||
lmax = 20
|
||||
|
||||
! print*, "b"
|
||||
p_new = mu_in / dsqrt(p + mu_in * mu_in)
|
||||
factor = dexp(-const_factor)
|
||||
coeff = dtwo_pi * factor * p_inv * p_new
|
||||
|
||||
n_pt = 2 * ( (power_A(1) + power_B(1)) + (power_A(2) + power_B(2)) + (power_A(3) + power_B(3)) )
|
||||
const = p * dist_integral * p_new * p_new
|
||||
if(n_pt == 0) then
|
||||
NAI_pol_mult_erf = coeff * rint(0, const)
|
||||
return
|
||||
endif
|
||||
|
||||
do i = 0, n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
n_pt = 2 * ( (power_A(1) + power_B(1)) +(power_A(2) + power_B(2)) +(power_A(3) + power_B(3)) )
|
||||
const = p * dist_integral * p_new * p_new
|
||||
if (n_pt == 0) then
|
||||
pouet = rint(0,const)
|
||||
NAI_pol_mult_erf = coeff * pouet
|
||||
return
|
||||
endif
|
||||
|
||||
! call give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in)
|
||||
p_new = p_new * p_new
|
||||
call give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,beta,power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in,p,p_inv,p_inv_2,p_new,P_center)
|
||||
call give_polynomial_mult_center_one_e_erf_opt( A_center, B_center, power_A, power_B, C_center &
|
||||
, n_pt_in, d, n_pt_out, p_inv_2, p_new, P_center)
|
||||
|
||||
|
||||
if(n_pt_out<0)then
|
||||
if(n_pt_out < 0) then
|
||||
NAI_pol_mult_erf = 0.d0
|
||||
return
|
||||
endif
|
||||
accu = 0.d0
|
||||
|
||||
! sum of integrals of type : int {t,[0,1]} exp-(rho.(P-Q)^2 * t^2) * t^i
|
||||
do i =0 ,n_pt_out,2
|
||||
accu += d(i) * rint(i/2,const)
|
||||
accu = 0.d0
|
||||
do i = 0, n_pt_out, 2
|
||||
accu += d(i) * rint(i/2, const)
|
||||
enddo
|
||||
NAI_pol_mult_erf = accu * coeff
|
||||
|
||||
end function NAI_pol_mult_erf
|
||||
|
||||
! ---
|
||||
subroutine NAI_pol_mult_erf_v(A_center, B_center, power_A, power_B, alpha, beta, C_center, n_pt_in, mu_in, res_v, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dr (x-A_x)^a (x-B_x)^b \exp(-\alpha (x-A_x)^2 - \beta (x-B_x)^2 )
|
||||
! \frac{\erf(\mu |r - R_C |)}{| r - R_C |}$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in, n_points
|
||||
integer, intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: C_center(n_points,3), A_center(3), B_center(3), alpha, beta, mu_in
|
||||
double precision, intent(out) :: res_v(n_points)
|
||||
|
||||
integer :: i, n_pt, n_pt_out, ipoint
|
||||
double precision :: P_center(3)
|
||||
double precision :: d(0:n_pt_in), coeff, dist, const, factor
|
||||
double precision :: const_factor, dist_integral
|
||||
double precision :: accu, p_inv, p, rho, p_inv_2
|
||||
double precision :: p_new
|
||||
|
||||
double precision :: rint
|
||||
|
||||
p = alpha + beta
|
||||
p_inv = 1.d0 / p
|
||||
p_inv_2 = 0.5d0 * p_inv
|
||||
rho = alpha * beta * p_inv
|
||||
p_new = mu_in / dsqrt(p + mu_in * mu_in)
|
||||
|
||||
dist = 0.d0
|
||||
do i = 1, 3
|
||||
P_center(i) = (alpha * A_center(i) + beta * B_center(i)) * p_inv
|
||||
dist += (A_center(i) - B_center(i)) * (A_center(i) - B_center(i))
|
||||
enddo
|
||||
|
||||
do ipoint=1,n_points
|
||||
dist_integral = 0.d0
|
||||
do i = 1, 3
|
||||
dist_integral += (P_center(i) - C_center(ipoint,i)) * (P_center(i) - C_center(ipoint,i))
|
||||
enddo
|
||||
const_factor = dist * rho
|
||||
if(const_factor > 80.d0) then
|
||||
res_V(ipoint) = 0.d0
|
||||
cycle
|
||||
endif
|
||||
|
||||
factor = dexp(-const_factor)
|
||||
coeff = dtwo_pi * factor * p_inv * p_new
|
||||
|
||||
n_pt = 2 * ( power_A(1) + power_B(1) + power_A(2) + power_B(2) + power_A(3) + power_B(3) )
|
||||
const = p * dist_integral * p_new * p_new
|
||||
if(n_pt == 0) then
|
||||
res_v(ipoint) = coeff * rint(0, const)
|
||||
cycle
|
||||
endif
|
||||
|
||||
do i = 0, n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
p_new = p_new * p_new
|
||||
call give_polynomial_mult_center_one_e_erf_opt( A_center, B_center, power_A, power_B, C_center(ipoint,1:3)&
|
||||
, n_pt_in, d, n_pt_out, p_inv_2, p_new, P_center)
|
||||
|
||||
if(n_pt_out < 0) then
|
||||
res_v(ipoint) = 0.d0
|
||||
cycle
|
||||
endif
|
||||
|
||||
! sum of integrals of type : int {t,[0,1]} exp-(rho.(P-Q)^2 * t^2) * t^i
|
||||
accu = 0.d0
|
||||
do i = 0, n_pt_out, 2
|
||||
accu += d(i) * rint(i/2, const)
|
||||
enddo
|
||||
res_v(ipoint) = accu * coeff
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
double precision function NAI_pol_mult_erf_with1s( A1_center, A2_center, power_A1, power_A2, alpha1, alpha2 &
|
||||
, beta, B_center, C_center, n_pt_in, mu_in )
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math::
|
||||
!
|
||||
! \int dx (x - A1_x)^a_1 (x - B1_x)^a_2 \exp(-\alpha_1 (x - A1_x)^2 - \alpha_2 (x - A2_x)^2)
|
||||
! \int dy (y - A1_y)^b_1 (y - B1_y)^b_2 \exp(-\alpha_1 (y - A1_y)^2 - \alpha_2 (y - A2_y)^2)
|
||||
! \int dz (x - A1_z)^c_1 (z - B1_z)^c_2 \exp(-\alpha_1 (z - A1_z)^2 - \alpha_2 (z - A2_z)^2)
|
||||
! \exp(-\beta (r - B)^2)
|
||||
! \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in
|
||||
integer, intent(in) :: power_A1(3), power_A2(3)
|
||||
double precision, intent(in) :: C_center(3), A1_center(3), A2_center(3), B_center(3)
|
||||
double precision, intent(in) :: alpha1, alpha2, beta, mu_in
|
||||
|
||||
integer :: i, n_pt, n_pt_out
|
||||
double precision :: alpha12, alpha12_inv, alpha12_inv_2, rho12, A12_center(3), dist12, const_factor12
|
||||
double precision :: p, p_inv, p_inv_2, rho, P_center(3), dist, const_factor
|
||||
double precision :: dist_integral
|
||||
double precision :: d(0:n_pt_in), coeff, const, factor
|
||||
double precision :: accu
|
||||
double precision :: p_new
|
||||
|
||||
double precision :: rint
|
||||
|
||||
|
||||
! e^{-alpha1 (r - A1)^2} e^{-alpha2 (r - A2)^2} = e^{-K12} e^{-alpha12 (r - A12)^2}
|
||||
alpha12 = alpha1 + alpha2
|
||||
alpha12_inv = 1.d0 / alpha12
|
||||
alpha12_inv_2 = 0.5d0 * alpha12_inv
|
||||
rho12 = alpha1 * alpha2 * alpha12_inv
|
||||
A12_center(1) = (alpha1 * A1_center(1) + alpha2 * A2_center(1)) * alpha12_inv
|
||||
A12_center(2) = (alpha1 * A1_center(2) + alpha2 * A2_center(2)) * alpha12_inv
|
||||
A12_center(3) = (alpha1 * A1_center(3) + alpha2 * A2_center(3)) * alpha12_inv
|
||||
dist12 = (A1_center(1) - A2_center(1)) * (A1_center(1) - A2_center(1)) &
|
||||
+ (A1_center(2) - A2_center(2)) * (A1_center(2) - A2_center(2)) &
|
||||
+ (A1_center(3) - A2_center(3)) * (A1_center(3) - A2_center(3))
|
||||
|
||||
const_factor12 = dist12 * rho12
|
||||
if(const_factor12 > 80.d0) then
|
||||
NAI_pol_mult_erf_with1s = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
! ---
|
||||
|
||||
! e^{-K12} e^{-alpha12 (r - A12)^2} e^{-beta (r - B)^2} = e^{-K} e^{-p (r - P)^2}
|
||||
p = alpha12 + beta
|
||||
p_inv = 1.d0 / p
|
||||
p_inv_2 = 0.5d0 * p_inv
|
||||
rho = alpha12 * beta * p_inv
|
||||
P_center(1) = (alpha12 * A12_center(1) + beta * B_center(1)) * p_inv
|
||||
P_center(2) = (alpha12 * A12_center(2) + beta * B_center(2)) * p_inv
|
||||
P_center(3) = (alpha12 * A12_center(3) + beta * B_center(3)) * p_inv
|
||||
dist = (A12_center(1) - B_center(1)) * (A12_center(1) - B_center(1)) &
|
||||
+ (A12_center(2) - B_center(2)) * (A12_center(2) - B_center(2)) &
|
||||
+ (A12_center(3) - B_center(3)) * (A12_center(3) - B_center(3))
|
||||
|
||||
const_factor = const_factor12 + dist * rho
|
||||
if(const_factor > 80.d0) then
|
||||
NAI_pol_mult_erf_with1s = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
dist_integral = (P_center(1) - C_center(1)) * (P_center(1) - C_center(1)) &
|
||||
+ (P_center(2) - C_center(2)) * (P_center(2) - C_center(2)) &
|
||||
+ (P_center(3) - C_center(3)) * (P_center(3) - C_center(3))
|
||||
|
||||
! ---
|
||||
|
||||
p_new = mu_in / dsqrt(p + mu_in * mu_in)
|
||||
factor = dexp(-const_factor)
|
||||
coeff = dtwo_pi * factor * p_inv * p_new
|
||||
|
||||
n_pt = 2 * ( (power_A1(1) + power_A2(1)) + (power_A1(2) + power_A2(2)) + (power_A1(3) + power_A2(3)) )
|
||||
const = p * dist_integral * p_new * p_new
|
||||
if(n_pt == 0) then
|
||||
NAI_pol_mult_erf_with1s = coeff * rint(0, const)
|
||||
return
|
||||
endif
|
||||
|
||||
do i = 0, n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
p_new = p_new * p_new
|
||||
|
||||
call give_polynomial_mult_center_one_e_erf_opt( A1_center, A2_center, power_A1, power_A2, C_center &
|
||||
, n_pt_in, d, n_pt_out, p_inv_2, p_new, P_center)
|
||||
|
||||
if(n_pt_out < 0) then
|
||||
NAI_pol_mult_erf_with1s = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
! sum of integrals of type : int {t,[0,1]} exp-(rho.(P-Q)^2 * t^2) * t^i
|
||||
accu = 0.d0
|
||||
do i = 0, n_pt_out, 2
|
||||
accu += d(i) * rint(i/2, const)
|
||||
enddo
|
||||
NAI_pol_mult_erf_with1s = accu * coeff
|
||||
|
||||
end function NAI_pol_mult_erf_with1s
|
||||
|
||||
!--
|
||||
|
||||
subroutine NAI_pol_mult_erf_with1s_v( A1_center, A2_center, power_A1, power_A2, alpha1, alpha2&
|
||||
, beta, B_center, C_center, n_pt_in, mu_in, res_v, n_points)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Computes the following integral :
|
||||
!
|
||||
! .. math ::
|
||||
!
|
||||
! \int dx (x - A1_x)^a_1 (x - B1_x)^a_2 \exp(-\alpha_1 (x - A1_x)^2 - \alpha_2 (x - A2_x)^2)
|
||||
! \int dy (y - A1_y)^b_1 (y - B1_y)^b_2 \exp(-\alpha_1 (y - A1_y)^2 - \alpha_2 (y - A2_y)^2)
|
||||
! \int dz (x - A1_z)^c_1 (z - B1_z)^c_2 \exp(-\alpha_1 (z - A1_z)^2 - \alpha_2 (z - A2_z)^2)
|
||||
! \exp(-\beta (r - B)^2)
|
||||
! \frac{\erf(\mu |r - R_C|)}{|r - R_C|}$.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in, n_points
|
||||
integer, intent(in) :: power_A1(3), power_A2(3)
|
||||
double precision, intent(in) :: C_center(n_points,3), A1_center(3), A2_center(3), B_center(n_points,3)
|
||||
double precision, intent(in) :: alpha1, alpha2, beta, mu_in
|
||||
double precision, intent(out) :: res_v(n_points)
|
||||
|
||||
integer :: i, n_pt, n_pt_out, ipoint
|
||||
double precision :: alpha12, alpha12_inv, alpha12_inv_2, rho12, A12_center(3), dist12, const_factor12
|
||||
double precision :: p, p_inv, p_inv_2, rho, P_center(3), dist, const_factor
|
||||
double precision :: dist_integral
|
||||
double precision :: d(0:n_pt_in), coeff, const, factor
|
||||
double precision :: accu
|
||||
double precision :: p_new, p_new2
|
||||
|
||||
double precision :: rint
|
||||
|
||||
|
||||
! e^{-alpha1 (r - A1)^2} e^{-alpha2 (r - A2)^2} = e^{-K12} e^{-alpha12 (r - A12)^2}
|
||||
alpha12 = alpha1 + alpha2
|
||||
alpha12_inv = 1.d0 / alpha12
|
||||
alpha12_inv_2 = 0.5d0 * alpha12_inv
|
||||
rho12 = alpha1 * alpha2 * alpha12_inv
|
||||
A12_center(1) = (alpha1 * A1_center(1) + alpha2 * A2_center(1)) * alpha12_inv
|
||||
A12_center(2) = (alpha1 * A1_center(2) + alpha2 * A2_center(2)) * alpha12_inv
|
||||
A12_center(3) = (alpha1 * A1_center(3) + alpha2 * A2_center(3)) * alpha12_inv
|
||||
dist12 = (A1_center(1) - A2_center(1)) * (A1_center(1) - A2_center(1))&
|
||||
+ (A1_center(2) - A2_center(2)) * (A1_center(2) - A2_center(2))&
|
||||
+ (A1_center(3) - A2_center(3)) * (A1_center(3) - A2_center(3))
|
||||
|
||||
const_factor12 = dist12 * rho12
|
||||
|
||||
if(const_factor12 > 80.d0) then
|
||||
res_v(:) = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
! ---
|
||||
|
||||
! e^{-K12} e^{-alpha12 (r - A12)^2} e^{-beta (r - B)^2} = e^{-K} e^{-p (r - P)^2}
|
||||
p = alpha12 + beta
|
||||
p_inv = 1.d0 / p
|
||||
p_inv_2 = 0.5d0 * p_inv
|
||||
rho = alpha12 * beta * p_inv
|
||||
p_new = mu_in / dsqrt(p + mu_in * mu_in)
|
||||
p_new2 = p_new * p_new
|
||||
n_pt = 2 * (power_A1(1) + power_A2(1) + power_A1(2) + power_A2(2) &
|
||||
+ power_A1(3) + power_A2(3) )
|
||||
|
||||
do ipoint=1,n_points
|
||||
|
||||
P_center(1) = (alpha12 * A12_center(1) + beta * B_center(ipoint,1)) * p_inv
|
||||
P_center(2) = (alpha12 * A12_center(2) + beta * B_center(ipoint,2)) * p_inv
|
||||
P_center(3) = (alpha12 * A12_center(3) + beta * B_center(ipoint,3)) * p_inv
|
||||
dist = (A12_center(1) - B_center(ipoint,1)) * (A12_center(1) - B_center(ipoint,1))&
|
||||
+ (A12_center(2) - B_center(ipoint,2)) * (A12_center(2) - B_center(ipoint,2))&
|
||||
+ (A12_center(3) - B_center(ipoint,3)) * (A12_center(3) - B_center(ipoint,3))
|
||||
|
||||
const_factor = const_factor12 + dist * rho
|
||||
if(const_factor > 80.d0) then
|
||||
res_v(ipoint) = 0.d0
|
||||
cycle
|
||||
endif
|
||||
|
||||
dist_integral = (P_center(1) - C_center(ipoint,1)) * (P_center(1) - C_center(ipoint,1))&
|
||||
+ (P_center(2) - C_center(ipoint,2)) * (P_center(2) - C_center(ipoint,2))&
|
||||
+ (P_center(3) - C_center(ipoint,3)) * (P_center(3) - C_center(ipoint,3))
|
||||
|
||||
! ---
|
||||
|
||||
factor = dexp(-const_factor)
|
||||
coeff = dtwo_pi * factor * p_inv * p_new
|
||||
|
||||
const = p * dist_integral * p_new2
|
||||
if(n_pt == 0) then
|
||||
res_v(ipoint) = coeff * rint(0, const)
|
||||
cycle
|
||||
endif
|
||||
|
||||
do i = 0, n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
|
||||
!TODO: VECTORIZE HERE
|
||||
call give_polynomial_mult_center_one_e_erf_opt( &
|
||||
A1_center, A2_center, power_A1, power_A2, C_center(ipoint,1:3)&
|
||||
, n_pt_in, d, n_pt_out, p_inv_2, p_new, P_center,1)
|
||||
|
||||
if(n_pt_out < 0) then
|
||||
res_v(ipoint) = 0.d0
|
||||
cycle
|
||||
endif
|
||||
|
||||
! sum of integrals of type : int {t,[0,1]} exp-(rho.(P-Q)^2 * t^2) * t^i
|
||||
accu = 0.d0
|
||||
do i = 0, n_pt_out, 2
|
||||
accu += d(i) * rint(i/2, const)
|
||||
enddo
|
||||
res_v(ipoint) = accu * coeff
|
||||
end do
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
! ---
|
||||
|
||||
subroutine give_polynomial_mult_center_one_e_erf_opt( A_center, B_center, power_A, power_B, C_center &
|
||||
, n_pt_in, d, n_pt_out, p_inv_2, p_new, P_center)
|
||||
|
||||
subroutine give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,beta,&
|
||||
power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in,p,p_inv,p_inv_2,p_new,P_center)
|
||||
BEGIN_DOC
|
||||
! Returns the explicit polynomial in terms of the $t$ variable of the
|
||||
! following polynomial:
|
||||
!
|
||||
! $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$.
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n_pt_in
|
||||
integer,intent(out) :: n_pt_out
|
||||
double precision, intent(in) :: A_center(3), B_center(3),C_center(3),p,p_inv,p_inv_2,p_new,P_center(3)
|
||||
double precision, intent(in) :: alpha,beta,mu_in
|
||||
integer, intent(in) :: power_A(3), power_B(3)
|
||||
integer :: a_x,b_x,a_y,b_y,a_z,b_z
|
||||
double precision :: d(0:n_pt_in)
|
||||
double precision :: d1(0:n_pt_in)
|
||||
double precision :: d2(0:n_pt_in)
|
||||
double precision :: d3(0:n_pt_in)
|
||||
double precision :: accu
|
||||
integer, intent(in) :: n_pt_in
|
||||
integer, intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: A_center(3), B_center(3), C_center(3), p_inv_2, p_new, P_center(3)
|
||||
integer, intent(out) :: n_pt_out
|
||||
double precision, intent(out) :: d(0:n_pt_in)
|
||||
|
||||
integer :: a_x, b_x, a_y, b_y, a_z, b_z
|
||||
integer :: n_pt1, n_pt2, n_pt3, dim, i
|
||||
integer :: n_pt_tmp
|
||||
double precision :: d1(0:n_pt_in)
|
||||
double precision :: d2(0:n_pt_in)
|
||||
double precision :: d3(0:n_pt_in)
|
||||
double precision :: accu
|
||||
double precision :: R1x(0:2), B01(0:2), R1xp(0:2), R2x(0:2)
|
||||
|
||||
accu = 0.d0
|
||||
ASSERT (n_pt_in > 1)
|
||||
|
||||
double precision :: R1x(0:2), B01(0:2), R1xp(0:2),R2x(0:2)
|
||||
R1x(0) = (P_center(1) - A_center(1))
|
||||
R1x(1) = 0.d0
|
||||
R1x(2) = -(P_center(1) - C_center(1))* p_new
|
||||
|
@ -161,27 +564,22 @@ subroutine give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,bet
|
|||
!R1xp = (P_x - B_x) - (P_x - C_x) ( t * mu/sqrt(p+mu^2) )^2
|
||||
R2x(0) = p_inv_2
|
||||
R2x(1) = 0.d0
|
||||
R2x(2) = -p_inv_2* p_new
|
||||
R2x(2) = -p_inv_2 * p_new
|
||||
!R2x = 0.5 / p - 0.5/p ( t * mu/sqrt(p+mu^2) )^2
|
||||
do i = 0,n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
do i = 0,n_pt_in
|
||||
|
||||
do i = 0, n_pt_in
|
||||
d (i) = 0.d0
|
||||
d1(i) = 0.d0
|
||||
enddo
|
||||
do i = 0,n_pt_in
|
||||
d2(i) = 0.d0
|
||||
enddo
|
||||
do i = 0,n_pt_in
|
||||
d3(i) = 0.d0
|
||||
enddo
|
||||
integer :: n_pt1,n_pt2,n_pt3,dim,i
|
||||
|
||||
n_pt1 = n_pt_in
|
||||
n_pt2 = n_pt_in
|
||||
n_pt3 = n_pt_in
|
||||
a_x = power_A(1)
|
||||
b_x = power_B(1)
|
||||
call I_x1_pol_mult_one_e(a_x,b_x,R1x,R1xp,R2x,d1,n_pt1,n_pt_in)
|
||||
call I_x1_pol_mult_one_e(a_x, b_x, R1x, R1xp, R2x, d1, n_pt1, n_pt_in)
|
||||
if(n_pt1<0)then
|
||||
n_pt_out = -1
|
||||
do i = 0,n_pt_in
|
||||
|
@ -200,7 +598,7 @@ subroutine give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,bet
|
|||
!R1xp = (P_x - B_x) - (P_x - C_x) ( t * mu/sqrt(p+mu^2) )^2
|
||||
a_y = power_A(2)
|
||||
b_y = power_B(2)
|
||||
call I_x1_pol_mult_one_e(a_y,b_y,R1x,R1xp,R2x,d2,n_pt2,n_pt_in)
|
||||
call I_x1_pol_mult_one_e(a_y, b_y, R1x, R1xp, R2x, d2, n_pt2, n_pt_in)
|
||||
if(n_pt2<0)then
|
||||
n_pt_out = -1
|
||||
do i = 0,n_pt_in
|
||||
|
@ -209,47 +607,47 @@ subroutine give_polynomial_mult_center_one_e_erf_opt(A_center,B_center,alpha,bet
|
|||
return
|
||||
endif
|
||||
|
||||
|
||||
R1x(0) = (P_center(3) - A_center(3))
|
||||
R1x(1) = 0.d0
|
||||
R1x(2) = -(P_center(3) - C_center(3))* p_new
|
||||
R1x(2) = -(P_center(3) - C_center(3)) * p_new
|
||||
! R1x = (P_x - A_x) - (P_x - C_x) ( t * mu/sqrt(p+mu^2) )^2
|
||||
R1xp(0) = (P_center(3) - B_center(3))
|
||||
R1xp(1) = 0.d0
|
||||
R1xp(2) =-(P_center(3) - C_center(3))* p_new
|
||||
R1xp(2) =-(P_center(3) - C_center(3)) * p_new
|
||||
!R2x = 0.5 / p - 0.5/p ( t * mu/sqrt(p+mu^2) )^2
|
||||
a_z = power_A(3)
|
||||
b_z = power_B(3)
|
||||
|
||||
call I_x1_pol_mult_one_e(a_z,b_z,R1x,R1xp,R2x,d3,n_pt3,n_pt_in)
|
||||
if(n_pt3<0)then
|
||||
call I_x1_pol_mult_one_e(a_z, b_z, R1x, R1xp, R2x, d3, n_pt3, n_pt_in)
|
||||
if(n_pt3 < 0) then
|
||||
n_pt_out = -1
|
||||
do i = 0,n_pt_in
|
||||
d(i) = 0.d0
|
||||
enddo
|
||||
return
|
||||
endif
|
||||
integer :: n_pt_tmp
|
||||
|
||||
n_pt_tmp = 0
|
||||
call multiply_poly(d1,n_pt1,d2,n_pt2,d,n_pt_tmp)
|
||||
do i = 0,n_pt_tmp
|
||||
call multiply_poly(d1, n_pt1, d2, n_pt2, d, n_pt_tmp)
|
||||
do i = 0, n_pt_tmp
|
||||
d1(i) = 0.d0
|
||||
enddo
|
||||
n_pt_out = 0
|
||||
call multiply_poly(d ,n_pt_tmp ,d3,n_pt3,d1,n_pt_out)
|
||||
call multiply_poly(d, n_pt_tmp, d3, n_pt3, d1, n_pt_out)
|
||||
do i = 0, n_pt_out
|
||||
d(i) = d1(i)
|
||||
enddo
|
||||
|
||||
end
|
||||
end subroutine give_polynomial_mult_center_one_e_erf_opt
|
||||
|
||||
! ---
|
||||
|
||||
|
||||
|
||||
subroutine give_polynomial_mult_center_one_e_erf(A_center,B_center,alpha,beta,&
|
||||
power_A,power_B,C_center,n_pt_in,d,n_pt_out,mu_in)
|
||||
BEGIN_DOC
|
||||
! Returns the explicit polynomial in terms of the $t$ variable of the
|
||||
! Returns the explicit polynomial in terms of the $t$ variable of the
|
||||
! following polynomial:
|
||||
!
|
||||
! $I_{x1}(a_x, d_x,p,q) \times I_{x1}(a_y, d_y,p,q) \times I_{x1}(a_z, d_z,p,q)$.
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_integrals_n_e, (ao_num,ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
! Nucleus-electron interaction, in the |AO| basis set.
|
||||
!
|
||||
|
@ -6,78 +10,98 @@ BEGIN_PROVIDER [ double precision, ao_integrals_n_e, (ao_num,ao_num)]
|
|||
!
|
||||
! These integrals also contain the pseudopotential integrals.
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
double precision :: alpha, beta, gama, delta
|
||||
integer :: num_A,num_B
|
||||
double precision :: A_center(3),B_center(3),C_center(3)
|
||||
integer :: power_A(3),power_B(3)
|
||||
integer :: i,j,k,l,n_pt_in,m
|
||||
double precision :: overlap_x,overlap_y,overlap_z,overlap,dx,NAI_pol_mult
|
||||
integer :: num_A, num_B, power_A(3), power_B(3)
|
||||
integer :: i, j, k, l, n_pt_in, m
|
||||
double precision :: alpha, beta
|
||||
double precision :: A_center(3),B_center(3),C_center(3)
|
||||
double precision :: overlap_x,overlap_y,overlap_z,overlap,dx,NAI_pol_mult
|
||||
|
||||
if (read_ao_integrals_n_e) then
|
||||
|
||||
call ezfio_get_ao_one_e_ints_ao_integrals_n_e(ao_integrals_n_e)
|
||||
print *, 'AO N-e integrals read from disk'
|
||||
|
||||
else
|
||||
|
||||
ao_integrals_n_e = 0.d0
|
||||
if(use_cosgtos) then
|
||||
!print *, " use_cosgtos for ao_integrals_n_e ?", use_cosgtos
|
||||
|
||||
! _
|
||||
! /| / |_)
|
||||
! | / | \
|
||||
!
|
||||
do j = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
ao_integrals_n_e(i,j) = ao_integrals_n_e_cosgtos(i,j)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,l,m,alpha,beta,A_center,B_center,C_center,power_A,power_B,&
|
||||
!$OMP num_A,num_B,Z,c,n_pt_in) &
|
||||
!$OMP SHARED (ao_num,ao_prim_num,ao_expo_ordered_transp,ao_power,ao_nucl,nucl_coord,ao_coef_normalized_ordered_transp,&
|
||||
!$OMP n_pt_max_integrals,ao_integrals_n_e,nucl_num,nucl_charge)
|
||||
else
|
||||
|
||||
n_pt_in = n_pt_max_integrals
|
||||
ao_integrals_n_e = 0.d0
|
||||
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,l,m,alpha,beta,A_center,B_center,C_center,power_A,power_B,&
|
||||
!$OMP num_A,num_B,Z,c,c1,n_pt_in) &
|
||||
!$OMP SHARED (ao_num,ao_prim_num,ao_expo_ordered_transp,ao_power,ao_nucl,nucl_coord,ao_coef_normalized_ordered_transp,&
|
||||
!$OMP n_pt_max_integrals,ao_integrals_n_e,nucl_num,nucl_charge)
|
||||
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3)= ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
n_pt_in = n_pt_max_integrals
|
||||
|
||||
do i = 1, ao_num
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3)= ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3)= ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do l=1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
do i = 1, ao_num
|
||||
|
||||
do m=1,ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3)= ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
double precision :: c
|
||||
c = 0.d0
|
||||
do l=1,ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do k = 1, nucl_num
|
||||
double precision :: Z
|
||||
Z = nucl_charge(k)
|
||||
do m=1,ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
C_center(1:3) = nucl_coord(k,1:3)
|
||||
double precision :: c, c1
|
||||
c = 0.d0
|
||||
|
||||
c = c - Z * NAI_pol_mult(A_center,B_center, &
|
||||
power_A,power_B,alpha,beta,C_center,n_pt_in)
|
||||
do k = 1, nucl_num
|
||||
double precision :: Z
|
||||
Z = nucl_charge(k)
|
||||
|
||||
C_center(1:3) = nucl_coord(k,1:3)
|
||||
|
||||
!print *, ' '
|
||||
!print *, A_center, B_center, C_center, power_A, power_B
|
||||
!print *, alpha, beta
|
||||
|
||||
c1 = NAI_pol_mult( A_center, B_center, power_A, power_B &
|
||||
, alpha, beta, C_center, n_pt_in )
|
||||
|
||||
!print *, ' c1 = ', c1
|
||||
|
||||
c = c - Z * c1
|
||||
|
||||
enddo
|
||||
ao_integrals_n_e(i,j) = ao_integrals_n_e(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
ao_integrals_n_e(i,j) = ao_integrals_n_e(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
IF (DO_PSEUDO) THEN
|
||||
|
||||
endif
|
||||
|
||||
|
||||
IF(do_pseudo) THEN
|
||||
ao_integrals_n_e += ao_pseudo_integrals
|
||||
ENDIF
|
||||
|
||||
|
@ -98,7 +122,7 @@ BEGIN_PROVIDER [ double precision, ao_integrals_n_e_imag, (ao_num,ao_num)]
|
|||
! :math:`\langle \chi_i | -\sum_A \frac{1}{|r-R_A|} | \chi_j \rangle`
|
||||
END_DOC
|
||||
implicit none
|
||||
double precision :: alpha, beta, gama, delta
|
||||
double precision :: alpha, beta
|
||||
integer :: num_A,num_B
|
||||
double precision :: A_center(3),B_center(3),C_center(3)
|
||||
integer :: power_A(3),power_B(3)
|
||||
|
@ -121,7 +145,7 @@ BEGIN_PROVIDER [ double precision, ao_integrals_n_e_per_atom, (ao_num,ao_num,nuc
|
|||
! :math:`\langle \chi_i | -\frac{1}{|r-R_A|} | \chi_j \rangle`
|
||||
END_DOC
|
||||
implicit none
|
||||
double precision :: alpha, beta, gama, delta
|
||||
double precision :: alpha, beta
|
||||
integer :: i_c,num_A,num_B
|
||||
double precision :: A_center(3),B_center(3),C_center(3)
|
||||
integer :: power_A(3),power_B(3)
|
||||
|
@ -264,6 +288,7 @@ double precision function NAI_pol_mult(A_center,B_center,power_A,power_B,alpha,b
|
|||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
subroutine give_polynomial_mult_center_one_e(A_center,B_center,alpha,beta,power_A,power_B,C_center,n_pt_in,d,n_pt_out)
|
||||
implicit none
|
||||
|
@ -575,61 +600,3 @@ double precision function V_r(n,alpha)
|
|||
end
|
||||
|
||||
|
||||
double precision function V_phi(n,m)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Computes the angular $\phi$ part of the nuclear attraction integral:
|
||||
!
|
||||
! $\int_{0}^{2 \pi} \cos(\phi)^n \sin(\phi)^m d\phi$.
|
||||
END_DOC
|
||||
integer :: n,m, i
|
||||
double precision :: prod, Wallis
|
||||
prod = 1.d0
|
||||
do i = 0,shiftr(n,1)-1
|
||||
prod = prod/ (1.d0 + dfloat(m+1)/dfloat(n-i-i-1))
|
||||
enddo
|
||||
V_phi = 4.d0 * prod * Wallis(m)
|
||||
end
|
||||
|
||||
|
||||
double precision function V_theta(n,m)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Computes the angular $\theta$ part of the nuclear attraction integral:
|
||||
!
|
||||
! $\int_{0}^{\pi} \cos(\theta)^n \sin(\theta)^m d\theta$
|
||||
END_DOC
|
||||
integer :: n,m,i
|
||||
double precision :: Wallis, prod
|
||||
include 'utils/constants.include.F'
|
||||
V_theta = 0.d0
|
||||
prod = 1.d0
|
||||
do i = 0,shiftr(n,1)-1
|
||||
prod = prod / (1.d0 + dfloat(m+1)/dfloat(n-i-i-1))
|
||||
enddo
|
||||
V_theta = (prod+prod) * Wallis(m)
|
||||
end
|
||||
|
||||
|
||||
double precision function Wallis(n)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Wallis integral:
|
||||
!
|
||||
! $\int_{0}^{\pi} \cos(\theta)^n d\theta$.
|
||||
END_DOC
|
||||
double precision :: fact
|
||||
integer :: n,p
|
||||
include 'utils/constants.include.F'
|
||||
if(iand(n,1).eq.0)then
|
||||
Wallis = fact(shiftr(n,1))
|
||||
Wallis = pi * fact(n) / (dble(ibset(0_8,n)) * (Wallis+Wallis)*Wallis)
|
||||
else
|
||||
p = shiftr(n,1)
|
||||
Wallis = fact(p)
|
||||
Wallis = dble(ibset(0_8,p+p)) * Wallis*Wallis / fact(p+p+1)
|
||||
endif
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ BEGIN_PROVIDER [ double precision, ao_pseudo_integrals, (ao_num,ao_num)]
|
|||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_pseudo_integrals_local, (ao_num,ao_num)]
|
||||
use omp_lib
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Local pseudo-potential
|
||||
|
@ -43,6 +42,7 @@ BEGIN_PROVIDER [ double precision, ao_pseudo_integrals_local, (ao_num,ao_num)]
|
|||
|
||||
double precision :: wall_1, wall_2, wall_0
|
||||
integer :: thread_num
|
||||
integer, external :: omp_get_thread_num
|
||||
double precision :: c
|
||||
double precision :: Z
|
||||
|
||||
|
@ -158,7 +158,6 @@ BEGIN_PROVIDER [ double precision, ao_pseudo_integrals_local, (ao_num,ao_num)]
|
|||
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_pseudo_integrals_non_local, (ao_num,ao_num)]
|
||||
use omp_lib
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Non-local pseudo-potential
|
||||
|
@ -170,6 +169,7 @@ BEGIN_PROVIDER [ double precision, ao_pseudo_integrals_local, (ao_num,ao_num)]
|
|||
integer :: power_A(3),power_B(3)
|
||||
integer :: i,j,k,l,m
|
||||
double precision :: Vloc, Vpseudo
|
||||
integer, external :: omp_get_thread_num
|
||||
|
||||
double precision :: wall_1, wall_2, wall_0
|
||||
integer :: thread_num
|
||||
|
|
|
@ -1095,9 +1095,9 @@ double precision function overlap_orb_ylm_grid(nptsgrid,r_orb,npower_orb,center_
|
|||
implicit none
|
||||
!! PSEUDOS
|
||||
integer nptsgridmax,nptsgrid
|
||||
double precision coefs_pseudo,ptsgrid
|
||||
parameter(nptsgridmax=50)
|
||||
common/pseudos/coefs_pseudo(nptsgridmax),ptsgrid(nptsgridmax,3)
|
||||
double precision coefs_pseudo(nptsgridmax),ptsgrid(nptsgridmax,3)
|
||||
common/pseudos/coefs_pseudo,ptsgrid
|
||||
!!!!!
|
||||
integer npower_orb(3),l,m,i
|
||||
double precision x,g_orb,two_pi,dx,dphi,term,orb_phi,ylm_real,sintheta,r_orb,phi,center_orb(3)
|
||||
|
@ -1235,10 +1235,10 @@ end
|
|||
subroutine initpseudos(nptsgrid)
|
||||
implicit none
|
||||
integer nptsgridmax,nptsgrid,ik
|
||||
double precision coefs_pseudo,ptsgrid
|
||||
double precision p,q,r,s
|
||||
parameter(nptsgridmax=50)
|
||||
common/pseudos/coefs_pseudo(nptsgridmax),ptsgrid(nptsgridmax,3)
|
||||
double precision coefs_pseudo(nptsgridmax),ptsgrid(nptsgridmax,3)
|
||||
common/pseudos/coefs_pseudo,ptsgrid
|
||||
|
||||
p=1.d0/dsqrt(2.d0)
|
||||
q=1.d0/dsqrt(3.d0)
|
||||
|
|
5
src/ao_tc_eff_map/NEED
Normal file
5
src/ao_tc_eff_map/NEED
Normal file
|
@ -0,0 +1,5 @@
|
|||
ao_two_e_erf_ints
|
||||
mo_one_e_ints
|
||||
ao_many_one_e_ints
|
||||
dft_utils_in_r
|
||||
tc_keywords
|
12
src/ao_tc_eff_map/README.rst
Normal file
12
src/ao_tc_eff_map/README.rst
Normal file
|
@ -0,0 +1,12 @@
|
|||
ao_tc_eff_map
|
||||
=============
|
||||
|
||||
This is a module to obtain the integrals on the AO basis of the SCALAR HERMITIAN
|
||||
effective potential defined in Eq. 32 of JCP 154, 084119 (2021)
|
||||
It also contains the modification by a one-body Jastrow factor.
|
||||
|
||||
The main routine/providers are
|
||||
|
||||
+) ao_tc_sym_two_e_pot_map : map of the SCALAR PART of total effective two-electron on the AO basis in PHYSICIST notations. It might contain the two-electron term coming from the one-e correlation factor.
|
||||
+) get_ao_tc_sym_two_e_pot(i,j,k,l,ao_tc_sym_two_e_pot_map) : routine to get the integrals from ao_tc_sym_two_e_pot_map.
|
||||
+) ao_tc_sym_two_e_pot(i,j,k,l) : FUNCTION that returns the scalar part of TC-potential EXCLUDING the erf(mu r12)/r12. See two_e_ints_gauss.irp.f for more details.
|
76
src/ao_tc_eff_map/compute_ints_eff_pot.irp.f
Normal file
76
src/ao_tc_eff_map/compute_ints_eff_pot.irp.f
Normal file
|
@ -0,0 +1,76 @@
|
|||
|
||||
|
||||
subroutine compute_ao_tc_sym_two_e_pot_jl(j, l, n_integrals, buffer_i, buffer_value)
|
||||
|
||||
use map_module
|
||||
|
||||
BEGIN_DOC
|
||||
! Parallel client for AO integrals
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: j, l
|
||||
integer,intent(out) :: n_integrals
|
||||
integer(key_kind),intent(out) :: buffer_i(ao_num*ao_num)
|
||||
real(integral_kind),intent(out) :: buffer_value(ao_num*ao_num)
|
||||
|
||||
integer :: i, k
|
||||
integer :: kk, m, j1, i1
|
||||
double precision :: cpu_1, cpu_2, wall_1, wall_2
|
||||
double precision :: integral, wall_0, integral_pot, integral_erf
|
||||
double precision :: thr
|
||||
|
||||
logical, external :: ao_two_e_integral_zero
|
||||
double precision :: ao_tc_sym_two_e_pot, ao_two_e_integral_erf
|
||||
double precision :: j1b_gauss_2e_j1, j1b_gauss_2e_j2
|
||||
|
||||
|
||||
PROVIDE j1b_type
|
||||
|
||||
thr = ao_integrals_threshold
|
||||
|
||||
n_integrals = 0
|
||||
|
||||
j1 = j+ishft(l*l-l,-1)
|
||||
do k = 1, ao_num ! r1
|
||||
i1 = ishft(k*k-k,-1)
|
||||
if (i1 > j1) then
|
||||
exit
|
||||
endif
|
||||
do i = 1, k
|
||||
i1 += 1
|
||||
if (i1 > j1) then
|
||||
exit
|
||||
endif
|
||||
|
||||
if (ao_two_e_integral_erf_schwartz(i,k)*ao_two_e_integral_erf_schwartz(j,l) < thr) then
|
||||
cycle
|
||||
endif
|
||||
|
||||
!DIR$ FORCEINLINE
|
||||
integral_pot = ao_tc_sym_two_e_pot (i, k, j, l) ! i,k : r1 j,l : r2
|
||||
integral_erf = ao_two_e_integral_erf(i, k, j, l)
|
||||
integral = integral_erf + integral_pot
|
||||
|
||||
if( j1b_type .eq. 1 ) then
|
||||
!print *, ' j1b type 1 is added'
|
||||
integral = integral + j1b_gauss_2e_j1(i, k, j, l)
|
||||
elseif( j1b_type .eq. 2 ) then
|
||||
!print *, ' j1b type 2 is added'
|
||||
integral = integral + j1b_gauss_2e_j2(i, k, j, l)
|
||||
endif
|
||||
|
||||
if(abs(integral) < thr) then
|
||||
cycle
|
||||
endif
|
||||
|
||||
n_integrals += 1
|
||||
!DIR$ FORCEINLINE
|
||||
call two_e_integrals_index(i, j, k, l, buffer_i(n_integrals))
|
||||
buffer_value(n_integrals) = integral
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end subroutine compute_ao_tc_sym_two_e_pot_jl
|
||||
|
188
src/ao_tc_eff_map/fit_j.irp.f
Normal file
188
src/ao_tc_eff_map/fit_j.irp.f
Normal file
|
@ -0,0 +1,188 @@
|
|||
BEGIN_PROVIDER [ double precision, expo_j_xmu, (n_fit_1_erf_x) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! F(x) = x * (1 - erf(x)) - 1/sqrt(pi) * exp(-x**2) is fitted with a gaussian and a Slater
|
||||
!
|
||||
! \approx - 1/sqrt(pi) * exp(-alpha * x ) exp(-beta * x**2)
|
||||
!
|
||||
! where alpha = expo_j_xmu(1) and beta = expo_j_xmu(2)
|
||||
END_DOC
|
||||
expo_j_xmu(1) = 1.7477d0
|
||||
expo_j_xmu(2) = 0.668662d0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_j_mu_x, (n_max_fit_slat)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_j_mu_x, (n_max_fit_slat)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! J(mu,r12) = 1/2 r12 * (1 - erf(mu*r12)) - 1/(2 sqrt(pi)*mu) exp(-(mu*r12)^2) is expressed as
|
||||
!
|
||||
! J(mu,r12) = 0.5/mu * F(r12*mu) where F(x) = x * (1 - erf(x)) - 1/sqrt(pi) * exp(-x**2)
|
||||
!
|
||||
! F(x) is fitted by - 1/sqrt(pi) * exp(-alpha * x) exp(-beta * x^2) (see expo_j_xmu)
|
||||
!
|
||||
! The slater function exp(-alpha * x) is fitted with n_max_fit_slat gaussians
|
||||
!
|
||||
! See Appendix 2 of JCP 154, 084119 (2021)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
double precision :: tmp
|
||||
double precision :: expos(n_max_fit_slat), alpha, beta
|
||||
|
||||
tmp = -0.5d0 / (mu_erf * sqrt(dacos(-1.d0)))
|
||||
|
||||
alpha = expo_j_xmu(1) * mu_erf
|
||||
call expo_fit_slater_gam(alpha, expos)
|
||||
beta = expo_j_xmu(2) * mu_erf * mu_erf
|
||||
|
||||
do i = 1, n_max_fit_slat
|
||||
expo_gauss_j_mu_x(i) = expos(i) + beta
|
||||
coef_gauss_j_mu_x(i) = tmp * coef_fit_slat_gauss(i)
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_j_mu_x_2, (n_max_fit_slat)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_j_mu_x_2, (n_max_fit_slat)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! J(mu,r12)^2 = 0.25/mu^2 F(r12*mu)^2
|
||||
!
|
||||
! F(x)^2 = 1 /pi * exp(-2 * alpha * x) exp(-2 * beta * x^2)
|
||||
!
|
||||
! The slater function exp(-2 * alpha * x) is fitted with n_max_fit_slat gaussians
|
||||
!
|
||||
! See Appendix 2 of JCP 154, 084119 (2021)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
double precision :: tmp
|
||||
double precision :: expos(n_max_fit_slat), alpha, beta
|
||||
double precision :: alpha_opt, beta_opt
|
||||
|
||||
!alpha_opt = 2.d0 * expo_j_xmu(1)
|
||||
!beta_opt = 2.d0 * expo_j_xmu(2)
|
||||
|
||||
! direct opt
|
||||
alpha_opt = 3.52751759d0
|
||||
beta_opt = 1.26214809d0
|
||||
|
||||
tmp = 0.25d0 / (mu_erf * mu_erf * dacos(-1.d0))
|
||||
|
||||
alpha = alpha_opt * mu_erf
|
||||
call expo_fit_slater_gam(alpha, expos)
|
||||
beta = beta_opt * mu_erf * mu_erf
|
||||
|
||||
do i = 1, n_max_fit_slat
|
||||
expo_gauss_j_mu_x_2(i) = expos(i) + beta
|
||||
coef_gauss_j_mu_x_2(i) = tmp * coef_fit_slat_gauss(i)
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_j_mu_1_erf, (n_max_fit_slat)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_j_mu_1_erf, (n_max_fit_slat)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! J(mu,r12) x \frac{1 - erf(mu * r12)}{2} =
|
||||
!
|
||||
! - \frac{1}{4 \sqrt{\pi} \mu} \exp(-(alpha1 + alpha2) * mu * r12 - (beta1 + beta2) * mu^2 * r12^2)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
double precision :: tmp
|
||||
double precision :: expos(n_max_fit_slat), alpha, beta
|
||||
double precision :: alpha_opt, beta_opt
|
||||
|
||||
!alpha_opt = expo_j_xmu(1) + expo_gauss_1_erf_x(1)
|
||||
!beta_opt = expo_j_xmu(2) + expo_gauss_1_erf_x(2)
|
||||
|
||||
! direct opt
|
||||
alpha_opt = 2.87875632d0
|
||||
beta_opt = 1.34801003d0
|
||||
|
||||
tmp = -0.25d0 / (mu_erf * dsqrt(dacos(-1.d0)))
|
||||
|
||||
alpha = alpha_opt * mu_erf
|
||||
call expo_fit_slater_gam(alpha, expos)
|
||||
beta = beta_opt * mu_erf * mu_erf
|
||||
|
||||
do i = 1, n_max_fit_slat
|
||||
expo_gauss_j_mu_1_erf(i) = expos(i) + beta
|
||||
coef_gauss_j_mu_1_erf(i) = tmp * coef_fit_slat_gauss(i)
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
double precision function F_x_j(x)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! F_x_j(x) = dimension-less correlation factor = x (1 - erf(x)) - 1/sqrt(pi) exp(-x^2)
|
||||
END_DOC
|
||||
double precision, intent(in) :: x
|
||||
F_x_j = x * (1.d0 - derf(x)) - 1/dsqrt(dacos(-1.d0)) * dexp(-x**2)
|
||||
|
||||
end
|
||||
|
||||
double precision function j_mu_F_x_j(x)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! j_mu_F_x_j(x) = correlation factor = 1/2 r12 * (1 - erf(mu*r12)) - 1/(2 sqrt(pi)*mu) exp(-(mu*r12)^2)
|
||||
!
|
||||
! = 1/(2*mu) * F_x_j(mu*x)
|
||||
END_DOC
|
||||
double precision :: F_x_j
|
||||
double precision, intent(in) :: x
|
||||
j_mu_F_x_j = 0.5d0/mu_erf * F_x_j(x*mu_erf)
|
||||
end
|
||||
|
||||
double precision function j_mu(x)
|
||||
implicit none
|
||||
double precision, intent(in) :: x
|
||||
BEGIN_DOC
|
||||
! j_mu(x) = correlation factor = 1/2 r12 * (1 - erf(mu*r12)) - 1/(2 sqrt(pi)*mu) exp(-(mu*r12)^2)
|
||||
END_DOC
|
||||
j_mu = 0.5d0* x * (1.d0 - derf(mu_erf*x)) - 0.5d0/( dsqrt(dacos(-1.d0))*mu_erf) * dexp(-(mu_erf*x)*(mu_erf*x))
|
||||
|
||||
end
|
||||
|
||||
double precision function j_mu_fit_gauss(x)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! j_mu_fit_gauss(x) = correlation factor = 1/2 r12 * (1 - erf(mu*r12)) - 1/(2 sqrt(pi)*mu) exp(-(mu*r12)^2)
|
||||
!
|
||||
! but fitted with gaussians
|
||||
END_DOC
|
||||
double precision, intent(in) :: x
|
||||
integer :: i
|
||||
double precision :: alpha,coef
|
||||
j_mu_fit_gauss = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
alpha = expo_gauss_j_mu_x(i)
|
||||
coef = coef_gauss_j_mu_x(i)
|
||||
j_mu_fit_gauss += coef * dexp(-alpha*x*x)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
194
src/ao_tc_eff_map/integrals_eff_pot_in_map_slave.irp.f
Normal file
194
src/ao_tc_eff_map/integrals_eff_pot_in_map_slave.irp.f
Normal file
|
@ -0,0 +1,194 @@
|
|||
subroutine ao_tc_sym_two_e_pot_in_map_slave_tcp(i)
|
||||
implicit none
|
||||
integer, intent(in) :: i
|
||||
BEGIN_DOC
|
||||
! Computes a buffer of integrals. i is the ID of the current thread.
|
||||
END_DOC
|
||||
call ao_tc_sym_two_e_pot_in_map_slave(0,i)
|
||||
end
|
||||
|
||||
|
||||
subroutine ao_tc_sym_two_e_pot_in_map_slave_inproc(i)
|
||||
implicit none
|
||||
integer, intent(in) :: i
|
||||
BEGIN_DOC
|
||||
! Computes a buffer of integrals. i is the ID of the current thread.
|
||||
END_DOC
|
||||
call ao_tc_sym_two_e_pot_in_map_slave(1,i)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
subroutine ao_tc_sym_two_e_pot_in_map_slave(thread,iproc)
|
||||
use map_module
|
||||
use f77_zmq
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Computes a buffer of integrals
|
||||
END_DOC
|
||||
|
||||
integer, intent(in) :: thread, iproc
|
||||
|
||||
integer :: j,l,n_integrals
|
||||
integer :: rc
|
||||
real(integral_kind), allocatable :: buffer_value(:)
|
||||
integer(key_kind), allocatable :: buffer_i(:)
|
||||
|
||||
integer :: worker_id, task_id
|
||||
character*(512) :: task
|
||||
|
||||
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
|
||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
||||
|
||||
integer(ZMQ_PTR), external :: new_zmq_push_socket
|
||||
integer(ZMQ_PTR) :: zmq_socket_push
|
||||
|
||||
character*(64) :: state
|
||||
|
||||
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
||||
|
||||
integer, external :: connect_to_taskserver
|
||||
if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then
|
||||
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
|
||||
return
|
||||
endif
|
||||
|
||||
zmq_socket_push = new_zmq_push_socket(thread)
|
||||
|
||||
allocate ( buffer_i(ao_num*ao_num), buffer_value(ao_num*ao_num) )
|
||||
|
||||
|
||||
do
|
||||
integer, external :: get_task_from_taskserver
|
||||
if (get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task) == -1) then
|
||||
exit
|
||||
endif
|
||||
if (task_id == 0) exit
|
||||
read(task,*) j, l
|
||||
integer, external :: task_done_to_taskserver
|
||||
call compute_ao_tc_sym_two_e_pot_jl(j,l,n_integrals,buffer_i,buffer_value)
|
||||
if (task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id) == -1) then
|
||||
stop 'Unable to send task_done'
|
||||
endif
|
||||
call push_integrals(zmq_socket_push, n_integrals, buffer_i, buffer_value, task_id)
|
||||
enddo
|
||||
|
||||
integer, external :: disconnect_from_taskserver
|
||||
if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) == -1) then
|
||||
continue
|
||||
endif
|
||||
deallocate( buffer_i, buffer_value )
|
||||
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
|
||||
call end_zmq_push_socket(zmq_socket_push,thread)
|
||||
|
||||
end
|
||||
|
||||
|
||||
subroutine ao_tc_sym_two_e_pot_in_map_collector(zmq_socket_pull)
|
||||
use map_module
|
||||
use f77_zmq
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Collects results from the AO integral calculation
|
||||
END_DOC
|
||||
|
||||
integer(ZMQ_PTR), intent(in) :: zmq_socket_pull
|
||||
integer :: j,l,n_integrals
|
||||
integer :: rc
|
||||
|
||||
real(integral_kind), allocatable :: buffer_value(:)
|
||||
integer(key_kind), allocatable :: buffer_i(:)
|
||||
|
||||
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
|
||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
|
||||
|
||||
integer(ZMQ_PTR), external :: new_zmq_pull_socket
|
||||
|
||||
integer*8 :: control, accu, sze
|
||||
integer :: task_id, more
|
||||
|
||||
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
||||
|
||||
sze = ao_num*ao_num
|
||||
allocate ( buffer_i(sze), buffer_value(sze) )
|
||||
|
||||
accu = 0_8
|
||||
more = 1
|
||||
do while (more == 1)
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, n_integrals, 4, 0)
|
||||
if (rc == -1) then
|
||||
n_integrals = 0
|
||||
return
|
||||
endif
|
||||
if (rc /= 4) then
|
||||
print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, n_integrals, 4, 0)'
|
||||
stop 'error'
|
||||
endif
|
||||
|
||||
if (n_integrals >= 0) then
|
||||
|
||||
if (n_integrals > sze) then
|
||||
deallocate (buffer_value, buffer_i)
|
||||
sze = n_integrals
|
||||
allocate (buffer_value(sze), buffer_i(sze))
|
||||
endif
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, buffer_i, key_kind*n_integrals, 0)
|
||||
if (rc /= key_kind*n_integrals) then
|
||||
print *, rc, key_kind, n_integrals
|
||||
print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, buffer_i, key_kind*n_integrals, 0)'
|
||||
stop 'error'
|
||||
endif
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, buffer_value, integral_kind*n_integrals, 0)
|
||||
if (rc /= integral_kind*n_integrals) then
|
||||
print *, irp_here, ': f77_zmq_recv( zmq_socket_pull, buffer_value, integral_kind*n_integrals, 0)'
|
||||
stop 'error'
|
||||
endif
|
||||
|
||||
rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0)
|
||||
|
||||
IRP_IF ZMQ_PUSH
|
||||
IRP_ELSE
|
||||
rc = f77_zmq_send( zmq_socket_pull, 0, 4, 0)
|
||||
if (rc /= 4) then
|
||||
print *, irp_here, ' : f77_zmq_send (zmq_socket_pull,...'
|
||||
stop 'error'
|
||||
endif
|
||||
IRP_ENDIF
|
||||
|
||||
|
||||
call insert_into_ao_tc_sym_two_e_pot_map(n_integrals,buffer_i,buffer_value)
|
||||
accu += n_integrals
|
||||
if (task_id /= 0) then
|
||||
integer, external :: zmq_delete_task
|
||||
if (zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id,more) == -1) then
|
||||
stop 'Unable to delete task'
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
enddo
|
||||
|
||||
deallocate( buffer_i, buffer_value )
|
||||
|
||||
integer (map_size_kind) :: get_ao_tc_sym_two_e_pot_map_size
|
||||
control = get_ao_tc_sym_two_e_pot_map_size(ao_tc_sym_two_e_pot_map)
|
||||
|
||||
if (control /= accu) then
|
||||
print *, ''
|
||||
print *, irp_here
|
||||
print *, 'Control : ', control
|
||||
print *, 'Accu : ', accu
|
||||
print *, 'Some integrals were lost during the parallel computation.'
|
||||
print *, 'Try to reduce the number of threads.'
|
||||
stop
|
||||
endif
|
||||
|
||||
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
|
||||
|
||||
end
|
||||
|
313
src/ao_tc_eff_map/map_integrals_eff_pot.irp.f
Normal file
313
src/ao_tc_eff_map/map_integrals_eff_pot.irp.f
Normal file
|
@ -0,0 +1,313 @@
|
|||
use map_module
|
||||
|
||||
!! AO Map
|
||||
!! ======
|
||||
|
||||
BEGIN_PROVIDER [ type(map_type), ao_tc_sym_two_e_pot_map ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! |AO| integrals
|
||||
END_DOC
|
||||
integer(key_kind) :: key_max
|
||||
integer(map_size_kind) :: sze
|
||||
call two_e_integrals_index(ao_num,ao_num,ao_num,ao_num,key_max)
|
||||
sze = key_max
|
||||
call map_init(ao_tc_sym_two_e_pot_map,sze)
|
||||
print*, 'ao_tc_sym_two_e_pot_map map initialized : ', sze
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ integer, ao_tc_sym_two_e_pot_cache_min ]
|
||||
&BEGIN_PROVIDER [ integer, ao_tc_sym_two_e_pot_cache_max ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Min and max values of the AOs for which the integrals are in the cache
|
||||
END_DOC
|
||||
ao_tc_sym_two_e_pot_cache_min = max(1,ao_num - 63)
|
||||
ao_tc_sym_two_e_pot_cache_max = ao_num
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_tc_sym_two_e_pot_cache, (0:64*64*64*64) ]
|
||||
|
||||
use map_module
|
||||
implicit none
|
||||
|
||||
BEGIN_DOC
|
||||
! Cache of |AO| integrals for fast access
|
||||
END_DOC
|
||||
|
||||
integer :: i,j,k,l,ii
|
||||
integer(key_kind) :: idx
|
||||
real(integral_kind) :: integral
|
||||
|
||||
PROVIDE ao_tc_sym_two_e_pot_in_map
|
||||
|
||||
!$OMP PARALLEL DO PRIVATE (i,j,k,l,idx,ii,integral)
|
||||
do l = ao_tc_sym_two_e_pot_cache_min, ao_tc_sym_two_e_pot_cache_max
|
||||
do k = ao_tc_sym_two_e_pot_cache_min, ao_tc_sym_two_e_pot_cache_max
|
||||
do j = ao_tc_sym_two_e_pot_cache_min, ao_tc_sym_two_e_pot_cache_max
|
||||
do i = ao_tc_sym_two_e_pot_cache_min, ao_tc_sym_two_e_pot_cache_max
|
||||
!DIR$ FORCEINLINE
|
||||
call two_e_integrals_index(i, j, k, l, idx)
|
||||
!DIR$ FORCEINLINE
|
||||
call map_get(ao_tc_sym_two_e_pot_map, idx, integral)
|
||||
ii = l-ao_tc_sym_two_e_pot_cache_min
|
||||
ii = ior( ishft(ii,6), k-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior( ishft(ii,6), j-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior( ishft(ii,6), i-ao_tc_sym_two_e_pot_cache_min)
|
||||
ao_tc_sym_two_e_pot_cache(ii) = integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
subroutine insert_into_ao_tc_sym_two_e_pot_map(n_integrals, buffer_i, buffer_values)
|
||||
|
||||
use map_module
|
||||
implicit none
|
||||
|
||||
BEGIN_DOC
|
||||
! Create new entry into |AO| map
|
||||
END_DOC
|
||||
|
||||
integer, intent(in) :: n_integrals
|
||||
integer(key_kind), intent(inout) :: buffer_i(n_integrals)
|
||||
real(integral_kind), intent(inout) :: buffer_values(n_integrals)
|
||||
|
||||
call map_append(ao_tc_sym_two_e_pot_map, buffer_i, buffer_values, n_integrals)
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
double precision function get_ao_tc_sym_two_e_pot(i, j, k, l, map) result(result)
|
||||
|
||||
use map_module
|
||||
|
||||
implicit none
|
||||
|
||||
BEGIN_DOC
|
||||
! Gets one |AO| two-electron integral from the |AO| map
|
||||
END_DOC
|
||||
|
||||
integer, intent(in) :: i,j,k,l
|
||||
integer(key_kind) :: idx
|
||||
type(map_type), intent(inout) :: map
|
||||
integer :: ii
|
||||
real(integral_kind) :: tmp
|
||||
logical, external :: ao_two_e_integral_zero
|
||||
|
||||
PROVIDE ao_tc_sym_two_e_pot_in_map ao_tc_sym_two_e_pot_cache ao_tc_sym_two_e_pot_cache_min
|
||||
|
||||
!DIR$ FORCEINLINE
|
||||
! if (ao_two_e_integral_zero(i,j,k,l)) then
|
||||
if (.False.) then
|
||||
tmp = 0.d0
|
||||
!else if (ao_two_e_integral_erf_schwartz(i,k)*ao_two_e_integral_erf_schwartz(j,l) < ao_integrals_threshold) then
|
||||
! tmp = 0.d0
|
||||
else
|
||||
ii = l-ao_tc_sym_two_e_pot_cache_min
|
||||
ii = ior(ii, k-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior(ii, j-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior(ii, i-ao_tc_sym_two_e_pot_cache_min)
|
||||
if (iand(ii, -64) /= 0) then
|
||||
!DIR$ FORCEINLINE
|
||||
call two_e_integrals_index(i, j, k, l, idx)
|
||||
!DIR$ FORCEINLINE
|
||||
call map_get(map, idx, tmp)
|
||||
tmp = tmp
|
||||
else
|
||||
ii = l-ao_tc_sym_two_e_pot_cache_min
|
||||
ii = ior( ishft(ii,6), k-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior( ishft(ii,6), j-ao_tc_sym_two_e_pot_cache_min)
|
||||
ii = ior( ishft(ii,6), i-ao_tc_sym_two_e_pot_cache_min)
|
||||
tmp = ao_tc_sym_two_e_pot_cache(ii)
|
||||
endif
|
||||
endif
|
||||
|
||||
result = tmp
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
subroutine get_many_ao_tc_sym_two_e_pot(j,k,l,sze,out_val)
|
||||
use map_module
|
||||
BEGIN_DOC
|
||||
! Gets multiple |AO| two-electron integral from the |AO| map .
|
||||
! All i are retrieved for j,k,l fixed.
|
||||
END_DOC
|
||||
implicit none
|
||||
integer, intent(in) :: j,k,l, sze
|
||||
real(integral_kind), intent(out) :: out_val(sze)
|
||||
|
||||
integer :: i
|
||||
integer(key_kind) :: hash
|
||||
double precision :: thresh
|
||||
! logical, external :: ao_one_e_integral_zero
|
||||
PROVIDE ao_tc_sym_two_e_pot_in_map ao_tc_sym_two_e_pot_map
|
||||
thresh = ao_integrals_threshold
|
||||
|
||||
! if (ao_one_e_integral_zero(j,l)) then
|
||||
if (.False.) then
|
||||
out_val = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
double precision :: get_ao_tc_sym_two_e_pot
|
||||
do i=1,sze
|
||||
out_val(i) = get_ao_tc_sym_two_e_pot(i,j,k,l,ao_tc_sym_two_e_pot_map)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
subroutine get_many_ao_tc_sym_two_e_pot_non_zero(j,k,l,sze,out_val,out_val_index,non_zero_int)
|
||||
use map_module
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Gets multiple |AO| two-electron integrals from the |AO| map .
|
||||
! All non-zero i are retrieved for j,k,l fixed.
|
||||
END_DOC
|
||||
integer, intent(in) :: j,k,l, sze
|
||||
real(integral_kind), intent(out) :: out_val(sze)
|
||||
integer, intent(out) :: out_val_index(sze),non_zero_int
|
||||
|
||||
integer :: i
|
||||
integer(key_kind) :: hash
|
||||
double precision :: thresh,tmp
|
||||
! logical, external :: ao_one_e_integral_zero
|
||||
PROVIDE ao_tc_sym_two_e_pot_in_map
|
||||
thresh = ao_integrals_threshold
|
||||
|
||||
non_zero_int = 0
|
||||
! if (ao_one_e_integral_zero(j,l)) then
|
||||
if (.False.) then
|
||||
out_val = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
non_zero_int = 0
|
||||
do i=1,sze
|
||||
integer, external :: ao_l4
|
||||
double precision, external :: ao_two_e_integral_eff_pot
|
||||
!DIR$ FORCEINLINE
|
||||
!if (ao_two_e_integral_erf_schwartz(i,k)*ao_two_e_integral_erf_schwartz(j,l) < thresh) then
|
||||
! cycle
|
||||
!endif
|
||||
call two_e_integrals_index(i,j,k,l,hash)
|
||||
call map_get(ao_tc_sym_two_e_pot_map, hash,tmp)
|
||||
if (dabs(tmp) < thresh ) cycle
|
||||
non_zero_int = non_zero_int+1
|
||||
out_val_index(non_zero_int) = i
|
||||
out_val(non_zero_int) = tmp
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
|
||||
function get_ao_tc_sym_two_e_pot_map_size()
|
||||
implicit none
|
||||
integer (map_size_kind) :: get_ao_tc_sym_two_e_pot_map_size
|
||||
BEGIN_DOC
|
||||
! Returns the number of elements in the |AO| map
|
||||
END_DOC
|
||||
get_ao_tc_sym_two_e_pot_map_size = ao_tc_sym_two_e_pot_map % n_elements
|
||||
end
|
||||
|
||||
subroutine clear_ao_tc_sym_two_e_pot_map
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Frees the memory of the |AO| map
|
||||
END_DOC
|
||||
call map_deinit(ao_tc_sym_two_e_pot_map)
|
||||
FREE ao_tc_sym_two_e_pot_map
|
||||
end
|
||||
|
||||
|
||||
|
||||
subroutine dump_ao_tc_sym_two_e_pot(filename)
|
||||
use map_module
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Save to disk the |AO| eff_pot integrals
|
||||
END_DOC
|
||||
character*(*), intent(in) :: filename
|
||||
integer(cache_key_kind), pointer :: key(:)
|
||||
real(integral_kind), pointer :: val(:)
|
||||
integer*8 :: i,j, n
|
||||
call ezfio_set_work_empty(.False.)
|
||||
open(unit=66,file=filename,FORM='unformatted')
|
||||
write(66) integral_kind, key_kind
|
||||
write(66) ao_tc_sym_two_e_pot_map%sorted, ao_tc_sym_two_e_pot_map%map_size, &
|
||||
ao_tc_sym_two_e_pot_map%n_elements
|
||||
do i=0_8,ao_tc_sym_two_e_pot_map%map_size
|
||||
write(66) ao_tc_sym_two_e_pot_map%map(i)%sorted, ao_tc_sym_two_e_pot_map%map(i)%map_size,&
|
||||
ao_tc_sym_two_e_pot_map%map(i)%n_elements
|
||||
enddo
|
||||
do i=0_8,ao_tc_sym_two_e_pot_map%map_size
|
||||
key => ao_tc_sym_two_e_pot_map%map(i)%key
|
||||
val => ao_tc_sym_two_e_pot_map%map(i)%value
|
||||
n = ao_tc_sym_two_e_pot_map%map(i)%n_elements
|
||||
write(66) (key(j), j=1,n), (val(j), j=1,n)
|
||||
enddo
|
||||
close(66)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
integer function load_ao_tc_sym_two_e_pot(filename)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Read from disk the |AO| eff_pot integrals
|
||||
END_DOC
|
||||
character*(*), intent(in) :: filename
|
||||
integer*8 :: i
|
||||
integer(cache_key_kind), pointer :: key(:)
|
||||
real(integral_kind), pointer :: val(:)
|
||||
integer :: iknd, kknd
|
||||
integer*8 :: n, j
|
||||
load_ao_tc_sym_two_e_pot = 1
|
||||
open(unit=66,file=filename,FORM='unformatted',STATUS='UNKNOWN')
|
||||
read(66,err=98,end=98) iknd, kknd
|
||||
if (iknd /= integral_kind) then
|
||||
print *, 'Wrong integrals kind in file :', iknd
|
||||
stop 1
|
||||
endif
|
||||
if (kknd /= key_kind) then
|
||||
print *, 'Wrong key kind in file :', kknd
|
||||
stop 1
|
||||
endif
|
||||
read(66,err=98,end=98) ao_tc_sym_two_e_pot_map%sorted, ao_tc_sym_two_e_pot_map%map_size,&
|
||||
ao_tc_sym_two_e_pot_map%n_elements
|
||||
do i=0_8, ao_tc_sym_two_e_pot_map%map_size
|
||||
read(66,err=99,end=99) ao_tc_sym_two_e_pot_map%map(i)%sorted, &
|
||||
ao_tc_sym_two_e_pot_map%map(i)%map_size, ao_tc_sym_two_e_pot_map%map(i)%n_elements
|
||||
call cache_map_reallocate(ao_tc_sym_two_e_pot_map%map(i),ao_tc_sym_two_e_pot_map%map(i)%map_size)
|
||||
enddo
|
||||
do i=0_8, ao_tc_sym_two_e_pot_map%map_size
|
||||
key => ao_tc_sym_two_e_pot_map%map(i)%key
|
||||
val => ao_tc_sym_two_e_pot_map%map(i)%value
|
||||
n = ao_tc_sym_two_e_pot_map%map(i)%n_elements
|
||||
read(66,err=99,end=99) (key(j), j=1,n), (val(j), j=1,n)
|
||||
enddo
|
||||
call map_sort(ao_tc_sym_two_e_pot_map)
|
||||
load_ao_tc_sym_two_e_pot = 0
|
||||
return
|
||||
99 continue
|
||||
call map_deinit(ao_tc_sym_two_e_pot_map)
|
||||
98 continue
|
||||
stop 'Problem reading ao_tc_sym_two_e_pot_map file in work/'
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
332
src/ao_tc_eff_map/one_e_1bgauss_grad2.irp.f
Normal file
332
src/ao_tc_eff_map/one_e_1bgauss_grad2.irp.f
Normal file
|
@ -0,0 +1,332 @@
|
|||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, j1b_gauss_hermII, (ao_num,ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! :math:`\langle \chi_A | -0.5 \grad \tau_{1b} \cdot \grad \tau_{1b} | \chi_B \rangle`
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: num_A, num_B
|
||||
integer :: power_A(3), power_B(3)
|
||||
integer :: i, j, k1, k2, l, m
|
||||
double precision :: alpha, beta, gama1, gama2, coef1, coef2
|
||||
double precision :: A_center(3), B_center(3), C_center1(3), C_center2(3)
|
||||
double precision :: c1, c
|
||||
|
||||
integer :: dim1
|
||||
double precision :: overlap_y, d_a_2, overlap_z, overlap
|
||||
|
||||
double precision :: int_gauss_4G
|
||||
|
||||
PROVIDE j1b_type j1b_pen j1b_coeff
|
||||
|
||||
! --------------------------------------------------------------------------------
|
||||
! -- Dummy call to provide everything
|
||||
dim1 = 100
|
||||
A_center(:) = 0.d0
|
||||
B_center(:) = 1.d0
|
||||
alpha = 1.d0
|
||||
beta = 0.1d0
|
||||
power_A(:) = 1
|
||||
power_B(:) = 0
|
||||
call overlap_gaussian_xyz( A_center, B_center, alpha, beta, power_A, power_B &
|
||||
, overlap_y, d_a_2, overlap_z, overlap, dim1 )
|
||||
! --------------------------------------------------------------------------------
|
||||
|
||||
|
||||
j1b_gauss_hermII(1:ao_num,1:ao_num) = 0.d0
|
||||
|
||||
if(j1b_type .eq. 1) then
|
||||
! \tau_1b = \sum_iA -[1 - exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k1, k2, l, m, alpha, beta, gama1, gama2, &
|
||||
!$OMP A_center, B_center, C_center1, C_center2, &
|
||||
!$OMP power_A, power_B, num_A, num_B, c1, c) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_hermII)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k1 = 1, nucl_num
|
||||
gama1 = j1b_pen(k1)
|
||||
C_center1(1:3) = nucl_coord(k1,1:3)
|
||||
|
||||
do k2 = 1, nucl_num
|
||||
gama2 = j1b_pen(k2)
|
||||
C_center2(1:3) = nucl_coord(k2,1:3)
|
||||
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] r_C1 \cdot r_C2 | XB >
|
||||
c1 = int_gauss_4G( A_center, B_center, C_center1, C_center2 &
|
||||
, power_A, power_B, alpha, beta, gama1, gama2 )
|
||||
|
||||
c = c - 2.d0 * gama1 * gama2 * c1
|
||||
enddo
|
||||
enddo
|
||||
|
||||
j1b_gauss_hermII(i,j) = j1b_gauss_hermII(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
elseif(j1b_type .eq. 2) then
|
||||
! \tau_1b = \sum_iA [c_A exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k1, k2, l, m, alpha, beta, gama1, gama2, &
|
||||
!$OMP A_center, B_center, C_center1, C_center2, &
|
||||
!$OMP power_A, power_B, num_A, num_B, c1, c, &
|
||||
!$OMP coef1, coef2) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_hermII, &
|
||||
!$OMP j1b_coeff)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k1 = 1, nucl_num
|
||||
gama1 = j1b_pen (k1)
|
||||
coef1 = j1b_coeff(k1)
|
||||
C_center1(1:3) = nucl_coord(k1,1:3)
|
||||
|
||||
do k2 = 1, nucl_num
|
||||
gama2 = j1b_pen (k2)
|
||||
coef2 = j1b_coeff(k2)
|
||||
C_center2(1:3) = nucl_coord(k2,1:3)
|
||||
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] r_C1 \cdot r_C2 | XB >
|
||||
c1 = int_gauss_4G( A_center, B_center, C_center1, C_center2 &
|
||||
, power_A, power_B, alpha, beta, gama1, gama2 )
|
||||
|
||||
c = c - 2.d0 * gama1 * gama2 * coef1 * coef2 * c1
|
||||
enddo
|
||||
enddo
|
||||
|
||||
j1b_gauss_hermII(i,j) = j1b_gauss_hermII(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
!_____________________________________________________________________________________________________________
|
||||
!
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] r_C1 \cdot r_C2 | XB >
|
||||
!
|
||||
double precision function int_gauss_4G( A_center, B_center, C_center1, C_center2, power_A, power_B &
|
||||
, alpha, beta, gama1, gama2 )
|
||||
|
||||
! for max_dim
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer , intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: A_center(3), B_center(3), C_center1(3), C_center2(3)
|
||||
double precision, intent(in) :: alpha, beta, gama1, gama2
|
||||
|
||||
integer :: i, dim1, power_C
|
||||
integer :: iorder(3)
|
||||
double precision :: AB_expo, fact_AB, AB_center(3), P_AB(0:max_dim,3)
|
||||
double precision :: gama, fact_C, C_center(3)
|
||||
double precision :: cx0, cy0, cz0, c_tmp1, c_tmp2, cx, cy, cz
|
||||
double precision :: int_tmp
|
||||
|
||||
double precision :: overlap_gaussian_x
|
||||
|
||||
dim1 = 100
|
||||
|
||||
! P_AB(0:max_dim,3) polynomial
|
||||
! AB_center(3) new center
|
||||
! AB_expo new exponent
|
||||
! fact_AB constant factor
|
||||
! iorder(3) i_order(i) = order of the polynomials
|
||||
call give_explicit_poly_and_gaussian( P_AB, AB_center, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_B, A_center, B_center, dim1)
|
||||
|
||||
call gaussian_product(gama1, C_center1, gama2, C_center2, fact_C, gama, C_center)
|
||||
|
||||
! <<<
|
||||
! to avoid multi-evaluation
|
||||
power_C = 0
|
||||
|
||||
cx0 = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx0 = cx0 + P_AB(i,1) * overlap_gaussian_x( AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cy0 = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy0 = cy0 + P_AB(i,2) * overlap_gaussian_x( AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cz0 = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz0 = cz0 + P_AB(i,3) * overlap_gaussian_x( AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
! >>>
|
||||
|
||||
int_tmp = 0.d0
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
!
|
||||
! x term:
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] (x - x_C1) (x - x_C2) | XB >
|
||||
!
|
||||
|
||||
c_tmp1 = 2.d0 * C_center(1) - C_center1(1) - C_center2(1)
|
||||
c_tmp2 = ( C_center(1) - C_center1(1) ) * ( C_center(1) - C_center2(1) )
|
||||
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (x - x_C)^2 | XB >
|
||||
power_C = 2
|
||||
cx = cx + P_AB(i,1) &
|
||||
* overlap_gaussian_x( AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (x - x_C) | XB >
|
||||
power_C = 1
|
||||
cx = cx + P_AB(i,1) * c_tmp1 &
|
||||
* overlap_gaussian_x( AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
power_C = 0
|
||||
cx = cx + P_AB(i,1) * c_tmp2 &
|
||||
* overlap_gaussian_x( AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
enddo
|
||||
|
||||
int_tmp += cx * cy0 * cz0
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
!
|
||||
! y term:
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] (y - y_C1) (y - y_C2) | XB >
|
||||
!
|
||||
|
||||
c_tmp1 = 2.d0 * C_center(2) - C_center1(2) - C_center2(2)
|
||||
c_tmp2 = ( C_center(2) - C_center1(2) ) * ( C_center(2) - C_center2(2) )
|
||||
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (y - y_C)^2 | XB >
|
||||
power_C = 2
|
||||
cy = cy + P_AB(i,2) &
|
||||
* overlap_gaussian_x( AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (y - y_C) | XB >
|
||||
power_C = 1
|
||||
cy = cy + P_AB(i,2) * c_tmp1 &
|
||||
* overlap_gaussian_x( AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
power_C = 0
|
||||
cy = cy + P_AB(i,2) * c_tmp2 &
|
||||
* overlap_gaussian_x( AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
enddo
|
||||
|
||||
int_tmp += cx0 * cy * cz0
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
!
|
||||
! z term:
|
||||
! < XA | exp[-gama1 r_C1^2 -gama2 r_C2^2] (z - z_C1) (z - z_C2) | XB >
|
||||
!
|
||||
|
||||
c_tmp1 = 2.d0 * C_center(3) - C_center1(3) - C_center2(3)
|
||||
c_tmp2 = ( C_center(3) - C_center1(3) ) * ( C_center(3) - C_center2(3) )
|
||||
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (z - z_C)^2 | XB >
|
||||
power_C = 2
|
||||
cz = cz + P_AB(i,3) &
|
||||
* overlap_gaussian_x( AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] (z - z_C) | XB >
|
||||
power_C = 1
|
||||
cz = cz + P_AB(i,3) * c_tmp1 &
|
||||
* overlap_gaussian_x( AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
power_C = 0
|
||||
cz = cz + P_AB(i,3) * c_tmp2 &
|
||||
* overlap_gaussian_x( AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
|
||||
enddo
|
||||
|
||||
int_tmp += cx0 * cy0 * cz
|
||||
|
||||
! -----------------------------------------------------------------------------------------------
|
||||
|
||||
int_gauss_4G = fact_AB * fact_C * int_tmp
|
||||
|
||||
return
|
||||
end function int_gauss_4G
|
||||
!_____________________________________________________________________________________________________________
|
||||
!_____________________________________________________________________________________________________________
|
||||
|
||||
|
303
src/ao_tc_eff_map/one_e_1bgauss_lap.irp.f
Normal file
303
src/ao_tc_eff_map/one_e_1bgauss_lap.irp.f
Normal file
|
@ -0,0 +1,303 @@
|
|||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, j1b_gauss_hermI, (ao_num,ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! :math:`\langle \chi_A | -0.5 \Delta \tau_{1b} | \chi_B \rangle`
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: num_A, num_B
|
||||
integer :: power_A(3), power_B(3)
|
||||
integer :: i, j, k, l, m
|
||||
double precision :: alpha, beta, gama, coef
|
||||
double precision :: A_center(3), B_center(3), C_center(3)
|
||||
double precision :: c1, c2, c
|
||||
|
||||
integer :: dim1
|
||||
double precision :: overlap_y, d_a_2, overlap_z, overlap
|
||||
|
||||
double precision :: int_gauss_r0, int_gauss_r2
|
||||
|
||||
PROVIDE j1b_type j1b_pen j1b_coeff
|
||||
|
||||
! --------------------------------------------------------------------------------
|
||||
! -- Dummy call to provide everything
|
||||
dim1 = 100
|
||||
A_center(:) = 0.d0
|
||||
B_center(:) = 1.d0
|
||||
alpha = 1.d0
|
||||
beta = 0.1d0
|
||||
power_A(:) = 1
|
||||
power_B(:) = 0
|
||||
call overlap_gaussian_xyz( A_center, B_center, alpha, beta, power_A, power_B &
|
||||
, overlap_y, d_a_2, overlap_z, overlap, dim1 )
|
||||
! --------------------------------------------------------------------------------
|
||||
|
||||
j1b_gauss_hermI(1:ao_num,1:ao_num) = 0.d0
|
||||
|
||||
if(j1b_type .eq. 1) then
|
||||
! \tau_1b = \sum_iA -[1 - exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l, m, alpha, beta, gama, &
|
||||
!$OMP A_center, B_center, C_center, power_A, power_B, &
|
||||
!$OMP num_A, num_B, c1, c2, c) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_hermI)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k = 1, nucl_num
|
||||
gama = j1b_pen(k)
|
||||
C_center(1:3) = nucl_coord(k,1:3)
|
||||
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
c1 = int_gauss_r0( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
! < XA | r_A^2 exp[-gama r_C^2] | XB >
|
||||
c2 = int_gauss_r2( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
c = c + 3.d0 * gama * c1 - 2.d0 * gama * gama * c2
|
||||
enddo
|
||||
|
||||
j1b_gauss_hermI(i,j) = j1b_gauss_hermI(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
elseif(j1b_type .eq. 2) then
|
||||
! \tau_1b = \sum_iA [c_A exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l, m, alpha, beta, gama, coef, &
|
||||
!$OMP A_center, B_center, C_center, power_A, power_B, &
|
||||
!$OMP num_A, num_B, c1, c2, c) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_hermI, &
|
||||
!$OMP j1b_coeff)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k = 1, nucl_num
|
||||
gama = j1b_pen (k)
|
||||
coef = j1b_coeff(k)
|
||||
C_center(1:3) = nucl_coord(k,1:3)
|
||||
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
c1 = int_gauss_r0( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
! < XA | r_A^2 exp[-gama r_C^2] | XB >
|
||||
c2 = int_gauss_r2( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
c = c + 3.d0 * gama * coef * c1 - 2.d0 * gama * gama * coef * c2
|
||||
enddo
|
||||
|
||||
j1b_gauss_hermI(i,j) = j1b_gauss_hermI(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
!_____________________________________________________________________________________________________________
|
||||
!
|
||||
! < XA | exp[-gama r_C^2] | XB >
|
||||
!
|
||||
double precision function int_gauss_r0(A_center, B_center, C_center, power_A, power_B, alpha, beta, gama)
|
||||
|
||||
! for max_dim
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer , intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: A_center(3), B_center(3), C_center(3)
|
||||
double precision, intent(in) :: alpha, beta, gama
|
||||
|
||||
integer :: i, power_C, dim1
|
||||
integer :: iorder(3)
|
||||
integer :: nmax
|
||||
double precision :: AB_expo, fact_AB, AB_center(3), P_AB(0:max_dim,3)
|
||||
double precision :: cx, cy, cz
|
||||
|
||||
double precision :: overlap_gaussian_x
|
||||
|
||||
dim1 = 100
|
||||
|
||||
! P_AB(0:max_dim,3) polynomial
|
||||
! AB_center(3) new center
|
||||
! AB_expo new exponent
|
||||
! fact_AB constant factor
|
||||
! iorder(3) i_order(i) = order of the polynomials
|
||||
call give_explicit_poly_and_gaussian( P_AB, AB_center, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_B, A_center, B_center, dim1)
|
||||
|
||||
if( fact_AB .lt. 1d-20 ) then
|
||||
int_gauss_r0 = 0.d0
|
||||
return
|
||||
endif
|
||||
|
||||
power_C = 0
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + P_AB(i,1) * overlap_gaussian_x(AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + P_AB(i,2) * overlap_gaussian_x(AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + P_AB(i,3) * overlap_gaussian_x(AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_r0 = fact_AB * cx * cy * cz
|
||||
|
||||
return
|
||||
end function int_gauss_r0
|
||||
!_____________________________________________________________________________________________________________
|
||||
!_____________________________________________________________________________________________________________
|
||||
|
||||
|
||||
|
||||
!_____________________________________________________________________________________________________________
|
||||
!
|
||||
! < XA | r_C^2 exp[-gama r_C^2] | XB >
|
||||
!
|
||||
double precision function int_gauss_r2(A_center, B_center, C_center, power_A, power_B, alpha, beta, gama)
|
||||
|
||||
! for max_dim
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: A_center(3), B_center(3), C_center(3)
|
||||
double precision, intent(in) :: alpha, beta, gama
|
||||
|
||||
integer :: i, power_C, dim1
|
||||
integer :: iorder(3)
|
||||
double precision :: AB_expo, fact_AB, AB_center(3), P_AB(0:max_dim,3)
|
||||
double precision :: cx0, cy0, cz0, cx, cy, cz
|
||||
double precision :: int_tmp
|
||||
|
||||
double precision :: overlap_gaussian_x
|
||||
|
||||
dim1 = 100
|
||||
|
||||
! P_AB(0:max_dim,3) polynomial centered on AB_center
|
||||
! AB_center(3) new center
|
||||
! AB_expo new exponent
|
||||
! fact_AB constant factor
|
||||
! iorder(3) i_order(i) = order of the polynomials
|
||||
call give_explicit_poly_and_gaussian( P_AB, AB_center, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_B, A_center, B_center, dim1)
|
||||
|
||||
! <<<
|
||||
! to avoid multi-evaluation
|
||||
power_C = 0
|
||||
|
||||
cx0 = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx0 = cx0 + P_AB(i,1) * overlap_gaussian_x(AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cy0 = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy0 = cy0 + P_AB(i,2) * overlap_gaussian_x(AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
cz0 = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz0 = cz0 + P_AB(i,3) * overlap_gaussian_x(AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
! >>>
|
||||
|
||||
int_tmp = 0.d0
|
||||
|
||||
power_C = 2
|
||||
|
||||
! ( x - XC)^2
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + P_AB(i,1) * overlap_gaussian_x(AB_center(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
int_tmp += cx * cy0 * cz0
|
||||
|
||||
! ( y - YC)^2
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + P_AB(i,2) * overlap_gaussian_x(AB_center(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
int_tmp += cx0 * cy * cz0
|
||||
|
||||
! ( z - ZC)^2
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + P_AB(i,3) * overlap_gaussian_x(AB_center(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
int_tmp += cx0 * cy0 * cz
|
||||
|
||||
int_gauss_r2 = fact_AB * int_tmp
|
||||
|
||||
return
|
||||
end function int_gauss_r2
|
||||
!_____________________________________________________________________________________________________________
|
||||
!_____________________________________________________________________________________________________________
|
||||
|
||||
|
371
src/ao_tc_eff_map/one_e_1bgauss_nonherm.irp.f
Normal file
371
src/ao_tc_eff_map/one_e_1bgauss_nonherm.irp.f
Normal file
|
@ -0,0 +1,371 @@
|
|||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, j1b_gauss_nonherm, (ao_num,ao_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! j1b_gauss_nonherm(i,j) = \langle \chi_j | - grad \tau_{1b} \cdot grad | \chi_i \rangle
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: num_A, num_B
|
||||
integer :: power_A(3), power_B(3)
|
||||
integer :: i, j, k, l, m
|
||||
double precision :: alpha, beta, gama, coef
|
||||
double precision :: A_center(3), B_center(3), C_center(3)
|
||||
double precision :: c1, c
|
||||
|
||||
integer :: dim1
|
||||
double precision :: overlap_y, d_a_2, overlap_z, overlap
|
||||
|
||||
double precision :: int_gauss_deriv
|
||||
|
||||
PROVIDE j1b_type j1b_pen j1b_coeff
|
||||
|
||||
! --------------------------------------------------------------------------------
|
||||
! -- Dummy call to provide everything
|
||||
dim1 = 100
|
||||
A_center(:) = 0.d0
|
||||
B_center(:) = 1.d0
|
||||
alpha = 1.d0
|
||||
beta = 0.1d0
|
||||
power_A(:) = 1
|
||||
power_B(:) = 0
|
||||
call overlap_gaussian_xyz( A_center, B_center, alpha, beta, power_A, power_B &
|
||||
, overlap_y, d_a_2, overlap_z, overlap, dim1 )
|
||||
! --------------------------------------------------------------------------------
|
||||
|
||||
|
||||
j1b_gauss_nonherm(1:ao_num,1:ao_num) = 0.d0
|
||||
|
||||
if(j1b_type .eq. 1) then
|
||||
! \tau_1b = \sum_iA -[1 - exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l, m, alpha, beta, gama, &
|
||||
!$OMP A_center, B_center, C_center, power_A, power_B, &
|
||||
!$OMP num_A, num_B, c1, c) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_nonherm)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k = 1, nucl_num
|
||||
gama = j1b_pen(k)
|
||||
C_center(1:3) = nucl_coord(k,1:3)
|
||||
|
||||
! \langle \chi_A | exp[-gama r_C^2] r_C \cdot grad | \chi_B \rangle
|
||||
c1 = int_gauss_deriv( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
c = c + 2.d0 * gama * c1
|
||||
enddo
|
||||
|
||||
j1b_gauss_nonherm(i,j) = j1b_gauss_nonherm(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
elseif(j1b_type .eq. 2) then
|
||||
! \tau_1b = \sum_iA [c_A exp(-alpha_A r_iA^2)]
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, k, l, m, alpha, beta, gama, coef, &
|
||||
!$OMP A_center, B_center, C_center, power_A, power_B, &
|
||||
!$OMP num_A, num_B, c1, c) &
|
||||
!$OMP SHARED (ao_num, ao_prim_num, ao_expo_ordered_transp, &
|
||||
!$OMP ao_power, ao_nucl, nucl_coord, &
|
||||
!$OMP ao_coef_normalized_ordered_transp, &
|
||||
!$OMP nucl_num, j1b_pen, j1b_gauss_nonherm, &
|
||||
!$OMP j1b_coeff)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do j = 1, ao_num
|
||||
num_A = ao_nucl(j)
|
||||
power_A(1:3) = ao_power(j,1:3)
|
||||
A_center(1:3) = nucl_coord(num_A,1:3)
|
||||
|
||||
do i = 1, ao_num
|
||||
num_B = ao_nucl(i)
|
||||
power_B(1:3) = ao_power(i,1:3)
|
||||
B_center(1:3) = nucl_coord(num_B,1:3)
|
||||
|
||||
do l = 1, ao_prim_num(j)
|
||||
alpha = ao_expo_ordered_transp(l,j)
|
||||
|
||||
do m = 1, ao_prim_num(i)
|
||||
beta = ao_expo_ordered_transp(m,i)
|
||||
|
||||
c = 0.d0
|
||||
do k = 1, nucl_num
|
||||
gama = j1b_pen (k)
|
||||
coef = j1b_coeff(k)
|
||||
C_center(1:3) = nucl_coord(k,1:3)
|
||||
|
||||
! \langle \chi_A | exp[-gama r_C^2] r_C \cdot grad | \chi_B \rangle
|
||||
c1 = int_gauss_deriv( A_center, B_center, C_center &
|
||||
, power_A, power_B, alpha, beta, gama )
|
||||
|
||||
c = c + 2.d0 * gama * coef * c1
|
||||
enddo
|
||||
|
||||
j1b_gauss_nonherm(i,j) = j1b_gauss_nonherm(i,j) &
|
||||
+ ao_coef_normalized_ordered_transp(l,j) &
|
||||
* ao_coef_normalized_ordered_transp(m,i) * c
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
!_____________________________________________________________________________________________________________
|
||||
!
|
||||
! < XA | exp[-gama r_C^2] r_C \cdot grad | XB >
|
||||
!
|
||||
double precision function int_gauss_deriv(A_center, B_center, C_center, power_A, power_B, alpha, beta, gama)
|
||||
|
||||
! for max_dim
|
||||
include 'constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
double precision, intent(in) :: A_center(3), B_center(3), C_center(3)
|
||||
integer , intent(in) :: power_A(3), power_B(3)
|
||||
double precision, intent(in) :: alpha, beta, gama
|
||||
|
||||
integer :: i, power_C, dim1
|
||||
integer :: iorder(3), power_D(3)
|
||||
double precision :: AB_expo
|
||||
double precision :: fact_AB, center_AB(3), pol_AB(0:max_dim,3)
|
||||
double precision :: cx, cy, cz
|
||||
|
||||
double precision :: overlap_gaussian_x
|
||||
|
||||
dim1 = 100
|
||||
|
||||
int_gauss_deriv = 0.d0
|
||||
|
||||
! ===============
|
||||
! term I:
|
||||
! \partial_x
|
||||
! ===============
|
||||
|
||||
if( power_B(1) .ge. 1 ) then
|
||||
|
||||
power_D(1) = power_B(1) - 1
|
||||
power_D(2) = power_B(2)
|
||||
power_D(3) = power_B(3)
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 1
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv + fact_AB * dble(power_B(1)) * cx * cy * cz
|
||||
endif
|
||||
|
||||
! ===============
|
||||
|
||||
power_D(1) = power_B(1) + 1
|
||||
power_D(2) = power_B(2)
|
||||
power_D(3) = power_B(3)
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 1
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv - 2.d0 * beta * fact_AB * cx * cy * cz
|
||||
|
||||
! ===============
|
||||
! ===============
|
||||
|
||||
|
||||
! ===============
|
||||
! term II:
|
||||
! \partial_y
|
||||
! ===============
|
||||
|
||||
if( power_B(2) .ge. 1 ) then
|
||||
|
||||
power_D(1) = power_B(1)
|
||||
power_D(2) = power_B(2) - 1
|
||||
power_D(3) = power_B(3)
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 0
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 1
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv + fact_AB * dble(power_B(2)) * cx * cy * cz
|
||||
endif
|
||||
|
||||
! ===============
|
||||
|
||||
power_D(1) = power_B(1)
|
||||
power_D(2) = power_B(2) + 1
|
||||
power_D(3) = power_B(3)
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 0
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 1
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv - 2.d0 * beta * fact_AB * cx * cy * cz
|
||||
|
||||
! ===============
|
||||
! ===============
|
||||
|
||||
! ===============
|
||||
! term III:
|
||||
! \partial_z
|
||||
! ===============
|
||||
|
||||
if( power_B(3) .ge. 1 ) then
|
||||
|
||||
power_D(1) = power_B(1)
|
||||
power_D(2) = power_B(2)
|
||||
power_D(3) = power_B(3) - 1
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 0
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 1
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv + fact_AB * dble(power_B(3)) * cx * cy * cz
|
||||
endif
|
||||
|
||||
! ===============
|
||||
|
||||
power_D(1) = power_B(1)
|
||||
power_D(2) = power_B(2)
|
||||
power_D(3) = power_B(3) + 1
|
||||
|
||||
call give_explicit_poly_and_gaussian( pol_AB, center_AB, AB_expo, fact_AB &
|
||||
, iorder, alpha, beta, power_A, power_D, A_center, B_center, dim1)
|
||||
power_C = 0
|
||||
cx = 0.d0
|
||||
do i = 0, iorder(1)
|
||||
cx = cx + pol_AB(i,1) * overlap_gaussian_x( center_AB(1), C_center(1), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 0
|
||||
cy = 0.d0
|
||||
do i = 0, iorder(2)
|
||||
cy = cy + pol_AB(i,2) * overlap_gaussian_x( center_AB(2), C_center(2), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
power_C = 1
|
||||
cz = 0.d0
|
||||
do i = 0, iorder(3)
|
||||
cz = cz + pol_AB(i,3) * overlap_gaussian_x( center_AB(3), C_center(3), AB_expo, gama, i, power_C, dim1)
|
||||
enddo
|
||||
|
||||
int_gauss_deriv = int_gauss_deriv - 2.d0 * beta * fact_AB * cx * cy * cz
|
||||
|
||||
! ===============
|
||||
! ===============
|
||||
|
||||
return
|
||||
end function int_gauss_deriv
|
||||
!_____________________________________________________________________________________________________________
|
||||
!_____________________________________________________________________________________________________________
|
||||
|
||||
|
213
src/ao_tc_eff_map/potential.irp.f
Normal file
213
src/ao_tc_eff_map/potential.irp.f
Normal file
|
@ -0,0 +1,213 @@
|
|||
BEGIN_PROVIDER [integer, n_gauss_eff_pot]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! number of gaussians to represent the effective potential :
|
||||
!
|
||||
! V(mu,r12) = -0.25 * (1 - erf(mu*r12))^2 + 1/(\sqrt(pi)mu) * exp(-(mu*r12)^2)
|
||||
!
|
||||
! Here (1 - erf(mu*r12))^2 is expanded in Gaussians as Eqs A11-A20 in JCP 154, 084119 (2021)
|
||||
END_DOC
|
||||
n_gauss_eff_pot = n_max_fit_slat + 1
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [integer, n_gauss_eff_pot_deriv]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! V(r12) = -(1 - erf(mu*r12))^2 is expanded in Gaussians as Eqs A11-A20 in JCP 154, 084119 (2021)
|
||||
END_DOC
|
||||
n_gauss_eff_pot_deriv = n_max_fit_slat
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_eff_pot, (n_gauss_eff_pot)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_eff_pot, (n_gauss_eff_pot)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Coefficients and exponents of the Fit on Gaussians of V(X) = -(1 - erf(mu*X))^2 + 1/(\sqrt(pi)mu) * exp(-(mu*X)^2)
|
||||
!
|
||||
! V(X) = \sum_{i=1,n_gauss_eff_pot} coef_gauss_eff_pot(i) * exp(-expo_gauss_eff_pot(i) * X^2)
|
||||
!
|
||||
! Relies on the fit proposed in Eqs A11-A20 in JCP 154, 084119 (2021)
|
||||
END_DOC
|
||||
include 'constants.include.F'
|
||||
|
||||
integer :: i
|
||||
! fit of the -0.25 * (1 - erf(mu*x))^2 with n_max_fit_slat gaussians
|
||||
do i = 1, n_max_fit_slat
|
||||
expo_gauss_eff_pot(i) = expo_gauss_1_erf_x_2(i)
|
||||
coef_gauss_eff_pot(i) = -0.25d0 * coef_gauss_1_erf_x_2(i) ! -1/4 * (1 - erf(mu*x))^2
|
||||
enddo
|
||||
! Analytical Gaussian part of the potential: + 1/(\sqrt(pi)mu) * exp(-(mu*x)^2)
|
||||
expo_gauss_eff_pot(n_max_fit_slat+1) = mu_erf * mu_erf
|
||||
coef_gauss_eff_pot(n_max_fit_slat+1) = 1.d0 * mu_erf * inv_sq_pi
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
double precision function eff_pot_gauss(x,mu)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! V(mu,r12) = -0.25 * (1 - erf(mu*r12))^2 + 1/(\sqrt(pi)mu) * exp(-(mu*r12)^2)
|
||||
END_DOC
|
||||
double precision, intent(in) :: x,mu
|
||||
eff_pot_gauss = mu/dsqrt(dacos(-1.d0)) * dexp(-mu*mu*x*x) - 0.25d0 * (1.d0 - derf(mu*x))**2.d0
|
||||
end
|
||||
|
||||
|
||||
|
||||
! -------------------------------------------------------------------------------------------------
|
||||
! ---
|
||||
|
||||
double precision function eff_pot_fit_gauss(x)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! V(mu,r12) = -0.25 * (1 - erf(mu*r12))^2 + 1/(\sqrt(pi)mu) * exp(-(mu*r12)^2)
|
||||
!
|
||||
! but fitted with gaussians
|
||||
END_DOC
|
||||
double precision, intent(in) :: x
|
||||
integer :: i
|
||||
double precision :: alpha
|
||||
eff_pot_fit_gauss = derf(mu_erf*x)/x
|
||||
do i = 1, n_gauss_eff_pot
|
||||
alpha = expo_gauss_eff_pot(i)
|
||||
eff_pot_fit_gauss += coef_gauss_eff_pot(i) * dexp(-alpha*x*x)
|
||||
enddo
|
||||
end
|
||||
|
||||
BEGIN_PROVIDER [integer, n_fit_1_erf_x]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
!
|
||||
END_DOC
|
||||
n_fit_1_erf_x = 2
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, expos_slat_gauss_1_erf_x, (n_fit_1_erf_x)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! 1 - erf(mu*x) is fitted with a Slater and gaussian as in Eq.A15 of JCP 154, 084119 (2021)
|
||||
!
|
||||
! 1 - erf(mu*x) = e^{-expos_slat_gauss_1_erf_x(1) * mu *x} * e^{-expos_slat_gauss_1_erf_x(2) * mu^2 * x^2}
|
||||
END_DOC
|
||||
expos_slat_gauss_1_erf_x(1) = 1.09529d0
|
||||
expos_slat_gauss_1_erf_x(2) = 0.756023d0
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_1_erf_x, (n_max_fit_slat)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_1_erf_x, (n_max_fit_slat)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! (1 - erf(mu*x)) = \sum_i coef_gauss_1_erf_x(i) * exp(-expo_gauss_1_erf_x(i) * x^2)
|
||||
!
|
||||
! This is based on a fit of (1 - erf(mu*x)) by exp(-alpha * x) exp(-beta*mu^2x^2)
|
||||
!
|
||||
! and the slater function exp(-alpha * x) is fitted with n_max_fit_slat gaussians
|
||||
!
|
||||
! See Appendix 2 of JCP 154, 084119 (2021)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i
|
||||
double precision :: expos(n_max_fit_slat), alpha, beta
|
||||
|
||||
alpha = expos_slat_gauss_1_erf_x(1) * mu_erf
|
||||
call expo_fit_slater_gam(alpha, expos)
|
||||
beta = expos_slat_gauss_1_erf_x(2) * mu_erf * mu_erf
|
||||
|
||||
do i = 1, n_max_fit_slat
|
||||
expo_gauss_1_erf_x(i) = expos(i) + beta
|
||||
coef_gauss_1_erf_x(i) = coef_fit_slat_gauss(i)
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
double precision function fit_1_erf_x(x)
|
||||
implicit none
|
||||
double precision, intent(in) :: x
|
||||
BEGIN_DOC
|
||||
! fit_1_erf_x(x) = \sum_i c_i exp (-alpha_i x^2) \approx (1 - erf(mu*x))
|
||||
END_DOC
|
||||
integer :: i
|
||||
fit_1_erf_x = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
fit_1_erf_x += dexp(-expo_gauss_1_erf_x(i) *x*x) * coef_gauss_1_erf_x(i)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
BEGIN_PROVIDER [double precision, expo_gauss_1_erf_x_2, (n_max_fit_slat)]
|
||||
&BEGIN_PROVIDER [double precision, coef_gauss_1_erf_x_2, (n_max_fit_slat)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! (1 - erf(mu*x))^2 = \sum_i coef_gauss_1_erf_x_2(i) * exp(-expo_gauss_1_erf_x_2(i) * x^2)
|
||||
!
|
||||
! This is based on a fit of (1 - erf(mu*x)) by exp(-alpha * x) exp(-beta*mu^2x^2)
|
||||
!
|
||||
! and the slater function exp(-alpha * x) is fitted with n_max_fit_slat gaussians
|
||||
END_DOC
|
||||
integer :: i
|
||||
double precision :: expos(n_max_fit_slat),alpha,beta
|
||||
alpha = 2.d0 * expos_slat_gauss_1_erf_x(1) * mu_erf
|
||||
call expo_fit_slater_gam(alpha,expos)
|
||||
beta = 2.d0 * expos_slat_gauss_1_erf_x(2) * mu_erf**2.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
expo_gauss_1_erf_x_2(i) = expos(i) + beta
|
||||
coef_gauss_1_erf_x_2(i) = coef_fit_slat_gauss(i)
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
double precision function fit_1_erf_x_2(x)
|
||||
implicit none
|
||||
double precision, intent(in) :: x
|
||||
BEGIN_DOC
|
||||
! fit_1_erf_x_2(x) = \sum_i c_i exp (-alpha_i x^2) \approx (1 - erf(mu*x))^2
|
||||
END_DOC
|
||||
integer :: i
|
||||
fit_1_erf_x_2 = 0.d0
|
||||
do i = 1, n_max_fit_slat
|
||||
fit_1_erf_x_2 += dexp(-expo_gauss_1_erf_x_2(i) *x*x) * coef_gauss_1_erf_x_2(i)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
subroutine inv_r_times_poly(r, dist_r, dist_vec, poly)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! returns
|
||||
!
|
||||
! poly(1) = x / sqrt(x^2+y^2+z^2), poly(2) = y / sqrt(x^2+y^2+z^2), poly(3) = z / sqrt(x^2+y^2+z^2)
|
||||
!
|
||||
! with the arguments
|
||||
!
|
||||
! r(1) = x, r(2) = y, r(3) = z, dist_r = sqrt(x^2+y^2+z^2)
|
||||
!
|
||||
! dist_vec(1) = sqrt(y^2+z^2), dist_vec(2) = sqrt(x^2+z^2), dist_vec(3) = sqrt(x^2+y^2)
|
||||
END_DOC
|
||||
double precision, intent(in) :: r(3), dist_r, dist_vec(3)
|
||||
double precision, intent(out):: poly(3)
|
||||
double precision :: inv_dist
|
||||
integer :: i
|
||||
if (dist_r.gt. 1.d-8)then
|
||||
inv_dist = 1.d0/dist_r
|
||||
do i = 1, 3
|
||||
poly(i) = r(i) * inv_dist
|
||||
enddo
|
||||
else
|
||||
do i = 1, 3
|
||||
if(dabs(r(i)).lt.dist_vec(i))then
|
||||
inv_dist = 1.d0/dist_r
|
||||
poly(i) = r(i) * inv_dist
|
||||
else !if(dabs(r(i)))then
|
||||
poly(i) = 1.d0
|
||||
! poly(i) = 0.d0
|
||||
endif
|
||||
enddo
|
||||
endif
|
||||
end
|
86
src/ao_tc_eff_map/providers_ao_eff_pot.irp.f
Normal file
86
src/ao_tc_eff_map/providers_ao_eff_pot.irp.f
Normal file
|
@ -0,0 +1,86 @@
|
|||
|
||||
BEGIN_PROVIDER [ logical, ao_tc_sym_two_e_pot_in_map ]
|
||||
implicit none
|
||||
use f77_zmq
|
||||
use map_module
|
||||
BEGIN_DOC
|
||||
! Map of Atomic integrals
|
||||
! i(r1) j(r2) 1/r12 k(r1) l(r2)
|
||||
END_DOC
|
||||
|
||||
integer :: i,j,k,l
|
||||
double precision :: ao_tc_sym_two_e_pot,cpu_1,cpu_2, wall_1, wall_2
|
||||
double precision :: integral, wall_0
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
! For integrals file
|
||||
integer(key_kind),allocatable :: buffer_i(:)
|
||||
integer,parameter :: size_buffer = 1024*64
|
||||
real(integral_kind),allocatable :: buffer_value(:)
|
||||
|
||||
integer :: n_integrals, rc
|
||||
integer :: kk, m, j1, i1, lmax
|
||||
character*(64) :: fmt
|
||||
|
||||
!double precision :: j1b_gauss_coul_debug
|
||||
!integral = j1b_gauss_coul_debug(1,1,1,1)
|
||||
|
||||
integral = ao_tc_sym_two_e_pot(1,1,1,1)
|
||||
|
||||
double precision :: map_mb
|
||||
|
||||
print*, 'Providing the ao_tc_sym_two_e_pot_map integrals'
|
||||
call wall_time(wall_0)
|
||||
call wall_time(wall_1)
|
||||
call cpu_time(cpu_1)
|
||||
|
||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull
|
||||
call new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'ao_tc_sym_two_e_pot')
|
||||
|
||||
character(len=:), allocatable :: task
|
||||
allocate(character(len=ao_num*12) :: task)
|
||||
write(fmt,*) '(', ao_num, '(I5,X,I5,''|''))'
|
||||
do l=1,ao_num
|
||||
write(task,fmt) (i,l, i=1,l)
|
||||
integer, external :: add_task_to_taskserver
|
||||
if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task)) == -1) then
|
||||
stop 'Unable to add task to server'
|
||||
endif
|
||||
enddo
|
||||
deallocate(task)
|
||||
|
||||
integer, external :: zmq_set_running
|
||||
if (zmq_set_running(zmq_to_qp_run_socket) == -1) then
|
||||
print *, irp_here, ': Failed in zmq_set_running'
|
||||
endif
|
||||
|
||||
PROVIDE nproc
|
||||
!$OMP PARALLEL DEFAULT(shared) private(i) num_threads(nproc+1)
|
||||
i = omp_get_thread_num()
|
||||
if (i==0) then
|
||||
call ao_tc_sym_two_e_pot_in_map_collector(zmq_socket_pull)
|
||||
else
|
||||
call ao_tc_sym_two_e_pot_in_map_slave_inproc(i)
|
||||
endif
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'ao_tc_sym_two_e_pot')
|
||||
|
||||
|
||||
print*, 'Sorting the map'
|
||||
call map_sort(ao_tc_sym_two_e_pot_map)
|
||||
call cpu_time(cpu_2)
|
||||
call wall_time(wall_2)
|
||||
integer(map_size_kind) :: get_ao_tc_sym_two_e_pot_map_size, ao_eff_pot_map_size
|
||||
ao_eff_pot_map_size = get_ao_tc_sym_two_e_pot_map_size()
|
||||
|
||||
print*, 'AO eff_pot integrals provided:'
|
||||
print*, ' Size of AO eff_pot map : ', map_mb(ao_tc_sym_two_e_pot_map) ,'MB'
|
||||
print*, ' Number of AO eff_pot integrals :', ao_eff_pot_map_size
|
||||
print*, ' cpu time :',cpu_2 - cpu_1, 's'
|
||||
print*, ' wall time :',wall_2 - wall_1, 's ( x ', (cpu_2-cpu_1)/(wall_2-wall_1+tiny(1.d0)), ' )'
|
||||
|
||||
ao_tc_sym_two_e_pot_in_map = .True.
|
||||
|
||||
|
||||
END_PROVIDER
|
728
src/ao_tc_eff_map/two_e_1bgauss_j1.irp.f
Normal file
728
src/ao_tc_eff_map/two_e_1bgauss_j1.irp.f
Normal file
|
@ -0,0 +1,728 @@
|
|||
! ---
|
||||
|
||||
double precision function j1b_gauss_2e_j1(i, j, k, l)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! integral in the AO basis:
|
||||
! i(r1) j(r1) f(r12) k(r2) l(r2)
|
||||
!
|
||||
! with:
|
||||
! f(r12) = - [ (0.5 - 0.5 erf(mu r12)) / r12 ] (r1-r2) \cdot \sum_A (-2 a_A) [ r1A exp(-aA r1A^2) - r2A exp(-aA r2A^2) ]
|
||||
! = [ (1 - erf(mu r12) / r12 ] \sum_A a_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! + (r2-RA)^2 exp(-aA r2A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r1A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, k, l
|
||||
|
||||
integer :: p, q, r, s
|
||||
integer :: num_i, num_j, num_k, num_l, num_ii
|
||||
integer :: I_power(3), J_power(3), K_power(3), L_power(3)
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
integer :: shift_P(3), shift_Q(3)
|
||||
integer :: dim1
|
||||
|
||||
double precision :: coef1, coef2, coef3, coef4
|
||||
double precision :: expo1, expo2, expo3, expo4
|
||||
double precision :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision :: I_center(3), J_center(3), K_center(3), L_center(3)
|
||||
double precision :: ff, gg, cx, cy, cz
|
||||
|
||||
double precision :: j1b_gauss_2e_j1_schwartz
|
||||
|
||||
if( ao_prim_num(i) * ao_prim_num(j) * ao_prim_num(k) * ao_prim_num(l) > 1024 ) then
|
||||
j1b_gauss_2e_j1 = j1b_gauss_2e_j1_schwartz(i, j, k, l)
|
||||
return
|
||||
endif
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
j1b_gauss_2e_j1 = 0.d0
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p, i)
|
||||
expo1 = ao_expo_ordered_transp(p, i)
|
||||
|
||||
do q = 1, ao_prim_num(j)
|
||||
coef2 = coef1 * ao_coef_normalized_ordered_transp(q, j)
|
||||
expo2 = ao_expo_ordered_transp(q, j)
|
||||
|
||||
call give_explicit_poly_and_gaussian( P1_new, P1_center, pp1, fact_p1, iorder_p, expo1, expo2 &
|
||||
, I_power, J_power, I_center, J_center, dim1 )
|
||||
p1_inv = 1.d0 / pp1
|
||||
|
||||
do r = 1, ao_prim_num(k)
|
||||
coef3 = coef2 * ao_coef_normalized_ordered_transp(r, k)
|
||||
expo3 = ao_expo_ordered_transp(r, k)
|
||||
|
||||
do s = 1, ao_prim_num(l)
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s, l)
|
||||
expo4 = ao_expo_ordered_transp(s, l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j1( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
j1b_gauss_2e_j1 = j1b_gauss_2e_j1 + coef4 * ( cx + cy + cz )
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
return
|
||||
end function j1b_gauss_2e_j1
|
||||
|
||||
! ---
|
||||
|
||||
double precision function j1b_gauss_2e_j1_schwartz(i, j, k, l)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! integral in the AO basis:
|
||||
! i(r1) j(r1) f(r12) k(r2) l(r2)
|
||||
!
|
||||
! with:
|
||||
! f(r12) = - [ (0.5 - 0.5 erf(mu r12)) / r12 ] (r1-r2) \cdot \sum_A (-2 a_A) [ r1A exp(-aA r1A^2) - r2A exp(-aA r2A^2) ]
|
||||
! = [ (1 - erf(mu r12) / r12 ] \sum_A a_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! + (r2-RA)^2 exp(-aA r2A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r1A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, k, l
|
||||
|
||||
integer :: p, q, r, s
|
||||
integer :: num_i, num_j, num_k, num_l, num_ii
|
||||
integer :: I_power(3), J_power(3), K_power(3), L_power(3)
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
integer :: dim1
|
||||
|
||||
double precision :: coef1, coef2, coef3, coef4
|
||||
double precision :: expo1, expo2, expo3, expo4
|
||||
double precision :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision :: I_center(3), J_center(3), K_center(3), L_center(3)
|
||||
double precision :: cx, cy, cz
|
||||
double precision :: schwartz_ij, thr
|
||||
double precision, allocatable :: schwartz_kl(:,:)
|
||||
|
||||
PROVIDE j1b_pen
|
||||
|
||||
dim1 = n_pt_max_integrals
|
||||
thr = ao_integrals_threshold * ao_integrals_threshold
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
|
||||
allocate( schwartz_kl(0:ao_prim_num(l) , 0:ao_prim_num(k)) )
|
||||
|
||||
schwartz_kl(0,0) = 0.d0
|
||||
do r = 1, ao_prim_num(k)
|
||||
expo3 = ao_expo_ordered_transp(r,k)
|
||||
coef3 = ao_coef_normalized_ordered_transp(r,k) * ao_coef_normalized_ordered_transp(r,k)
|
||||
|
||||
schwartz_kl(0,r) = 0.d0
|
||||
do s = 1, ao_prim_num(l)
|
||||
expo4 = ao_expo_ordered_transp(s,l)
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s,l) * ao_coef_normalized_ordered_transp(s,l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j1( dim1, cx, cy, cz &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
schwartz_kl(s,r) = coef4 * dabs( cx + cy + cz )
|
||||
schwartz_kl(0,r) = max( schwartz_kl(0,r) , schwartz_kl(s,r) )
|
||||
enddo
|
||||
|
||||
schwartz_kl(0,0) = max( schwartz_kl(0,r) , schwartz_kl(0,0) )
|
||||
enddo
|
||||
|
||||
|
||||
j1b_gauss_2e_j1_schwartz = 0.d0
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
expo1 = ao_expo_ordered_transp(p, i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p, i)
|
||||
|
||||
do q = 1, ao_prim_num(j)
|
||||
expo2 = ao_expo_ordered_transp(q, j)
|
||||
coef2 = coef1 * ao_coef_normalized_ordered_transp(q, j)
|
||||
|
||||
call give_explicit_poly_and_gaussian( P1_new, P1_center, pp1, fact_p1, iorder_p, expo1, expo2 &
|
||||
, I_power, J_power, I_center, J_center, dim1 )
|
||||
p1_inv = 1.d0 / pp1
|
||||
|
||||
call get_cxcycz_j1( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p )
|
||||
|
||||
schwartz_ij = coef2 * coef2 * dabs( cx + cy + cz )
|
||||
if( schwartz_kl(0,0) * schwartz_ij < thr ) cycle
|
||||
|
||||
do r = 1, ao_prim_num(k)
|
||||
if( schwartz_kl(0,r) * schwartz_ij < thr ) cycle
|
||||
coef3 = coef2 * ao_coef_normalized_ordered_transp(r, k)
|
||||
expo3 = ao_expo_ordered_transp(r, k)
|
||||
|
||||
do s = 1, ao_prim_num(l)
|
||||
if( schwartz_kl(s,r) * schwartz_ij < thr ) cycle
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s, l)
|
||||
expo4 = ao_expo_ordered_transp(s, l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j1( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
j1b_gauss_2e_j1_schwartz = j1b_gauss_2e_j1_schwartz + coef4 * ( cx + cy + cz )
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
deallocate( schwartz_kl )
|
||||
|
||||
return
|
||||
end function j1b_gauss_2e_j1_schwartz
|
||||
|
||||
! ---
|
||||
|
||||
subroutine get_cxcycz_j1( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: dim1
|
||||
integer, intent(in) :: iorder_p(3), iorder_q(3)
|
||||
double precision, intent(in) :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision, intent(in) :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision, intent(out) :: cx, cy, cz
|
||||
|
||||
integer :: ii
|
||||
integer :: shift_P(3), shift_Q(3)
|
||||
double precision :: expoii, factii, Centerii(3)
|
||||
double precision :: P2_new(0:max_dim,3), P2_center(3), fact_p2, pp2, p2_inv
|
||||
double precision :: Q2_new(0:max_dim,3), Q2_center(3), fact_q2, qq2, q2_inv
|
||||
double precision :: ff, gg
|
||||
|
||||
double precision :: general_primitive_integral_erf_shifted
|
||||
double precision :: general_primitive_integral_coul_shifted
|
||||
|
||||
PROVIDE j1b_pen
|
||||
|
||||
cx = 0.d0
|
||||
cy = 0.d0
|
||||
cz = 0.d0
|
||||
do ii = 1, nucl_num
|
||||
|
||||
expoii = j1b_pen(ii)
|
||||
Centerii(1:3) = nucl_coord(ii, 1:3)
|
||||
|
||||
call gaussian_product(pp1, P1_center, expoii, Centerii, factii, pp2, P2_center)
|
||||
fact_p2 = fact_p1 * factii
|
||||
p2_inv = 1.d0 / pp2
|
||||
call pol_modif_center( P1_center, P2_center, iorder_p, P1_new, P2_new )
|
||||
|
||||
call gaussian_product(qq1, Q1_center, expoii, Centerii, factii, qq2, Q2_center)
|
||||
fact_q2 = fact_q1 * factii
|
||||
q2_inv = 1.d0 / qq2
|
||||
call pol_modif_center( Q1_center, Q2_center, iorder_q, Q1_new, Q2_new )
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! [ (1-erf(mu r12)) / r12 ] \sum_A a_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
|
||||
! x term:
|
||||
ff = P2_center(1) - Centerii(1)
|
||||
|
||||
shift_P = (/ 2, 0, 0 /)
|
||||
cx = cx + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 1, 0, 0 /)
|
||||
cx = cx + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cx = cx + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P2_center(2) - Centerii(2)
|
||||
|
||||
shift_P = (/ 0, 2, 0 /)
|
||||
cy = cy + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 1, 0 /)
|
||||
cy = cy + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cy = cy + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P2_center(3) - Centerii(3)
|
||||
|
||||
shift_P = (/ 0, 0, 2 /)
|
||||
cz = cz + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 1 /)
|
||||
cz = cz + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cz = cz + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! [ (1-erf(mu r12)) / r12 ] \sum_A a_A [ (r2-RA)^2 exp(-aA r2A^2)
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
|
||||
! x term:
|
||||
ff = Q2_center(1) - Centerii(1)
|
||||
|
||||
shift_Q = (/ 2, 0, 0 /)
|
||||
cx = cx + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = Q2_center(2) - Centerii(2)
|
||||
|
||||
shift_Q = (/ 0, 2, 0 /)
|
||||
cy = cy + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = Q2_center(3) - Centerii(3)
|
||||
|
||||
shift_Q = (/ 0, 0, 2 /)
|
||||
cz = cz + expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz + expoii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz + expoii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! - [ (1-erf(mu r12)) / r12 ] \sum_A a_A [ (r1-RA) \cdot (r2-RA) exp(-aA r1A^2) ]
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
! x term:
|
||||
ff = P2_center(1) - Centerii(1)
|
||||
gg = Q1_center(1) - Centerii(1)
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P2_center(2) - Centerii(2)
|
||||
gg = Q1_center(2) - Centerii(2)
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P2_center(3) - Centerii(3)
|
||||
gg = Q1_center(3) - Centerii(3)
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! - [ (1-erf(mu r12)) / r12 ] \sum_A a_A [ (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
! x term:
|
||||
ff = P1_center(1) - Centerii(1)
|
||||
gg = Q2_center(1) - Centerii(1)
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P1_center(2) - Centerii(2)
|
||||
gg = Q2_center(2) - Centerii(2)
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P1_center(3) - Centerii(3)
|
||||
gg = Q2_center(3) - Centerii(3)
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine get_cxcycz_j1
|
||||
|
||||
! ---
|
||||
|
729
src/ao_tc_eff_map/two_e_1bgauss_j2.irp.f
Normal file
729
src/ao_tc_eff_map/two_e_1bgauss_j2.irp.f
Normal file
|
@ -0,0 +1,729 @@
|
|||
! ---
|
||||
|
||||
double precision function j1b_gauss_2e_j2(i, j, k, l)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! integral in the AO basis:
|
||||
! i(r1) j(r1) f(r12) k(r2) l(r2)
|
||||
!
|
||||
! with:
|
||||
! f(r12) = - [ (0.5 - 0.5 erf(mu r12)) / r12 ] (r1-r2) \cdot \sum_A (-2 a_A c_A) [ r1A exp(-aA r1A^2) - r2A exp(-aA r2A^2) ]
|
||||
! = [ (1 - erf(mu r12) / r12 ] \sum_A a_A c_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! + (r2-RA)^2 exp(-aA r2A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r1A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, k, l
|
||||
|
||||
integer :: p, q, r, s
|
||||
integer :: num_i, num_j, num_k, num_l, num_ii
|
||||
integer :: I_power(3), J_power(3), K_power(3), L_power(3)
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
integer :: shift_P(3), shift_Q(3)
|
||||
integer :: dim1
|
||||
|
||||
double precision :: coef1, coef2, coef3, coef4
|
||||
double precision :: expo1, expo2, expo3, expo4
|
||||
double precision :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision :: I_center(3), J_center(3), K_center(3), L_center(3)
|
||||
double precision :: ff, gg, cx, cy, cz
|
||||
|
||||
double precision :: j1b_gauss_2e_j2_schwartz
|
||||
|
||||
dim1 = n_pt_max_integrals
|
||||
|
||||
if( ao_prim_num(i) * ao_prim_num(j) * ao_prim_num(k) * ao_prim_num(l) > 1024 ) then
|
||||
j1b_gauss_2e_j2 = j1b_gauss_2e_j2_schwartz(i, j, k, l)
|
||||
return
|
||||
endif
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
j1b_gauss_2e_j2 = 0.d0
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p, i)
|
||||
expo1 = ao_expo_ordered_transp(p, i)
|
||||
|
||||
do q = 1, ao_prim_num(j)
|
||||
coef2 = coef1 * ao_coef_normalized_ordered_transp(q, j)
|
||||
expo2 = ao_expo_ordered_transp(q, j)
|
||||
|
||||
call give_explicit_poly_and_gaussian( P1_new, P1_center, pp1, fact_p1, iorder_p, expo1, expo2 &
|
||||
, I_power, J_power, I_center, J_center, dim1 )
|
||||
p1_inv = 1.d0 / pp1
|
||||
|
||||
do r = 1, ao_prim_num(k)
|
||||
coef3 = coef2 * ao_coef_normalized_ordered_transp(r, k)
|
||||
expo3 = ao_expo_ordered_transp(r, k)
|
||||
|
||||
do s = 1, ao_prim_num(l)
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s, l)
|
||||
expo4 = ao_expo_ordered_transp(s, l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j2( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
j1b_gauss_2e_j2 = j1b_gauss_2e_j2 + coef4 * ( cx + cy + cz )
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
return
|
||||
end function j1b_gauss_2e_j2
|
||||
|
||||
! ---
|
||||
|
||||
double precision function j1b_gauss_2e_j2_schwartz(i, j, k, l)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! integral in the AO basis:
|
||||
! i(r1) j(r1) f(r12) k(r2) l(r2)
|
||||
!
|
||||
! with:
|
||||
! f(r12) = - [ (0.5 - 0.5 erf(mu r12)) / r12 ] (r1-r2) \cdot \sum_A (-2 a_A c_A) [ r1A exp(-aA r1A^2) - r2A exp(-aA r2A^2) ]
|
||||
! = [ (1 - erf(mu r12) / r12 ] \sum_A a_A c_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! + (r2-RA)^2 exp(-aA r2A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r1A^2)
|
||||
! - (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
!
|
||||
END_DOC
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: i, j, k, l
|
||||
|
||||
integer :: p, q, r, s
|
||||
integer :: num_i, num_j, num_k, num_l, num_ii
|
||||
integer :: I_power(3), J_power(3), K_power(3), L_power(3)
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
integer :: dim1
|
||||
|
||||
double precision :: coef1, coef2, coef3, coef4
|
||||
double precision :: expo1, expo2, expo3, expo4
|
||||
double precision :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision :: I_center(3), J_center(3), K_center(3), L_center(3)
|
||||
double precision :: cx, cy, cz
|
||||
double precision :: schwartz_ij, thr
|
||||
double precision, allocatable :: schwartz_kl(:,:)
|
||||
|
||||
dim1 = n_pt_max_integrals
|
||||
thr = ao_integrals_threshold * ao_integrals_threshold
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
|
||||
allocate( schwartz_kl(0:ao_prim_num(l) , 0:ao_prim_num(k)) )
|
||||
|
||||
schwartz_kl(0,0) = 0.d0
|
||||
do r = 1, ao_prim_num(k)
|
||||
expo3 = ao_expo_ordered_transp(r,k)
|
||||
coef3 = ao_coef_normalized_ordered_transp(r,k) * ao_coef_normalized_ordered_transp(r,k)
|
||||
|
||||
schwartz_kl(0,r) = 0.d0
|
||||
do s = 1, ao_prim_num(l)
|
||||
expo4 = ao_expo_ordered_transp(s,l)
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s,l) * ao_coef_normalized_ordered_transp(s,l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j2( dim1, cx, cy, cz &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
schwartz_kl(s,r) = coef4 * dabs( cx + cy + cz )
|
||||
schwartz_kl(0,r) = max( schwartz_kl(0,r) , schwartz_kl(s,r) )
|
||||
enddo
|
||||
|
||||
schwartz_kl(0,0) = max( schwartz_kl(0,r) , schwartz_kl(0,0) )
|
||||
enddo
|
||||
|
||||
|
||||
j1b_gauss_2e_j2_schwartz = 0.d0
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
expo1 = ao_expo_ordered_transp(p, i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p, i)
|
||||
|
||||
do q = 1, ao_prim_num(j)
|
||||
expo2 = ao_expo_ordered_transp(q, j)
|
||||
coef2 = coef1 * ao_coef_normalized_ordered_transp(q, j)
|
||||
|
||||
call give_explicit_poly_and_gaussian( P1_new, P1_center, pp1, fact_p1, iorder_p, expo1, expo2 &
|
||||
, I_power, J_power, I_center, J_center, dim1 )
|
||||
p1_inv = 1.d0 / pp1
|
||||
|
||||
call get_cxcycz_j2( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p )
|
||||
|
||||
schwartz_ij = coef2 * coef2 * dabs( cx + cy + cz )
|
||||
if( schwartz_kl(0,0) * schwartz_ij < thr ) cycle
|
||||
|
||||
do r = 1, ao_prim_num(k)
|
||||
if( schwartz_kl(0,r) * schwartz_ij < thr ) cycle
|
||||
coef3 = coef2 * ao_coef_normalized_ordered_transp(r, k)
|
||||
expo3 = ao_expo_ordered_transp(r, k)
|
||||
|
||||
do s = 1, ao_prim_num(l)
|
||||
if( schwartz_kl(s,r) * schwartz_ij < thr ) cycle
|
||||
coef4 = coef3 * ao_coef_normalized_ordered_transp(s, l)
|
||||
expo4 = ao_expo_ordered_transp(s, l)
|
||||
|
||||
call give_explicit_poly_and_gaussian( Q1_new, Q1_center, qq1, fact_q1, iorder_q, expo3, expo4 &
|
||||
, K_power, L_power, K_center, L_center, dim1 )
|
||||
q1_inv = 1.d0 / qq1
|
||||
|
||||
call get_cxcycz_j2( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
j1b_gauss_2e_j2_schwartz = j1b_gauss_2e_j2_schwartz + coef4 * ( cx + cy + cz )
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
deallocate( schwartz_kl )
|
||||
|
||||
return
|
||||
end function j1b_gauss_2e_j2_schwartz
|
||||
|
||||
! ---
|
||||
|
||||
subroutine get_cxcycz_j2( dim1, cx, cy, cz &
|
||||
, P1_center, P1_new, pp1, fact_p1, p1_inv, iorder_p &
|
||||
, Q1_center, Q1_new, qq1, fact_q1, q1_inv, iorder_q )
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: dim1
|
||||
integer, intent(in) :: iorder_p(3), iorder_q(3)
|
||||
double precision, intent(in) :: P1_new(0:max_dim,3), P1_center(3), fact_p1, pp1, p1_inv
|
||||
double precision, intent(in) :: Q1_new(0:max_dim,3), Q1_center(3), fact_q1, qq1, q1_inv
|
||||
double precision, intent(out) :: cx, cy, cz
|
||||
|
||||
integer :: ii
|
||||
integer :: shift_P(3), shift_Q(3)
|
||||
double precision :: coefii, expoii, factii, Centerii(3)
|
||||
double precision :: P2_new(0:max_dim,3), P2_center(3), fact_p2, pp2, p2_inv
|
||||
double precision :: Q2_new(0:max_dim,3), Q2_center(3), fact_q2, qq2, q2_inv
|
||||
double precision :: ff, gg
|
||||
|
||||
double precision :: general_primitive_integral_erf_shifted
|
||||
double precision :: general_primitive_integral_coul_shifted
|
||||
|
||||
PROVIDE j1b_pen j1b_coeff
|
||||
|
||||
cx = 0.d0
|
||||
cy = 0.d0
|
||||
cz = 0.d0
|
||||
do ii = 1, nucl_num
|
||||
|
||||
expoii = j1b_pen (ii)
|
||||
coefii = j1b_coeff(ii)
|
||||
Centerii(1:3) = nucl_coord(ii, 1:3)
|
||||
|
||||
call gaussian_product(pp1, P1_center, expoii, Centerii, factii, pp2, P2_center)
|
||||
fact_p2 = fact_p1 * factii
|
||||
p2_inv = 1.d0 / pp2
|
||||
call pol_modif_center( P1_center, P2_center, iorder_p, P1_new, P2_new )
|
||||
|
||||
call gaussian_product(qq1, Q1_center, expoii, Centerii, factii, qq2, Q2_center)
|
||||
fact_q2 = fact_q1 * factii
|
||||
q2_inv = 1.d0 / qq2
|
||||
call pol_modif_center( Q1_center, Q2_center, iorder_q, Q1_new, Q2_new )
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! [ (1-erf(mu r12)) / r12 ] \sum_A a_A c_A [ (r1-RA)^2 exp(-aA r1A^2)
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
|
||||
! x term:
|
||||
ff = P2_center(1) - Centerii(1)
|
||||
|
||||
shift_P = (/ 2, 0, 0 /)
|
||||
cx = cx + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 1, 0, 0 /)
|
||||
cx = cx + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cx = cx + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P2_center(2) - Centerii(2)
|
||||
|
||||
shift_P = (/ 0, 2, 0 /)
|
||||
cy = cy + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 1, 0 /)
|
||||
cy = cy + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cy = cy + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P2_center(3) - Centerii(3)
|
||||
|
||||
shift_P = (/ 0, 0, 2 /)
|
||||
cz = cz + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 1 /)
|
||||
cz = cz + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
cz = cz + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! [ (1-erf(mu r12)) / r12 ] \sum_A a_A c_A [ (r2-RA)^2 exp(-aA r2A^2)
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
shift_P = (/ 0, 0, 0 /)
|
||||
|
||||
! x term:
|
||||
ff = Q2_center(1) - Centerii(1)
|
||||
|
||||
shift_Q = (/ 2, 0, 0 /)
|
||||
cx = cx + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = Q2_center(2) - Centerii(2)
|
||||
|
||||
shift_Q = (/ 0, 2, 0 /)
|
||||
cy = cy + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = Q2_center(3) - Centerii(3)
|
||||
|
||||
shift_Q = (/ 0, 0, 2 /)
|
||||
cz = cz + expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz + expoii * coefii * 2.d0 * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * 2.d0 * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz + expoii * coefii * ff * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz - expoii * coefii * ff * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! - [ (1-erf(mu r12)) / r12 ] \sum_A a_A c_A [ (r1-RA) \cdot (r2-RA) exp(-aA r1A^2) ]
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
! x term:
|
||||
ff = P2_center(1) - Centerii(1)
|
||||
gg = Q1_center(1) - Centerii(1)
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P2_center(2) - Centerii(2)
|
||||
gg = Q1_center(2) - Centerii(2)
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P2_center(3) - Centerii(3)
|
||||
gg = Q1_center(3) - Centerii(3)
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P2_new, P2_center, fact_p2, pp2, p2_inv, iorder_p, shift_P &
|
||||
, Q1_new, Q1_center, fact_q1, qq1, q1_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
! - [ (1-erf(mu r12)) / r12 ] \sum_A a_A c_A [ (r1-RA) \cdot (r2-RA) exp(-aA r2A^2) ]
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
! x term:
|
||||
ff = P1_center(1) - Centerii(1)
|
||||
gg = Q2_center(1) - Centerii(1)
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 1, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 1, 0, 0 /)
|
||||
cx = cx - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cx = cx - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cx = cx + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! y term:
|
||||
ff = P1_center(2) - Centerii(2)
|
||||
gg = Q2_center(2) - Centerii(2)
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 1, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 1, 0 /)
|
||||
cy = cy - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cy = cy - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cy = cy + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! z term:
|
||||
ff = P1_center(3) - Centerii(3)
|
||||
gg = Q2_center(3) - Centerii(3)
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * coefii * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 1 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * coefii * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 1 /)
|
||||
cz = cz - expoii * coefii * ff * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * ff * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
shift_p = (/ 0, 0, 0 /)
|
||||
shift_Q = (/ 0, 0, 0 /)
|
||||
cz = cz - expoii * coefii * ff * gg * general_primitive_integral_coul_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
cz = cz + expoii * coefii * ff * gg * general_primitive_integral_erf_shifted( dim1 &
|
||||
, P1_new, P1_center, fact_p1, pp1, p1_inv, iorder_p, shift_P &
|
||||
, Q2_new, Q2_center, fact_q2, qq2, q2_inv, iorder_q, shift_Q )
|
||||
|
||||
! ----------------------------------------------------------------------------------------------------
|
||||
|
||||
enddo
|
||||
|
||||
return
|
||||
end subroutine get_cxcycz_j2
|
||||
|
||||
! ---
|
||||
|
327
src/ao_tc_eff_map/two_e_ints_gauss.irp.f
Normal file
327
src/ao_tc_eff_map/two_e_ints_gauss.irp.f
Normal file
|
@ -0,0 +1,327 @@
|
|||
double precision function ao_tc_sym_two_e_pot(i,j,k,l)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! integral of the AO basis <ik|jl> or (ij|kl)
|
||||
! i(r1) j(r1) (tc_pot(r12,mu)) k(r2) l(r2)
|
||||
!
|
||||
! where (tc_pot(r12,mu)) is the scalar part of the potential EXCLUDING the term erf(mu r12)/r12.
|
||||
!
|
||||
! See Eq. (32) of JCP 154, 084119 (2021).
|
||||
END_DOC
|
||||
integer,intent(in) :: i,j,k,l
|
||||
integer :: p,q,r,s
|
||||
double precision :: I_center(3),J_center(3),K_center(3),L_center(3)
|
||||
integer :: num_i,num_j,num_k,num_l,dim1,I_power(3),J_power(3),K_power(3),L_power(3)
|
||||
double precision :: integral
|
||||
include 'utils/constants.include.F'
|
||||
double precision :: P_new(0:max_dim,3),P_center(3),fact_p,pp
|
||||
double precision :: Q_new(0:max_dim,3),Q_center(3),fact_q,qq
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
double precision, allocatable :: schwartz_kl(:,:)
|
||||
double precision :: schwartz_ij
|
||||
double precision :: scw_gauss_int,general_primitive_integral_gauss
|
||||
|
||||
dim1 = n_pt_max_integrals
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
ao_tc_sym_two_e_pot = 0.d0
|
||||
double precision :: thr
|
||||
thr = ao_integrals_threshold*ao_integrals_threshold
|
||||
|
||||
allocate(schwartz_kl(0:ao_prim_num(l),0:ao_prim_num(k)))
|
||||
|
||||
double precision :: coef3
|
||||
double precision :: coef2
|
||||
double precision :: p_inv,q_inv
|
||||
double precision :: coef1
|
||||
double precision :: coef4
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
schwartz_kl(0,0) = 0.d0
|
||||
do r = 1, ao_prim_num(k)
|
||||
coef1 = ao_coef_normalized_ordered_transp(r,k)*ao_coef_normalized_ordered_transp(r,k)
|
||||
schwartz_kl(0,r) = 0.d0
|
||||
do s = 1, ao_prim_num(l)
|
||||
coef2 = coef1 * ao_coef_normalized_ordered_transp(s,l) * ao_coef_normalized_ordered_transp(s,l)
|
||||
call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q,&
|
||||
ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l), &
|
||||
K_power,L_power,K_center,L_center,dim1)
|
||||
q_inv = 1.d0/qq
|
||||
scw_gauss_int = general_primitive_integral_gauss(dim1, &
|
||||
Q_new,Q_center,fact_q,qq,q_inv,iorder_q, &
|
||||
Q_new,Q_center,fact_q,qq,q_inv,iorder_q)
|
||||
|
||||
schwartz_kl(s,r) = dabs(scw_gauss_int * coef2)
|
||||
schwartz_kl(0,r) = max(schwartz_kl(0,r),schwartz_kl(s,r))
|
||||
enddo
|
||||
schwartz_kl(0,0) = max(schwartz_kl(0,r),schwartz_kl(0,0))
|
||||
enddo
|
||||
do p = 1, ao_prim_num(i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p,i)
|
||||
do q = 1, ao_prim_num(j)
|
||||
coef2 = coef1*ao_coef_normalized_ordered_transp(q,j)
|
||||
call give_explicit_poly_and_gaussian(P_new,P_center,pp,fact_p,iorder_p,&
|
||||
ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j), &
|
||||
I_power,J_power,I_center,J_center,dim1)
|
||||
p_inv = 1.d0/pp
|
||||
scw_gauss_int = general_primitive_integral_gauss(dim1, &
|
||||
P_new,P_center,fact_p,pp,p_inv,iorder_p, &
|
||||
P_new,P_center,fact_p,pp,p_inv,iorder_p)
|
||||
schwartz_ij = dabs(scw_gauss_int * coef2*coef2)
|
||||
if (schwartz_kl(0,0)*schwartz_ij < thr) then
|
||||
cycle
|
||||
endif
|
||||
do r = 1, ao_prim_num(k)
|
||||
if (schwartz_kl(0,r)*schwartz_ij < thr) then
|
||||
cycle
|
||||
endif
|
||||
coef3 = coef2*ao_coef_normalized_ordered_transp(r,k)
|
||||
do s = 1, ao_prim_num(l)
|
||||
if (schwartz_kl(s,r)*schwartz_ij < thr) then
|
||||
cycle
|
||||
endif
|
||||
coef4 = coef3*ao_coef_normalized_ordered_transp(s,l)
|
||||
call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q, &
|
||||
ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l), &
|
||||
K_power,L_power,K_center,L_center,dim1)
|
||||
q_inv = 1.d0/qq
|
||||
integral = general_primitive_integral_gauss(dim1, &
|
||||
P_new,P_center,fact_p,pp,p_inv,iorder_p, &
|
||||
Q_new,Q_center,fact_q,qq,q_inv,iorder_q)
|
||||
ao_tc_sym_two_e_pot = ao_tc_sym_two_e_pot + coef4 * integral
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
deallocate (schwartz_kl)
|
||||
|
||||
end
|
||||
|
||||
|
||||
double precision function general_primitive_integral_gauss(dim, &
|
||||
P_new,P_center,fact_p,p,p_inv,iorder_p, &
|
||||
Q_new,Q_center,fact_q,q,q_inv,iorder_q)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Computes the integral <pq|rs> where p,q,r,s are Gaussian primitives
|
||||
END_DOC
|
||||
integer,intent(in) :: dim
|
||||
include 'utils/constants.include.F'
|
||||
double precision, intent(in) :: P_new(0:max_dim,3),P_center(3),fact_p,p,p_inv
|
||||
double precision, intent(in) :: Q_new(0:max_dim,3),Q_center(3),fact_q,q,q_inv
|
||||
integer, intent(in) :: iorder_p(3)
|
||||
integer, intent(in) :: iorder_q(3)
|
||||
|
||||
double precision :: r_cut,gama_r_cut,rho,dist
|
||||
double precision :: dx(0:max_dim),Ix_pol(0:max_dim),dy(0:max_dim),Iy_pol(0:max_dim),dz(0:max_dim),Iz_pol(0:max_dim)
|
||||
integer :: n_Ix,n_Iy,n_Iz,nx,ny,nz
|
||||
double precision :: bla
|
||||
integer :: ix,iy,iz,jx,jy,jz,i
|
||||
double precision :: a,b,c,d,e,f,accu,pq,const
|
||||
double precision :: pq_inv, p10_1, p10_2, p01_1, p01_2,pq_inv_2
|
||||
integer :: n_pt_tmp,n_pt_out, iorder
|
||||
double precision :: d1(0:max_dim),d_poly(0:max_dim),rint,d1_screened(0:max_dim)
|
||||
double precision :: thr
|
||||
|
||||
thr = ao_integrals_threshold
|
||||
|
||||
general_primitive_integral_gauss = 0.d0
|
||||
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: dx,Ix_pol,dy,Iy_pol,dz,Iz_pol
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: d1, d_poly
|
||||
|
||||
! Gaussian Product
|
||||
! ----------------
|
||||
|
||||
pq = p_inv*0.5d0*q_inv
|
||||
pq_inv = 0.5d0/(p+q)
|
||||
p10_1 = q*pq ! 1/(2p)
|
||||
p01_1 = p*pq ! 1/(2q)
|
||||
pq_inv_2 = pq_inv+pq_inv
|
||||
p10_2 = pq_inv_2 * p10_1*q !0.5d0*q/(pq + p*p)
|
||||
p01_2 = pq_inv_2 * p01_1*p !0.5d0*p/(q*q + pq)
|
||||
|
||||
|
||||
accu = 0.d0
|
||||
iorder = iorder_p(1)+iorder_q(1)+iorder_p(1)+iorder_q(1)
|
||||
do ix=0,iorder
|
||||
Ix_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Ix = 0
|
||||
do ix = 0, iorder_p(1)
|
||||
if (abs(P_new(ix,1)) < thr) cycle
|
||||
a = P_new(ix,1)
|
||||
do jx = 0, iorder_q(1)
|
||||
d = a*Q_new(jx,1)
|
||||
if (abs(d) < thr) cycle
|
||||
!DIR$ FORCEINLINE
|
||||
call give_polynom_mult_center_x(P_center(1),Q_center(1),ix,jx,p,q,iorder,pq_inv,pq_inv_2,p10_1,p01_1,p10_2,p01_2,dx,nx)
|
||||
!DIR$ FORCEINLINE
|
||||
call add_poly_multiply(dx,nx,d,Ix_pol,n_Ix)
|
||||
enddo
|
||||
enddo
|
||||
if (n_Ix == -1) then
|
||||
return
|
||||
endif
|
||||
iorder = iorder_p(2)+iorder_q(2)+iorder_p(2)+iorder_q(2)
|
||||
do ix=0, iorder
|
||||
Iy_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iy = 0
|
||||
do iy = 0, iorder_p(2)
|
||||
if (abs(P_new(iy,2)) > thr) then
|
||||
b = P_new(iy,2)
|
||||
do jy = 0, iorder_q(2)
|
||||
e = b*Q_new(jy,2)
|
||||
if (abs(e) < thr) cycle
|
||||
!DIR$ FORCEINLINE
|
||||
call give_polynom_mult_center_x(P_center(2),Q_center(2),iy,jy,p,q,iorder,pq_inv,pq_inv_2,p10_1,p01_1,p10_2,p01_2,dy,ny)
|
||||
!DIR$ FORCEINLINE
|
||||
call add_poly_multiply(dy,ny,e,Iy_pol,n_Iy)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if (n_Iy == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
iorder = iorder_p(3)+iorder_q(3)+iorder_p(3)+iorder_q(3)
|
||||
do ix=0,iorder
|
||||
Iz_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iz = 0
|
||||
do iz = 0, iorder_p(3)
|
||||
if (abs(P_new(iz,3)) > thr) then
|
||||
c = P_new(iz,3)
|
||||
do jz = 0, iorder_q(3)
|
||||
f = c*Q_new(jz,3)
|
||||
if (abs(f) < thr) cycle
|
||||
!DIR$ FORCEINLINE
|
||||
call give_polynom_mult_center_x(P_center(3),Q_center(3),iz,jz,p,q,iorder,pq_inv,pq_inv_2,p10_1,p01_1,p10_2,p01_2,dz,nz)
|
||||
!DIR$ FORCEINLINE
|
||||
call add_poly_multiply(dz,nz,f,Iz_pol,n_Iz)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if (n_Iz == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
rho = p*q *pq_inv_2
|
||||
dist = (P_center(1) - Q_center(1))*(P_center(1) - Q_center(1)) + &
|
||||
(P_center(2) - Q_center(2))*(P_center(2) - Q_center(2)) + &
|
||||
(P_center(3) - Q_center(3))*(P_center(3) - Q_center(3))
|
||||
const = dist*rho
|
||||
|
||||
n_pt_tmp = n_Ix+n_Iy
|
||||
do i=0,n_pt_tmp
|
||||
d_poly(i)=0.d0
|
||||
enddo
|
||||
|
||||
!DIR$ FORCEINLINE
|
||||
call multiply_poly(Ix_pol,n_Ix,Iy_pol,n_Iy,d_poly,n_pt_tmp)
|
||||
if (n_pt_tmp == -1) then
|
||||
return
|
||||
endif
|
||||
n_pt_out = n_pt_tmp+n_Iz
|
||||
do i=0,n_pt_out
|
||||
d1(i)=0.d0
|
||||
enddo
|
||||
|
||||
!DIR$ FORCEINLINE
|
||||
call multiply_poly(d_poly ,n_pt_tmp ,Iz_pol,n_Iz,d1,n_pt_out)
|
||||
|
||||
double precision :: aa,c_a,t_a,rho_old,w_a,pi_3,prefactor,inv_pq_3_2
|
||||
double precision :: gauss_int
|
||||
integer :: m
|
||||
gauss_int = 0.d0
|
||||
pi_3 = pi*pi*pi
|
||||
inv_pq_3_2 = (p_inv * q_inv)**(1.5d0)
|
||||
rho_old = (p*q)/(p+q)
|
||||
prefactor = pi_3 * inv_pq_3_2 * fact_p * fact_q
|
||||
do i = 1, n_gauss_eff_pot ! browse the gaussians with different expo/coef
|
||||
!do i = 1, n_gauss_eff_pot-1
|
||||
aa = expo_gauss_eff_pot(i)
|
||||
c_a = coef_gauss_eff_pot(i)
|
||||
t_a = dsqrt( aa /(rho_old + aa) )
|
||||
w_a = dexp(-t_a*t_a*rho_old*dist)
|
||||
accu = 0.d0
|
||||
! evaluation of the polynom Ix(t_a) * Iy(t_a) * Iz(t_a)
|
||||
do m = 0, n_pt_out,2
|
||||
accu += d1(m) * (t_a)**(dble(m))
|
||||
enddo
|
||||
! equation A8 of PRA-70-062505 (2004) of Toul. Col. Sav.
|
||||
gauss_int = gauss_int + c_a * prefactor * (1.d0 - t_a*t_a)**(1.5d0) * w_a * accu
|
||||
enddo
|
||||
|
||||
general_primitive_integral_gauss = gauss_int
|
||||
end
|
||||
|
||||
subroutine compute_ao_integrals_gauss_jl(j,l,n_integrals,buffer_i,buffer_value)
|
||||
implicit none
|
||||
use map_module
|
||||
BEGIN_DOC
|
||||
! Parallel client for AO integrals
|
||||
END_DOC
|
||||
|
||||
integer, intent(in) :: j,l
|
||||
integer,intent(out) :: n_integrals
|
||||
integer(key_kind),intent(out) :: buffer_i(ao_num*ao_num)
|
||||
real(integral_kind),intent(out) :: buffer_value(ao_num*ao_num)
|
||||
|
||||
integer :: i,k
|
||||
double precision :: cpu_1,cpu_2, wall_1, wall_2
|
||||
double precision :: integral, wall_0
|
||||
double precision :: thr,ao_tc_sym_two_e_pot
|
||||
integer :: kk, m, j1, i1
|
||||
logical, external :: ao_two_e_integral_zero
|
||||
|
||||
thr = ao_integrals_threshold
|
||||
|
||||
n_integrals = 0
|
||||
|
||||
j1 = j+ishft(l*l-l,-1)
|
||||
do k = 1, ao_num ! r1
|
||||
i1 = ishft(k*k-k,-1)
|
||||
if (i1 > j1) then
|
||||
exit
|
||||
endif
|
||||
do i = 1, k
|
||||
i1 += 1
|
||||
if (i1 > j1) then
|
||||
exit
|
||||
endif
|
||||
! if (ao_two_e_integral_zero(i,j,k,l)) then
|
||||
if (.False.) then
|
||||
cycle
|
||||
endif
|
||||
if (ao_two_e_integral_erf_schwartz(i,k)*ao_two_e_integral_erf_schwartz(j,l) < thr ) then
|
||||
cycle
|
||||
endif
|
||||
!DIR$ FORCEINLINE
|
||||
integral = ao_tc_sym_two_e_pot(i,k,j,l) ! i,k : r1 j,l : r2
|
||||
if (abs(integral) < thr) then
|
||||
cycle
|
||||
endif
|
||||
n_integrals += 1
|
||||
!DIR$ FORCEINLINE
|
||||
call two_e_integrals_index(i,j,k,l,buffer_i(n_integrals))
|
||||
buffer_value(n_integrals) = integral
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end
|
364
src/ao_tc_eff_map/useful_sub.irp.f
Normal file
364
src/ao_tc_eff_map/useful_sub.irp.f
Normal file
|
@ -0,0 +1,364 @@
|
|||
! ---
|
||||
|
||||
!______________________________________________________________________________________________________________________
|
||||
!______________________________________________________________________________________________________________________
|
||||
|
||||
double precision function general_primitive_integral_coul_shifted( dim &
|
||||
, P_new, P_center, fact_p, p, p_inv, iorder_p, shift_P &
|
||||
, Q_new, Q_center, fact_q, q, q_inv, iorder_q, shift_Q )
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: dim
|
||||
integer, intent(in) :: iorder_p(3), shift_P(3)
|
||||
integer, intent(in) :: iorder_q(3), shift_Q(3)
|
||||
double precision, intent(in) :: P_new(0:max_dim,3), P_center(3), fact_p, p, p_inv
|
||||
double precision, intent(in) :: Q_new(0:max_dim,3), Q_center(3), fact_q, q, q_inv
|
||||
|
||||
integer :: n_Ix, n_Iy, n_Iz, nx, ny, nz
|
||||
integer :: ix, iy, iz, jx, jy, jz, i
|
||||
integer :: n_pt_tmp, n_pt_out, iorder
|
||||
integer :: ii, jj
|
||||
double precision :: rho, dist
|
||||
double precision :: dx(0:max_dim), Ix_pol(0:max_dim)
|
||||
double precision :: dy(0:max_dim), Iy_pol(0:max_dim)
|
||||
double precision :: dz(0:max_dim), Iz_pol(0:max_dim)
|
||||
double precision :: a, b, c, d, e, f, accu, pq, const
|
||||
double precision :: pq_inv, p10_1, p10_2, p01_1, p01_2, pq_inv_2
|
||||
double precision :: d1(0:max_dim), d_poly(0:max_dim)
|
||||
double precision :: p_plus_q
|
||||
|
||||
double precision :: rint_sum
|
||||
|
||||
general_primitive_integral_coul_shifted = 0.d0
|
||||
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: dx, Ix_pol, dy, Iy_pol, dz, Iz_pol
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: d1, d_poly
|
||||
|
||||
! Gaussian Product
|
||||
! ----------------
|
||||
p_plus_q = (p+q)
|
||||
pq = p_inv * 0.5d0 * q_inv
|
||||
pq_inv = 0.5d0 / p_plus_q
|
||||
p10_1 = q * pq ! 1/(2p)
|
||||
p01_1 = p * pq ! 1/(2q)
|
||||
pq_inv_2 = pq_inv + pq_inv
|
||||
p10_2 = pq_inv_2 * p10_1 * q ! 0.5d0 * q / (pq + p*p)
|
||||
p01_2 = pq_inv_2 * p01_1 * p ! 0.5d0 * p / (q*q + pq)
|
||||
|
||||
accu = 0.d0
|
||||
|
||||
iorder = iorder_p(1) + iorder_q(1) + iorder_p(1) + iorder_q(1)
|
||||
iorder = iorder + shift_P(1) + shift_Q(1)
|
||||
iorder = iorder + shift_P(1) + shift_Q(1)
|
||||
!DIR$ VECTOR ALIGNED
|
||||
do ix = 0, iorder
|
||||
Ix_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Ix = 0
|
||||
do ix = 0, iorder_p(1)
|
||||
|
||||
ii = ix + shift_P(1)
|
||||
a = P_new(ix,1)
|
||||
if(abs(a) < thresh) cycle
|
||||
|
||||
do jx = 0, iorder_q(1)
|
||||
|
||||
jj = jx + shift_Q(1)
|
||||
d = a * Q_new(jx,1)
|
||||
if(abs(d) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(1), Q_center(1), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dx, nx )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dx, nx, d, Ix_pol, n_Ix)
|
||||
enddo
|
||||
enddo
|
||||
if(n_Ix == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
iorder = iorder_p(2) + iorder_q(2) + iorder_p(2) + iorder_q(2)
|
||||
iorder = iorder + shift_P(2) + shift_Q(2)
|
||||
iorder = iorder + shift_P(2) + shift_Q(2)
|
||||
!DIR$ VECTOR ALIGNED
|
||||
do ix = 0, iorder
|
||||
Iy_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iy = 0
|
||||
do iy = 0, iorder_p(2)
|
||||
|
||||
if(abs(P_new(iy,2)) > thresh) then
|
||||
|
||||
ii = iy + shift_P(2)
|
||||
b = P_new(iy,2)
|
||||
|
||||
do jy = 0, iorder_q(2)
|
||||
|
||||
jj = jy + shift_Q(2)
|
||||
e = b * Q_new(jy,2)
|
||||
if(abs(e) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(2), Q_center(2), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dy, ny )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dy, ny, e, Iy_pol, n_Iy)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if(n_Iy == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
iorder = iorder_p(3) + iorder_q(3) + iorder_p(3) + iorder_q(3)
|
||||
iorder = iorder + shift_P(3) + shift_Q(3)
|
||||
iorder = iorder + shift_P(3) + shift_Q(3)
|
||||
do ix = 0, iorder
|
||||
Iz_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iz = 0
|
||||
do iz = 0, iorder_p(3)
|
||||
|
||||
if( abs(P_new(iz,3)) > thresh ) then
|
||||
|
||||
ii = iz + shift_P(3)
|
||||
c = P_new(iz,3)
|
||||
|
||||
do jz = 0, iorder_q(3)
|
||||
|
||||
jj = jz + shift_Q(3)
|
||||
f = c * Q_new(jz,3)
|
||||
if(abs(f) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(3), Q_center(3), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dz, nz )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dz, nz, f, Iz_pol, n_Iz)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if(n_Iz == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
rho = p * q * pq_inv_2
|
||||
dist = (P_center(1) - Q_center(1)) * (P_center(1) - Q_center(1)) &
|
||||
+ (P_center(2) - Q_center(2)) * (P_center(2) - Q_center(2)) &
|
||||
+ (P_center(3) - Q_center(3)) * (P_center(3) - Q_center(3))
|
||||
const = dist*rho
|
||||
|
||||
n_pt_tmp = n_Ix + n_Iy
|
||||
do i = 0, n_pt_tmp
|
||||
d_poly(i) = 0.d0
|
||||
enddo
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call multiply_poly(Ix_pol, n_Ix, Iy_pol, n_Iy, d_poly, n_pt_tmp)
|
||||
if(n_pt_tmp == -1) then
|
||||
return
|
||||
endif
|
||||
n_pt_out = n_pt_tmp + n_Iz
|
||||
do i = 0, n_pt_out
|
||||
d1(i) = 0.d0
|
||||
enddo
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call multiply_poly(d_poly, n_pt_tmp, Iz_pol, n_Iz, d1, n_pt_out)
|
||||
accu = accu + rint_sum(n_pt_out, const, d1)
|
||||
|
||||
general_primitive_integral_coul_shifted = fact_p * fact_q * accu * pi_5_2 * p_inv * q_inv / dsqrt(p_plus_q)
|
||||
|
||||
return
|
||||
end function general_primitive_integral_coul_shifted
|
||||
!______________________________________________________________________________________________________________________
|
||||
!______________________________________________________________________________________________________________________
|
||||
|
||||
|
||||
|
||||
!______________________________________________________________________________________________________________________
|
||||
!______________________________________________________________________________________________________________________
|
||||
|
||||
double precision function general_primitive_integral_erf_shifted( dim &
|
||||
, P_new, P_center, fact_p, p, p_inv, iorder_p, shift_P &
|
||||
, Q_new, Q_center, fact_q, q, q_inv, iorder_q, shift_Q )
|
||||
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: dim
|
||||
integer, intent(in) :: iorder_p(3), shift_P(3)
|
||||
integer, intent(in) :: iorder_q(3), shift_Q(3)
|
||||
double precision, intent(in) :: P_new(0:max_dim,3), P_center(3), fact_p, p, p_inv
|
||||
double precision, intent(in) :: Q_new(0:max_dim,3), Q_center(3), fact_q, q, q_inv
|
||||
|
||||
integer :: n_Ix, n_Iy, n_Iz, nx, ny, nz
|
||||
integer :: ix, iy, iz, jx, jy, jz, i
|
||||
integer :: n_pt_tmp, n_pt_out, iorder
|
||||
integer :: ii, jj
|
||||
double precision :: rho, dist
|
||||
double precision :: dx(0:max_dim), Ix_pol(0:max_dim)
|
||||
double precision :: dy(0:max_dim), Iy_pol(0:max_dim)
|
||||
double precision :: dz(0:max_dim), Iz_pol(0:max_dim)
|
||||
double precision :: a, b, c, d, e, f, accu, pq, const
|
||||
double precision :: pq_inv, p10_1, p10_2, p01_1, p01_2, pq_inv_2
|
||||
double precision :: d1(0:max_dim), d_poly(0:max_dim)
|
||||
double precision :: p_plus_q
|
||||
|
||||
double precision :: rint_sum
|
||||
|
||||
general_primitive_integral_erf_shifted = 0.d0
|
||||
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: dx, Ix_pol, dy, Iy_pol, dz, Iz_pol
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: d1, d_poly
|
||||
|
||||
! Gaussian Product
|
||||
! ----------------
|
||||
p_plus_q = (p+q) * ( (p*q)/(p+q) + mu_erf*mu_erf ) / (mu_erf*mu_erf)
|
||||
pq = p_inv * 0.5d0 * q_inv
|
||||
pq_inv = 0.5d0 / p_plus_q
|
||||
p10_1 = q * pq ! 1/(2p)
|
||||
p01_1 = p * pq ! 1/(2q)
|
||||
pq_inv_2 = pq_inv + pq_inv
|
||||
p10_2 = pq_inv_2 * p10_1 * q ! 0.5d0 * q / (pq + p*p)
|
||||
p01_2 = pq_inv_2 * p01_1 * p ! 0.5d0 * p / (q*q + pq)
|
||||
|
||||
accu = 0.d0
|
||||
|
||||
iorder = iorder_p(1) + iorder_q(1) + iorder_p(1) + iorder_q(1)
|
||||
iorder = iorder + shift_P(1) + shift_Q(1)
|
||||
iorder = iorder + shift_P(1) + shift_Q(1)
|
||||
!DIR$ VECTOR ALIGNED
|
||||
do ix = 0, iorder
|
||||
Ix_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Ix = 0
|
||||
do ix = 0, iorder_p(1)
|
||||
|
||||
ii = ix + shift_P(1)
|
||||
a = P_new(ix,1)
|
||||
if(abs(a) < thresh) cycle
|
||||
|
||||
do jx = 0, iorder_q(1)
|
||||
|
||||
jj = jx + shift_Q(1)
|
||||
d = a * Q_new(jx,1)
|
||||
if(abs(d) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(1), Q_center(1), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dx, nx )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dx, nx, d, Ix_pol, n_Ix)
|
||||
enddo
|
||||
enddo
|
||||
if(n_Ix == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
iorder = iorder_p(2) + iorder_q(2) + iorder_p(2) + iorder_q(2)
|
||||
iorder = iorder + shift_P(2) + shift_Q(2)
|
||||
iorder = iorder + shift_P(2) + shift_Q(2)
|
||||
!DIR$ VECTOR ALIGNED
|
||||
do ix = 0, iorder
|
||||
Iy_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iy = 0
|
||||
do iy = 0, iorder_p(2)
|
||||
|
||||
if(abs(P_new(iy,2)) > thresh) then
|
||||
|
||||
ii = iy + shift_P(2)
|
||||
b = P_new(iy,2)
|
||||
|
||||
do jy = 0, iorder_q(2)
|
||||
|
||||
jj = jy + shift_Q(2)
|
||||
e = b * Q_new(jy,2)
|
||||
if(abs(e) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(2), Q_center(2), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dy, ny )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dy, ny, e, Iy_pol, n_Iy)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if(n_Iy == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
iorder = iorder_p(3) + iorder_q(3) + iorder_p(3) + iorder_q(3)
|
||||
iorder = iorder + shift_P(3) + shift_Q(3)
|
||||
iorder = iorder + shift_P(3) + shift_Q(3)
|
||||
do ix = 0, iorder
|
||||
Iz_pol(ix) = 0.d0
|
||||
enddo
|
||||
n_Iz = 0
|
||||
do iz = 0, iorder_p(3)
|
||||
|
||||
if( abs(P_new(iz,3)) > thresh ) then
|
||||
|
||||
ii = iz + shift_P(3)
|
||||
c = P_new(iz,3)
|
||||
|
||||
do jz = 0, iorder_q(3)
|
||||
|
||||
jj = jz + shift_Q(3)
|
||||
f = c * Q_new(jz,3)
|
||||
if(abs(f) < thresh) cycle
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call give_polynom_mult_center_x( P_center(3), Q_center(3), ii, jj &
|
||||
, p, q, iorder, pq_inv, pq_inv_2, p10_1, p01_1, p10_2, p01_2, dz, nz )
|
||||
!DEC$ FORCEINLINE
|
||||
call add_poly_multiply(dz, nz, f, Iz_pol, n_Iz)
|
||||
enddo
|
||||
endif
|
||||
enddo
|
||||
if(n_Iz == -1) then
|
||||
return
|
||||
endif
|
||||
|
||||
rho = p * q * pq_inv_2
|
||||
dist = (P_center(1) - Q_center(1)) * (P_center(1) - Q_center(1)) &
|
||||
+ (P_center(2) - Q_center(2)) * (P_center(2) - Q_center(2)) &
|
||||
+ (P_center(3) - Q_center(3)) * (P_center(3) - Q_center(3))
|
||||
const = dist*rho
|
||||
|
||||
n_pt_tmp = n_Ix + n_Iy
|
||||
do i = 0, n_pt_tmp
|
||||
d_poly(i) = 0.d0
|
||||
enddo
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call multiply_poly(Ix_pol, n_Ix, Iy_pol, n_Iy, d_poly, n_pt_tmp)
|
||||
if(n_pt_tmp == -1) then
|
||||
return
|
||||
endif
|
||||
n_pt_out = n_pt_tmp + n_Iz
|
||||
do i = 0, n_pt_out
|
||||
d1(i) = 0.d0
|
||||
enddo
|
||||
|
||||
!DEC$ FORCEINLINE
|
||||
call multiply_poly(d_poly, n_pt_tmp, Iz_pol, n_Iz, d1, n_pt_out)
|
||||
accu = accu + rint_sum(n_pt_out, const, d1)
|
||||
|
||||
general_primitive_integral_erf_shifted = fact_p * fact_q * accu * pi_5_2 * p_inv * q_inv / dsqrt(p_plus_q)
|
||||
|
||||
return
|
||||
end function general_primitive_integral_erf_shifted
|
||||
!______________________________________________________________________________________________________________________
|
||||
!______________________________________________________________________________________________________________________
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -4,13 +4,6 @@ doc: Read/Write |AO| integrals from/to disk [ Write | Read | None ]
|
|||
interface: ezfio,provider,ocaml
|
||||
default: None
|
||||
|
||||
[ao_integrals_threshold]
|
||||
type: Threshold
|
||||
doc: If | (pq|rs) | < `ao_integrals_threshold` then (pq|rs) is zero
|
||||
interface: ezfio,provider,ocaml
|
||||
default: 1.e-15
|
||||
ezfio_name: threshold_ao
|
||||
|
||||
[do_direct_integrals]
|
||||
type: logical
|
||||
doc: Compute integrals on the fly (very slow, only for debugging)
|
||||
|
|
|
@ -321,14 +321,15 @@ BEGIN_PROVIDER [ double precision, ao_integrals_cache, (0:64*64*64*64) ]
|
|||
!$OMP END PARALLEL DO
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
double precision function get_ao_two_e_integral(i,j,k,l,map) result(result)
|
||||
double precision function get_ao_two_e_integral(i, j, k, l, map) result(result)
|
||||
use map_module
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Gets one AO bi-electronic integral from the AO map
|
||||
! Gets one AO bi-electronic integral from the AO map in PHYSICIST NOTATION
|
||||
!
|
||||
! i,j,k,l in physicist notation <ij|kl>
|
||||
! <1:k, 2:l |1:i, 2:j>
|
||||
END_DOC
|
||||
integer, intent(in) :: i,j,k,l
|
||||
integer(key_kind) :: idx
|
||||
|
|
|
@ -1,108 +1,132 @@
|
|||
double precision function ao_two_e_integral(i,j,k,l)
|
||||
implicit none
|
||||
|
||||
! ---
|
||||
|
||||
double precision function ao_two_e_integral(i, j, k, l)
|
||||
|
||||
BEGIN_DOC
|
||||
! integral of the AO basis <ik|jl> or (ij|kl)
|
||||
! i(r1) j(r1) 1/r12 k(r2) l(r2)
|
||||
END_DOC
|
||||
|
||||
integer,intent(in) :: i,j,k,l
|
||||
integer :: p,q,r,s
|
||||
double precision :: I_center(3),J_center(3),K_center(3),L_center(3)
|
||||
integer :: num_i,num_j,num_k,num_l,dim1,I_power(3),J_power(3),K_power(3),L_power(3)
|
||||
double precision :: integral
|
||||
implicit none
|
||||
include 'utils/constants.include.F'
|
||||
|
||||
integer, intent(in) :: i, j, k, l
|
||||
|
||||
integer :: p, q, r, s
|
||||
integer :: num_i,num_j,num_k,num_l,dim1,I_power(3),J_power(3),K_power(3),L_power(3)
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
double precision :: I_center(3), J_center(3), K_center(3), L_center(3)
|
||||
double precision :: integral
|
||||
double precision :: P_new(0:max_dim,3),P_center(3),fact_p,pp
|
||||
double precision :: Q_new(0:max_dim,3),Q_center(3),fact_q,qq
|
||||
integer :: iorder_p(3), iorder_q(3)
|
||||
|
||||
double precision :: ao_two_e_integral_schwartz_accel
|
||||
|
||||
if (ao_prim_num(i) * ao_prim_num(j) * ao_prim_num(k) * ao_prim_num(l) > 1024 ) then
|
||||
ao_two_e_integral = ao_two_e_integral_schwartz_accel(i,j,k,l)
|
||||
else
|
||||
double precision :: ao_two_e_integral_cosgtos
|
||||
|
||||
dim1 = n_pt_max_integrals
|
||||
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
ao_two_e_integral = 0.d0
|
||||
if(use_cosgtos) then
|
||||
!print *, ' use_cosgtos for ao_two_e_integral ?', use_cosgtos
|
||||
|
||||
if (num_i /= num_j .or. num_k /= num_l .or. num_j /= num_k)then
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
ao_two_e_integral = ao_two_e_integral_cosgtos(i, j, k, l)
|
||||
|
||||
double precision :: coef1, coef2, coef3, coef4
|
||||
double precision :: p_inv,q_inv
|
||||
double precision :: general_primitive_integral
|
||||
else
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p,i)
|
||||
do q = 1, ao_prim_num(j)
|
||||
coef2 = coef1*ao_coef_normalized_ordered_transp(q,j)
|
||||
call give_explicit_poly_and_gaussian(P_new,P_center,pp,fact_p,iorder_p,&
|
||||
ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j), &
|
||||
I_power,J_power,I_center,J_center,dim1)
|
||||
p_inv = 1.d0/pp
|
||||
do r = 1, ao_prim_num(k)
|
||||
coef3 = coef2*ao_coef_normalized_ordered_transp(r,k)
|
||||
do s = 1, ao_prim_num(l)
|
||||
coef4 = coef3*ao_coef_normalized_ordered_transp(s,l)
|
||||
call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q,&
|
||||
ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l), &
|
||||
K_power,L_power,K_center,L_center,dim1)
|
||||
q_inv = 1.d0/qq
|
||||
integral = general_primitive_integral(dim1, &
|
||||
P_new,P_center,fact_p,pp,p_inv,iorder_p, &
|
||||
Q_new,Q_center,fact_q,qq,q_inv,iorder_q)
|
||||
ao_two_e_integral = ao_two_e_integral + coef4 * integral
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
if (ao_prim_num(i) * ao_prim_num(j) * ao_prim_num(k) * ao_prim_num(l) > 1024 ) then
|
||||
|
||||
ao_two_e_integral = ao_two_e_integral_schwartz_accel(i,j,k,l)
|
||||
|
||||
else
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
enddo
|
||||
double precision :: ERI
|
||||
dim1 = n_pt_max_integrals
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p,i)
|
||||
do q = 1, ao_prim_num(j)
|
||||
coef2 = coef1*ao_coef_normalized_ordered_transp(q,j)
|
||||
do r = 1, ao_prim_num(k)
|
||||
coef3 = coef2*ao_coef_normalized_ordered_transp(r,k)
|
||||
do s = 1, ao_prim_num(l)
|
||||
coef4 = coef3*ao_coef_normalized_ordered_transp(s,l)
|
||||
integral = ERI( &
|
||||
ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j),ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l),&
|
||||
I_power(1),J_power(1),K_power(1),L_power(1), &
|
||||
I_power(2),J_power(2),K_power(2),L_power(2), &
|
||||
I_power(3),J_power(3),K_power(3),L_power(3))
|
||||
ao_two_e_integral = ao_two_e_integral + coef4 * integral
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
num_i = ao_nucl(i)
|
||||
num_j = ao_nucl(j)
|
||||
num_k = ao_nucl(k)
|
||||
num_l = ao_nucl(l)
|
||||
ao_two_e_integral = 0.d0
|
||||
|
||||
if (num_i /= num_j .or. num_k /= num_l .or. num_j /= num_k)then
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
I_center(p) = nucl_coord(num_i,p)
|
||||
J_center(p) = nucl_coord(num_j,p)
|
||||
K_center(p) = nucl_coord(num_k,p)
|
||||
L_center(p) = nucl_coord(num_l,p)
|
||||
enddo
|
||||
|
||||
double precision :: coef1, coef2, coef3, coef4
|
||||
double precision :: p_inv,q_inv
|
||||
double precision :: general_primitive_integral
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p,i)
|
||||
do q = 1, ao_prim_num(j)
|
||||
coef2 = coef1*ao_coef_normalized_ordered_transp(q,j)
|
||||
call give_explicit_poly_and_gaussian(P_new,P_center,pp,fact_p,iorder_p,&
|
||||
ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j), &
|
||||
I_power,J_power,I_center,J_center,dim1)
|
||||
p_inv = 1.d0/pp
|
||||
do r = 1, ao_prim_num(k)
|
||||
coef3 = coef2*ao_coef_normalized_ordered_transp(r,k)
|
||||
do s = 1, ao_prim_num(l)
|
||||
coef4 = coef3*ao_coef_normalized_ordered_transp(s,l)
|
||||
call give_explicit_poly_and_gaussian(Q_new,Q_center,qq,fact_q,iorder_q,&
|
||||
ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l), &
|
||||
K_power,L_power,K_center,L_center,dim1)
|
||||
q_inv = 1.d0/qq
|
||||
integral = general_primitive_integral(dim1, &
|
||||
P_new,P_center,fact_p,pp,p_inv,iorder_p, &
|
||||
Q_new,Q_center,fact_q,qq,q_inv,iorder_q)
|
||||
ao_two_e_integral = ao_two_e_integral + coef4 * integral
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
else
|
||||
|
||||
do p = 1, 3
|
||||
I_power(p) = ao_power(i,p)
|
||||
J_power(p) = ao_power(j,p)
|
||||
K_power(p) = ao_power(k,p)
|
||||
L_power(p) = ao_power(l,p)
|
||||
enddo
|
||||
double precision :: ERI
|
||||
|
||||
do p = 1, ao_prim_num(i)
|
||||
coef1 = ao_coef_normalized_ordered_transp(p,i)
|
||||
do q = 1, ao_prim_num(j)
|
||||
coef2 = coef1*ao_coef_normalized_ordered_transp(q,j)
|
||||
do r = 1, ao_prim_num(k)
|
||||
coef3 = coef2*ao_coef_normalized_ordered_transp(r,k)
|
||||
do s = 1, ao_prim_num(l)
|
||||
coef4 = coef3*ao_coef_normalized_ordered_transp(s,l)
|
||||
integral = ERI( &
|
||||
ao_expo_ordered_transp(p,i),ao_expo_ordered_transp(q,j),ao_expo_ordered_transp(r,k),ao_expo_ordered_transp(s,l),&
|
||||
I_power(1),J_power(1),K_power(1),L_power(1), &
|
||||
I_power(2),J_power(2),K_power(2),L_power(2), &
|
||||
I_power(3),J_power(3),K_power(3),L_power(3))
|
||||
ao_two_e_integral = ao_two_e_integral + coef4 * integral
|
||||
enddo ! s
|
||||
enddo ! r
|
||||
enddo ! q
|
||||
enddo ! p
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
end
|
||||
|
||||
! ---
|
||||
|
||||
double precision function ao_two_e_integral_schwartz_accel(i,j,k,l)
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
|
@ -420,14 +444,17 @@ BEGIN_PROVIDER [ logical, ao_two_e_integrals_in_map ]
|
|||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_two_e_integral_schwartz,(ao_num,ao_num) ]
|
||||
implicit none
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_two_e_integral_schwartz, (ao_num, ao_num) ]
|
||||
|
||||
BEGIN_DOC
|
||||
! Needed to compute Schwartz inequalities
|
||||
END_DOC
|
||||
|
||||
integer :: i,k
|
||||
double precision :: ao_two_e_integral,cpu_1,cpu_2, wall_1, wall_2
|
||||
implicit none
|
||||
integer :: i, k
|
||||
double precision :: ao_two_e_integral,cpu_1,cpu_2, wall_1, wall_2
|
||||
|
||||
ao_two_e_integral_schwartz(1,1) = ao_two_e_integral(1,1,1,1)
|
||||
!$OMP PARALLEL DO PRIVATE(i,k) &
|
||||
|
@ -444,6 +471,7 @@ BEGIN_PROVIDER [ double precision, ao_two_e_integral_schwartz,(ao_num,ao_num) ]
|
|||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
double precision function general_primitive_integral(dim, &
|
||||
P_new,P_center,fact_p,p,p_inv,iorder_p, &
|
||||
|
|
57
src/basis_correction/pbe_ueg_self_contained.irp.f
Normal file
57
src/basis_correction/pbe_ueg_self_contained.irp.f
Normal file
|
@ -0,0 +1,57 @@
|
|||
double precision function ecmd_pbe_ueg_self_cont(dens,spin_pol,mu,e_PBE)
|
||||
implicit none
|
||||
! dens = total density
|
||||
! spin_pol = spin_polarization (n_a - n_b)/dens
|
||||
! e_PBE = PBE correlation (mu=0) energy evaluated at dens,spin_pol (and grad_rho)
|
||||
! e_PBE = epsilon_PBE * dens which means that it is not the energy density but the energy density X the density
|
||||
double precision, intent(in) :: dens,spin_pol,mu,e_PBE
|
||||
double precision :: rho_a,rho_b,pi,g0_UEG_func,denom,beta
|
||||
pi = dacos(-1.d0)
|
||||
rho_a = (dens * spin_pol + dens)*0.5d0
|
||||
rho_b = (dens - dens * spin_pol)*0.5d0
|
||||
if(mu == 0.d0) then
|
||||
ecmd_pbe_ueg_self_cont = e_PBE
|
||||
else
|
||||
! note: the on-top pair density is (1-zeta^2) rhoc^2 g0 = 4 rhoa * rhob * g0
|
||||
denom = (-2.d0+sqrt(2d0))*sqrt(2.d0*pi) * 4.d0*rho_a*rho_b*g0_UEG_func(rho_a,rho_b)
|
||||
if (dabs(denom) > 1.d-12) then
|
||||
beta = (3.d0*e_PBE)/denom
|
||||
ecmd_pbe_ueg_self_cont=e_PBE/(1.d0+beta*mu**3)
|
||||
else
|
||||
ecmd_pbe_ueg_self_cont=0.d0
|
||||
endif
|
||||
endif
|
||||
end
|
||||
|
||||
double precision function g0_UEG_func(rho_a,rho_b)
|
||||
! Pair distribution function g0(n_alpha,n_beta) of the Colombic UEG
|
||||
!
|
||||
! Taken from Eq. (46) P. Gori-Giorgi and A. Savin, Phys. Rev. A 73, 032506 (2006).
|
||||
implicit none
|
||||
double precision, intent(in) :: rho_a,rho_b
|
||||
double precision :: rho,pi,x
|
||||
double precision :: B, C, D, E, d2, rs, ahd
|
||||
rho = rho_a+rho_b
|
||||
pi = 4d0 * datan(1d0)
|
||||
ahd = -0.36583d0
|
||||
d2 = 0.7524d0
|
||||
B = -2d0 * ahd - d2
|
||||
C = 0.08193d0
|
||||
D = -0.01277d0
|
||||
E = 0.001859d0
|
||||
x = -d2*rs
|
||||
if (dabs(rho) > 1.d-20) then
|
||||
rs = (3d0 / (4d0*pi*rho))**(1d0/3d0)
|
||||
x = -d2*rs
|
||||
if(dabs(x).lt.50.d0)then
|
||||
g0_UEG_func= 0.5d0 * (1d0+ rs* (-B + rs*(C + rs*(D + rs*E))))*dexp(x)
|
||||
else
|
||||
g0_UEG_func= 0.d0
|
||||
endif
|
||||
else
|
||||
g0_UEG_func= 0.d0
|
||||
endif
|
||||
g0_UEG_func = max(g0_UEG_func,1.d-14)
|
||||
|
||||
end
|
||||
|
|
@ -38,7 +38,7 @@ subroutine print_basis_correction
|
|||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-UEG , state ',istate,' = ',ecmd_pbe_ueg_mu_of_r(istate)
|
||||
enddo
|
||||
|
||||
else if(mu_of_r_potential.EQ."cas_ful".or.mu_of_r_potential.EQ."cas_truncated".or.mu_of_r_potential.EQ."pure_act")then
|
||||
else if(mu_of_r_potential.EQ."cas_ful")then
|
||||
print*, ''
|
||||
print*,'Using a CAS-like two-body density to define mu(r)'
|
||||
print*,'This assumes that the CAS is a qualitative representation of the wave function '
|
||||
|
@ -80,3 +80,64 @@ subroutine print_basis_correction
|
|||
end
|
||||
|
||||
|
||||
|
||||
subroutine print_all_basis_correction
|
||||
implicit none
|
||||
integer :: istate
|
||||
provide mu_average_prov
|
||||
provide ecmd_lda_mu_of_r ecmd_pbe_ueg_mu_of_r
|
||||
provide ecmd_pbe_on_top_mu_of_r ecmd_pbe_on_top_su_mu_of_r
|
||||
|
||||
print*, ''
|
||||
print*, ''
|
||||
print*, '****************************************'
|
||||
print*, '****************************************'
|
||||
print*, 'Basis set correction for WFT using DFT Ecmd functionals'
|
||||
print*, 'These functionals are accurate for short-range correlation'
|
||||
print*, ''
|
||||
print*, 'For more details look at Journal of Chemical Physics 149, 194301 1-15 (2018) '
|
||||
print*, ' Journal of Physical Chemistry Letters 10, 2931-2937 (2019) '
|
||||
print*, ' ???REF SC?'
|
||||
print*, '****************************************'
|
||||
print*, '****************************************'
|
||||
print*, 'mu_of_r_potential = ',mu_of_r_potential
|
||||
print*, ''
|
||||
print*,'Using a CAS-like two-body density to define mu(r)'
|
||||
print*,'This assumes that the CAS is a qualitative representation of the wave function '
|
||||
print*,'********************************************'
|
||||
print*,'Functionals more suited for weak correlation'
|
||||
print*,'********************************************'
|
||||
print*,'+) LDA Ecmd functional : purely based on the UEG (JCP,149,194301,1-15 (2018)) '
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD LDA , state ',istate,' = ',ecmd_lda_mu_of_r(istate)
|
||||
enddo
|
||||
print*,'+) PBE-UEG Ecmd functional : PBE at mu=0, UEG ontop pair density at large mu (JPCL, 10, 2931-2937 (2019))'
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-UEG , state ',istate,' = ',ecmd_pbe_ueg_mu_of_r(istate)
|
||||
enddo
|
||||
print*,''
|
||||
print*,'********************************************'
|
||||
print*,'********************************************'
|
||||
print*,'+) PBE-on-top Ecmd functional : (??????? REF-SCF ??????????)'
|
||||
print*,'PBE at mu=0, extrapolated ontop pair density at large mu, usual spin-polarization'
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_mu_of_r(istate)
|
||||
enddo
|
||||
print*,''
|
||||
print*,'********************************************'
|
||||
print*,'+) PBE-on-top no spin polarization Ecmd functional : (??????? REF-SCF ??????????)'
|
||||
print*,'PBE at mu=0, extrapolated ontop pair density at large mu, and ZERO SPIN POLARIZATION'
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD SU-PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_su_mu_of_r(istate)
|
||||
enddo
|
||||
print*,''
|
||||
|
||||
print*,''
|
||||
print*,'**************'
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' Average mu(r) , state ',istate,' = ',mu_average_prov(istate)
|
||||
enddo
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -20,9 +20,10 @@ subroutine print_su_pbe_ot
|
|||
integer :: istate
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD PBE-UEG , state ',istate,' = ',ecmd_pbe_ueg_mu_of_r(istate)
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ecmd_pbe_ueg_test , state ',istate,' = ',ecmd_pbe_ueg_test(istate)
|
||||
enddo
|
||||
do istate = 1, N_states
|
||||
write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD SU-PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_su_mu_of_r(istate)
|
||||
enddo
|
||||
! do istate = 1, N_states
|
||||
! write(*, '(A29,X,I3,X,A3,X,F16.10)') ' ECMD SU-PBE-OT , state ',istate,' = ',ecmd_pbe_on_top_su_mu_of_r(istate)
|
||||
! enddo
|
||||
|
||||
end
|
||||
|
|
84
src/basis_correction/test_ueg_self_contained.irp.f
Normal file
84
src/basis_correction/test_ueg_self_contained.irp.f
Normal file
|
@ -0,0 +1,84 @@
|
|||
program test_sc
|
||||
implicit none
|
||||
integer :: m
|
||||
double precision :: r(3),f_hf,on_top,mu,sqpi
|
||||
double precision :: rho_a,rho_b,w_hf,dens,delta_rho,e_pbe
|
||||
double precision :: grad_rho_a(3),grad_rho_b(3),grad_rho_a_2(3),grad_rho_b_2(3),grad_rho_a_b(3)
|
||||
double precision :: sigmacc,sigmaco,sigmaoo,spin_pol
|
||||
double precision :: eps_c_md_PBE , ecmd_pbe_ueg_self_cont
|
||||
r = 0.D0
|
||||
r(3) = 1.D0
|
||||
call f_HF_valence_ab(r,r,f_hf,on_top)
|
||||
sqpi = dsqrt(dacos(-1.d0))
|
||||
if(on_top.le.1.d-12.or.f_hf.le.0.d0.or.f_hf * on_top.lt.0.d0)then
|
||||
w_hf = 1.d+10
|
||||
else
|
||||
w_hf = f_hf / on_top
|
||||
endif
|
||||
mu = sqpi * 0.5d0 * w_hf
|
||||
call density_and_grad_alpha_beta(r,rho_a,rho_b, grad_rho_a, grad_rho_b)
|
||||
dens = rho_a + rho_b
|
||||
delta_rho = rho_a - rho_b
|
||||
spin_pol = delta_rho/(max(1.d-10,dens))
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2 += grad_rho_a(m)*grad_rho_a(m)
|
||||
grad_rho_b_2 += grad_rho_b(m)*grad_rho_b(m)
|
||||
grad_rho_a_b += grad_rho_a(m)*grad_rho_b(m)
|
||||
enddo
|
||||
call grad_rho_ab_to_grad_rho_oc(grad_rho_a_2,grad_rho_b_2,grad_rho_a_b,sigmaoo,sigmacc,sigmaco)
|
||||
|
||||
! call the PBE energy
|
||||
print*,'f_hf,on_top = ',f_hf,on_top
|
||||
print*,'mu = ',mu
|
||||
print*,'dens,spin_pol',dens,spin_pol
|
||||
call ec_pbe_only(0.d0,dens,delta_rho,sigmacc,sigmaco,sigmaoo,e_PBE)
|
||||
print*,'e_PBE = ',e_PBE
|
||||
eps_c_md_PBE = ecmd_pbe_ueg_self_cont(dens,spin_pol,mu,e_PBE)
|
||||
print*,'eps_c_md_PBE = ',eps_c_md_PBE
|
||||
|
||||
print*,''
|
||||
print*,''
|
||||
print*,''
|
||||
print*,'energy_c' ,energy_c
|
||||
|
||||
integer::ipoint
|
||||
double precision :: weight , accu
|
||||
accu = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
r = final_grid_points(:,ipoint)
|
||||
weight = final_weight_at_r_vector(ipoint)
|
||||
call f_HF_valence_ab(r,r,f_hf,on_top)
|
||||
sqpi = dsqrt(dacos(-1.d0))
|
||||
if(on_top.le.1.d-12.or.f_hf.le.0.d0.or.f_hf * on_top.lt.0.d0)then
|
||||
w_hf = 1.d+10
|
||||
else
|
||||
w_hf = f_hf / on_top
|
||||
endif
|
||||
mu = sqpi * 0.5d0 * w_hf
|
||||
call density_and_grad_alpha_beta(r,rho_a,rho_b, grad_rho_a, grad_rho_b)
|
||||
dens = rho_a + rho_b
|
||||
delta_rho = rho_a - rho_b
|
||||
spin_pol = delta_rho/(max(1.d-10,dens))
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2 += grad_rho_a(m)*grad_rho_a(m)
|
||||
grad_rho_b_2 += grad_rho_b(m)*grad_rho_b(m)
|
||||
grad_rho_a_b += grad_rho_a(m)*grad_rho_b(m)
|
||||
enddo
|
||||
call grad_rho_ab_to_grad_rho_oc(grad_rho_a_2,grad_rho_b_2,grad_rho_a_b,sigmaoo,sigmacc,sigmaco)
|
||||
! call the PBE energy
|
||||
call ec_pbe_only(0.d0,dens,delta_rho,sigmacc,sigmaco,sigmaoo,e_PBE)
|
||||
eps_c_md_PBE = ecmd_pbe_ueg_self_cont(dens,spin_pol,mu,e_PBE)
|
||||
write(33,'(100(F16.10,X))')r(:), weight, w_hf, on_top, mu, dens, spin_pol, e_PBE, eps_c_md_PBE
|
||||
accu += weight * eps_c_md_PBE
|
||||
enddo
|
||||
print*,'accu = ',accu
|
||||
write(*, *) ' ECMD PBE-UEG ',ecmd_pbe_ueg_mu_of_r(1)
|
||||
write(*, *) ' ecmd_pbe_ueg_test ',ecmd_pbe_ueg_test(1)
|
||||
|
||||
end
|
|
@ -81,3 +81,54 @@ BEGIN_PROVIDER [double precision, ecmd_pbe_ueg_mu_of_r, (N_states)]
|
|||
print*,'Time for the ecmd_pbe_ueg_mu_of_r:',wall1-wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, ecmd_pbe_ueg_test, (N_states)]
|
||||
BEGIN_DOC
|
||||
! test of the routines contained in pbe_ueg_self_contained.irp.f
|
||||
END_DOC
|
||||
implicit none
|
||||
double precision :: weight
|
||||
integer :: ipoint,istate,m
|
||||
double precision :: mu,rho_a,rho_b
|
||||
double precision :: dens,spin_pol,grad_rho,e_PBE,delta_rho
|
||||
double precision :: ecmd_pbe_ueg_self_cont,eps_c_md_PBE
|
||||
ecmd_pbe_ueg_test = 0.d0
|
||||
|
||||
do istate = 1, N_states
|
||||
do ipoint = 1, n_points_final_grid
|
||||
weight=final_weight_at_r_vector(ipoint)
|
||||
|
||||
! mu(r) defined by Eq. (37) of J. Chem. Phys. 149, 194301 (2018)
|
||||
mu = mu_of_r_prov(ipoint,istate)
|
||||
|
||||
! conversion from rho_a,rho_b --> dens,spin_pol
|
||||
rho_a = one_e_dm_and_grad_alpha_in_r(4,ipoint,istate)
|
||||
rho_b = one_e_dm_and_grad_beta_in_r(4,ipoint,istate)
|
||||
dens = rho_a + rho_b
|
||||
spin_pol = (rho_a - rho_b)/(max(dens,1.d-12))
|
||||
delta_rho = rho_a - rho_b
|
||||
|
||||
! conversion from grad_rho_a ... to sigma
|
||||
double precision :: grad_rho_a(3),grad_rho_b(3),grad_rho_a_2(3),grad_rho_b_2(3),grad_rho_a_b(3)
|
||||
double precision :: sigmacc,sigmaco,sigmaoo
|
||||
grad_rho_b(1:3) = one_e_dm_and_grad_beta_in_r(1:3,ipoint,istate)
|
||||
grad_rho_a(1:3) = one_e_dm_and_grad_alpha_in_r(1:3,ipoint,istate)
|
||||
grad_rho_a_2 = 0.d0
|
||||
grad_rho_b_2 = 0.d0
|
||||
grad_rho_a_b = 0.d0
|
||||
do m = 1, 3
|
||||
grad_rho_a_2 += grad_rho_a(m)*grad_rho_a(m)
|
||||
grad_rho_b_2 += grad_rho_b(m)*grad_rho_b(m)
|
||||
grad_rho_a_b += grad_rho_a(m)*grad_rho_b(m)
|
||||
enddo
|
||||
call grad_rho_ab_to_grad_rho_oc(grad_rho_a_2,grad_rho_b_2,grad_rho_a_b,sigmaoo,sigmacc,sigmaco)
|
||||
|
||||
! call the PBE energy
|
||||
call ec_pbe_only(0.d0,dens,delta_rho,sigmacc,sigmaco,sigmaoo,e_PBE)
|
||||
eps_c_md_PBE = ecmd_pbe_ueg_self_cont(dens,spin_pol,mu,e_PBE)
|
||||
|
||||
ecmd_pbe_ueg_test(istate) += eps_c_md_PBE * weight
|
||||
enddo
|
||||
enddo
|
||||
!
|
||||
END_PROVIDER
|
||||
|
|
|
@ -64,7 +64,8 @@ END_PROVIDER
|
|||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, grid_points_per_atom, (3,n_points_integration_angular,n_points_radial_grid,nucl_num)]
|
||||
BEGIN_PROVIDER [double precision, grid_points_per_atom, (3,n_points_integration_angular,n_points_radial_grid,nucl_num)]
|
||||
&BEGIN_PROVIDER [double precision, radial_points_per_atom, (n_points_radial_grid,nucl_num)]
|
||||
BEGIN_DOC
|
||||
! x,y,z coordinates of grid points used for integration in 3d space
|
||||
END_DOC
|
||||
|
@ -72,6 +73,7 @@ BEGIN_PROVIDER [double precision, grid_points_per_atom, (3,n_points_integration_
|
|||
integer :: i,j,k
|
||||
double precision :: dr,x_ref,y_ref,z_ref
|
||||
double precision :: knowles_function
|
||||
radial_points_per_atom = 0.D0
|
||||
do i = 1, nucl_num
|
||||
x_ref = nucl_coord(i,1)
|
||||
y_ref = nucl_coord(i,2)
|
||||
|
@ -83,7 +85,7 @@ BEGIN_PROVIDER [double precision, grid_points_per_atom, (3,n_points_integration_
|
|||
|
||||
! value of the radial coordinate for the integration
|
||||
r = knowles_function(alpha_knowles(grid_atomic_number(i)),m_knowles,x)
|
||||
|
||||
radial_points_per_atom(j,i) = r
|
||||
! explicit values of the grid points centered around each atom
|
||||
do k = 1, n_points_integration_angular
|
||||
grid_points_per_atom(1,k,j,i) = &
|
||||
|
|
|
@ -46,8 +46,4 @@ END_PROVIDER
|
|||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
|
||||
|
||||
|
||||
END_PROVIDER
|
||||
|
|
|
@ -59,16 +59,17 @@ END_PROVIDER
|
|||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [double precision, final_grid_points_transp, (n_points_final_grid,3)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Transposed final_grid_points
|
||||
! final_grid_points_transp(j,1:3) = (/ x, y, z /) of the jth grid point
|
||||
END_DOC
|
||||
|
||||
integer :: i,j
|
||||
do j=1,3
|
||||
do i=1,n_points_final_grid
|
||||
final_grid_points_transp(i,j) = final_grid_points(j,i)
|
||||
enddo
|
||||
integer :: i
|
||||
do i=1,n_points_final_grid
|
||||
final_grid_points_transp(i,1) = final_grid_points(1,i)
|
||||
final_grid_points_transp(i,2) = final_grid_points(2,i)
|
||||
final_grid_points_transp(i,3) = final_grid_points(3,i)
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
|
|
4
src/bi_ort_ints/NEED
Normal file
4
src/bi_ort_ints/NEED
Normal file
|
@ -0,0 +1,4 @@
|
|||
non_h_ints_mu
|
||||
ao_tc_eff_map
|
||||
bi_ortho_mos
|
||||
tc_keywords
|
25
src/bi_ort_ints/README.rst
Normal file
25
src/bi_ort_ints/README.rst
Normal file
|
@ -0,0 +1,25 @@
|
|||
===========
|
||||
bi_ort_ints
|
||||
===========
|
||||
|
||||
This module contains all necessary integrals for the TC Hamiltonian in a bi-orthonormal (BO) MO Basis.
|
||||
See in bi_ortho_basis for more information.
|
||||
The main providers are :
|
||||
|
||||
One-electron integrals
|
||||
----------------------
|
||||
+) ao_one_e_integrals_tc_tot : total one-electron Hamiltonian which might include non hermitian part coming from one-e correlation factor.
|
||||
+) mo_bi_ortho_tc_one_e : one-electron Hamiltonian (h_core+one-J terms) on the BO-MO basis.
|
||||
+) mo_bi_orth_bipole_x : x-component of the dipole operator on the BO-MO basis. (Same for y,z)
|
||||
|
||||
Two-electron integrals
|
||||
----------------------
|
||||
+) ao_two_e_tc_tot : Total two-electron operator (including the non-hermitian term of the TC Hamiltonian) on the AO basis
|
||||
+) mo_bi_ortho_tc_two_e : Total two-electron operator on the BO-MO basis
|
||||
|
||||
Three-electron integrals
|
||||
------------------------
|
||||
+) three_body_ints_bi_ort : 6-indices three-electron tensor (-L) on the BO-MO basis. WARNING :: N^6 storage !
|
||||
+) three_e_3_idx_direct_bi_ort : DIRECT term with 3 different indices of the -L operator. These terms appear in the DIAGONAL matrix element of the -L operator. The 5 other permutations needed to compute matrix elements can be found in three_body_ijm.irp.f
|
||||
+) three_e_4_idx_direct_bi_ort : DIRECT term with 4 different indices of the -L operator. These terms appear in the OFF-DIAGONAL matrix element of the -L operator including SINGLE EXCITATIONS. The 5 other permutations needed to compute matrix elements can be found in three_body_ijmk.irp.f
|
||||
+) three_e_5_idx_direct_bi_ort : DIRECT term with 5 different indices of the -L operator. These terms appear in the OFF-DIAGONAL matrix element of the -L operator including DOUBLE EXCITATIONS. The 5 other permutations needed to compute matrix elements can be found in three_body_ijmkl.irp.f
|
44
src/bi_ort_ints/bi_ort_ints.irp.f
Normal file
44
src/bi_ort_ints/bi_ort_ints.irp.f
Normal file
|
@ -0,0 +1,44 @@
|
|||
program bi_ort_ints
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! TODO : Put the documentation of the program here
|
||||
END_DOC
|
||||
my_grid_becke = .True.
|
||||
my_n_pt_r_grid = 10
|
||||
my_n_pt_a_grid = 14
|
||||
touch my_grid_becke my_n_pt_r_grid my_n_pt_a_grid
|
||||
call test_3e
|
||||
end
|
||||
|
||||
subroutine test_3e
|
||||
implicit none
|
||||
integer :: i,k,j,l,m,n,ipoint
|
||||
double precision :: accu, contrib,new,ref
|
||||
i = 1
|
||||
k = 1
|
||||
accu = 0.d0
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
do n = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(n, l, k, m, j, i, new)
|
||||
call give_integrals_3_body_bi_ort_old(n, l, k, m, j, i, ref)
|
||||
contrib = dabs(new - ref)
|
||||
accu += contrib
|
||||
if(contrib .gt. 1.d-10)then
|
||||
print*,'pb !!'
|
||||
print*,i,k,j,l,m,n
|
||||
print*,ref,new,contrib
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
print*,'accu = ',accu/dble(mo_num)**6
|
||||
|
||||
|
||||
end
|
153
src/bi_ort_ints/biorthog_mo_for_h.irp.f
Normal file
153
src/bi_ort_ints/biorthog_mo_for_h.irp.f
Normal file
|
@ -0,0 +1,153 @@
|
|||
|
||||
! ---
|
||||
|
||||
double precision function bi_ortho_mo_coul_ints(l, k, j, i)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! < mo^L_k mo^L_l | 1/r12 | mo^R_i mo^R_j >
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: i, j, k, l
|
||||
integer :: m, n, p, q
|
||||
|
||||
bi_ortho_mo_coul_ints = 0.d0
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do n = 1, ao_num
|
||||
do q = 1, ao_num
|
||||
! p1h1p2h2 l1 l2 r1 r2
|
||||
bi_ortho_mo_coul_ints += ao_two_e_coul(n,q,m,p) * mo_l_coef(m,l) * mo_l_coef(n,k) * mo_r_coef(p,j) * mo_r_coef(q,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end function bi_ortho_mo_coul_ints
|
||||
|
||||
! ---
|
||||
|
||||
! TODO :: transform into DEGEMM
|
||||
|
||||
BEGIN_PROVIDER [double precision, mo_bi_ortho_coul_e_chemist, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! mo_bi_ortho_coul_e_chemist(k,i,l,j) = < k l | 1/r12 | i j > where i,j are right MOs and k,l are left MOs
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, l, m, n, p, q
|
||||
double precision, allocatable :: mo_tmp_1(:,:,:,:), mo_tmp_2(:,:,:,:)
|
||||
|
||||
allocate(mo_tmp_1(mo_num,ao_num,ao_num,ao_num))
|
||||
mo_tmp_1 = 0.d0
|
||||
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do n = 1, ao_num
|
||||
do q = 1, ao_num
|
||||
do k = 1, mo_num
|
||||
! (k n|p m) = sum_q c_qk * (q n|p m)
|
||||
mo_tmp_1(k,n,p,m) += mo_l_coef_transp(k,q) * ao_two_e_coul(q,n,p,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
allocate(mo_tmp_2(mo_num,mo_num,ao_num,ao_num))
|
||||
mo_tmp_2 = 0.d0
|
||||
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do n = 1, ao_num
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
! (k i|p m) = sum_n c_ni * (k n|p m)
|
||||
mo_tmp_2(k,i,p,m) += mo_r_coef_transp(i,n) * mo_tmp_1(k,n,p,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(mo_tmp_1)
|
||||
|
||||
allocate(mo_tmp_1(mo_num,mo_num,mo_num,ao_num))
|
||||
mo_tmp_1 = 0.d0
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do l = 1, mo_num
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
mo_tmp_1(k,i,l,m) += mo_l_coef_transp(l,p) * mo_tmp_2(k,i,p,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(mo_tmp_2)
|
||||
|
||||
mo_bi_ortho_coul_e_chemist = 0.d0
|
||||
do m = 1, ao_num
|
||||
do j = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
mo_bi_ortho_coul_e_chemist(k,i,l,j) += mo_r_coef_transp(j,m) * mo_tmp_1(k,i,l,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(mo_tmp_1)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, mo_bi_ortho_coul_e, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! mo_bi_ortho_coul_e(k,l,i,j) = < k l | 1/r12 | i j > where i,j are right MOs and k,l are left MOs
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, l
|
||||
|
||||
do j = 1, mo_num
|
||||
do i = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
! < k l | V12 | i j > (k i|l j)
|
||||
mo_bi_ortho_coul_e(k,l,i,j) = mo_bi_ortho_coul_e_chemist(k,i,l,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, mo_bi_ortho_one_e, (mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! mo_bi_ortho_one_e(k,i) = < MO^L_k | h_c | MO^R_i >
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
call ao_to_mo_bi_ortho(ao_one_e_integrals, ao_num, mo_bi_ortho_one_e , mo_num)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
75
src/bi_ort_ints/one_e_bi_ort.irp.f
Normal file
75
src/bi_ort_ints/one_e_bi_ort.irp.f
Normal file
|
@ -0,0 +1,75 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, ao_one_e_integrals_tc_tot, (ao_num,ao_num)]
|
||||
|
||||
implicit none
|
||||
integer :: i, j
|
||||
|
||||
ao_one_e_integrals_tc_tot = ao_one_e_integrals
|
||||
|
||||
provide j1b_type
|
||||
|
||||
if( (j1b_type .eq. 1) .or. (j1b_type .eq. 2) ) then
|
||||
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
ao_one_e_integrals_tc_tot(j,i) += ( j1b_gauss_hermI (j,i) &
|
||||
+ j1b_gauss_hermII (j,i) &
|
||||
+ j1b_gauss_nonherm(j,i) )
|
||||
enddo
|
||||
enddo
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, mo_bi_ortho_tc_one_e, (mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! mo_bi_ortho_tc_one_e(k,i) = <MO^L_k | h_c | MO^R_i>
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
|
||||
call ao_to_mo_bi_ortho(ao_one_e_integrals_tc_tot, ao_num, mo_bi_ortho_tc_one_e, mo_num)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, mo_bi_orth_bipole_x , (mo_num,mo_num)]
|
||||
&BEGIN_PROVIDER [double precision, mo_bi_orth_bipole_y , (mo_num,mo_num)]
|
||||
&BEGIN_PROVIDER [double precision, mo_bi_orth_bipole_z , (mo_num,mo_num)]
|
||||
BEGIN_DOC
|
||||
! array of the integrals of MO_i * x MO_j
|
||||
! array of the integrals of MO_i * y MO_j
|
||||
! array of the integrals of MO_i * z MO_j
|
||||
END_DOC
|
||||
implicit none
|
||||
|
||||
call ao_to_mo_bi_ortho( &
|
||||
ao_dipole_x, &
|
||||
size(ao_dipole_x,1), &
|
||||
mo_bi_orth_bipole_x, &
|
||||
size(mo_bi_orth_bipole_x,1) &
|
||||
)
|
||||
call ao_to_mo_bi_ortho( &
|
||||
ao_dipole_y, &
|
||||
size(ao_dipole_y,1), &
|
||||
mo_bi_orth_bipole_y, &
|
||||
size(mo_bi_orth_bipole_y,1) &
|
||||
)
|
||||
call ao_to_mo_bi_ortho( &
|
||||
ao_dipole_z, &
|
||||
size(ao_dipole_z,1), &
|
||||
mo_bi_orth_bipole_z, &
|
||||
size(mo_bi_orth_bipole_z,1) &
|
||||
)
|
||||
|
||||
END_PROVIDER
|
||||
|
312
src/bi_ort_ints/semi_num_ints_mo.irp.f
Normal file
312
src/bi_ort_ints/semi_num_ints_mo.irp.f
Normal file
|
@ -0,0 +1,312 @@
|
|||
|
||||
! ---
|
||||
|
||||
! TODO :: optimization : transform into a DGEMM
|
||||
|
||||
BEGIN_PROVIDER [ double precision, mo_v_ki_bi_ortho_erf_rk_cst_mu, (mo_num, mo_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! mo_v_ki_bi_ortho_erf_rk_cst_mu(k,i,ip) = int dr chi_k(r) phi_i(r) (erf(mu |r - R_ip|) - 1 )/(2|r - R_ip|) on the BI-ORTHO MO basis
|
||||
!
|
||||
! where phi_k(r) is a LEFT MOs and phi_i(r) is a RIGHT MO
|
||||
!
|
||||
! R_ip = the "ip"-th point of the DFT Grid
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint) &
|
||||
!$OMP SHARED (n_points_final_grid,v_ij_erf_rk_cst_mu,mo_v_ki_bi_ortho_erf_rk_cst_mu)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
call ao_to_mo_bi_ortho( v_ij_erf_rk_cst_mu (1,1,ipoint), size(v_ij_erf_rk_cst_mu, 1) &
|
||||
, mo_v_ki_bi_ortho_erf_rk_cst_mu(1,1,ipoint), size(mo_v_ki_bi_ortho_erf_rk_cst_mu, 1) )
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
mo_v_ki_bi_ortho_erf_rk_cst_mu = mo_v_ki_bi_ortho_erf_rk_cst_mu * 0.5d0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, mo_v_ki_bi_ortho_erf_rk_cst_mu_transp, (n_points_final_grid, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int dr phi_i(r) phi_j(r) (erf(mu(R) |r - R|) - 1)/(2|r - R|) on the BI-ORTHO MO basis
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint, i, j
|
||||
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
mo_v_ki_bi_ortho_erf_rk_cst_mu_transp(ipoint,j,i) = mo_v_ki_bi_ortho_erf_rk_cst_mu(j,i,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! FREE mo_v_ki_bi_ortho_erf_rk_cst_mu
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
! TODO :: optimization : transform into a DGEMM
|
||||
|
||||
BEGIN_PROVIDER [ double precision, mo_x_v_ki_bi_ortho_erf_rk_cst_mu, (mo_num, mo_num, 3, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! mo_x_v_ki_bi_ortho_erf_rk_cst_mu(k,i,m,ip) = int dr x(m) * chi_k(r) phi_i(r) (erf(mu |r - R_ip|) - 1)/2|r - R_ip| on the BI-ORTHO MO basis
|
||||
!
|
||||
! where chi_k(r)/phi_i(r) are left/right MOs, m=1 => x(m) = x, m=2 => x(m) = y, m=3 => x(m) = z,
|
||||
!
|
||||
! R_ip = the "ip"-th point of the DFT Grid
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint) &
|
||||
!$OMP SHARED (n_points_final_grid,x_v_ij_erf_rk_cst_mu_transp,mo_x_v_ki_bi_ortho_erf_rk_cst_mu)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
call ao_to_mo_bi_ortho( x_v_ij_erf_rk_cst_mu_transp (1,1,1,ipoint), size(x_v_ij_erf_rk_cst_mu_transp, 1) &
|
||||
, mo_x_v_ki_bi_ortho_erf_rk_cst_mu(1,1,1,ipoint), size(mo_x_v_ki_bi_ortho_erf_rk_cst_mu, 1) )
|
||||
call ao_to_mo_bi_ortho( x_v_ij_erf_rk_cst_mu_transp (1,1,2,ipoint), size(x_v_ij_erf_rk_cst_mu_transp, 1) &
|
||||
, mo_x_v_ki_bi_ortho_erf_rk_cst_mu(1,1,2,ipoint), size(mo_x_v_ki_bi_ortho_erf_rk_cst_mu, 1) )
|
||||
call ao_to_mo_bi_ortho( x_v_ij_erf_rk_cst_mu_transp (1,1,3,ipoint), size(x_v_ij_erf_rk_cst_mu_transp, 1) &
|
||||
, mo_x_v_ki_bi_ortho_erf_rk_cst_mu(1,1,3,ipoint), size(mo_x_v_ki_bi_ortho_erf_rk_cst_mu, 1) )
|
||||
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
mo_x_v_ki_bi_ortho_erf_rk_cst_mu = 0.5d0 * mo_x_v_ki_bi_ortho_erf_rk_cst_mu
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, int2_grad1_u12_ao_transp, (ao_num, ao_num, 3, n_points_final_grid)]
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
double precision :: wall0, wall1
|
||||
|
||||
call wall_time(wall0)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 1, ao_num
|
||||
do j = 1, ao_num
|
||||
int2_grad1_u12_ao_transp(j,i,1,ipoint) = int2_grad1_u12_ao(1,j,i,ipoint)
|
||||
int2_grad1_u12_ao_transp(j,i,2,ipoint) = int2_grad1_u12_ao(2,j,i,ipoint)
|
||||
int2_grad1_u12_ao_transp(j,i,3,ipoint) = int2_grad1_u12_ao(3,j,i,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for int2_grad1_u12_ao_transp ', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, int2_grad1_u12_bimo_transp, (mo_num, mo_num, 3, n_points_final_grid)]
|
||||
|
||||
implicit none
|
||||
integer :: ipoint
|
||||
|
||||
print*,'providing int2_grad1_u12_bimo_transp'
|
||||
double precision :: wall0, wall1
|
||||
call wall_time(wall0)
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint) &
|
||||
!$OMP SHARED (n_points_final_grid,int2_grad1_u12_ao_transp,int2_grad1_u12_bimo_transp)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
call ao_to_mo_bi_ortho( int2_grad1_u12_ao_transp (1,1,1,ipoint), size(int2_grad1_u12_ao_transp , 1) &
|
||||
, int2_grad1_u12_bimo_transp(1,1,1,ipoint), size(int2_grad1_u12_bimo_transp, 1) )
|
||||
call ao_to_mo_bi_ortho( int2_grad1_u12_ao_transp (1,1,2,ipoint), size(int2_grad1_u12_ao_transp , 1) &
|
||||
, int2_grad1_u12_bimo_transp(1,1,2,ipoint), size(int2_grad1_u12_bimo_transp, 1) )
|
||||
call ao_to_mo_bi_ortho( int2_grad1_u12_ao_transp (1,1,3,ipoint), size(int2_grad1_u12_ao_transp , 1) &
|
||||
, int2_grad1_u12_bimo_transp(1,1,3,ipoint), size(int2_grad1_u12_bimo_transp, 1) )
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
call wall_time(wall1)
|
||||
print*,'Wall time for providing int2_grad1_u12_bimo_transp',wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
BEGIN_PROVIDER [ double precision, int2_grad1_u12_bimo_t, (n_points_final_grid,3, mo_num, mo_num )]
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
do ipoint = 1, n_points_final_grid
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
int2_grad1_u12_bimo_t(ipoint,1,j,i) = int2_grad1_u12_bimo_transp(j,i,1,ipoint)
|
||||
int2_grad1_u12_bimo_t(ipoint,2,j,i) = int2_grad1_u12_bimo_transp(j,i,2,ipoint)
|
||||
int2_grad1_u12_bimo_t(ipoint,3,j,i) = int2_grad1_u12_bimo_transp(j,i,3,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, int2_grad1_u12_bimo, (3, mo_num, mo_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! int2_grad1_u12_bimo(:,k,i,ipoint) = \int dr2 [-1 * \grad_r1 J(r1,r2)] \chi_k(r2) \phi_i(r2)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: ipoint
|
||||
print*,'Wrong !!'
|
||||
stop
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint) &
|
||||
!$OMP SHARED (n_points_final_grid,int2_grad1_u12_ao,int2_grad1_u12_bimo)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do ipoint = 1, n_points_final_grid
|
||||
|
||||
call ao_to_mo_bi_ortho( int2_grad1_u12_ao (1,1,1,ipoint), size(int2_grad1_u12_ao , 2) &
|
||||
, int2_grad1_u12_bimo(1,1,1,ipoint), size(int2_grad1_u12_bimo, 2) )
|
||||
call ao_to_mo_bi_ortho( int2_grad1_u12_ao (2,1,1,ipoint), size(int2_grad1_u12_ao , 2) &
|
||||
, int2_grad1_u12_bimo(2,1,1,ipoint), size(int2_grad1_u12_bimo, 2) )
|
||||
call ao_to_mo_bi_ortho( int2_grad1_u12_ao (3,1,1,ipoint), size(int2_grad1_u12_ao , 2) &
|
||||
, int2_grad1_u12_bimo(3,1,1,ipoint), size(int2_grad1_u12_bimo, 2) )
|
||||
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, mo_x_v_ki_bi_ortho_erf_rk_cst_mu_transp, (n_points_final_grid, 3, mo_num, mo_num)]
|
||||
|
||||
implicit none
|
||||
integer :: i, j, ipoint
|
||||
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do ipoint = 1, n_points_final_grid
|
||||
mo_x_v_ki_bi_ortho_erf_rk_cst_mu_transp(ipoint,1,j,i) = mo_x_v_ki_bi_ortho_erf_rk_cst_mu(j,i,1,ipoint)
|
||||
mo_x_v_ki_bi_ortho_erf_rk_cst_mu_transp(ipoint,2,j,i) = mo_x_v_ki_bi_ortho_erf_rk_cst_mu(j,i,2,ipoint)
|
||||
mo_x_v_ki_bi_ortho_erf_rk_cst_mu_transp(ipoint,3,j,i) = mo_x_v_ki_bi_ortho_erf_rk_cst_mu(j,i,3,ipoint)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, x_W_ki_bi_ortho_erf_rk, (n_points_final_grid, 3, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! x_W_ki_bi_ortho_erf_rk(ip,m,k,i) = \int dr chi_k(r) \frac{(1 - erf(mu |r-R_ip|))}{2|r-R_ip|} (x(m)-R_ip(m)) phi_i(r) ON THE BI-ORTHO MO BASIS
|
||||
!
|
||||
! where chi_k(r)/phi_i(r) are left/right MOs, m=1 => X(m) = x, m=2 => X(m) = y, m=3 => X(m) = z,
|
||||
!
|
||||
! R_ip = the "ip"-th point of the DFT Grid
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
|
||||
integer :: ipoint, m, i, k
|
||||
double precision :: xyz
|
||||
double precision :: wall0, wall1
|
||||
|
||||
print*, ' providing x_W_ki_bi_ortho_erf_rk ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint,m,i,k,xyz) &
|
||||
!$OMP SHARED (x_W_ki_bi_ortho_erf_rk,n_points_final_grid,mo_x_v_ki_bi_ortho_erf_rk_cst_mu_transp,mo_v_ki_bi_ortho_erf_rk_cst_mu_transp,mo_num,final_grid_points)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do m = 1, 3
|
||||
do ipoint = 1, n_points_final_grid
|
||||
xyz = final_grid_points(m,ipoint)
|
||||
x_W_ki_bi_ortho_erf_rk(ipoint,m,k,i) = mo_x_v_ki_bi_ortho_erf_rk_cst_mu_transp(ipoint,m,k,i) - xyz * mo_v_ki_bi_ortho_erf_rk_cst_mu_transp(ipoint,k,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
! FREE mo_v_ki_bi_ortho_erf_rk_cst_mu_transp
|
||||
! FREE mo_x_v_ki_bi_ortho_erf_rk_cst_mu_transp
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' time to provide x_W_ki_bi_ortho_erf_rk = ', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, x_W_ki_bi_ortho_erf_rk_diag, (n_points_final_grid, 3, mo_num)]
|
||||
BEGIN_DOC
|
||||
! x_W_ki_bi_ortho_erf_rk_diag(ip,m,i) = \int dr chi_i(r) (1 - erf(mu |r-R_ip|)) (x(m)-X(m)_ip) phi_i(r) ON THE BI-ORTHO MO BASIS
|
||||
!
|
||||
! where chi_k(r)/phi_i(r) are left/right MOs, m=1 => X(m) = x, m=2 => X(m) = y, m=3 => X(m) = z,
|
||||
!
|
||||
! R_ip = the "ip"-th point of the DFT Grid
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
include 'constants.include.F'
|
||||
|
||||
integer :: ipoint, m, i
|
||||
double precision :: xyz
|
||||
double precision :: wall0, wall1
|
||||
|
||||
print*,'providing x_W_ki_bi_ortho_erf_rk_diag ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (ipoint,m,i,xyz) &
|
||||
!$OMP SHARED (x_W_ki_bi_ortho_erf_rk_diag,n_points_final_grid,mo_x_v_ki_bi_ortho_erf_rk_cst_mu_transp,mo_v_ki_bi_ortho_erf_rk_cst_mu_transp,mo_num,final_grid_points)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do m = 1, 3
|
||||
do ipoint = 1, n_points_final_grid
|
||||
xyz = final_grid_points(m,ipoint)
|
||||
x_W_ki_bi_ortho_erf_rk_diag(ipoint,m,i) = mo_x_v_ki_bi_ortho_erf_rk_cst_mu_transp(ipoint,m,i,i) - xyz * mo_v_ki_bi_ortho_erf_rk_cst_mu_transp(ipoint,i,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print*,'time to provide x_W_ki_bi_ortho_erf_rk_diag = ',wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
366
src/bi_ort_ints/three_body_ijm.irp.f
Normal file
366
src/bi_ort_ints/three_body_ijm.irp.f
Normal file
|
@ -0,0 +1,366 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_3_idx_direct_bi_ort, (mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator ON A BI ORTHONORMAL BASIS for the direct terms
|
||||
!
|
||||
! three_e_3_idx_direct_bi_ort(m,j,i) = <mji|-L|mji>
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_3_idx_direct_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_3_idx_direct_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_3_idx_direct_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = j, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, i, m, j, i, integral)
|
||||
three_e_3_idx_direct_bi_ort(m,j,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, j
|
||||
three_e_3_idx_direct_bi_ort(m,j,i) = three_e_3_idx_direct_bi_ort(j,m,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_3_idx_direct_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_3_idx_cycle_1_bi_ort, (mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator ON A BI ORTHONORMAL BASIS for the first cyclic permutation
|
||||
!
|
||||
! three_e_3_idx_direct_bi_ort(m,j,i) = <mji|-L|jim>
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_3_idx_cycle_1_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_3_idx_cycle_1_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_3_idx_cycle_1_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = j, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, i, j, i, m, integral)
|
||||
three_e_3_idx_cycle_1_bi_ort(m,j,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, j
|
||||
three_e_3_idx_cycle_1_bi_ort(m,j,i) = three_e_3_idx_cycle_1_bi_ort(j,m,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_3_idx_cycle_1_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_3_idx_cycle_2_bi_ort, (mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator ON A BI ORTHONORMAL BASIS for the second cyclic permutation
|
||||
!
|
||||
! three_e_3_idx_direct_bi_ort(m,j,i) = <mji|-L|imj>
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_3_idx_cycle_2_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_3_idx_cycle_2_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_3_idx_cycle_2_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = j, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, i, i, m, j, integral)
|
||||
three_e_3_idx_cycle_2_bi_ort(m,j,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, j
|
||||
three_e_3_idx_cycle_2_bi_ort(m,j,i) = three_e_3_idx_cycle_2_bi_ort(j,m,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_3_idx_cycle_2_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_3_idx_exch23_bi_ort, (mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator ON A BI ORTHONORMAL BASIS for the permutations of particle 2 and 3
|
||||
!
|
||||
! three_e_3_idx_exch23_bi_ort(m,j,i) = <mji|-L|jmi>
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_3_idx_exch23_bi_ort = 0.d0
|
||||
print*,'Providing the three_e_3_idx_exch23_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_3_idx_exch23_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = j, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, i, j, m, i, integral)
|
||||
three_e_3_idx_exch23_bi_ort(m,j,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, j
|
||||
three_e_3_idx_exch23_bi_ort(m,j,i) = three_e_3_idx_exch23_bi_ort(j,m,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_3_idx_exch23_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_3_idx_exch13_bi_ort, (mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator ON A BI ORTHONORMAL BASIS for the permutations of particle 1 and 3
|
||||
!
|
||||
! three_e_3_idx_exch13_bi_ort(m,j,i) = <mji|-L|ijm>
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i,j,m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_3_idx_exch13_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_3_idx_exch13_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_3_idx_exch13_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = j, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, i, i, j, m,integral)
|
||||
three_e_3_idx_exch13_bi_ort(m,j,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, j
|
||||
three_e_3_idx_exch13_bi_ort(m,j,i) = three_e_3_idx_exch13_bi_ort(j,m,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_3_idx_exch13_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_3_idx_exch12_bi_ort, (mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator ON A BI ORTHONORMAL BASIS for the permutations of particle 1 and 2
|
||||
!
|
||||
! three_e_3_idx_exch12_bi_ort(m,j,i) = <mji|-L|mij>
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_3_idx_exch12_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_3_idx_exch12_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_3_idx_exch12_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, i, m, i, j, integral)
|
||||
three_e_3_idx_exch12_bi_ort(m,j,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_3_idx_exch12_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_3_idx_exch12_bi_ort_new, (mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator ON A BI ORTHONORMAL BASIS for the permutations of particle 1 and 2
|
||||
!
|
||||
! three_e_3_idx_exch12_bi_ort_new(m,j,i) = <mji|-L|mij>
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_3_idx_exch12_bi_ort_new = 0.d0
|
||||
print *, ' Providing the three_e_3_idx_exch12_bi_ort_new ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_3_idx_exch12_bi_ort_new)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = j, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, i, m, i, j, integral)
|
||||
three_e_3_idx_exch12_bi_ort_new(m,j,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, j
|
||||
three_e_3_idx_exch12_bi_ort_new(m,j,i) = three_e_3_idx_exch12_bi_ort_new(j,m,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_3_idx_exch12_bi_ort_new', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
284
src/bi_ort_ints/three_body_ijmk.irp.f
Normal file
284
src/bi_ort_ints/three_body_ijmk.irp.f
Normal file
|
@ -0,0 +1,284 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_4_idx_direct_bi_ort, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE DIRECT TERMS OF SINGLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_4_idx_direct_bi_ort(m,j,k,i) = <mjk|-L|mji> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_4_idx_direct_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_4_idx_direct_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_4_idx_direct_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, k, m, j, i, integral)
|
||||
three_e_4_idx_direct_bi_ort(m,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_4_idx_direct_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_4_idx_cycle_1_bi_ort, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE FIRST CYCLIC PERMUTATION TERMS OF SINGLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_4_idx_cycle_1_bi_ort(m,j,k,i) = <mjk|-L|jim> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_4_idx_cycle_1_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_4_idx_cycle_1_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_4_idx_cycle_1_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, k, j, i, m, integral)
|
||||
three_e_4_idx_cycle_1_bi_ort(m,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_4_idx_cycle_1_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! --
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_4_idx_cycle_2_bi_ort, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE FIRST CYCLIC PERMUTATION TERMS OF SINGLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_4_idx_cycle_2_bi_ort(m,j,k,i) = <mjk|-L|imj> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_4_idx_cycle_2_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_4_idx_cycle_2_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_4_idx_cycle_2_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, k, i, m, j, integral)
|
||||
three_e_4_idx_cycle_2_bi_ort(m,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_4_idx_cycle_2_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_4_idx_exch23_bi_ort, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE DIRECT TERMS OF SINGLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_4_idx_exch23_bi_ort(m,j,k,i) = <mjk|-L|jmi> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_4_idx_exch23_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_4_idx_exch23_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_4_idx_exch23_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, k, j, m, i, integral)
|
||||
three_e_4_idx_exch23_bi_ort(m,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_4_idx_exch23_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_4_idx_exch13_bi_ort, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE DIRECT TERMS OF SINGLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_4_idx_exch13_bi_ort(m,j,k,i) = <mjk|-L|jmi> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_4_idx_exch13_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_4_idx_exch13_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_4_idx_exch13_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, k, i, j, m, integral)
|
||||
three_e_4_idx_exch13_bi_ort(m,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_4_idx_exch13_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_4_idx_exch12_bi_ort, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE DIRECT TERMS OF SINGLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_4_idx_exch12_bi_ort(m,j,k,i) = <mjk|-L|jmi> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_4_idx_exch12_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_4_idx_exch12_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_4_idx_exch12_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, j, k, m, i, j, integral)
|
||||
three_e_4_idx_exch12_bi_ort(m,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_4_idx_exch12_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
296
src/bi_ort_ints/three_body_ijmkl.irp.f
Normal file
296
src/bi_ort_ints/three_body_ijmkl.irp.f
Normal file
|
@ -0,0 +1,296 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_5_idx_direct_bi_ort, (mo_num, mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE DIRECT TERMS OF DOUBLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_5_idx_direct_bi_ort(m,l,j,k,i) = <mjk|-L|mji> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m, l
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_5_idx_direct_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_5_idx_direct_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,l,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_5_idx_direct_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, l, k, m, j, i, integral)
|
||||
three_e_5_idx_direct_bi_ort(m,l,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_5_idx_direct_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_5_idx_cycle_1_bi_ort, (mo_num, mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE FIRST CYCLIC PERMUTATION TERMS OF DOUBLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_5_idx_cycle_1_bi_ort(m,l,j,k,i) = <mlk|-L|jim> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m, l
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_5_idx_cycle_1_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_5_idx_cycle_1_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,l,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_5_idx_cycle_1_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, l, k, j, i, m, integral)
|
||||
three_e_5_idx_cycle_1_bi_ort(m,l,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_5_idx_cycle_1_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_5_idx_cycle_2_bi_ort, (mo_num, mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE FIRST CYCLIC PERMUTATION TERMS OF DOUBLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_5_idx_cycle_2_bi_ort(m,l,j,k,i) = <mlk|-L|imj> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m, l
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_5_idx_cycle_2_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_5_idx_cycle_2_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,l,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_5_idx_cycle_2_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, l, k, i, m, j, integral)
|
||||
three_e_5_idx_cycle_2_bi_ort(m,l,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_5_idx_cycle_2_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_5_idx_exch23_bi_ort, (mo_num, mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE DIRECT TERMS OF DOUBLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_5_idx_exch23_bi_ort(m,l,j,k,i) = <mlk|-L|jmi> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m, l
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_5_idx_exch23_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_5_idx_exch23_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,l,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_5_idx_exch23_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, l, k, j, m, i, integral)
|
||||
three_e_5_idx_exch23_bi_ort(m,l,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_5_idx_exch23_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_5_idx_exch13_bi_ort, (mo_num, mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE DIRECT TERMS OF DOUBLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_5_idx_exch13_bi_ort(m,l,j,k,i) = <mlk|-L|jmi> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m, l
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_5_idx_exch13_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_5_idx_exch13_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,l,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_5_idx_exch13_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, l, k, i, j, m, integral)
|
||||
three_e_5_idx_exch13_bi_ort(m,l,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_5_idx_exch13_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_e_5_idx_exch12_bi_ort, (mo_num, mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! matrix element of the -L three-body operator FOR THE DIRECT TERMS OF DOUBLE EXCITATIONS AND BI ORTHO MOs
|
||||
!
|
||||
! three_e_5_idx_exch12_bi_ort(m,l,j,k,i) = <mlk|-L|jmi> ::: notice that i is the RIGHT MO and k is the LEFT MO
|
||||
!
|
||||
! notice the -1 sign: in this way three_e_3_idx_direct_bi_ort can be directly used to compute Slater rules with a + sign
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, m, l
|
||||
double precision :: integral, wall1, wall0
|
||||
|
||||
three_e_5_idx_exch12_bi_ort = 0.d0
|
||||
print *, ' Providing the three_e_5_idx_exch12_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,m,l,integral) &
|
||||
!$OMP SHARED (mo_num,three_e_5_idx_exch12_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(m, l, k, m, i, j, integral)
|
||||
three_e_5_idx_exch12_bi_ort(m,l,j,k,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_e_5_idx_exch12_bi_ort', wall1 - wall0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
172
src/bi_ort_ints/three_body_ints_bi_ort.irp.f
Normal file
172
src/bi_ort_ints/three_body_ints_bi_ort.irp.f
Normal file
|
@ -0,0 +1,172 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, three_body_ints_bi_ort, (mo_num, mo_num, mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
! matrix element of the -L three-body operator
|
||||
!
|
||||
! notice the -1 sign: in this way three_body_ints_bi_ort can be directly used to compute Slater rules :)
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, l, m, n
|
||||
double precision :: integral, wall1, wall0
|
||||
character*(128) :: name_file
|
||||
|
||||
three_body_ints_bi_ort = 0.d0
|
||||
print*,'Providing the three_body_ints_bi_ort ...'
|
||||
call wall_time(wall0)
|
||||
name_file = 'six_index_tensor'
|
||||
|
||||
! if(read_three_body_ints_bi_ort)then
|
||||
! call read_fcidump_3_tc(three_body_ints_bi_ort)
|
||||
! else
|
||||
! if(read_three_body_ints_bi_ort)then
|
||||
! print*,'Reading three_body_ints_bi_ort from disk ...'
|
||||
! call read_array_6_index_tensor(mo_num,three_body_ints_bi_ort,name_file)
|
||||
! else
|
||||
|
||||
!provide x_W_ki_bi_ortho_erf_rk
|
||||
provide mos_r_in_r_array_transp mos_l_in_r_array_transp
|
||||
|
||||
!$OMP PARALLEL &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,j,k,l,m,n,integral) &
|
||||
!$OMP SHARED (mo_num,three_body_ints_bi_ort)
|
||||
!$OMP DO SCHEDULE (dynamic)
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do m = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do n = 1, mo_num
|
||||
call give_integrals_3_body_bi_ort(n, l, k, m, j, i, integral)
|
||||
|
||||
three_body_ints_bi_ort(n,l,k,m,j,i) = -1.d0 * integral
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END DO
|
||||
!$OMP END PARALLEL
|
||||
! endif
|
||||
! endif
|
||||
|
||||
call wall_time(wall1)
|
||||
print *, ' wall time for three_body_ints_bi_ort', wall1 - wall0
|
||||
! if(write_three_body_ints_bi_ort)then
|
||||
! print*,'Writing three_body_ints_bi_ort on disk ...'
|
||||
! call write_array_6_index_tensor(mo_num,three_body_ints_bi_ort,name_file)
|
||||
! call ezfio_set_three_body_ints_bi_ort_io_three_body_ints_bi_ort("Read")
|
||||
! endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
subroutine give_integrals_3_body_bi_ort(n, l, k, m, j, i, integral)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! < n l k | -L | m j i > with a BI-ORTHONORMAL ORBITALS
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n, l, k, m, j, i
|
||||
double precision, intent(out) :: integral
|
||||
integer :: ipoint
|
||||
double precision :: weight
|
||||
|
||||
integral = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
weight = final_weight_at_r_vector(ipoint)
|
||||
|
||||
integral += weight * mos_l_in_r_array_transp(ipoint,k) * mos_r_in_r_array_transp(ipoint,i) &
|
||||
* ( int2_grad1_u12_bimo_t(ipoint,1,n,m) * int2_grad1_u12_bimo_t(ipoint,1,l,j) &
|
||||
+ int2_grad1_u12_bimo_t(ipoint,2,n,m) * int2_grad1_u12_bimo_t(ipoint,2,l,j) &
|
||||
+ int2_grad1_u12_bimo_t(ipoint,3,n,m) * int2_grad1_u12_bimo_t(ipoint,3,l,j) )
|
||||
integral += weight * mos_l_in_r_array_transp(ipoint,l) * mos_r_in_r_array_transp(ipoint,j) &
|
||||
* ( int2_grad1_u12_bimo_t(ipoint,1,n,m) * int2_grad1_u12_bimo_t(ipoint,1,k,i) &
|
||||
+ int2_grad1_u12_bimo_t(ipoint,2,n,m) * int2_grad1_u12_bimo_t(ipoint,2,k,i) &
|
||||
+ int2_grad1_u12_bimo_t(ipoint,3,n,m) * int2_grad1_u12_bimo_t(ipoint,3,k,i) )
|
||||
integral += weight * mos_l_in_r_array_transp(ipoint,n) * mos_r_in_r_array_transp(ipoint,m) &
|
||||
* ( int2_grad1_u12_bimo_t(ipoint,1,l,j) * int2_grad1_u12_bimo_t(ipoint,1,k,i) &
|
||||
+ int2_grad1_u12_bimo_t(ipoint,2,l,j) * int2_grad1_u12_bimo_t(ipoint,2,k,i) &
|
||||
+ int2_grad1_u12_bimo_t(ipoint,3,l,j) * int2_grad1_u12_bimo_t(ipoint,3,k,i) )
|
||||
|
||||
enddo
|
||||
|
||||
end subroutine give_integrals_3_body_bi_ort
|
||||
|
||||
! ---
|
||||
|
||||
|
||||
subroutine give_integrals_3_body_bi_ort_old(n, l, k, m, j, i, integral)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! < n l k | -L | m j i > with a BI-ORTHONORMAL ORBITALS
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: n, l, k, m, j, i
|
||||
double precision, intent(out) :: integral
|
||||
integer :: ipoint
|
||||
double precision :: weight
|
||||
|
||||
integral = 0.d0
|
||||
do ipoint = 1, n_points_final_grid
|
||||
weight = final_weight_at_r_vector(ipoint)
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! integral += weight * mos_l_in_r_array_transp(ipoint,k) * mos_r_in_r_array_transp(ipoint,i) &
|
||||
! * ( x_W_ki_bi_ortho_erf_rk(ipoint,1,n,m) * x_W_ki_bi_ortho_erf_rk(ipoint,1,l,j) &
|
||||
! + x_W_ki_bi_ortho_erf_rk(ipoint,2,n,m) * x_W_ki_bi_ortho_erf_rk(ipoint,2,l,j) &
|
||||
! + x_W_ki_bi_ortho_erf_rk(ipoint,3,n,m) * x_W_ki_bi_ortho_erf_rk(ipoint,3,l,j) )
|
||||
! integral += weight * mos_l_in_r_array_transp(ipoint,l) * mos_r_in_r_array_transp(ipoint,j) &
|
||||
! * ( x_W_ki_bi_ortho_erf_rk(ipoint,1,n,m) * x_W_ki_bi_ortho_erf_rk(ipoint,1,k,i) &
|
||||
! + x_W_ki_bi_ortho_erf_rk(ipoint,2,n,m) * x_W_ki_bi_ortho_erf_rk(ipoint,2,k,i) &
|
||||
! + x_W_ki_bi_ortho_erf_rk(ipoint,3,n,m) * x_W_ki_bi_ortho_erf_rk(ipoint,3,k,i) )
|
||||
! integral += weight * mos_l_in_r_array_transp(ipoint,n) * mos_r_in_r_array_transp(ipoint,m) &
|
||||
! * ( x_W_ki_bi_ortho_erf_rk(ipoint,1,l,j) * x_W_ki_bi_ortho_erf_rk(ipoint,1,k,i) &
|
||||
! + x_W_ki_bi_ortho_erf_rk(ipoint,2,l,j) * x_W_ki_bi_ortho_erf_rk(ipoint,2,k,i) &
|
||||
! + x_W_ki_bi_ortho_erf_rk(ipoint,3,l,j) * x_W_ki_bi_ortho_erf_rk(ipoint,3,k,i) )
|
||||
|
||||
! integral += weight * mos_l_in_r_array_transp(ipoint,k) * mos_r_in_r_array_transp(ipoint,i) &
|
||||
! * ( int2_grad1_u12_bimo(1,n,m,ipoint) * int2_grad1_u12_bimo(1,l,j,ipoint) &
|
||||
! + int2_grad1_u12_bimo(2,n,m,ipoint) * int2_grad1_u12_bimo(2,l,j,ipoint) &
|
||||
! + int2_grad1_u12_bimo(3,n,m,ipoint) * int2_grad1_u12_bimo(3,l,j,ipoint) )
|
||||
! integral += weight * mos_l_in_r_array_transp(ipoint,l) * mos_r_in_r_array_transp(ipoint,j) &
|
||||
! * ( int2_grad1_u12_bimo(1,n,m,ipoint) * int2_grad1_u12_bimo(1,k,i,ipoint) &
|
||||
! + int2_grad1_u12_bimo(2,n,m,ipoint) * int2_grad1_u12_bimo(2,k,i,ipoint) &
|
||||
! + int2_grad1_u12_bimo(3,n,m,ipoint) * int2_grad1_u12_bimo(3,k,i,ipoint) )
|
||||
! integral += weight * mos_l_in_r_array_transp(ipoint,n) * mos_r_in_r_array_transp(ipoint,m) &
|
||||
! * ( int2_grad1_u12_bimo(1,l,j,ipoint) * int2_grad1_u12_bimo(1,k,i,ipoint) &
|
||||
! + int2_grad1_u12_bimo(2,l,j,ipoint) * int2_grad1_u12_bimo(2,k,i,ipoint) &
|
||||
! + int2_grad1_u12_bimo(3,l,j,ipoint) * int2_grad1_u12_bimo(3,k,i,ipoint) )
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
integral += weight * mos_l_in_r_array_transp(ipoint,k) * mos_r_in_r_array_transp(ipoint,i) &
|
||||
* ( int2_grad1_u12_bimo_transp(n,m,1,ipoint) * int2_grad1_u12_bimo_transp(l,j,1,ipoint) &
|
||||
+ int2_grad1_u12_bimo_transp(n,m,2,ipoint) * int2_grad1_u12_bimo_transp(l,j,2,ipoint) &
|
||||
+ int2_grad1_u12_bimo_transp(n,m,3,ipoint) * int2_grad1_u12_bimo_transp(l,j,3,ipoint) )
|
||||
integral += weight * mos_l_in_r_array_transp(ipoint,l) * mos_r_in_r_array_transp(ipoint,j) &
|
||||
* ( int2_grad1_u12_bimo_transp(n,m,1,ipoint) * int2_grad1_u12_bimo_transp(k,i,1,ipoint) &
|
||||
+ int2_grad1_u12_bimo_transp(n,m,2,ipoint) * int2_grad1_u12_bimo_transp(k,i,2,ipoint) &
|
||||
+ int2_grad1_u12_bimo_transp(n,m,3,ipoint) * int2_grad1_u12_bimo_transp(k,i,3,ipoint) )
|
||||
integral += weight * mos_l_in_r_array_transp(ipoint,n) * mos_r_in_r_array_transp(ipoint,m) &
|
||||
* ( int2_grad1_u12_bimo_transp(l,j,1,ipoint) * int2_grad1_u12_bimo_transp(k,i,1,ipoint) &
|
||||
+ int2_grad1_u12_bimo_transp(l,j,2,ipoint) * int2_grad1_u12_bimo_transp(k,i,2,ipoint) &
|
||||
+ int2_grad1_u12_bimo_transp(l,j,3,ipoint) * int2_grad1_u12_bimo_transp(k,i,3,ipoint) )
|
||||
|
||||
enddo
|
||||
|
||||
end subroutine give_integrals_3_body_bi_ort_old
|
||||
|
||||
! ---
|
||||
|
198
src/bi_ort_ints/total_twoe_pot.irp.f
Normal file
198
src/bi_ort_ints/total_twoe_pot.irp.f
Normal file
|
@ -0,0 +1,198 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, ao_two_e_tc_tot, (ao_num, ao_num, ao_num, ao_num) ]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! ao_two_e_tc_tot(k,i,l,j) = (ki|V^TC(r_12)|lj) = <lk| V^TC(r_12) |ji> where V^TC(r_12) is the total TC operator
|
||||
!
|
||||
! including both hermitian and non hermitian parts. THIS IS IN CHEMIST NOTATION.
|
||||
!
|
||||
! WARNING :: non hermitian ! acts on "the right functions" (i,j)
|
||||
!
|
||||
END_DOC
|
||||
|
||||
integer :: i, j, k, l
|
||||
double precision :: integral_sym, integral_nsym
|
||||
double precision, external :: get_ao_tc_sym_two_e_pot
|
||||
|
||||
provide j1b_type
|
||||
|
||||
if(j1b_type .eq. 3) then
|
||||
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
ao_two_e_tc_tot(k,i,l,j) = ao_tc_int_chemist(k,i,l,j)
|
||||
!write(222,*) ao_two_e_tc_tot(k,i,l,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
else
|
||||
|
||||
PROVIDE ao_tc_sym_two_e_pot_in_map
|
||||
|
||||
do j = 1, ao_num
|
||||
do l = 1, ao_num
|
||||
do i = 1, ao_num
|
||||
do k = 1, ao_num
|
||||
|
||||
integral_sym = get_ao_tc_sym_two_e_pot(i, j, k, l, ao_tc_sym_two_e_pot_map)
|
||||
! ao_non_hermit_term_chemist(k,i,l,j) = < k l | [erf( mu r12) - 1] d/d_r12 | i j > on the AO basis
|
||||
integral_nsym = ao_non_hermit_term_chemist(k,i,l,j)
|
||||
|
||||
ao_two_e_tc_tot(k,i,l,j) = integral_sym + integral_nsym
|
||||
!write(111,*) ao_two_e_tc_tot(k,i,l,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
double precision function bi_ortho_mo_ints(l, k, j, i)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! <mo^L_k mo^L_l | V^TC(r_12) | mo^R_i mo^R_j>
|
||||
!
|
||||
! WARNING :: very naive, super slow, only used to DEBUG.
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: i, j, k, l
|
||||
integer :: m, n, p, q
|
||||
|
||||
bi_ortho_mo_ints = 0.d0
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do n = 1, ao_num
|
||||
do q = 1, ao_num
|
||||
! p1h1p2h2 l1 l2 r1 r2
|
||||
bi_ortho_mo_ints += ao_two_e_tc_tot(n,q,m,p) * mo_l_coef(m,l) * mo_l_coef(n,k) * mo_r_coef(p,j) * mo_r_coef(q,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end function bi_ortho_mo_ints
|
||||
|
||||
! ---
|
||||
|
||||
! TODO :: transform into DEGEMM
|
||||
|
||||
BEGIN_PROVIDER [double precision, mo_bi_ortho_tc_two_e_chemist, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! mo_bi_ortho_tc_two_e_chemist(k,i,l,j) = <k l|V(r_12)|i j> where i,j are right MOs and k,l are left MOs
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, l, m, n, p, q
|
||||
double precision, allocatable :: mo_tmp_1(:,:,:,:), mo_tmp_2(:,:,:,:)
|
||||
|
||||
allocate(mo_tmp_1(mo_num,ao_num,ao_num,ao_num))
|
||||
mo_tmp_1 = 0.d0
|
||||
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do n = 1, ao_num
|
||||
do q = 1, ao_num
|
||||
do k = 1, mo_num
|
||||
! (k n|p m) = sum_q c_qk * (q n|p m)
|
||||
mo_tmp_1(k,n,p,m) += mo_l_coef_transp(k,q) * ao_two_e_tc_tot(q,n,p,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
allocate(mo_tmp_2(mo_num,mo_num,ao_num,ao_num))
|
||||
mo_tmp_2 = 0.d0
|
||||
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do n = 1, ao_num
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
! (k i|p m) = sum_n c_ni * (k n|p m)
|
||||
mo_tmp_2(k,i,p,m) += mo_r_coef_transp(i,n) * mo_tmp_1(k,n,p,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(mo_tmp_1)
|
||||
|
||||
allocate(mo_tmp_1(mo_num,mo_num,mo_num,ao_num))
|
||||
mo_tmp_1 = 0.d0
|
||||
do m = 1, ao_num
|
||||
do p = 1, ao_num
|
||||
do l = 1, mo_num
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
mo_tmp_1(k,i,l,m) += mo_l_coef_transp(l,p) * mo_tmp_2(k,i,p,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(mo_tmp_2)
|
||||
|
||||
mo_bi_ortho_tc_two_e_chemist = 0.d0
|
||||
do m = 1, ao_num
|
||||
do j = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
mo_bi_ortho_tc_two_e_chemist(k,i,l,j) += mo_r_coef_transp(j,m) * mo_tmp_1(k,i,l,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
deallocate(mo_tmp_1)
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, mo_bi_ortho_tc_two_e, (mo_num, mo_num, mo_num, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! mo_bi_ortho_tc_two_e(k,l,i,j) = <k l| V(r_12) |i j> where i,j are right MOs and k,l are left MOs
|
||||
!
|
||||
! the potential V(r_12) contains ALL TWO-E CONTRIBUTION OF THE TC-HAMILTONIAN
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j, k, l
|
||||
|
||||
do j = 1, mo_num
|
||||
do i = 1, mo_num
|
||||
do l = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
! < k l | V12 | i j > (k i|l j)
|
||||
mo_bi_ortho_tc_two_e(k,l,i,j) = mo_bi_ortho_tc_two_e_chemist(k,i,l,j)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
2
src/bi_ortho_aos/NEED
Normal file
2
src/bi_ortho_aos/NEED
Normal file
|
@ -0,0 +1,2 @@
|
|||
basis
|
||||
ao_basis
|
5
src/bi_ortho_aos/README.rst
Normal file
5
src/bi_ortho_aos/README.rst
Normal file
|
@ -0,0 +1,5 @@
|
|||
============
|
||||
bi_ortho_aos
|
||||
============
|
||||
|
||||
TODO
|
97
src/bi_ortho_aos/aos_l.irp.f
Normal file
97
src/bi_ortho_aos/aos_l.irp.f
Normal file
|
@ -0,0 +1,97 @@
|
|||
BEGIN_PROVIDER [ double precision, ao_coef_l , (ao_num,ao_prim_num_max) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Primitive coefficients and exponents for each atomic orbital. Copied from shell info.
|
||||
END_DOC
|
||||
|
||||
integer :: i, l
|
||||
do i=1,ao_num
|
||||
l = ao_shell(i)
|
||||
ao_coef_l(i,:) = shell_coef(l,:)
|
||||
end do
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_coef_l_normalized, (ao_num,ao_prim_num_max) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_coef_l_normalization_factor, (ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Coefficients including the |AO| normalization
|
||||
END_DOC
|
||||
|
||||
do i=1,ao_num
|
||||
l = ao_shell(i)
|
||||
ao_coef_l_normalized(i,:) = shell_coef(l,:) * shell_normalization_factor(l)
|
||||
end do
|
||||
|
||||
double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c
|
||||
integer :: l, powA(3), nz
|
||||
integer :: i,j,k
|
||||
nz=100
|
||||
C_A = 0.d0
|
||||
|
||||
do i=1,ao_num
|
||||
|
||||
powA(1) = ao_power(i,1)
|
||||
powA(2) = ao_power(i,2)
|
||||
powA(3) = ao_power(i,3)
|
||||
|
||||
! Normalization of the primitives
|
||||
if (primitives_normalized) then
|
||||
do j=1,ao_prim_num(i)
|
||||
call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,j), &
|
||||
powA,powA,overlap_x,overlap_y,overlap_z,norm,nz)
|
||||
ao_coef_l_normalized(i,j) = ao_coef_l_normalized(i,j)/dsqrt(norm)
|
||||
enddo
|
||||
endif
|
||||
! Normalization of the contracted basis functions
|
||||
if (ao_normalized) then
|
||||
norm = 0.d0
|
||||
do j=1,ao_prim_num(i)
|
||||
do k=1,ao_prim_num(i)
|
||||
call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz)
|
||||
norm = norm+c*ao_coef_l_normalized(i,j)*ao_coef_l_normalized(i,k)
|
||||
enddo
|
||||
enddo
|
||||
ao_coef_l_normalization_factor(i) = 1.d0/dsqrt(norm)
|
||||
else
|
||||
ao_coef_l_normalization_factor(i) = 1.d0
|
||||
endif
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_coef_l_normalized_ordered, (ao_num,ao_prim_num_max) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Sorted primitives to accelerate 4 index |MO| transformation
|
||||
END_DOC
|
||||
|
||||
integer :: iorder(ao_prim_num_max)
|
||||
double precision :: d(ao_prim_num_max,2)
|
||||
integer :: i,j
|
||||
do i=1,ao_num
|
||||
do j=1,ao_prim_num(i)
|
||||
iorder(j) = j
|
||||
d(j,2) = ao_coef_l_normalized(i,j)
|
||||
enddo
|
||||
call dsort(d(1,1),iorder,ao_prim_num(i))
|
||||
call dset_order(d(1,2),iorder,ao_prim_num(i))
|
||||
do j=1,ao_prim_num(i)
|
||||
ao_coef_l_normalized_ordered(i,j) = d(j,2)
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_coef_l_normalized_ordered_transp, (ao_prim_num_max,ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Transposed :c:data:`ao_coef_l_normalized_ordered`
|
||||
END_DOC
|
||||
integer :: i,j
|
||||
do j=1, ao_num
|
||||
do i=1, ao_prim_num_max
|
||||
ao_coef_l_normalized_ordered_transp(i,j) = ao_coef_l_normalized_ordered(j,i)
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
97
src/bi_ortho_aos/aos_r.irp.f
Normal file
97
src/bi_ortho_aos/aos_r.irp.f
Normal file
|
@ -0,0 +1,97 @@
|
|||
BEGIN_PROVIDER [ double precision, ao_coef_r , (ao_num,ao_prim_num_max) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Primitive coefficients and exponents for each atomic orbital. Copied from shell info.
|
||||
END_DOC
|
||||
|
||||
integer :: i, l
|
||||
do i=1,ao_num
|
||||
l = ao_shell(i)
|
||||
ao_coef_r(i,:) = shell_coef(l,:)
|
||||
end do
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_coef_r_normalized, (ao_num,ao_prim_num_max) ]
|
||||
&BEGIN_PROVIDER [ double precision, ao_coef_r_normalization_factor, (ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Coefficients including the |AO| normalization
|
||||
END_DOC
|
||||
|
||||
do i=1,ao_num
|
||||
l = ao_shell(i)
|
||||
ao_coef_r_normalized(i,:) = shell_coef(l,:) * shell_normalization_factor(l)
|
||||
end do
|
||||
|
||||
double precision :: norm,overlap_x,overlap_y,overlap_z,C_A(3), c
|
||||
integer :: l, powA(3), nz
|
||||
integer :: i,j,k
|
||||
nz=100
|
||||
C_A = 0.d0
|
||||
|
||||
do i=1,ao_num
|
||||
|
||||
powA(1) = ao_power(i,1)
|
||||
powA(2) = ao_power(i,2)
|
||||
powA(3) = ao_power(i,3)
|
||||
|
||||
! Normalization of the primitives
|
||||
if (primitives_normalized) then
|
||||
do j=1,ao_prim_num(i)
|
||||
call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,j), &
|
||||
powA,powA,overlap_x,overlap_y,overlap_z,norm,nz)
|
||||
ao_coef_r_normalized(i,j) = ao_coef_r_normalized(i,j)/dsqrt(norm)
|
||||
enddo
|
||||
endif
|
||||
! Normalization of the contracted basis functions
|
||||
if (ao_normalized) then
|
||||
norm = 0.d0
|
||||
do j=1,ao_prim_num(i)
|
||||
do k=1,ao_prim_num(i)
|
||||
call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz)
|
||||
norm = norm+c*ao_coef_r_normalized(i,j)*ao_coef_r_normalized(i,k)
|
||||
enddo
|
||||
enddo
|
||||
ao_coef_r_normalization_factor(i) = 1.d0/dsqrt(norm)
|
||||
else
|
||||
ao_coef_r_normalization_factor(i) = 1.d0
|
||||
endif
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_coef_r_normalized_ordered, (ao_num,ao_prim_num_max) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Sorted primitives to accelerate 4 index |MO| transformation
|
||||
END_DOC
|
||||
|
||||
integer :: iorder(ao_prim_num_max)
|
||||
double precision :: d(ao_prim_num_max,2)
|
||||
integer :: i,j
|
||||
do i=1,ao_num
|
||||
do j=1,ao_prim_num(i)
|
||||
iorder(j) = j
|
||||
d(j,2) = ao_coef_r_normalized(i,j)
|
||||
enddo
|
||||
call dsort(d(1,1),iorder,ao_prim_num(i))
|
||||
call dset_order(d(1,2),iorder,ao_prim_num(i))
|
||||
do j=1,ao_prim_num(i)
|
||||
ao_coef_r_normalized_ordered(i,j) = d(j,2)
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, ao_coef_r_normalized_ordered_transp, (ao_prim_num_max,ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Transposed :c:data:`ao_coef_r_normalized_ordered`
|
||||
END_DOC
|
||||
integer :: i,j
|
||||
do j=1, ao_num
|
||||
do i=1, ao_prim_num_max
|
||||
ao_coef_r_normalized_ordered_transp(i,j) = ao_coef_r_normalized_ordered(j,i)
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
11
src/bi_ortho_mos/EZFIO.cfg
Normal file
11
src/bi_ortho_mos/EZFIO.cfg
Normal file
|
@ -0,0 +1,11 @@
|
|||
[mo_r_coef]
|
||||
type: double precision
|
||||
doc: right-coefficient of the i-th |AO| on the j-th |MO|
|
||||
interface: ezfio
|
||||
size: (ao_basis.ao_num,mo_basis.mo_num)
|
||||
|
||||
[mo_l_coef]
|
||||
type: double precision
|
||||
doc: right-coefficient of the i-th |AO| on the j-th |MO|
|
||||
interface: ezfio
|
||||
size: (ao_basis.ao_num,mo_basis.mo_num)
|
3
src/bi_ortho_mos/NEED
Normal file
3
src/bi_ortho_mos/NEED
Normal file
|
@ -0,0 +1,3 @@
|
|||
mo_basis
|
||||
becke_numerical_grid
|
||||
dft_utils_in_r
|
49
src/bi_ortho_mos/bi_density.irp.f
Normal file
49
src/bi_ortho_mos/bi_density.irp.f
Normal file
|
@ -0,0 +1,49 @@
|
|||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [double precision, TCSCF_bi_ort_dm_ao_alpha, (ao_num, ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! TCSCF_bi_ort_dm_ao_alpha(i,j) = <Chi_0| a^dagger_i,alpha a_j,alpha |Phi_0> where i,j are AO basis.
|
||||
!
|
||||
! This is the equivalent of the alpha density of the HF Slater determinant, but with a couple of bi-orthonormal Slater determinant |Chi_0> and |Phi_0>
|
||||
END_DOC
|
||||
call dgemm( 'N', 'T', ao_num, ao_num, elec_alpha_num, 1.d0 &
|
||||
, mo_l_coef, size(mo_l_coef, 1), mo_r_coef, size(mo_r_coef, 1) &
|
||||
, 0.d0, TCSCF_bi_ort_dm_ao_alpha, size(TCSCF_bi_ort_dm_ao_alpha, 1) )
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, TCSCF_bi_ort_dm_ao_beta, (ao_num, ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! TCSCF_bi_ort_dm_ao_beta(i,j) = <Chi_0| a^dagger_i,beta a_j,beta |Phi_0> where i,j are AO basis.
|
||||
!
|
||||
! This is the equivalent of the beta density of the HF Slater determinant, but with a couple of bi-orthonormal Slater determinant |Chi_0> and |Phi_0>
|
||||
END_DOC
|
||||
call dgemm( 'N', 'T', ao_num, ao_num, elec_beta_num, 1.d0 &
|
||||
, mo_l_coef, size(mo_l_coef, 1), mo_r_coef, size(mo_r_coef, 1) &
|
||||
, 0.d0, TCSCF_bi_ort_dm_ao_beta, size(TCSCF_bi_ort_dm_ao_beta, 1) )
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, TCSCF_bi_ort_dm_ao, (ao_num, ao_num) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! TCSCF_bi_ort_dm_ao(i,j) = <Chi_0| a^dagger_i,beta+alpha a_j,beta+alpha |Phi_0> where i,j are AO basis.
|
||||
!
|
||||
! This is the equivalent of the total electronic density of the HF Slater determinant, but with a couple of bi-orthonormal Slater determinant |Chi_0> and |Phi_0>
|
||||
END_DOC
|
||||
ASSERT ( size(TCSCF_bi_ort_dm_ao, 1) == size(TCSCF_bi_ort_dm_ao_alpha, 1) )
|
||||
if( elec_alpha_num==elec_beta_num ) then
|
||||
TCSCF_bi_ort_dm_ao = TCSCF_bi_ort_dm_ao_alpha + TCSCF_bi_ort_dm_ao_alpha
|
||||
else
|
||||
ASSERT ( size(TCSCF_bi_ort_dm_ao, 1) == size(TCSCF_bi_ort_dm_ao_beta, 1))
|
||||
TCSCF_bi_ort_dm_ao = TCSCF_bi_ort_dm_ao_alpha + TCSCF_bi_ort_dm_ao_beta
|
||||
endif
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
137
src/bi_ortho_mos/bi_ort_mos_in_r.irp.f
Normal file
137
src/bi_ortho_mos/bi_ort_mos_in_r.irp.f
Normal file
|
@ -0,0 +1,137 @@
|
|||
|
||||
! TODO: left & right MO without duplicate AO calculation
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER[double precision, mos_r_in_r_array, (mo_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
! mos_in_r_array(i,j) = value of the ith RIGHT mo on the jth grid point
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j
|
||||
double precision :: mos_array(mo_num), r(3)
|
||||
|
||||
!$OMP PARALLEL DO &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i, j, r, mos_array) &
|
||||
!$OMP SHARED (mos_r_in_r_array, n_points_final_grid, mo_num, final_grid_points)
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
call give_all_mos_r_at_r(r, mos_array)
|
||||
do j = 1, mo_num
|
||||
mos_r_in_r_array(j,i) = mos_array(j)
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER[double precision, mos_r_in_r_array_transp, (n_points_final_grid, mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
! mos_r_in_r_array_transp(i,j) = value of the jth mo on the ith grid point
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i,j
|
||||
|
||||
do i = 1, n_points_final_grid
|
||||
do j = 1, mo_num
|
||||
mos_r_in_r_array_transp(i,j) = mos_r_in_r_array(j,i)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
subroutine give_all_mos_r_at_r(r, mos_r_array)
|
||||
|
||||
BEGIN_DOC
|
||||
! mos_r_array(i) = ith RIGHT MO function evaluated at "r"
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r(3)
|
||||
double precision, intent(out) :: mos_r_array(mo_num)
|
||||
double precision :: aos_array(ao_num)
|
||||
|
||||
call give_all_aos_at_r(r, aos_array)
|
||||
call dgemv('N', mo_num, ao_num, 1.d0, mo_r_coef_transp, mo_num, aos_array, 1, 0.d0, mos_r_array, 1)
|
||||
|
||||
end subroutine give_all_mos_r_at_r
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER[double precision, mos_l_in_r_array, (mo_num, n_points_final_grid)]
|
||||
|
||||
BEGIN_DOC
|
||||
! mos_in_r_array(i,j) = value of the ith LEFT mo on the jth grid point
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j
|
||||
double precision :: mos_array(mo_num), r(3)
|
||||
|
||||
!$OMP PARALLEL DO &
|
||||
!$OMP DEFAULT (NONE) &
|
||||
!$OMP PRIVATE (i,r,mos_array,j) &
|
||||
!$OMP SHARED(mos_l_in_r_array,n_points_final_grid,mo_num,final_grid_points)
|
||||
do i = 1, n_points_final_grid
|
||||
r(1) = final_grid_points(1,i)
|
||||
r(2) = final_grid_points(2,i)
|
||||
r(3) = final_grid_points(3,i)
|
||||
call give_all_mos_l_at_r(r, mos_array)
|
||||
do j = 1, mo_num
|
||||
mos_l_in_r_array(j,i) = mos_array(j)
|
||||
enddo
|
||||
enddo
|
||||
!$OMP END PARALLEL DO
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
subroutine give_all_mos_l_at_r(r, mos_l_array)
|
||||
|
||||
BEGIN_DOC
|
||||
! mos_l_array(i) = ith LEFT MO function evaluated at "r"
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
double precision, intent(in) :: r(3)
|
||||
double precision, intent(out) :: mos_l_array(mo_num)
|
||||
double precision :: aos_array(ao_num)
|
||||
|
||||
call give_all_aos_at_r(r, aos_array)
|
||||
call dgemv('N', mo_num, ao_num, 1.d0, mo_l_coef_transp, mo_num, aos_array, 1, 0.d0, mos_l_array, 1)
|
||||
|
||||
end subroutine give_all_mos_l_at_r
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER[double precision, mos_l_in_r_array_transp,(n_points_final_grid,mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
! mos_l_in_r_array_transp(i,j) = value of the jth mo on the ith grid point
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j
|
||||
|
||||
do i = 1, n_points_final_grid
|
||||
do j = 1, mo_num
|
||||
mos_l_in_r_array_transp(i,j) = mos_l_in_r_array(j,i)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
100
src/bi_ortho_mos/grad_bi_ort_mos_in_r.irp.f
Normal file
100
src/bi_ortho_mos/grad_bi_ort_mos_in_r.irp.f
Normal file
|
@ -0,0 +1,100 @@
|
|||
BEGIN_PROVIDER[double precision, mos_r_grad_in_r_array,(mo_num,n_points_final_grid,3)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! mos_r_grad_in_r_array(i,j,k) = value of the kth component of the gradient of ith RIGHT mo on the jth grid point
|
||||
!
|
||||
! k = 1 : x, k= 2, y, k 3, z
|
||||
END_DOC
|
||||
integer :: m
|
||||
mos_r_grad_in_r_array = 0.d0
|
||||
do m=1,3
|
||||
call dgemm('N','N',mo_num,n_points_final_grid,ao_num,1.d0,mo_r_coef_transp,mo_num,aos_grad_in_r_array(1,1,m),ao_num,0.d0,mos_r_grad_in_r_array(1,1,m),mo_num)
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER[double precision, mos_r_grad_in_r_array_transp,(3,mo_num,n_points_final_grid)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! mos_r_grad_in_r_array_transp(i,j,k) = value of the kth component of the gradient of jth RIGHT mo on the ith grid point
|
||||
!
|
||||
! k = 1 : x, k= 2, y, k 3, z
|
||||
END_DOC
|
||||
integer :: m
|
||||
integer :: i,j
|
||||
mos_r_grad_in_r_array_transp = 0.d0
|
||||
do i = 1, n_points_final_grid
|
||||
do j = 1, mo_num
|
||||
do m = 1, 3
|
||||
mos_r_grad_in_r_array_transp(m,j,i) = mos_r_grad_in_r_array(j,i,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER[double precision, mos_r_grad_in_r_array_transp_bis,(3,n_points_final_grid,mo_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! mos_r_grad_in_r_array_transp(i,j,k) = value of the ith component of the gradient on the jth grid point of jth RIGHT MO
|
||||
END_DOC
|
||||
integer :: m
|
||||
integer :: i,j
|
||||
mos_r_grad_in_r_array_transp_bis = 0.d0
|
||||
do j = 1, mo_num
|
||||
do i = 1, n_points_final_grid
|
||||
do m = 1, 3
|
||||
mos_r_grad_in_r_array_transp_bis(m,i,j) = mos_r_grad_in_r_array(j,i,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER[double precision, mos_l_grad_in_r_array,(mo_num,n_points_final_grid,3)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! mos_l_grad_in_r_array(i,j,k) = value of the kth component of the gradient of ith RIGHT mo on the jth grid point
|
||||
!
|
||||
! k = 1 : x, k= 2, y, k 3, z
|
||||
END_DOC
|
||||
integer :: m
|
||||
mos_l_grad_in_r_array = 0.d0
|
||||
do m=1,3
|
||||
call dgemm('N','N',mo_num,n_points_final_grid,ao_num,1.d0,mo_r_coef_transp,mo_num,aos_grad_in_r_array(1,1,m),ao_num,0.d0,mos_l_grad_in_r_array(1,1,m),mo_num)
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER[double precision, mos_l_grad_in_r_array_transp,(3,mo_num,n_points_final_grid)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! mos_l_grad_in_r_array_transp(i,j,k) = value of the kth component of the gradient of jth RIGHT mo on the ith grid point
|
||||
!
|
||||
! k = 1 : x, k= 2, y, k 3, z
|
||||
END_DOC
|
||||
integer :: m
|
||||
integer :: i,j
|
||||
mos_l_grad_in_r_array_transp = 0.d0
|
||||
do i = 1, n_points_final_grid
|
||||
do j = 1, mo_num
|
||||
do m = 1, 3
|
||||
mos_l_grad_in_r_array_transp(m,j,i) = mos_l_grad_in_r_array(j,i,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER[double precision, mos_l_grad_in_r_array_transp_bis,(3,n_points_final_grid,mo_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! mos_l_grad_in_r_array_transp(i,j,k) = value of the ith component of the gradient on the jth grid point of jth RIGHT MO
|
||||
END_DOC
|
||||
integer :: m
|
||||
integer :: i,j
|
||||
mos_l_grad_in_r_array_transp_bis = 0.d0
|
||||
do j = 1, mo_num
|
||||
do i = 1, n_points_final_grid
|
||||
do m = 1, 3
|
||||
mos_l_grad_in_r_array_transp_bis(m,i,j) = mos_l_grad_in_r_array(j,i,m)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
177
src/bi_ortho_mos/mos_rl.irp.f
Normal file
177
src/bi_ortho_mos/mos_rl.irp.f
Normal file
|
@ -0,0 +1,177 @@
|
|||
|
||||
! ---
|
||||
|
||||
subroutine ao_to_mo_bi_ortho(A_ao, LDA_ao, A_mo, LDA_mo)
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Transform A from the |AO| basis to the BI ORTHONORMAL MOS
|
||||
!
|
||||
! $C_L^\dagger.A_{ao}.C_R$ where C_L and C_R are the LEFT and RIGHT MO coefs
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer, intent(in) :: LDA_ao, LDA_mo
|
||||
double precision, intent(in) :: A_ao(LDA_ao,ao_num)
|
||||
double precision, intent(out) :: A_mo(LDA_mo,mo_num)
|
||||
double precision, allocatable :: T(:,:)
|
||||
|
||||
allocate ( T(ao_num,mo_num) )
|
||||
!DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: T
|
||||
|
||||
! T = A_ao x mo_r_coef
|
||||
call dgemm( 'N', 'N', ao_num, mo_num, ao_num, 1.d0 &
|
||||
, A_ao, LDA_ao, mo_r_coef, size(mo_r_coef, 1) &
|
||||
, 0.d0, T, size(T, 1) )
|
||||
|
||||
! A_mo = mo_l_coef.T x T
|
||||
call dgemm( 'T', 'N', mo_num, mo_num, ao_num, 1.d0 &
|
||||
, mo_l_coef, size(mo_l_coef, 1), T, size(T, 1) &
|
||||
, 0.d0, A_mo, LDA_mo )
|
||||
|
||||
! call restore_symmetry(mo_num,mo_num,A_mo,size(A_mo,1),1.d-12)
|
||||
deallocate(T)
|
||||
|
||||
end subroutine ao_to_mo_bi_ortho
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, mo_r_coef, (ao_num, mo_num) ]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Molecular right-orbital coefficients on |AO| basis set
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j
|
||||
logical :: exists
|
||||
|
||||
PROVIDE ezfio_filename
|
||||
|
||||
if (mpi_master) then
|
||||
call ezfio_has_bi_ortho_mos_mo_r_coef(exists)
|
||||
endif
|
||||
IRP_IF MPI_DEBUG
|
||||
print *, irp_here, mpi_rank
|
||||
call MPI_BARRIER(MPI_COMM_WORLD, ierr)
|
||||
IRP_ENDIF
|
||||
IRP_IF MPI
|
||||
include 'mpif.h'
|
||||
integer :: ierr
|
||||
call MPI_BCAST(exists, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
|
||||
if (ierr /= MPI_SUCCESS) then
|
||||
stop 'Unable to read mo_r_coef with MPI'
|
||||
endif
|
||||
IRP_ENDIF
|
||||
|
||||
if (exists) then
|
||||
if (mpi_master) then
|
||||
call ezfio_get_bi_ortho_mos_mo_r_coef(mo_r_coef)
|
||||
write(*,*) 'Read mo_r_coef'
|
||||
endif
|
||||
IRP_IF MPI
|
||||
call MPI_BCAST(mo_r_coef, mo_num*ao_num, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
|
||||
if (ierr /= MPI_SUCCESS) then
|
||||
stop 'Unable to read mo_r_coef with MPI'
|
||||
endif
|
||||
IRP_ENDIF
|
||||
else
|
||||
|
||||
print*, 'mo_r_coef are mo_coef'
|
||||
do i = 1, mo_num
|
||||
do j = 1, ao_num
|
||||
mo_r_coef(j,i) = mo_coef(j,i)
|
||||
enddo
|
||||
enddo
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, mo_l_coef, (ao_num, mo_num) ]
|
||||
|
||||
BEGIN_DOC
|
||||
!
|
||||
! Molecular left-orbital coefficients on |AO| basis set
|
||||
!
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, j
|
||||
logical :: exists
|
||||
|
||||
PROVIDE ezfio_filename
|
||||
|
||||
if (mpi_master) then
|
||||
call ezfio_has_bi_ortho_mos_mo_l_coef(exists)
|
||||
endif
|
||||
IRP_IF MPI_DEBUG
|
||||
print *, irp_here, mpi_rank
|
||||
call MPI_BARRIER(MPI_COMM_WORLD, ierr)
|
||||
IRP_ENDIF
|
||||
IRP_IF MPI
|
||||
include 'mpif.h'
|
||||
integer :: ierr
|
||||
call MPI_BCAST(exists, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
|
||||
if (ierr /= MPI_SUCCESS) then
|
||||
stop 'Unable to read mo_l_coef with MPI'
|
||||
endif
|
||||
IRP_ENDIF
|
||||
|
||||
if (exists) then
|
||||
if (mpi_master) then
|
||||
call ezfio_get_bi_ortho_mos_mo_l_coef(mo_l_coef)
|
||||
write(*,*) 'Read mo_l_coef'
|
||||
endif
|
||||
IRP_IF MPI
|
||||
call MPI_BCAST(mo_l_coef, mo_num*ao_num, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr)
|
||||
if (ierr /= MPI_SUCCESS) then
|
||||
stop 'Unable to read mo_l_coef with MPI'
|
||||
endif
|
||||
IRP_ENDIF
|
||||
else
|
||||
|
||||
print*, 'mo_l_coef are mo_coef'
|
||||
do i = 1, mo_num
|
||||
do j = 1, ao_num
|
||||
mo_l_coef(j,i) = mo_coef(j,i)
|
||||
enddo
|
||||
enddo
|
||||
endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, mo_r_coef_transp, (mo_num, ao_num)]
|
||||
|
||||
implicit none
|
||||
integer :: j, m
|
||||
do j = 1, mo_num
|
||||
do m = 1, ao_num
|
||||
mo_r_coef_transp(j,m) = mo_r_coef(m,j)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
BEGIN_PROVIDER [ double precision, mo_l_coef_transp, (mo_num, ao_num)]
|
||||
|
||||
implicit none
|
||||
integer :: j, m
|
||||
do j = 1, mo_num
|
||||
do m = 1, ao_num
|
||||
mo_l_coef_transp(j,m) = mo_l_coef(m,j)
|
||||
enddo
|
||||
enddo
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
142
src/bi_ortho_mos/overlap.irp.f
Normal file
142
src/bi_ortho_mos/overlap.irp.f
Normal file
|
@ -0,0 +1,142 @@
|
|||
|
||||
|
||||
BEGIN_PROVIDER [ double precision, overlap_bi_ortho, (mo_num, mo_num)]
|
||||
&BEGIN_PROVIDER [ double precision, overlap_diag_bi_ortho, (mo_num)]
|
||||
|
||||
BEGIN_DOC
|
||||
! Overlap matrix between the RIGHT and LEFT MOs. Should be the identity matrix
|
||||
END_DOC
|
||||
|
||||
implicit none
|
||||
integer :: i, k, m, n
|
||||
double precision :: accu_d, accu_nd
|
||||
double precision, allocatable :: tmp(:,:)
|
||||
|
||||
! TODO : re do the DEGEMM
|
||||
|
||||
overlap_bi_ortho = 0.d0
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
do m = 1, ao_num
|
||||
do n = 1, ao_num
|
||||
overlap_bi_ortho(k,i) += ao_overlap(n,m) * mo_l_coef(n,k) * mo_r_coef(m,i)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
|
||||
! allocate( tmp(mo_num,ao_num) )
|
||||
!
|
||||
! ! tmp <-- L.T x S_ao
|
||||
! call dgemm( "T", "N", mo_num, ao_num, ao_num, 1.d0 &
|
||||
! , mo_l_coef, size(mo_l_coef, 1), ao_overlap, size(ao_overlap, 1) &
|
||||
! , 0.d0, tmp, size(tmp, 1) )
|
||||
!
|
||||
! ! S <-- tmp x R
|
||||
! call dgemm( "N", "N", mo_num, mo_num, ao_num, 1.d0 &
|
||||
! , tmp, size(tmp, 1), mo_r_coef, size(mo_r_coef, 1) &
|
||||
! , 0.d0, overlap_bi_ortho, size(overlap_bi_ortho, 1) )
|
||||
!
|
||||
! deallocate( tmp )
|
||||
|
||||
do i = 1, mo_num
|
||||
overlap_diag_bi_ortho(i) = overlap_bi_ortho(i,i)
|
||||
enddo
|
||||
|
||||
accu_d = 0.d0
|
||||
accu_nd = 0.d0
|
||||
do i = 1, mo_num
|
||||
do k = 1, mo_num
|
||||
if(i==k) then
|
||||
accu_d += dabs(overlap_bi_ortho(k,i))
|
||||
else
|
||||
accu_nd += dabs(overlap_bi_ortho(k,i))
|
||||
endif
|
||||
enddo
|
||||
enddo
|
||||
accu_d = accu_d/dble(mo_num)
|
||||
accu_nd = accu_nd/dble(mo_num**2-mo_num)
|
||||
if(dabs(accu_d-1.d0).gt.1.d-10.or.dabs(accu_nd).gt.1.d-10)then
|
||||
print*,'Warning !!!'
|
||||
print*,'Average trace of overlap_bi_ortho is different from 1 by ', accu_d
|
||||
print*,'And bi orthogonality is off by an average of ',accu_nd
|
||||
print*,'****************'
|
||||
print*,'Overlap matrix betwee mo_l_coef and mo_r_coef '
|
||||
do i = 1, mo_num
|
||||
write(*,'(100(F16.10,X))')overlap_bi_ortho(i,:)
|
||||
enddo
|
||||
endif
|
||||
print*,'Average trace of overlap_bi_ortho (should be 1.)'
|
||||
print*,'accu_d = ',accu_d
|
||||
print*,'Sum of off diagonal terms of overlap_bi_ortho (should be zero)'
|
||||
print*,'accu_nd = ',accu_nd
|
||||
print*,'****************'
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
! ---
|
||||
|
||||
|
||||
BEGIN_PROVIDER [ double precision, overlap_mo_r, (mo_num, mo_num)]
|
||||
&BEGIN_PROVIDER [ double precision, overlap_mo_l, (mo_num, mo_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! overlap_mo_r_mo(j,i) = <MO_i|MO_R_j>
|
||||
END_DOC
|
||||
integer :: i,j,p,q
|
||||
overlap_mo_r= 0.d0
|
||||
overlap_mo_l= 0.d0
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do p = 1, ao_num
|
||||
do q = 1, ao_num
|
||||
overlap_mo_r(j,i) += mo_r_coef(q,i) * mo_r_coef(p,j) * ao_overlap(q,p)
|
||||
overlap_mo_l(j,i) += mo_l_coef(q,i) * mo_l_coef(p,j) * ao_overlap(q,p)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, overlap_mo_r_mo, (mo_num, mo_num)]
|
||||
&BEGIN_PROVIDER [ double precision, overlap_mo_l_mo, (mo_num, mo_num)]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! overlap_mo_r_mo(j,i) = <MO_j|MO_R_i>
|
||||
END_DOC
|
||||
integer :: i,j,p,q
|
||||
overlap_mo_r_mo = 0.d0
|
||||
overlap_mo_l_mo = 0.d0
|
||||
do i = 1, mo_num
|
||||
do j = 1, mo_num
|
||||
do p = 1, ao_num
|
||||
do q = 1, ao_num
|
||||
overlap_mo_r_mo(j,i) += mo_coef(p,j) * mo_r_coef(q,i) * ao_overlap(q,p)
|
||||
overlap_mo_l_mo(j,i) += mo_coef(p,j) * mo_l_coef(q,i) * ao_overlap(q,p)
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, angle_left_right, (mo_num)]
|
||||
&BEGIN_PROVIDER [ double precision, max_angle_left_right]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! angle_left_right(i) = angle between the left-eigenvector chi_i and the right-eigenvector phi_i
|
||||
END_DOC
|
||||
integer :: i,j
|
||||
double precision :: left,right,arg
|
||||
do i = 1, mo_num
|
||||
left = overlap_mo_l(i,i)
|
||||
right = overlap_mo_r(i,i)
|
||||
arg = min(overlap_bi_ortho(i,i)/(left*right),1.d0)
|
||||
arg = max(arg,-1.d0)
|
||||
angle_left_right(i) = dacos(arg) * 180.d0/dacos(-1.d0)
|
||||
enddo
|
||||
double precision :: angle(mo_num)
|
||||
angle(1:mo_num) = dabs(angle_left_right(1:mo_num))
|
||||
max_angle_left_right = maxval(angle)
|
||||
END_PROVIDER
|
||||
|
||||
|
|
@ -70,8 +70,8 @@ subroutine run_cipsi
|
|||
|
||||
do while ( &
|
||||
(N_det < N_det_max) .and. &
|
||||
(sum(abs(pt2_data % pt2(1:N_states)) * state_average_weight(1:N_states)) > pt2_max) .and. &
|
||||
(sum(abs(pt2_data % variance(1:N_states)) * state_average_weight(1:N_states)) > variance_max) .and. &
|
||||
(maxval(abs(pt2_data % pt2(1:N_states))) > pt2_max) .and. &
|
||||
(maxval(abs(pt2_data % variance(1:N_states))) > variance_max) .and. &
|
||||
(correlation_energy_ratio <= correlation_energy_ratio_max) &
|
||||
)
|
||||
write(*,'(A)') '--------------------------------------------------------------------------------'
|
||||
|
|
183
src/cipsi/pert_rdm_providers.irp.f
Normal file
183
src/cipsi/pert_rdm_providers.irp.f
Normal file
|
@ -0,0 +1,183 @@
|
|||
|
||||
use bitmasks
|
||||
use omp_lib
|
||||
|
||||
BEGIN_PROVIDER [ integer(omp_lock_kind), pert_2rdm_lock]
|
||||
use f77_zmq
|
||||
implicit none
|
||||
call omp_init_lock(pert_2rdm_lock)
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [integer, n_orb_pert_rdm]
|
||||
implicit none
|
||||
n_orb_pert_rdm = n_act_orb
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [integer, list_orb_reverse_pert_rdm, (mo_num)]
|
||||
implicit none
|
||||
list_orb_reverse_pert_rdm = list_act_reverse
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [integer, list_orb_pert_rdm, (n_orb_pert_rdm)]
|
||||
implicit none
|
||||
list_orb_pert_rdm = list_act
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [double precision, pert_2rdm_provider, (n_orb_pert_rdm,n_orb_pert_rdm,n_orb_pert_rdm,n_orb_pert_rdm)]
|
||||
implicit none
|
||||
pert_2rdm_provider = 0.d0
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
subroutine fill_buffer_double_rdm(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2_data, mat, buf, psi_det_connection, psi_coef_connection_reverse, n_det_connection)
|
||||
use bitmasks
|
||||
use selection_types
|
||||
implicit none
|
||||
|
||||
integer, intent(in) :: n_det_connection
|
||||
double precision, intent(in) :: psi_coef_connection_reverse(N_states,n_det_connection)
|
||||
integer(bit_kind), intent(in) :: psi_det_connection(N_int,2,n_det_connection)
|
||||
integer, intent(in) :: i_generator, sp, h1, h2
|
||||
double precision, intent(in) :: mat(N_states, mo_num, mo_num)
|
||||
logical, intent(in) :: bannedOrb(mo_num, 2), banned(mo_num, mo_num)
|
||||
double precision, intent(in) :: fock_diag_tmp(mo_num)
|
||||
double precision, intent(in) :: E0(N_states)
|
||||
type(pt2_type), intent(inout) :: pt2_data
|
||||
type(selection_buffer), intent(inout) :: buf
|
||||
logical :: ok
|
||||
integer :: s1, s2, p1, p2, ib, j, istate, jstate
|
||||
integer(bit_kind) :: mask(N_int, 2), det(N_int, 2)
|
||||
double precision :: e_pert, delta_E, val, Hii, sum_e_pert, tmp, alpha_h_psi, coef(N_states)
|
||||
double precision, external :: diag_H_mat_elem_fock
|
||||
double precision :: E_shift
|
||||
|
||||
logical, external :: detEq
|
||||
double precision, allocatable :: values(:)
|
||||
integer, allocatable :: keys(:,:)
|
||||
integer :: nkeys
|
||||
integer :: sze_buff
|
||||
sze_buff = 5 * mo_num ** 2
|
||||
allocate(keys(4,sze_buff),values(sze_buff))
|
||||
nkeys = 0
|
||||
if(sp == 3) then
|
||||
s1 = 1
|
||||
s2 = 2
|
||||
else
|
||||
s1 = sp
|
||||
s2 = sp
|
||||
end if
|
||||
call apply_holes(psi_det_generators(1,1,i_generator), s1, h1, s2, h2, mask, ok, N_int)
|
||||
E_shift = 0.d0
|
||||
|
||||
if (h0_type == 'CFG') then
|
||||
j = det_to_configuration(i_generator)
|
||||
E_shift = psi_det_Hii(i_generator) - psi_configuration_Hii(j)
|
||||
endif
|
||||
|
||||
do p1=1,mo_num
|
||||
if(bannedOrb(p1, s1)) cycle
|
||||
ib = 1
|
||||
if(sp /= 3) ib = p1+1
|
||||
|
||||
do p2=ib,mo_num
|
||||
|
||||
! -----
|
||||
! /!\ Generating only single excited determinants doesn't work because a
|
||||
! determinant generated by a single excitation may be doubly excited wrt
|
||||
! to a determinant of the future. In that case, the determinant will be
|
||||
! detected as already generated when generating in the future with a
|
||||
! double excitation.
|
||||
!
|
||||
! if (.not.do_singles) then
|
||||
! if ((h1 == p1) .or. (h2 == p2)) then
|
||||
! cycle
|
||||
! endif
|
||||
! endif
|
||||
!
|
||||
! if (.not.do_doubles) then
|
||||
! if ((h1 /= p1).and.(h2 /= p2)) then
|
||||
! cycle
|
||||
! endif
|
||||
! endif
|
||||
! -----
|
||||
|
||||
if(bannedOrb(p2, s2)) cycle
|
||||
if(banned(p1,p2)) cycle
|
||||
|
||||
|
||||
if( sum(abs(mat(1:N_states, p1, p2))) == 0d0) cycle
|
||||
call apply_particles(mask, s1, p1, s2, p2, det, ok, N_int)
|
||||
|
||||
if (do_only_cas) then
|
||||
integer, external :: number_of_holes, number_of_particles
|
||||
if (number_of_particles(det)>0) then
|
||||
cycle
|
||||
endif
|
||||
if (number_of_holes(det)>0) then
|
||||
cycle
|
||||
endif
|
||||
endif
|
||||
|
||||
if (do_ddci) then
|
||||
logical, external :: is_a_two_holes_two_particles
|
||||
if (is_a_two_holes_two_particles(det)) then
|
||||
cycle
|
||||
endif
|
||||
endif
|
||||
|
||||
if (do_only_1h1p) then
|
||||
logical, external :: is_a_1h1p
|
||||
if (.not.is_a_1h1p(det)) cycle
|
||||
endif
|
||||
|
||||
|
||||
Hii = diag_H_mat_elem_fock(psi_det_generators(1,1,i_generator),det,fock_diag_tmp,N_int)
|
||||
|
||||
sum_e_pert = 0d0
|
||||
integer :: degree
|
||||
call get_excitation_degree(det,HF_bitmask,degree,N_int)
|
||||
if(degree == 2)cycle
|
||||
do istate=1,N_states
|
||||
delta_E = E0(istate) - Hii + E_shift
|
||||
alpha_h_psi = mat(istate, p1, p2)
|
||||
val = alpha_h_psi + alpha_h_psi
|
||||
tmp = dsqrt(delta_E * delta_E + val * val)
|
||||
if (delta_E < 0.d0) then
|
||||
tmp = -tmp
|
||||
endif
|
||||
e_pert = 0.5d0 * (tmp - delta_E)
|
||||
coef(istate) = e_pert / alpha_h_psi
|
||||
print*,e_pert,coef,alpha_h_psi
|
||||
pt2_data % pt2(istate) += e_pert
|
||||
pt2_data % variance(istate) += alpha_h_psi * alpha_h_psi
|
||||
enddo
|
||||
|
||||
do istate=1,N_states
|
||||
alpha_h_psi = mat(istate, p1, p2)
|
||||
e_pert = coef(istate) * alpha_h_psi
|
||||
do jstate=1,N_states
|
||||
pt2_data % overlap(jstate,jstate) = coef(istate) * coef(jstate)
|
||||
enddo
|
||||
|
||||
if (weight_selection /= 5) then
|
||||
! Energy selection
|
||||
sum_e_pert = sum_e_pert + e_pert * selection_weight(istate)
|
||||
|
||||
else
|
||||
! Variance selection
|
||||
sum_e_pert = sum_e_pert - alpha_h_psi * alpha_h_psi * selection_weight(istate)
|
||||
endif
|
||||
end do
|
||||
call give_2rdm_pert_contrib(det,coef,psi_det_connection,psi_coef_connection_reverse,n_det_connection,nkeys,keys,values,sze_buff)
|
||||
|
||||
if(sum_e_pert <= buf%mini) then
|
||||
call add_to_selection_buffer(buf, det, sum_e_pert)
|
||||
end if
|
||||
end do
|
||||
end do
|
||||
call update_keys_values(keys,values,nkeys,n_orb_pert_rdm,pert_2rdm_provider,pert_2rdm_lock)
|
||||
end
|
||||
|
||||
|
|
@ -117,6 +117,7 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in)
|
|||
|
||||
integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull
|
||||
integer, intent(in) :: N_in
|
||||
! integer, intent(inout) :: N_in
|
||||
double precision, intent(in) :: relative_error, E(N_states)
|
||||
type(pt2_type), intent(inout) :: pt2_data, pt2_data_err
|
||||
!
|
||||
|
@ -131,7 +132,7 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in)
|
|||
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
|
||||
PROVIDE psi_bilinear_matrix_transp_order psi_selectors_coef_transp psi_det_sorted
|
||||
PROVIDE psi_det_hii selection_weight pseudo_sym
|
||||
PROVIDE list_act list_inact list_core list_virt list_del seniority_max
|
||||
PROVIDE n_act_orb n_inact_orb n_core_orb n_virt_orb n_del_orb seniority_max
|
||||
PROVIDE excitation_beta_max excitation_alpha_max excitation_max
|
||||
|
||||
if (h0_type == 'CFG') then
|
||||
|
@ -288,12 +289,9 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in)
|
|||
call write_double(6,mem,'Memory (Gb)')
|
||||
|
||||
call set_multiple_levels_omp(.False.)
|
||||
! call omp_set_max_active_levels(1)
|
||||
|
||||
|
||||
! old
|
||||
!print '(A)', '========== ======================= ===================== ===================== ==========='
|
||||
!print '(A)', ' Samples Energy Variance Norm^2 Seconds'
|
||||
!print '(A)', '========== ======================= ===================== ===================== ==========='
|
||||
print '(A)', '========== ==================== ================ ================ ================ ============= ==========='
|
||||
print '(A)', ' Samples Energy PT2 Variance Norm^2 Convergence Seconds'
|
||||
print '(A)', '========== ==================== ================ ================ ================ ============= ==========='
|
||||
|
@ -319,9 +317,8 @@ subroutine ZMQ_pt2(E, pt2_data, pt2_data_err, relative_error, N_in)
|
|||
!$OMP END PARALLEL
|
||||
call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'pt2')
|
||||
call set_multiple_levels_omp(.True.)
|
||||
! call omp_set_max_active_levels(8)
|
||||
|
||||
! old
|
||||
!print '(A)', '========== ======================= ===================== ===================== ==========='
|
||||
print '(A)', '========== ==================== ================ ================ ================ ============= ==========='
|
||||
|
||||
|
||||
|
@ -908,6 +905,7 @@ END_PROVIDER
|
|||
if (tooth_width == 0.d0) then
|
||||
tooth_width = max(1.d-15,sum(tilde_w(pt2_n_0(t):pt2_n_0(t+1))))
|
||||
endif
|
||||
ASSERT(tooth_width > 0.d0)
|
||||
do i=pt2_n_0(t)+1, pt2_n_0(t+1)
|
||||
pt2_w(i) = tilde_w(i) * pt2_W_T / tooth_width
|
||||
end do
|
||||
|
|
|
@ -31,11 +31,12 @@ subroutine run_pt2_slave(thread,iproc,energy)
|
|||
|
||||
double precision, intent(in) :: energy(N_states_diag)
|
||||
integer, intent(in) :: thread, iproc
|
||||
if (N_det > 100000 ) then
|
||||
call run_pt2_slave_large(thread,iproc,energy)
|
||||
else
|
||||
call run_pt2_slave_small(thread,iproc,energy)
|
||||
endif
|
||||
call run_pt2_slave_large(thread,iproc,energy)
|
||||
! if (N_det > nproc*(elec_alpha_num * (mo_num-elec_alpha_num))**2) then
|
||||
! call run_pt2_slave_large(thread,iproc,energy)
|
||||
! else
|
||||
! call run_pt2_slave_small(thread,iproc,energy)
|
||||
! endif
|
||||
end
|
||||
|
||||
subroutine run_pt2_slave_small(thread,iproc,energy)
|
||||
|
@ -66,6 +67,7 @@ subroutine run_pt2_slave_small(thread,iproc,energy)
|
|||
|
||||
double precision, external :: memory_of_double, memory_of_int
|
||||
integer :: bsize ! Size of selection buffers
|
||||
! logical :: sending
|
||||
|
||||
allocate(task_id(pt2_n_tasks_max), task(pt2_n_tasks_max))
|
||||
allocate(pt2_data(pt2_n_tasks_max), i_generator(pt2_n_tasks_max), subset(pt2_n_tasks_max))
|
||||
|
@ -83,6 +85,7 @@ subroutine run_pt2_slave_small(thread,iproc,energy)
|
|||
buffer_ready = .False.
|
||||
n_tasks = 1
|
||||
|
||||
! sending = .False.
|
||||
done = .False.
|
||||
do while (.not.done)
|
||||
|
||||
|
@ -116,13 +119,14 @@ subroutine run_pt2_slave_small(thread,iproc,energy)
|
|||
do k=1,n_tasks
|
||||
call pt2_alloc(pt2_data(k),N_states)
|
||||
b%cur = 0
|
||||
! double precision :: time2
|
||||
! call wall_time(time2)
|
||||
!double precision :: time2
|
||||
!call wall_time(time2)
|
||||
call select_connected(i_generator(k),energy,pt2_data(k),b,subset(k),pt2_F(i_generator(k)))
|
||||
! call wall_time(time1)
|
||||
! print *, i_generator(1), time1-time2, n_tasks, pt2_F(i_generator(1))
|
||||
!call wall_time(time1)
|
||||
!print *, i_generator(1), time1-time2, n_tasks, pt2_F(i_generator(1))
|
||||
enddo
|
||||
call wall_time(time1)
|
||||
!print *, '-->', i_generator(1), time1-time0, n_tasks
|
||||
|
||||
integer, external :: tasks_done_to_taskserver
|
||||
if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then
|
||||
|
@ -160,11 +164,6 @@ end subroutine
|
|||
subroutine run_pt2_slave_large(thread,iproc,energy)
|
||||
use selection_types
|
||||
use f77_zmq
|
||||
BEGIN_DOC
|
||||
! This subroutine can miss important determinants when the PT2 is completely
|
||||
! computed. It should be called only for large workloads where the PT2 is
|
||||
! interrupted before the end
|
||||
END_DOC
|
||||
implicit none
|
||||
|
||||
double precision, intent(in) :: energy(N_states_diag)
|
||||
|
@ -190,12 +189,8 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||
|
||||
integer :: bsize ! Size of selection buffers
|
||||
logical :: sending
|
||||
double precision :: time_shift
|
||||
|
||||
PROVIDE global_selection_buffer global_selection_buffer_lock
|
||||
|
||||
call random_number(time_shift)
|
||||
time_shift = time_shift*15.d0
|
||||
|
||||
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
|
||||
|
||||
|
@ -213,9 +208,6 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||
|
||||
sending = .False.
|
||||
done = .False.
|
||||
double precision :: time0, time1
|
||||
call wall_time(time0)
|
||||
time0 = time0+time_shift
|
||||
do while (.not.done)
|
||||
|
||||
integer, external :: get_tasks_from_taskserver
|
||||
|
@ -242,28 +234,25 @@ subroutine run_pt2_slave_large(thread,iproc,energy)
|
|||
ASSERT (b%N == bsize)
|
||||
endif
|
||||
|
||||
double precision :: time0, time1
|
||||
call wall_time(time0)
|
||||
call pt2_alloc(pt2_data,N_states)
|
||||
b%cur = 0
|
||||
call select_connected(i_generator,energy,pt2_data,b,subset,pt2_F(i_generator))
|
||||
call wall_time(time1)
|
||||
|
||||
integer, external :: tasks_done_to_taskserver
|
||||
if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then
|
||||
done = .true.
|
||||
endif
|
||||
call sort_selection_buffer(b)
|
||||
|
||||
call wall_time(time1)
|
||||
! if (time1-time0 > 15.d0) then
|
||||
call omp_set_lock(global_selection_buffer_lock)
|
||||
global_selection_buffer%mini = b%mini
|
||||
call merge_selection_buffers(b,global_selection_buffer)
|
||||
b%cur=0
|
||||
call omp_unset_lock(global_selection_buffer_lock)
|
||||
call wall_time(time0)
|
||||
! endif
|
||||
|
||||
call push_pt2_results_async_recv(zmq_socket_push,b%mini,sending)
|
||||
if ( iproc == 1 .or. i_generator < 100 .or. done) then
|
||||
call omp_set_lock(global_selection_buffer_lock)
|
||||
global_selection_buffer%mini = b%mini
|
||||
call merge_selection_buffers(b,global_selection_buffer)
|
||||
b%cur=0
|
||||
call omp_unset_lock(global_selection_buffer_lock)
|
||||
if ( iproc == 1 ) then
|
||||
call omp_set_lock(global_selection_buffer_lock)
|
||||
call push_pt2_results_async_send(zmq_socket_push, (/i_generator/), (/pt2_data/), global_selection_buffer, (/task_id/), 1,sending)
|
||||
global_selection_buffer%cur = 0
|
||||
|
|
|
@ -61,14 +61,10 @@ subroutine run_selection_slave(thread,iproc,energy)
|
|||
if (N /= buf%N) then
|
||||
print *, 'N=', N
|
||||
print *, 'buf%N=', buf%N
|
||||
print *, 'In ', irp_here, ': N /= buf%N'
|
||||
stop -1
|
||||
print *, 'bug in ', irp_here
|
||||
stop '-1'
|
||||
end if
|
||||
end if
|
||||
if (i_generator > N_det_generators) then
|
||||
print *, 'In ', irp_here, ': i_generator > N_det_generators'
|
||||
stop -1
|
||||
endif
|
||||
call select_connected(i_generator,energy,pt2_data,buf,subset,pt2_F(i_generator))
|
||||
endif
|
||||
|
||||
|
|
|
@ -258,6 +258,8 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
|
|||
deallocate(exc_degree)
|
||||
nmax=k-1
|
||||
|
||||
call isort_noidx(indices,nmax)
|
||||
|
||||
! Start with 32 elements. Size will double along with the filtering.
|
||||
allocate(preinteresting(0:32), prefullinteresting(0:32), &
|
||||
interesting(0:32), fullinteresting(0:32))
|
||||
|
@ -569,7 +571,6 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
|
|||
double precision, external :: diag_H_mat_elem_fock
|
||||
double precision :: E_shift
|
||||
double precision :: s_weight(N_states,N_states)
|
||||
logical, external :: is_in_wavefunction
|
||||
PROVIDE dominant_dets_of_cfgs N_dominant_dets_of_cfgs
|
||||
do jstate=1,N_states
|
||||
do istate=1,N_states
|
||||
|
@ -800,9 +801,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
|
|||
|
||||
alpha_h_psi = mat(istate, p1, p2)
|
||||
|
||||
do k=1,N_states
|
||||
pt2_data % overlap(k,istate) = pt2_data % overlap(k,istate) + coef(k) * coef(istate)
|
||||
end do
|
||||
pt2_data % overlap(:,istate) = pt2_data % overlap(:,istate) + coef(:) * coef(istate)
|
||||
pt2_data % variance(istate) = pt2_data % variance(istate) + alpha_h_psi * alpha_h_psi
|
||||
pt2_data % pt2(istate) = pt2_data % pt2(istate) + e_pert(istate)
|
||||
|
||||
|
@ -864,6 +863,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
|
|||
!!!BEGIN_DEBUG
|
||||
! ! To check if the pt2 is taking determinants already in the wf
|
||||
! if (is_in_wavefunction(det(N_int,1),N_int)) then
|
||||
! logical, external :: is_in_wavefunction
|
||||
! print*, 'A determinant contributing to the pt2 is already in'
|
||||
! print*, 'the wave function:'
|
||||
! call print_det(det(N_int,1),N_int)
|
||||
|
|
|
@ -311,7 +311,7 @@ subroutine run_slave_main
|
|||
if (mpi_master) then
|
||||
print *, 'Running PT2'
|
||||
endif
|
||||
!$OMP PARALLEL PRIVATE(i) NUM_THREADS(nproc_target)
|
||||
!$OMP PARALLEL PRIVATE(i) NUM_THREADS(nproc_target+1)
|
||||
i = omp_get_thread_num()
|
||||
call run_pt2_slave(0,i,pt2_e0_denominator)
|
||||
!$OMP END PARALLEL
|
||||
|
|
|
@ -69,8 +69,8 @@ subroutine run_stochastic_cipsi
|
|||
|
||||
do while ( &
|
||||
(N_det < N_det_max) .and. &
|
||||
(sum(abs(pt2_data % pt2(1:N_states)) * state_average_weight(1:N_states)) > pt2_max) .and. &
|
||||
(sum(abs(pt2_data % variance(1:N_states)) * state_average_weight(1:N_states)) > variance_max) .and. &
|
||||
(maxval(abs(pt2_data % pt2(1:N_states))) > pt2_max) .and. &
|
||||
(maxval(abs(pt2_data % variance(1:N_states))) > variance_max) .and. &
|
||||
(correlation_energy_ratio <= correlation_energy_ratio_max) &
|
||||
)
|
||||
write(*,'(A)') '--------------------------------------------------------------------------------'
|
||||
|
|
223
src/cipsi/update_2rdm.irp.f
Normal file
223
src/cipsi/update_2rdm.irp.f
Normal file
|
@ -0,0 +1,223 @@
|
|||
use bitmasks
|
||||
|
||||
subroutine give_2rdm_pert_contrib(det,coef,psi_det_connection,psi_coef_connection_reverse,n_det_connection,nkeys,keys,values,sze_buff)
|
||||
implicit none
|
||||
integer, intent(in) :: n_det_connection,sze_buff
|
||||
double precision, intent(in) :: coef(N_states)
|
||||
integer(bit_kind), intent(in) :: det(N_int,2)
|
||||
integer(bit_kind), intent(in) :: psi_det_connection(N_int,2,n_det_connection)
|
||||
double precision, intent(in) :: psi_coef_connection_reverse(N_states,n_det_connection)
|
||||
integer, intent(inout) :: keys(4,sze_buff),nkeys
|
||||
double precision, intent(inout) :: values(sze_buff)
|
||||
integer :: i,j
|
||||
integer :: exc(0:2,2,2)
|
||||
integer :: degree
|
||||
double precision :: phase, contrib
|
||||
do i = 1, n_det_connection
|
||||
call get_excitation(det,psi_det_connection(1,1,i),exc,degree,phase,N_int)
|
||||
if(degree.gt.2)cycle
|
||||
contrib = 0.d0
|
||||
do j = 1, N_states
|
||||
contrib += state_average_weight(j) * psi_coef_connection_reverse(j,i) * phase * coef(j)
|
||||
enddo
|
||||
! case of single excitations
|
||||
if(degree == 1)then
|
||||
if (nkeys + 6 * elec_alpha_num .ge. sze_buff)then
|
||||
call update_keys_values(keys,values,nkeys,n_orb_pert_rdm,pert_2rdm_provider,pert_2rdm_lock)
|
||||
nkeys = 0
|
||||
endif
|
||||
call update_buffer_single_exc_rdm(det,psi_det_connection(1,1,i),exc,phase,contrib,nkeys,keys,values,sze_buff)
|
||||
else
|
||||
!! case of double excitations
|
||||
! if (nkeys + 4 .ge. sze_buff)then
|
||||
! call update_keys_values(keys,values,nkeys,n_orb_pert_rdm,pert_2rdm_provider,pert_2rdm_lock)
|
||||
! nkeys = 0
|
||||
! endif
|
||||
! call update_buffer_double_exc_rdm(exc,phase,contrib,nkeys,keys,values,sze_buff)
|
||||
endif
|
||||
enddo
|
||||
!call update_keys_values(keys,values,nkeys,n_orb_pert_rdm,pert_2rdm_provider,pert_2rdm_lock)
|
||||
!nkeys = 0
|
||||
|
||||
end
|
||||
|
||||
subroutine update_buffer_single_exc_rdm(det1,det2,exc,phase,contrib,nkeys,keys,values,sze_buff)
|
||||
implicit none
|
||||
integer, intent(in) :: sze_buff
|
||||
integer(bit_kind), intent(in) :: det1(N_int,2)
|
||||
integer(bit_kind), intent(in) :: det2(N_int,2)
|
||||
integer,intent(in) :: exc(0:2,2,2)
|
||||
double precision,intent(in) :: phase, contrib
|
||||
integer, intent(inout) :: nkeys, keys(4,sze_buff)
|
||||
double precision, intent(inout):: values(sze_buff)
|
||||
|
||||
integer :: occ(N_int*bit_kind_size,2)
|
||||
integer :: n_occ_ab(2),ispin,other_spin
|
||||
integer :: h1,h2,p1,p2,i
|
||||
call bitstring_to_list_ab(det1, occ, n_occ_ab, N_int)
|
||||
|
||||
if (exc(0,1,1) == 1) then
|
||||
! Mono alpha
|
||||
h1 = exc(1,1,1)
|
||||
p1 = exc(1,2,1)
|
||||
ispin = 1
|
||||
other_spin = 2
|
||||
else
|
||||
! Mono beta
|
||||
h1 = exc(1,1,2)
|
||||
p1 = exc(1,2,2)
|
||||
ispin = 2
|
||||
other_spin = 1
|
||||
endif
|
||||
if(list_orb_reverse_pert_rdm(h1).lt.0)return
|
||||
h1 = list_orb_reverse_pert_rdm(h1)
|
||||
if(list_orb_reverse_pert_rdm(p1).lt.0)return
|
||||
p1 = list_orb_reverse_pert_rdm(p1)
|
||||
!update the alpha/beta part
|
||||
do i = 1, n_occ_ab(other_spin)
|
||||
h2 = occ(i,other_spin)
|
||||
if(list_orb_reverse_pert_rdm(h2).lt.0)return
|
||||
h2 = list_orb_reverse_pert_rdm(h2)
|
||||
|
||||
nkeys += 1
|
||||
values(nkeys) = 0.5d0 * contrib * phase
|
||||
keys(1,nkeys) = h1
|
||||
keys(2,nkeys) = h2
|
||||
keys(3,nkeys) = p1
|
||||
keys(4,nkeys) = h2
|
||||
nkeys += 1
|
||||
values(nkeys) = 0.5d0 * contrib * phase
|
||||
keys(1,nkeys) = h2
|
||||
keys(2,nkeys) = h1
|
||||
keys(3,nkeys) = h2
|
||||
keys(4,nkeys) = p1
|
||||
enddo
|
||||
!update the same spin part
|
||||
!do i = 1, n_occ_ab(ispin)
|
||||
! h2 = occ(i,ispin)
|
||||
! if(list_orb_reverse_pert_rdm(h2).lt.0)return
|
||||
! h2 = list_orb_reverse_pert_rdm(h2)
|
||||
|
||||
! nkeys += 1
|
||||
! values(nkeys) = 0.5d0 * contrib * phase
|
||||
! keys(1,nkeys) = h1
|
||||
! keys(2,nkeys) = h2
|
||||
! keys(3,nkeys) = p1
|
||||
! keys(4,nkeys) = h2
|
||||
|
||||
! nkeys += 1
|
||||
! values(nkeys) = - 0.5d0 * contrib * phase
|
||||
! keys(1,nkeys) = h1
|
||||
! keys(2,nkeys) = h2
|
||||
! keys(3,nkeys) = h2
|
||||
! keys(4,nkeys) = p1
|
||||
!
|
||||
! nkeys += 1
|
||||
! values(nkeys) = 0.5d0 * contrib * phase
|
||||
! keys(1,nkeys) = h2
|
||||
! keys(2,nkeys) = h1
|
||||
! keys(3,nkeys) = h2
|
||||
! keys(4,nkeys) = p1
|
||||
|
||||
! nkeys += 1
|
||||
! values(nkeys) = - 0.5d0 * contrib * phase
|
||||
! keys(1,nkeys) = h2
|
||||
! keys(2,nkeys) = h1
|
||||
! keys(3,nkeys) = p1
|
||||
! keys(4,nkeys) = h2
|
||||
!enddo
|
||||
|
||||
end
|
||||
|
||||
subroutine update_buffer_double_exc_rdm(exc,phase,contrib,nkeys,keys,values,sze_buff)
|
||||
implicit none
|
||||
integer, intent(in) :: sze_buff
|
||||
integer,intent(in) :: exc(0:2,2,2)
|
||||
double precision,intent(in) :: phase, contrib
|
||||
integer, intent(inout) :: nkeys, keys(4,sze_buff)
|
||||
double precision, intent(inout):: values(sze_buff)
|
||||
integer :: h1,h2,p1,p2
|
||||
|
||||
if (exc(0,1,1) == 1) then
|
||||
! Double alpha/beta
|
||||
h1 = exc(1,1,1)
|
||||
h2 = exc(1,1,2)
|
||||
p1 = exc(1,2,1)
|
||||
p2 = exc(1,2,2)
|
||||
! check if the orbitals involved are within the orbital range
|
||||
if(list_orb_reverse_pert_rdm(h1).lt.0)return
|
||||
h1 = list_orb_reverse_pert_rdm(h1)
|
||||
if(list_orb_reverse_pert_rdm(h2).lt.0)return
|
||||
h2 = list_orb_reverse_pert_rdm(h2)
|
||||
if(list_orb_reverse_pert_rdm(p1).lt.0)return
|
||||
p1 = list_orb_reverse_pert_rdm(p1)
|
||||
if(list_orb_reverse_pert_rdm(p2).lt.0)return
|
||||
p2 = list_orb_reverse_pert_rdm(p2)
|
||||
nkeys += 1
|
||||
values(nkeys) = 0.5d0 * contrib * phase
|
||||
keys(1,nkeys) = h1
|
||||
keys(2,nkeys) = h2
|
||||
keys(3,nkeys) = p1
|
||||
keys(4,nkeys) = p2
|
||||
nkeys += 1
|
||||
values(nkeys) = 0.5d0 * contrib * phase
|
||||
keys(1,nkeys) = p1
|
||||
keys(2,nkeys) = p2
|
||||
keys(3,nkeys) = h1
|
||||
keys(4,nkeys) = h2
|
||||
|
||||
else
|
||||
if (exc(0,1,1) == 2) then
|
||||
! Double alpha/alpha
|
||||
h1 = exc(1,1,1)
|
||||
h2 = exc(2,1,1)
|
||||
p1 = exc(1,2,1)
|
||||
p2 = exc(2,2,1)
|
||||
else if (exc(0,1,2) == 2) then
|
||||
! Double beta
|
||||
h1 = exc(1,1,2)
|
||||
h2 = exc(2,1,2)
|
||||
p1 = exc(1,2,2)
|
||||
p2 = exc(2,2,2)
|
||||
endif
|
||||
! check if the orbitals involved are within the orbital range
|
||||
if(list_orb_reverse_pert_rdm(h1).lt.0)return
|
||||
h1 = list_orb_reverse_pert_rdm(h1)
|
||||
if(list_orb_reverse_pert_rdm(h2).lt.0)return
|
||||
h2 = list_orb_reverse_pert_rdm(h2)
|
||||
if(list_orb_reverse_pert_rdm(p1).lt.0)return
|
||||
p1 = list_orb_reverse_pert_rdm(p1)
|
||||
if(list_orb_reverse_pert_rdm(p2).lt.0)return
|
||||
p2 = list_orb_reverse_pert_rdm(p2)
|
||||
nkeys += 1
|
||||
values(nkeys) = 0.5d0 * contrib * phase
|
||||
keys(1,nkeys) = h1
|
||||
keys(2,nkeys) = h2
|
||||
keys(3,nkeys) = p1
|
||||
keys(4,nkeys) = p2
|
||||
|
||||
nkeys += 1
|
||||
values(nkeys) = - 0.5d0 * contrib * phase
|
||||
keys(1,nkeys) = h1
|
||||
keys(2,nkeys) = h2
|
||||
keys(3,nkeys) = p2
|
||||
keys(4,nkeys) = p1
|
||||
|
||||
nkeys += 1
|
||||
values(nkeys) = 0.5d0 * contrib * phase
|
||||
keys(1,nkeys) = h2
|
||||
keys(2,nkeys) = h1
|
||||
keys(3,nkeys) = p2
|
||||
keys(4,nkeys) = p1
|
||||
|
||||
nkeys += 1
|
||||
values(nkeys) = - 0.5d0 * contrib * phase
|
||||
keys(1,nkeys) = h2
|
||||
keys(2,nkeys) = h1
|
||||
keys(3,nkeys) = p1
|
||||
keys(4,nkeys) = p2
|
||||
endif
|
||||
|
||||
end
|
||||
|
||||
|
36
src/cipsi_tc_bi_ortho/EZFIO.cfg
Normal file
36
src/cipsi_tc_bi_ortho/EZFIO.cfg
Normal file
|
@ -0,0 +1,36 @@
|
|||
[save_wf_after_selection]
|
||||
type: logical
|
||||
doc: If true, saves the wave function after the selection, before the diagonalization
|
||||
interface: ezfio,provider,ocaml
|
||||
default: False
|
||||
|
||||
[seniority_max]
|
||||
type: integer
|
||||
doc: Maximum number of allowed open shells. Using -1 selects all determinants
|
||||
interface: ezfio,ocaml,provider
|
||||
default: -1
|
||||
|
||||
[excitation_ref]
|
||||
type: integer
|
||||
doc: 1: Hartree-Fock determinant, 2:All determinants of the dominant configuration
|
||||
interface: ezfio,ocaml,provider
|
||||
default: 1
|
||||
|
||||
[excitation_max]
|
||||
type: integer
|
||||
doc: Maximum number of excitation with respect to the Hartree-Fock determinant. Using -1 selects all determinants
|
||||
interface: ezfio,ocaml,provider
|
||||
default: -1
|
||||
|
||||
[excitation_alpha_max]
|
||||
type: integer
|
||||
doc: Maximum number of excitation for alpha determinants with respect to the Hartree-Fock determinant. Using -1 selects all determinants
|
||||
interface: ezfio,ocaml,provider
|
||||
default: -1
|
||||
|
||||
[excitation_beta_max]
|
||||
type: integer
|
||||
doc: Maximum number of excitation for beta determinants with respect to the Hartree-Fock determinant. Using -1 selects all determinants
|
||||
interface: ezfio,ocaml,provider
|
||||
default: -1
|
||||
|
6
src/cipsi_tc_bi_ortho/NEED
Normal file
6
src/cipsi_tc_bi_ortho/NEED
Normal file
|
@ -0,0 +1,6 @@
|
|||
mpi
|
||||
perturbation
|
||||
zmq
|
||||
iterations_tc
|
||||
csf
|
||||
tc_bi_ortho
|
136
src/cipsi_tc_bi_ortho/cipsi.irp.f
Normal file
136
src/cipsi_tc_bi_ortho/cipsi.irp.f
Normal file
|
@ -0,0 +1,136 @@
|
|||
subroutine run_cipsi
|
||||
|
||||
BEGIN_DOC
|
||||
! Selected Full Configuration Interaction with deterministic selection and
|
||||
! stochastic PT2.
|
||||
END_DOC
|
||||
|
||||
use selection_types
|
||||
|
||||
implicit none
|
||||
|
||||
integer :: i,j,k,ndet
|
||||
type(pt2_type) :: pt2_data, pt2_data_err
|
||||
double precision, allocatable :: zeros(:)
|
||||
integer :: to_select
|
||||
logical, external :: qp_stop
|
||||
|
||||
double precision :: threshold_generators_save
|
||||
double precision :: rss
|
||||
double precision, external :: memory_of_double
|
||||
double precision :: correlation_energy_ratio,E_denom,E_tc,norm
|
||||
|
||||
PROVIDE H_apply_buffer_allocated distributed_davidson
|
||||
|
||||
print*,'Diagonal elements of the Fock matrix '
|
||||
do i = 1, mo_num
|
||||
write(*,*)i,Fock_matrix_tc_mo_tot(i,i)
|
||||
enddo
|
||||
|
||||
N_iter = 1
|
||||
threshold_generators = 1.d0
|
||||
SOFT_TOUCH threshold_generators
|
||||
|
||||
rss = memory_of_double(N_states)*4.d0
|
||||
call check_mem(rss,irp_here)
|
||||
|
||||
allocate (zeros(N_states))
|
||||
call pt2_alloc(pt2_data, N_states)
|
||||
call pt2_alloc(pt2_data_err, N_states)
|
||||
|
||||
double precision :: hf_energy_ref
|
||||
logical :: has, print_pt2
|
||||
double precision :: relative_error
|
||||
|
||||
relative_error=PT2_relative_error
|
||||
|
||||
zeros = 0.d0
|
||||
pt2_data % pt2 = -huge(1.e0)
|
||||
pt2_data % rpt2 = -huge(1.e0)
|
||||
pt2_data % overlap(:,:) = 0.d0
|
||||
pt2_data % variance = huge(1.e0)
|
||||
|
||||
if (s2_eig) then
|
||||
call make_s2_eigenfunction
|
||||
endif
|
||||
print_pt2 = .False.
|
||||
call diagonalize_CI_tc_bi_ortho(ndet, E_tc,norm,pt2_data,print_pt2)
|
||||
|
||||
call ezfio_has_hartree_fock_energy(has)
|
||||
if (has) then
|
||||
call ezfio_get_hartree_fock_energy(hf_energy_ref)
|
||||
else
|
||||
hf_energy_ref = ref_bitmask_energy
|
||||
endif
|
||||
|
||||
if (N_det > N_det_max) then
|
||||
psi_det(1:N_int,1:2,1:N_det) = psi_det_sorted_tc_gen(1:N_int,1:2,1:N_det)
|
||||
psi_coef(1:N_det,1:N_states) = psi_coef_sorted_tc_gen(1:N_det,1:N_states)
|
||||
N_det = N_det_max
|
||||
soft_touch N_det psi_det psi_coef
|
||||
if (s2_eig) then
|
||||
call make_s2_eigenfunction
|
||||
endif
|
||||
print_pt2 = .False.
|
||||
call diagonalize_CI_tc_bi_ortho(ndet, E_tc,norm,pt2_data,print_pt2)
|
||||
! call routine_save_right
|
||||
endif
|
||||
|
||||
correlation_energy_ratio = 0.d0
|
||||
|
||||
print_pt2 = .True.
|
||||
do while ( &
|
||||
(N_det < N_det_max) .and. &
|
||||
(maxval(abs(pt2_data % pt2(1:N_states))) > pt2_max) &
|
||||
)
|
||||
write(*,'(A)') '--------------------------------------------------------------------------------'
|
||||
|
||||
|
||||
to_select = int(sqrt(dble(N_states))*dble(N_det)*selection_factor)
|
||||
to_select = max(N_states_diag, to_select)
|
||||
|
||||
E_denom = E_tc ! TC Energy of the current wave function
|
||||
if (do_pt2) then
|
||||
call pt2_dealloc(pt2_data)
|
||||
call pt2_dealloc(pt2_data_err)
|
||||
call pt2_alloc(pt2_data, N_states)
|
||||
call pt2_alloc(pt2_data_err, N_states)
|
||||
threshold_generators_save = threshold_generators
|
||||
threshold_generators = 1.d0
|
||||
SOFT_TOUCH threshold_generators
|
||||
call ZMQ_pt2(E_denom, pt2_data, pt2_data_err, relative_error,to_select) ! Stochastic PT2 and selection
|
||||
threshold_generators = threshold_generators_save
|
||||
SOFT_TOUCH threshold_generators
|
||||
else
|
||||
call pt2_dealloc(pt2_data)
|
||||
call pt2_alloc(pt2_data, N_states)
|
||||
call ZMQ_selection(to_select, pt2_data)
|
||||
endif
|
||||
|
||||
N_iter += 1
|
||||
|
||||
if (qp_stop()) exit
|
||||
|
||||
! Add selected determinants
|
||||
call copy_H_apply_buffer_to_wf()
|
||||
|
||||
if (save_wf_after_selection) then
|
||||
call save_wavefunction
|
||||
endif
|
||||
|
||||
PROVIDE psi_coef
|
||||
PROVIDE psi_det
|
||||
PROVIDE psi_det_sorted_tc
|
||||
|
||||
call diagonalize_CI_tc_bi_ortho(ndet, E_tc,norm,pt2_data,print_pt2)
|
||||
if (qp_stop()) exit
|
||||
enddo
|
||||
|
||||
call pt2_dealloc(pt2_data)
|
||||
call pt2_dealloc(pt2_data_err)
|
||||
call pt2_alloc(pt2_data, N_states)
|
||||
call pt2_alloc(pt2_data_err, N_states)
|
||||
call ZMQ_pt2(E_tc, pt2_data, pt2_data_err, relative_error,0) ! Stochastic PT2 and selection
|
||||
call diagonalize_CI_tc_bi_ortho(ndet, E_tc,norm,pt2_data,print_pt2)
|
||||
|
||||
end
|
51
src/cipsi_tc_bi_ortho/energy.irp.f
Normal file
51
src/cipsi_tc_bi_ortho/energy.irp.f
Normal file
|
@ -0,0 +1,51 @@
|
|||
BEGIN_PROVIDER [ logical, initialize_pt2_E0_denominator ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! If true, initialize pt2_E0_denominator
|
||||
END_DOC
|
||||
initialize_pt2_E0_denominator = .True.
|
||||
END_PROVIDER
|
||||
|
||||
BEGIN_PROVIDER [ double precision, pt2_E0_denominator, (N_states) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! E0 in the denominator of the PT2
|
||||
END_DOC
|
||||
integer :: i,j
|
||||
|
||||
pt2_E0_denominator = eigval_right_tc_bi_orth
|
||||
|
||||
! if (initialize_pt2_E0_denominator) then
|
||||
! if (h0_type == "EN") then
|
||||
! pt2_E0_denominator(1:N_states) = psi_energy(1:N_states)
|
||||
! else if (h0_type == "HF") then
|
||||
! do i=1,N_states
|
||||
! j = maxloc(abs(psi_coef(:,i)),1)
|
||||
! pt2_E0_denominator(i) = psi_det_hii(j)
|
||||
! enddo
|
||||
! else if (h0_type == "Barycentric") then
|
||||
! pt2_E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states)
|
||||
! else if (h0_type == "CFG") then
|
||||
! pt2_E0_denominator(1:N_states) = psi_energy(1:N_states)
|
||||
! else
|
||||
! print *, h0_type, ' not implemented'
|
||||
! stop
|
||||
! endif
|
||||
! do i=1,N_states
|
||||
! call write_double(6,pt2_E0_denominator(i)+nuclear_repulsion, 'PT2 Energy denominator')
|
||||
! enddo
|
||||
! else
|
||||
! pt2_E0_denominator = -huge(1.d0)
|
||||
! endif
|
||||
|
||||
END_PROVIDER
|
||||
|
||||
|
||||
BEGIN_PROVIDER [ double precision, pt2_overlap, (N_states, N_states) ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Overlap between the perturbed wave functions
|
||||
END_DOC
|
||||
pt2_overlap(1:N_states,1:N_states) = 0.d0
|
||||
END_PROVIDER
|
||||
|
14
src/cipsi_tc_bi_ortho/environment.irp.f
Normal file
14
src/cipsi_tc_bi_ortho/environment.irp.f
Normal file
|
@ -0,0 +1,14 @@
|
|||
BEGIN_PROVIDER [ integer, nthreads_pt2 ]
|
||||
implicit none
|
||||
BEGIN_DOC
|
||||
! Number of threads for Davidson
|
||||
END_DOC
|
||||
nthreads_pt2 = nproc
|
||||
character*(32) :: env
|
||||
call getenv('QP_NTHREADS_PT2',env)
|
||||
if (trim(env) /= '') then
|
||||
read(env,*) nthreads_pt2
|
||||
call write_int(6,nthreads_pt2,'Target number of threads for PT2')
|
||||
endif
|
||||
END_PROVIDER
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user