mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-11-06 21:43:39 +01:00
Merge branch 'QuantumPackage-dev-stable' into dev-stable-tc-scf
This commit is contained in:
commit
b74ac64148
@ -6,7 +6,7 @@
|
|||||||
# --align=32 : Align all provided arrays on a 32-byte boundary
|
# --align=32 : Align all provided arrays on a 32-byte boundary
|
||||||
#
|
#
|
||||||
[COMMON]
|
[COMMON]
|
||||||
FC : ifort -fpic
|
FC : ifort -fpic -diag-disable 5462
|
||||||
LAPACK_LIB : -mkl=parallel
|
LAPACK_LIB : -mkl=parallel
|
||||||
IRPF90 : irpf90
|
IRPF90 : irpf90
|
||||||
IRPF90_FLAGS : --ninja --align=64 -DINTEL
|
IRPF90_FLAGS : --ninja --align=64 -DINTEL
|
||||||
|
2
configure
vendored
2
configure
vendored
@ -232,7 +232,7 @@ EOF
|
|||||||
|
|
||||||
execute << EOF
|
execute << EOF
|
||||||
cd "\${QP_ROOT}"/external
|
cd "\${QP_ROOT}"/external
|
||||||
tar --gunzip --extract --file qp2-dependencies/f77-zmq-4.3.2.tar.gz
|
tar --gunzip --extract --file qp2-dependencies/f77-zmq-4.3.?.tar.gz
|
||||||
cd f77-zmq-*
|
cd f77-zmq-*
|
||||||
./configure --prefix=\$QP_ROOT
|
./configure --prefix=\$QP_ROOT
|
||||||
export ZMQ_H="\$QP_ROOT"/include/zmq.h
|
export ZMQ_H="\$QP_ROOT"/include/zmq.h
|
||||||
|
@ -25,7 +25,7 @@ except ImportError:
|
|||||||
"quantum_package.rc"))
|
"quantum_package.rc"))
|
||||||
|
|
||||||
print("\n".join(["", "Error:", "source %s" % f, ""]))
|
print("\n".join(["", "Error:", "source %s" % f, ""]))
|
||||||
sys.exit(1)
|
raise
|
||||||
|
|
||||||
# Compress path
|
# Compress path
|
||||||
def comp_path(path):
|
def comp_path(path):
|
||||||
|
186
scripts/qp_exc_energy.py
Executable file
186
scripts/qp_exc_energy.py
Executable file
@ -0,0 +1,186 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# Computes the error on the excitation energy of a CIPSI run.
|
||||||
|
|
||||||
|
def student(p,df):
|
||||||
|
import scipy
|
||||||
|
from scipy.stats import t
|
||||||
|
return t.ppf(p, df)
|
||||||
|
|
||||||
|
|
||||||
|
def chi2cdf(x,k):
|
||||||
|
import scipy
|
||||||
|
import scipy.stats
|
||||||
|
return scipy.stats.chi2.cdf(x,k)
|
||||||
|
|
||||||
|
|
||||||
|
def jarque_bera(data):
|
||||||
|
|
||||||
|
n = max(len(data), 2)
|
||||||
|
norm = 1./ sum( [ w for (_,w) in data ] )
|
||||||
|
|
||||||
|
mu = sum( [ w* x for (x,w) in data ] ) * norm
|
||||||
|
sigma2 = sum( [ w*(x-mu)**2 for (x,w) in data ] ) * norm
|
||||||
|
if sigma2 > 0.:
|
||||||
|
S = ( sum( [ w*(x-mu)**3 for (x,w) in data ] ) * norm ) / sigma2**(3./2.)
|
||||||
|
K = ( sum( [ w*(x-mu)**4 for (x,w) in data ] ) * norm ) / sigma2**2
|
||||||
|
else:
|
||||||
|
S = 0.
|
||||||
|
K = 0.
|
||||||
|
|
||||||
|
# Value of the Jarque-Bera test
|
||||||
|
JB = n/6. * (S**2 + 1./4. * (K-3.)**2)
|
||||||
|
|
||||||
|
# Probability that the data comes from a Gaussian distribution
|
||||||
|
p = 1. - chi2cdf(JB,2)
|
||||||
|
|
||||||
|
return JB, mu, sqrt(sigma2/(n-1)), p
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
to_eV = 27.2107362681
|
||||||
|
import sys, os
|
||||||
|
import scipy
|
||||||
|
import scipy.stats
|
||||||
|
from math import sqrt, gamma, exp
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
|
def read_data(filename,state):
|
||||||
|
""" Read energies and PT2 from input file """
|
||||||
|
with open(filename,'r') as f:
|
||||||
|
lines = json.load(f)['fci']
|
||||||
|
|
||||||
|
print(f"State: {state}")
|
||||||
|
|
||||||
|
gs = []
|
||||||
|
es = []
|
||||||
|
|
||||||
|
for l in lines:
|
||||||
|
try:
|
||||||
|
pt2_0 = l['states'][0]['pt2']
|
||||||
|
e_0 = l['states'][0]['energy']
|
||||||
|
pt2_1 = l['states'][state]['pt2']
|
||||||
|
e_1 = l['states'][state]['energy']
|
||||||
|
gs.append( (e_0, pt2_0) )
|
||||||
|
es.append( (e_1, pt2_1) )
|
||||||
|
except: pass
|
||||||
|
|
||||||
|
def f(p_1, p0, p1):
|
||||||
|
e, pt2 = p0
|
||||||
|
y0, x0 = p_1
|
||||||
|
y1, x1 = p1
|
||||||
|
try:
|
||||||
|
alpha = (y1-y0)/(x0-x1)
|
||||||
|
except ZeroDivisionError:
|
||||||
|
alpha = 1.
|
||||||
|
return [e, pt2, alpha]
|
||||||
|
|
||||||
|
for l in (gs, es):
|
||||||
|
p_1, p0, p1 = l[0], l[0], l[1]
|
||||||
|
l[0] = f(p_1, p0, p1)
|
||||||
|
|
||||||
|
for i in range(1,len(l)-1):
|
||||||
|
p_1 = (l[i-1][0], l[i-1][1])
|
||||||
|
p0 = l[i]
|
||||||
|
p1 = l[i+1]
|
||||||
|
l[i] = f(p_1, p0, p1)
|
||||||
|
|
||||||
|
i = len(l)-1
|
||||||
|
p_1 = (l[i-1][0], l[i-1][1])
|
||||||
|
p0 = l[i]
|
||||||
|
p1 = l[-1]
|
||||||
|
l[i] = f(p_1, p0, p1)
|
||||||
|
|
||||||
|
return [ x+y for x,y in zip(gs,es) ]
|
||||||
|
|
||||||
|
|
||||||
|
def compute(data):
|
||||||
|
|
||||||
|
d = []
|
||||||
|
for e0, p0, a0, e1, p1, a1 in data:
|
||||||
|
x = (e1+p1)-(e0+p0)
|
||||||
|
w = 1./sqrt(p0**2 + p1**2)
|
||||||
|
bias = (a1-1.)*p1 - (a0-1.)*p0
|
||||||
|
d.append( (x,w,bias) )
|
||||||
|
|
||||||
|
x = []
|
||||||
|
target = (scipy.stats.norm.cdf(1.)-0.5)*2 # = 0.6827
|
||||||
|
|
||||||
|
print("| %2s | %8s | %8s | %8s | %8s | %8s |"%( "N", "DE", "+/-", "bias", "P(G)", "J"))
|
||||||
|
print("|----+----------+----------+----------+----------+----------|")
|
||||||
|
xmax = (0.,0.,0.,0.,0.,0,0.)
|
||||||
|
for i in range(len(data)-1):
|
||||||
|
jb, mu, sigma, p = jarque_bera( [ (x,w) for (x,w,bias) in d[i:] ] )
|
||||||
|
bias = sum ( [ w * e for (_,w,e) in d[i:] ] ) / sum ( [ w for (_,w,_) in d[i:] ] )
|
||||||
|
mu = (mu+0.5*bias) * to_eV
|
||||||
|
sigma = sigma * to_eV
|
||||||
|
bias = bias * to_eV
|
||||||
|
n = len(data[i:])
|
||||||
|
beta = student(0.5*(1.+target/p) ,n)
|
||||||
|
err = sigma * beta + 0.5*abs(bias)
|
||||||
|
print("| %2d | %8.3f | %8.3f | %8.3f | %8.3f | %8.3f |"%( n, mu, err, bias, p, jb))
|
||||||
|
if n < 3 :
|
||||||
|
continue
|
||||||
|
y = (err, p, mu, err, jb,n,bias)
|
||||||
|
if p > xmax[1]: xmax = y
|
||||||
|
if p < 0.8:
|
||||||
|
continue
|
||||||
|
x.append(y)
|
||||||
|
|
||||||
|
x = sorted(x)
|
||||||
|
|
||||||
|
print("|----+----------+----------+----------+----------+----------|")
|
||||||
|
if x != []:
|
||||||
|
xmax = x[0]
|
||||||
|
_, p, mu, err, jb, n, bias = xmax
|
||||||
|
beta = student(0.5*(1.+target/p),n)
|
||||||
|
print("| %2d | %8.3f | %8.3f | %8.3f | %8.3f | %8.3f |\n"%(n, mu, err, bias, p, jb))
|
||||||
|
|
||||||
|
return mu, err, bias, p
|
||||||
|
|
||||||
|
filename = sys.argv[1]
|
||||||
|
print(filename)
|
||||||
|
if len(sys.argv) > 2:
|
||||||
|
state = int(sys.argv[2])
|
||||||
|
else:
|
||||||
|
state = 1
|
||||||
|
data = read_data(filename,state)
|
||||||
|
mu, err, bias, _ = compute(data)
|
||||||
|
print(" %s: %8.3f +/- %5.3f eV\n"%(filename, mu, err))
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
A = np.array( [ [ data[-1][1], 1. ],
|
||||||
|
[ data[-2][1], 1. ] ] )
|
||||||
|
B = np.array( [ [ data[-1][0] ],
|
||||||
|
[ data[-2][0] ] ] )
|
||||||
|
E0 = np.linalg.solve(A,B)[1]
|
||||||
|
A = np.array( [ [ data[-1][4], 1. ],
|
||||||
|
[ data[-2][4], 1. ] ] )
|
||||||
|
B = np.array( [ [ data[-1][3] ],
|
||||||
|
[ data[-2][3] ] ] )
|
||||||
|
E1 = np.linalg.solve(A,B)[1]
|
||||||
|
average_2 = (E1-E0)*to_eV
|
||||||
|
|
||||||
|
A = np.array( [ [ data[-1][1], 1. ],
|
||||||
|
[ data[-2][1], 1. ],
|
||||||
|
[ data[-3][1], 1. ] ] )
|
||||||
|
B = np.array( [ [ data[-1][0] ],
|
||||||
|
[ data[-2][0] ],
|
||||||
|
[ data[-3][0] ] ] )
|
||||||
|
E0 = np.linalg.lstsq(A,B,rcond=None)[0][1]
|
||||||
|
A = np.array( [ [ data[-1][4], 1. ],
|
||||||
|
[ data[-2][4], 1. ],
|
||||||
|
[ data[-3][4], 1. ] ] )
|
||||||
|
B = np.array( [ [ data[-1][3] ],
|
||||||
|
[ data[-2][3] ],
|
||||||
|
[ data[-3][3] ] ] )
|
||||||
|
E1 = np.linalg.lstsq(A,B,rcond=None)[0][1]
|
||||||
|
average_3 = (E1-E0)*to_eV
|
||||||
|
|
||||||
|
exc = ((data[-1][3] + data[-1][4]) - (data[-1][0] + data[-1][1])) * to_eV
|
||||||
|
error_2 = abs(average_2 - average_3)
|
||||||
|
error_3 = abs(average_3 - exc)
|
||||||
|
print(" 2-3 points: %.3f +/- %.3f "% (average_3, error_2))
|
||||||
|
print(" largest wf: %.3f +/- %.3f "%(average_3, error_3))
|
||||||
|
|
||||||
|
|
@ -18,3 +18,8 @@ interface: ezfio,provider,ocaml
|
|||||||
default: False
|
default: False
|
||||||
ezfio_name: direct
|
ezfio_name: direct
|
||||||
|
|
||||||
|
[do_ao_cholesky]
|
||||||
|
type: logical
|
||||||
|
doc: Perform Cholesky decomposition of AO integrals
|
||||||
|
interface: ezfio,provider,ocaml
|
||||||
|
default: True
|
||||||
|
100
src/ao_two_e_ints/cholesky.irp.f
Normal file
100
src/ao_two_e_ints/cholesky.irp.f
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
BEGIN_PROVIDER [ integer, cholesky_ao_num_guess ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Number of Cholesky vectors in AO basis
|
||||||
|
END_DOC
|
||||||
|
|
||||||
|
integer :: i,j,k,l
|
||||||
|
double precision :: xnorm0, x, integral
|
||||||
|
double precision, external :: ao_two_e_integral
|
||||||
|
|
||||||
|
cholesky_ao_num_guess = 0
|
||||||
|
xnorm0 = 0.d0
|
||||||
|
x = 0.d0
|
||||||
|
do j=1,ao_num
|
||||||
|
do i=1,ao_num
|
||||||
|
integral = ao_two_e_integral(i,i,j,j)
|
||||||
|
if (integral > ao_integrals_threshold) then
|
||||||
|
cholesky_ao_num_guess += 1
|
||||||
|
else
|
||||||
|
x += integral
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
print *, 'Cholesky decomposition of AO integrals'
|
||||||
|
print *, '--------------------------------------'
|
||||||
|
print *, ''
|
||||||
|
print *, 'Estimated Error: ', x
|
||||||
|
print *, 'Guess size: ', cholesky_ao_num_guess, '(', 100.d0*dble(cholesky_ao_num_guess)/dble(ao_num*ao_num), ' %)'
|
||||||
|
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ integer, cholesky_ao_num ]
|
||||||
|
&BEGIN_PROVIDER [ double precision, cholesky_ao, (ao_num, ao_num, cholesky_ao_num_guess) ]
|
||||||
|
use mmap_module
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Cholesky vectors in AO basis: (ik|a):
|
||||||
|
! <ij|kl> = (ik|jl) = sum_a (ik|a).(a|jl)
|
||||||
|
END_DOC
|
||||||
|
|
||||||
|
type(c_ptr) :: ptr
|
||||||
|
integer :: fd, i,j,k,l, rank
|
||||||
|
double precision, pointer :: ao_integrals(:,:,:,:)
|
||||||
|
double precision, external :: ao_two_e_integral
|
||||||
|
|
||||||
|
! Store AO integrals in a memory mapped file
|
||||||
|
call mmap(trim(ezfio_work_dir)//'ao_integrals', &
|
||||||
|
(/ int(ao_num,8), int(ao_num,8), int(ao_num,8), int(ao_num,8) /), &
|
||||||
|
8, fd, .False., ptr)
|
||||||
|
call c_f_pointer(ptr, ao_integrals, (/ao_num, ao_num, ao_num, ao_num/))
|
||||||
|
|
||||||
|
double precision :: integral
|
||||||
|
logical, external :: ao_two_e_integral_zero
|
||||||
|
!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i,j,k,l, integral) SCHEDULE(dynamic)
|
||||||
|
do l=1,ao_num
|
||||||
|
do j=1,l
|
||||||
|
do k=1,ao_num
|
||||||
|
do i=1,k
|
||||||
|
if (ao_two_e_integral_zero(i,j,k,l)) cycle
|
||||||
|
integral = ao_two_e_integral(i,k,j,l)
|
||||||
|
ao_integrals(i,k,j,l) = integral
|
||||||
|
ao_integrals(k,i,j,l) = integral
|
||||||
|
ao_integrals(i,k,l,j) = integral
|
||||||
|
ao_integrals(k,i,l,j) = integral
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
!$OMP END PARALLEL DO
|
||||||
|
|
||||||
|
! Call Lapack
|
||||||
|
cholesky_ao_num = cholesky_ao_num_guess
|
||||||
|
call pivoted_cholesky(ao_integrals, cholesky_ao_num, ao_integrals_threshold, ao_num*ao_num, cholesky_ao)
|
||||||
|
print *, 'Rank: ', cholesky_ao_num, '(', 100.d0*dble(cholesky_ao_num)/dble(ao_num*ao_num), ' %)'
|
||||||
|
|
||||||
|
! Remove mmap
|
||||||
|
double precision, external :: getUnitAndOpen
|
||||||
|
call munmap( &
|
||||||
|
(/ int(ao_num,8), int(ao_num,8), int(ao_num,8), int(ao_num,8) /), &
|
||||||
|
8, fd, ptr)
|
||||||
|
open(unit=99,file=trim(ezfio_work_dir)//'ao_integrals')
|
||||||
|
close(99, status='delete')
|
||||||
|
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ double precision, cholesky_ao_transp, (cholesky_ao_num, ao_num, ao_num) ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Transposed of the Cholesky vectors in AO basis set
|
||||||
|
END_DOC
|
||||||
|
integer :: i,j,k
|
||||||
|
do j=1,ao_num
|
||||||
|
do i=1,ao_num
|
||||||
|
do k=1,ao_num
|
||||||
|
cholesky_ao_transp(k,i,j) = cholesky_ao(i,j,k)
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
END_PROVIDER
|
||||||
|
|
@ -486,7 +486,7 @@ subroutine get_ao_two_e_integrals(j,k,l,sze,out_val)
|
|||||||
PROVIDE ao_two_e_integrals_in_map ao_integrals_map
|
PROVIDE ao_two_e_integrals_in_map ao_integrals_map
|
||||||
|
|
||||||
if (ao_one_e_integral_zero(j,l)) then
|
if (ao_one_e_integral_zero(j,l)) then
|
||||||
out_val = 0.d0
|
out_val(1:sze) = 0.d0
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
json
|
||||||
perturbation
|
perturbation
|
||||||
zmq
|
zmq
|
||||||
mpi
|
mpi
|
||||||
|
@ -16,7 +16,6 @@ subroutine run_cipsi
|
|||||||
double precision, external :: memory_of_double
|
double precision, external :: memory_of_double
|
||||||
PROVIDE H_apply_buffer_allocated
|
PROVIDE H_apply_buffer_allocated
|
||||||
|
|
||||||
N_iter = 1
|
|
||||||
threshold_generators = 1.d0
|
threshold_generators = 1.d0
|
||||||
SOFT_TOUCH threshold_generators
|
SOFT_TOUCH threshold_generators
|
||||||
|
|
||||||
@ -76,7 +75,6 @@ subroutine run_cipsi
|
|||||||
)
|
)
|
||||||
write(*,'(A)') '--------------------------------------------------------------------------------'
|
write(*,'(A)') '--------------------------------------------------------------------------------'
|
||||||
|
|
||||||
|
|
||||||
to_select = int(sqrt(dble(N_states))*dble(N_det)*selection_factor)
|
to_select = int(sqrt(dble(N_states))*dble(N_det)*selection_factor)
|
||||||
to_select = max(N_states_diag, to_select)
|
to_select = max(N_states_diag, to_select)
|
||||||
if (do_pt2) then
|
if (do_pt2) then
|
||||||
@ -106,10 +104,10 @@ subroutine run_cipsi
|
|||||||
|
|
||||||
call save_energy(psi_energy_with_nucl_rep, pt2_data % pt2)
|
call save_energy(psi_energy_with_nucl_rep, pt2_data % pt2)
|
||||||
|
|
||||||
call save_iterations(psi_energy_with_nucl_rep(1:N_states),pt2_data % rpt2,N_det)
|
call increment_n_iter(psi_energy_with_nucl_rep, pt2_data)
|
||||||
call print_extrapolated_energy()
|
call print_extrapolated_energy()
|
||||||
call print_mol_properties()
|
call print_mol_properties()
|
||||||
N_iter += 1
|
call write_cipsi_json(pt2_data,pt2_data_err)
|
||||||
|
|
||||||
if (qp_stop()) exit
|
if (qp_stop()) exit
|
||||||
|
|
||||||
@ -130,13 +128,13 @@ subroutine run_cipsi
|
|||||||
if (qp_stop()) exit
|
if (qp_stop()) exit
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
if (.not.qp_stop()) then
|
! If stopped because N_det > N_det_max, do an extra iteration to compute the PT2
|
||||||
if (N_det < N_det_max) then
|
if ((.not.qp_stop()).and. &
|
||||||
call diagonalize_CI
|
(N_det > N_det_max) .and. &
|
||||||
call save_wavefunction
|
(maxval(abs(pt2_data % pt2(1:N_states))) > pt2_max) .and. &
|
||||||
call save_energy(psi_energy_with_nucl_rep, zeros)
|
(maxval(abs(pt2_data % variance(1:N_states))) > variance_max) .and.&
|
||||||
endif
|
(correlation_energy_ratio <= correlation_energy_ratio_max) &
|
||||||
|
) then
|
||||||
if (do_pt2) then
|
if (do_pt2) then
|
||||||
call pt2_dealloc(pt2_data)
|
call pt2_dealloc(pt2_data)
|
||||||
call pt2_dealloc(pt2_data_err)
|
call pt2_dealloc(pt2_data_err)
|
||||||
@ -155,11 +153,13 @@ subroutine run_cipsi
|
|||||||
call save_energy(psi_energy_with_nucl_rep, pt2_data % pt2)
|
call save_energy(psi_energy_with_nucl_rep, pt2_data % pt2)
|
||||||
call print_summary(psi_energy_with_nucl_rep(1:N_states), &
|
call print_summary(psi_energy_with_nucl_rep(1:N_states), &
|
||||||
pt2_data, pt2_data_err, N_det,N_configuration,N_states,psi_s2)
|
pt2_data, pt2_data_err, N_det,N_configuration,N_states,psi_s2)
|
||||||
call save_iterations(psi_energy_with_nucl_rep(1:N_states),pt2_data % rpt2,N_det)
|
call increment_n_iter(psi_energy_with_nucl_rep, pt2_data)
|
||||||
call print_extrapolated_energy()
|
call print_extrapolated_energy()
|
||||||
call print_mol_properties()
|
call print_mol_properties()
|
||||||
|
call write_cipsi_json(pt2_data,pt2_data_err)
|
||||||
endif
|
endif
|
||||||
call pt2_dealloc(pt2_data)
|
call pt2_dealloc(pt2_data)
|
||||||
call pt2_dealloc(pt2_data_err)
|
call pt2_dealloc(pt2_data_err)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -7,7 +7,9 @@ BEGIN_PROVIDER [ integer, nthreads_pt2 ]
|
|||||||
character*(32) :: env
|
character*(32) :: env
|
||||||
call getenv('QP_NTHREADS_PT2',env)
|
call getenv('QP_NTHREADS_PT2',env)
|
||||||
if (trim(env) /= '') then
|
if (trim(env) /= '') then
|
||||||
|
call lock_io()
|
||||||
read(env,*) nthreads_pt2
|
read(env,*) nthreads_pt2
|
||||||
|
call unlock_io()
|
||||||
call write_int(6,nthreads_pt2,'Target number of threads for PT2')
|
call write_int(6,nthreads_pt2,'Target number of threads for PT2')
|
||||||
endif
|
endif
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
@ -15,7 +15,6 @@ subroutine run_stochastic_cipsi
|
|||||||
double precision, external :: memory_of_double
|
double precision, external :: memory_of_double
|
||||||
PROVIDE H_apply_buffer_allocated distributed_davidson mo_two_e_integrals_in_map
|
PROVIDE H_apply_buffer_allocated distributed_davidson mo_two_e_integrals_in_map
|
||||||
|
|
||||||
N_iter = 1
|
|
||||||
threshold_generators = 1.d0
|
threshold_generators = 1.d0
|
||||||
SOFT_TOUCH threshold_generators
|
SOFT_TOUCH threshold_generators
|
||||||
|
|
||||||
@ -96,10 +95,10 @@ subroutine run_stochastic_cipsi
|
|||||||
|
|
||||||
call save_energy(psi_energy_with_nucl_rep, pt2_data % pt2)
|
call save_energy(psi_energy_with_nucl_rep, pt2_data % pt2)
|
||||||
|
|
||||||
call save_iterations(psi_energy_with_nucl_rep(1:N_states),pt2_data % rpt2,N_det)
|
call increment_n_iter(psi_energy_with_nucl_rep, pt2_data)
|
||||||
call print_extrapolated_energy()
|
call print_extrapolated_energy()
|
||||||
call print_mol_properties()
|
call print_mol_properties()
|
||||||
N_iter += 1
|
call write_cipsi_json(pt2_data,pt2_data_err)
|
||||||
|
|
||||||
if (qp_stop()) exit
|
if (qp_stop()) exit
|
||||||
|
|
||||||
@ -119,13 +118,13 @@ subroutine run_stochastic_cipsi
|
|||||||
if (qp_stop()) exit
|
if (qp_stop()) exit
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
if (.not.qp_stop()) then
|
! If stopped because N_det > N_det_max, do an extra iteration to compute the PT2
|
||||||
if (N_det < N_det_max) then
|
if ((.not.qp_stop()).and. &
|
||||||
call diagonalize_CI
|
(N_det > N_det_max) .and. &
|
||||||
call save_wavefunction
|
(maxval(abs(pt2_data % pt2(1:N_states))) > pt2_max) .and. &
|
||||||
call save_energy(psi_energy_with_nucl_rep, zeros)
|
(maxval(abs(pt2_data % variance(1:N_states))) > variance_max) .and.&
|
||||||
endif
|
(correlation_energy_ratio <= correlation_energy_ratio_max) &
|
||||||
|
) then
|
||||||
call pt2_dealloc(pt2_data)
|
call pt2_dealloc(pt2_data)
|
||||||
call pt2_dealloc(pt2_data_err)
|
call pt2_dealloc(pt2_data_err)
|
||||||
call pt2_alloc(pt2_data, N_states)
|
call pt2_alloc(pt2_data, N_states)
|
||||||
@ -135,9 +134,10 @@ subroutine run_stochastic_cipsi
|
|||||||
call save_energy(psi_energy_with_nucl_rep, pt2_data % pt2)
|
call save_energy(psi_energy_with_nucl_rep, pt2_data % pt2)
|
||||||
call print_summary(psi_energy_with_nucl_rep, &
|
call print_summary(psi_energy_with_nucl_rep, &
|
||||||
pt2_data , pt2_data_err, N_det, N_configuration, N_states, psi_s2)
|
pt2_data , pt2_data_err, N_det, N_configuration, N_states, psi_s2)
|
||||||
call save_iterations(psi_energy_with_nucl_rep(1:N_states),pt2_data % rpt2,N_det)
|
call increment_n_iter(psi_energy_with_nucl_rep, pt2_data)
|
||||||
call print_extrapolated_energy()
|
call print_extrapolated_energy()
|
||||||
call print_mol_properties()
|
call print_mol_properties()
|
||||||
|
call write_cipsi_json(pt2_data,pt2_data_err)
|
||||||
endif
|
endif
|
||||||
call pt2_dealloc(pt2_data)
|
call pt2_dealloc(pt2_data)
|
||||||
call pt2_dealloc(pt2_data_err)
|
call pt2_dealloc(pt2_data_err)
|
||||||
|
53
src/cipsi/write_cipsi_json.irp.f
Normal file
53
src/cipsi/write_cipsi_json.irp.f
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
subroutine write_cipsi_json(pt2_data, pt2_data_err)
|
||||||
|
use selection_types
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Writes JSON data for CIPSI runs
|
||||||
|
END_DOC
|
||||||
|
type(pt2_type), intent(in) :: pt2_data, pt2_data_err
|
||||||
|
integer :: i,j,k
|
||||||
|
|
||||||
|
call lock_io
|
||||||
|
character*(64), allocatable :: fmtk(:)
|
||||||
|
integer :: N_states_p, N_iter_p
|
||||||
|
N_states_p = min(N_states,N_det)
|
||||||
|
N_iter_p = min(N_iter,8)
|
||||||
|
allocate(fmtk(0:N_iter_p))
|
||||||
|
fmtk(:) = '('' '',E22.15,'','')'
|
||||||
|
fmtk(N_iter_p) = '('' '',E22.15)'
|
||||||
|
|
||||||
|
write(json_unit, json_dict_uopen_fmt)
|
||||||
|
write(json_unit, json_int_fmt) 'n_det', N_det
|
||||||
|
if (s2_eig) then
|
||||||
|
write(json_unit, json_int_fmt) 'n_cfg', N_configuration
|
||||||
|
if (only_expected_s2) then
|
||||||
|
write(json_unit, json_int_fmt) 'n_csf', N_csf
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
write(json_unit, json_array_open_fmt) 'states'
|
||||||
|
do k=1,N_states_p
|
||||||
|
write(json_unit, json_dict_uopen_fmt)
|
||||||
|
write(json_unit, json_real_fmt) 'energy', psi_energy_with_nucl_rep(k)
|
||||||
|
write(json_unit, json_real_fmt) 's2', psi_s2(k)
|
||||||
|
write(json_unit, json_real_fmt) 'pt2', pt2_data % pt2(k)
|
||||||
|
write(json_unit, json_real_fmt) 'pt2_err', pt2_data_err % pt2(k)
|
||||||
|
write(json_unit, json_real_fmt) 'rpt2', pt2_data % rpt2(k)
|
||||||
|
write(json_unit, json_real_fmt) 'rpt2_err', pt2_data_err % rpt2(k)
|
||||||
|
write(json_unit, json_real_fmt) 'variance', pt2_data % variance(k)
|
||||||
|
write(json_unit, json_real_fmt) 'variance_err', pt2_data_err % variance(k)
|
||||||
|
write(json_unit, json_array_open_fmt) 'ex_energy'
|
||||||
|
do i=2,N_iter_p
|
||||||
|
write(json_unit, fmtk(i)) extrapolated_energy(i,k)
|
||||||
|
enddo
|
||||||
|
write(json_unit, json_array_close_fmtx)
|
||||||
|
if (k < N_states_p) then
|
||||||
|
write(json_unit, json_dict_close_fmt)
|
||||||
|
else
|
||||||
|
write(json_unit, json_dict_close_fmtx)
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
write(json_unit, json_array_close_fmtx)
|
||||||
|
write(json_unit, json_dict_close_fmt)
|
||||||
|
deallocate(fmtk)
|
||||||
|
call unlock_io
|
||||||
|
end
|
@ -1,6 +1,7 @@
|
|||||||
|
json
|
||||||
mpi
|
mpi
|
||||||
perturbation
|
perturbation
|
||||||
zmq
|
zmq
|
||||||
iterations_tc
|
iterations
|
||||||
csf
|
csf
|
||||||
tc_bi_ortho
|
tc_bi_ortho
|
||||||
|
@ -94,7 +94,15 @@ subroutine run_stochastic_cipsi
|
|||||||
call ZMQ_pt2(E_denom, pt2_data, pt2_data_err, relative_error,to_select) ! Stochastic PT2 and selection
|
call ZMQ_pt2(E_denom, pt2_data, pt2_data_err, relative_error,to_select) ! Stochastic PT2 and selection
|
||||||
! stop
|
! stop
|
||||||
|
|
||||||
N_iter += 1
|
call print_summary(psi_energy_with_nucl_rep, &
|
||||||
|
pt2_data, pt2_data_err, N_det,N_configuration,N_states,psi_s2)
|
||||||
|
|
||||||
|
call save_energy(psi_energy_with_nucl_rep, pt2_data % pt2)
|
||||||
|
|
||||||
|
call increment_n_iter(psi_energy_with_nucl_rep, pt2_data)
|
||||||
|
call print_extrapolated_energy()
|
||||||
|
! call print_mol_properties()
|
||||||
|
call write_cipsi_json(pt2_data,pt2_data_err)
|
||||||
|
|
||||||
if (qp_stop()) exit
|
if (qp_stop()) exit
|
||||||
|
|
||||||
|
53
src/cipsi_tc_bi_ortho/write_cipsi_json.irp.f
Normal file
53
src/cipsi_tc_bi_ortho/write_cipsi_json.irp.f
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
subroutine write_cipsi_json(pt2_data, pt2_data_err)
|
||||||
|
use selection_types
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Writes JSON data for CIPSI runs
|
||||||
|
END_DOC
|
||||||
|
type(pt2_type), intent(in) :: pt2_data, pt2_data_err
|
||||||
|
integer :: i,j,k
|
||||||
|
|
||||||
|
call lock_io
|
||||||
|
character*(64), allocatable :: fmtk(:)
|
||||||
|
integer :: N_states_p, N_iter_p
|
||||||
|
N_states_p = min(N_states,N_det)
|
||||||
|
N_iter_p = min(N_iter,8)
|
||||||
|
allocate(fmtk(0:N_iter_p))
|
||||||
|
fmtk(:) = '('' '',E22.15,'','')'
|
||||||
|
fmtk(N_iter_p) = '('' '',E22.15)'
|
||||||
|
|
||||||
|
write(json_unit, json_dict_uopen_fmt)
|
||||||
|
write(json_unit, json_int_fmt) 'n_det', N_det
|
||||||
|
if (s2_eig) then
|
||||||
|
write(json_unit, json_int_fmt) 'n_cfg', N_configuration
|
||||||
|
if (only_expected_s2) then
|
||||||
|
write(json_unit, json_int_fmt) 'n_csf', N_csf
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
write(json_unit, json_array_open_fmt) 'states'
|
||||||
|
do k=1,N_states_p
|
||||||
|
write(json_unit, json_dict_uopen_fmt)
|
||||||
|
write(json_unit, json_real_fmt) 'energy', psi_energy_with_nucl_rep(k)
|
||||||
|
write(json_unit, json_real_fmt) 's2', psi_s2(k)
|
||||||
|
write(json_unit, json_real_fmt) 'pt2', pt2_data % pt2(k)
|
||||||
|
write(json_unit, json_real_fmt) 'pt2_err', pt2_data_err % pt2(k)
|
||||||
|
write(json_unit, json_real_fmt) 'rpt2', pt2_data % rpt2(k)
|
||||||
|
write(json_unit, json_real_fmt) 'rpt2_err', pt2_data_err % rpt2(k)
|
||||||
|
write(json_unit, json_real_fmt) 'variance', pt2_data % variance(k)
|
||||||
|
write(json_unit, json_real_fmt) 'variance_err', pt2_data_err % variance(k)
|
||||||
|
write(json_unit, json_array_open_fmt) 'ex_energy'
|
||||||
|
do i=2,N_iter_p
|
||||||
|
write(json_unit, fmtk(i)) extrapolated_energy(i,k)
|
||||||
|
enddo
|
||||||
|
write(json_unit, json_array_close_fmtx)
|
||||||
|
if (k < N_states_p) then
|
||||||
|
write(json_unit, json_dict_close_fmt)
|
||||||
|
else
|
||||||
|
write(json_unit, json_dict_close_fmtx)
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
write(json_unit, json_array_close_fmtx)
|
||||||
|
write(json_unit, json_dict_close_fmt)
|
||||||
|
deallocate(fmtk)
|
||||||
|
call unlock_io
|
||||||
|
end
|
@ -150,7 +150,9 @@ subroutine davidson_slave_work(zmq_to_qp_run_socket, zmq_socket_push, N_st, sze,
|
|||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
if(task_id == 0) exit
|
if(task_id == 0) exit
|
||||||
|
call lock_io()
|
||||||
read (msg,*) imin, imax, ishift, istep
|
read (msg,*) imin, imax, ishift, istep
|
||||||
|
call unlock_io()
|
||||||
integer :: k
|
integer :: k
|
||||||
do k=imin,imax
|
do k=imin,imax
|
||||||
v_t(:,k) = 0.d0
|
v_t(:,k) = 0.d0
|
||||||
@ -546,6 +548,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
integer function zmq_put_N_states_diag(zmq_to_qp_run_socket,worker_id)
|
integer function zmq_put_N_states_diag(zmq_to_qp_run_socket,worker_id)
|
||||||
use f77_zmq
|
use f77_zmq
|
||||||
implicit none
|
implicit none
|
||||||
|
@ -461,9 +461,8 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_
|
|||||||
integer :: lwork, info
|
integer :: lwork, info
|
||||||
double precision, allocatable :: work(:)
|
double precision, allocatable :: work(:)
|
||||||
|
|
||||||
|
|
||||||
y = h
|
y = h
|
||||||
!y = h_p
|
! y = h_p ! Doesn't work for non-singlets
|
||||||
lwork = -1
|
lwork = -1
|
||||||
allocate(work(1))
|
allocate(work(1))
|
||||||
call dsygv(1,'V','U',shift2,y,size(y,1), &
|
call dsygv(1,'V','U',shift2,y,size(y,1), &
|
||||||
|
@ -9,4 +9,21 @@ BEGIN_PROVIDER [ integer(omp_lock_kind), file_lock ]
|
|||||||
call omp_init_lock(file_lock)
|
call omp_init_lock(file_lock)
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
! These functions need to be called because internal read and write are not thread safe.
|
||||||
|
subroutine lock_io()
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Needs to be called because before doing I/O because internal read and write
|
||||||
|
! are not thread safe.
|
||||||
|
END_DOC
|
||||||
|
call omp_set_lock(file_lock)
|
||||||
|
end subroutine lock_io()
|
||||||
|
|
||||||
|
subroutine unlock_io()
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Needs to be called because afterdoing I/O because internal read and write
|
||||||
|
! are not thread safe.
|
||||||
|
END_DOC
|
||||||
|
call omp_unset_lock(file_lock)
|
||||||
|
end subroutine lock_io()
|
||||||
|
@ -39,12 +39,19 @@ program fci
|
|||||||
if (.not.is_zmq_slave) then
|
if (.not.is_zmq_slave) then
|
||||||
PROVIDE psi_det psi_coef mo_two_e_integrals_in_map
|
PROVIDE psi_det psi_coef mo_two_e_integrals_in_map
|
||||||
|
|
||||||
|
write(json_unit,json_array_open_fmt) 'fci'
|
||||||
|
|
||||||
if (do_pt2) then
|
if (do_pt2) then
|
||||||
call run_stochastic_cipsi
|
call run_stochastic_cipsi
|
||||||
else
|
else
|
||||||
call run_cipsi
|
call run_cipsi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
write(json_unit,json_dict_uopen_fmt)
|
||||||
|
write(json_unit,json_dict_close_fmtx)
|
||||||
|
write(json_unit,json_array_close_fmtx)
|
||||||
|
call json_close
|
||||||
|
|
||||||
else
|
else
|
||||||
PROVIDE mo_two_e_integrals_in_map pt2_min_parallel_tasks
|
PROVIDE mo_two_e_integrals_in_map pt2_min_parallel_tasks
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
json
|
||||||
tc_bi_ortho
|
tc_bi_ortho
|
||||||
davidson_undressed
|
davidson_undressed
|
||||||
cipsi_tc_bi_ortho
|
cipsi_tc_bi_ortho
|
||||||
|
@ -62,6 +62,7 @@ subroutine run_cipsi_tc
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
! ---
|
! ---
|
||||||
|
write(json_unit,json_array_open_fmt) 'fci_tc'
|
||||||
|
|
||||||
if (do_pt2) then
|
if (do_pt2) then
|
||||||
call run_stochastic_cipsi
|
call run_stochastic_cipsi
|
||||||
@ -69,6 +70,11 @@ subroutine run_cipsi_tc
|
|||||||
call run_cipsi
|
call run_cipsi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
write(json_unit,json_dict_uopen_fmt)
|
||||||
|
write(json_unit,json_dict_close_fmtx)
|
||||||
|
write(json_unit,json_array_close_fmtx)
|
||||||
|
call json_close
|
||||||
|
|
||||||
else
|
else
|
||||||
PROVIDE mo_bi_ortho_tc_one_e mo_bi_ortho_tc_two_e pt2_min_parallel_tasks
|
PROVIDE mo_bi_ortho_tc_one_e mo_bi_ortho_tc_two_e pt2_min_parallel_tasks
|
||||||
if(elec_alpha_num+elec_beta_num.ge.3)then
|
if(elec_alpha_num+elec_beta_num.ge.3)then
|
||||||
|
@ -4,6 +4,6 @@ subroutine save_energy(E,pt2)
|
|||||||
! Saves the energy in |EZFIO|.
|
! Saves the energy in |EZFIO|.
|
||||||
END_DOC
|
END_DOC
|
||||||
double precision, intent(in) :: E(N_states), pt2(N_states)
|
double precision, intent(in) :: E(N_states), pt2(N_states)
|
||||||
call ezfio_set_fci_tc_energy(E(1:N_states))
|
call ezfio_set_fci_tc_bi_energy(E(1:N_states))
|
||||||
call ezfio_set_fci_tc_energy_pt2(E(1:N_states)+pt2(1:N_states))
|
call ezfio_set_fci_tc_bi_energy_pt2(E(1:N_states)+pt2(1:N_states))
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
ao_one_e_ints
|
ao_one_e_ints
|
||||||
ao_two_e_ints
|
ao_two_e_ints
|
||||||
scf_utils
|
scf_utils
|
||||||
|
json
|
||||||
|
@ -15,6 +15,12 @@
|
|||||||
double precision, allocatable :: ao_two_e_integral_alpha_tmp(:,:)
|
double precision, allocatable :: ao_two_e_integral_alpha_tmp(:,:)
|
||||||
double precision, allocatable :: ao_two_e_integral_beta_tmp(:,:)
|
double precision, allocatable :: ao_two_e_integral_beta_tmp(:,:)
|
||||||
|
|
||||||
|
if (do_ao_cholesky) then ! Use Cholesky-decomposed integrals
|
||||||
|
ao_two_e_integral_alpha(:,:) = ao_two_e_integral_alpha_chol(:,:)
|
||||||
|
ao_two_e_integral_beta (:,:) = ao_two_e_integral_beta_chol (:,:)
|
||||||
|
|
||||||
|
else ! Use integrals in AO basis set
|
||||||
|
|
||||||
ao_two_e_integral_alpha = 0.d0
|
ao_two_e_integral_alpha = 0.d0
|
||||||
ao_two_e_integral_beta = 0.d0
|
ao_two_e_integral_beta = 0.d0
|
||||||
if (do_direct_integrals) then
|
if (do_direct_integrals) then
|
||||||
@ -150,6 +156,81 @@
|
|||||||
!$OMP END PARALLEL
|
!$OMP END PARALLEL
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ double precision, ao_two_e_integral_alpha_chol, (ao_num, ao_num) ]
|
||||||
|
&BEGIN_PROVIDER [ double precision, ao_two_e_integral_beta_chol , (ao_num, ao_num) ]
|
||||||
|
use map_module
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Alpha and Beta Fock matrices in AO basis set
|
||||||
|
END_DOC
|
||||||
|
|
||||||
|
integer :: m,n,l,s,j
|
||||||
|
double precision :: integral
|
||||||
|
double precision, allocatable :: X(:), X2(:,:,:,:), X3(:,:,:,:)
|
||||||
|
|
||||||
|
allocate (X(cholesky_ao_num))
|
||||||
|
|
||||||
|
|
||||||
|
! X(j) = \sum_{mn} SCF_density_matrix_ao(m,n) * cholesky_ao(m,n,j)
|
||||||
|
call dgemm('T','N',cholesky_ao_num,1,ao_num*ao_num,1.d0, &
|
||||||
|
cholesky_ao, ao_num*ao_num, &
|
||||||
|
SCF_density_matrix_ao, ao_num*ao_num,0.d0, &
|
||||||
|
X, cholesky_ao_num)
|
||||||
|
!
|
||||||
|
|
||||||
|
! ao_two_e_integral_alpha(m,n) = \sum_{j} cholesky_ao(m,n,j) * X(j)
|
||||||
|
call dgemm('N','N',ao_num*ao_num,1,cholesky_ao_num, 1.d0, &
|
||||||
|
cholesky_ao, ao_num*ao_num, &
|
||||||
|
X, cholesky_ao_num, 0.d0, &
|
||||||
|
ao_two_e_integral_alpha_chol, ao_num*ao_num)
|
||||||
|
|
||||||
|
deallocate(X)
|
||||||
|
|
||||||
|
ao_two_e_integral_beta_chol = ao_two_e_integral_alpha_chol
|
||||||
|
|
||||||
|
|
||||||
|
allocate(X2(ao_num,ao_num,cholesky_ao_num,2))
|
||||||
|
|
||||||
|
! ao_two_e_integral_alpha_chol (l,s) -= cholesky_ao(l,m,j) * SCF_density_matrix_ao_beta (m,n) * cholesky_ao(n,s,j)
|
||||||
|
|
||||||
|
call dgemm('N','N',ao_num,ao_num*cholesky_ao_num,ao_num, 1.d0, &
|
||||||
|
SCF_density_matrix_ao_alpha, ao_num, &
|
||||||
|
cholesky_ao, ao_num, 0.d0, &
|
||||||
|
X2(1,1,1,1), ao_num)
|
||||||
|
|
||||||
|
call dgemm('N','N',ao_num,ao_num*cholesky_ao_num,ao_num, 1.d0, &
|
||||||
|
SCF_density_matrix_ao_beta, ao_num, &
|
||||||
|
cholesky_ao, ao_num, 0.d0, &
|
||||||
|
X2(1,1,1,2), ao_num)
|
||||||
|
|
||||||
|
allocate(X3(ao_num,cholesky_ao_num,ao_num,2))
|
||||||
|
|
||||||
|
do s=1,ao_num
|
||||||
|
do j=1,cholesky_ao_num
|
||||||
|
do m=1,ao_num
|
||||||
|
X3(m,j,s,1) = X2(m,s,j,1)
|
||||||
|
X3(m,j,s,2) = X2(m,s,j,2)
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
|
||||||
|
deallocate(X2)
|
||||||
|
|
||||||
|
call dgemm('N','N',ao_num,ao_num,ao_num*cholesky_ao_num, -1.d0, &
|
||||||
|
cholesky_ao, ao_num, &
|
||||||
|
X3(1,1,1,1), ao_num*cholesky_ao_num, 1.d0, &
|
||||||
|
ao_two_e_integral_alpha_chol, ao_num)
|
||||||
|
|
||||||
|
call dgemm('N','N',ao_num,ao_num,ao_num*cholesky_ao_num, -1.d0, &
|
||||||
|
cholesky_ao, ao_num, &
|
||||||
|
X3(1,1,1,2), ao_num*cholesky_ao_num, 1.d0, &
|
||||||
|
ao_two_e_integral_beta_chol, ao_num)
|
||||||
|
|
||||||
|
deallocate(X3)
|
||||||
|
|
||||||
END_PROVIDER
|
END_PROVIDER
|
||||||
|
|
||||||
|
@ -80,9 +80,14 @@ subroutine run
|
|||||||
|
|
||||||
mo_label = 'Orthonormalized'
|
mo_label = 'Orthonormalized'
|
||||||
|
|
||||||
call Roothaan_Hall_SCF
|
write(json_unit,json_array_open_fmt) 'scf'
|
||||||
call ezfio_set_hartree_fock_energy(SCF_energy)
|
|
||||||
|
|
||||||
|
call Roothaan_Hall_SCF
|
||||||
|
|
||||||
|
write(json_unit,json_array_close_fmtx)
|
||||||
|
call json_close
|
||||||
|
|
||||||
|
call ezfio_set_hartree_fock_energy(SCF_energy)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
[n_iter]
|
|
||||||
interface: ezfio
|
|
||||||
doc: Number of saved iterations
|
|
||||||
type:integer
|
|
||||||
default: 1
|
|
||||||
|
|
||||||
[n_det_iterations]
|
|
||||||
interface: ezfio, provider
|
|
||||||
doc: Number of determinants at each iteration
|
|
||||||
type: integer
|
|
||||||
size: (100)
|
|
||||||
|
|
||||||
[energy_iterations]
|
|
||||||
interface: ezfio, provider
|
|
||||||
doc: The variational energy at each iteration
|
|
||||||
type: double precision
|
|
||||||
size: (determinants.n_states,100)
|
|
||||||
|
|
||||||
[pt2_iterations]
|
|
||||||
interface: ezfio, provider
|
|
||||||
doc: The |PT2| correction at each iteration
|
|
||||||
type: double precision
|
|
||||||
size: (determinants.n_states,100)
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
BEGIN_PROVIDER [ integer, n_iter ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! number of iterations
|
|
||||||
END_DOC
|
|
||||||
|
|
||||||
logical :: has
|
|
||||||
PROVIDE ezfio_filename
|
|
||||||
if (mpi_master) then
|
|
||||||
|
|
||||||
double precision :: zeros(N_states,100)
|
|
||||||
integer :: izeros(100)
|
|
||||||
zeros = 0.d0
|
|
||||||
izeros = 0
|
|
||||||
call ezfio_set_iterations_n_iter(0)
|
|
||||||
call ezfio_set_iterations_energy_iterations(zeros)
|
|
||||||
call ezfio_set_iterations_pt2_iterations(zeros)
|
|
||||||
call ezfio_set_iterations_n_det_iterations(izeros)
|
|
||||||
n_iter = 1
|
|
||||||
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( n_iter, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
|
|
||||||
if (ierr /= MPI_SUCCESS) then
|
|
||||||
stop 'Unable to read n_iter with MPI'
|
|
||||||
endif
|
|
||||||
IRP_ENDIF
|
|
||||||
|
|
||||||
call write_time(6)
|
|
||||||
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
@ -1,42 +1,65 @@
|
|||||||
BEGIN_PROVIDER [ double precision, extrapolated_energy, (N_iter,N_states) ]
|
BEGIN_PROVIDER [ integer, N_iter ]
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! Extrapolated energy, using E_var = f(PT2) where PT2=0
|
! Number of CIPSI iterations
|
||||||
END_DOC
|
END_DOC
|
||||||
integer :: i
|
|
||||||
do i=1,min(N_states,N_det)
|
N_iter = 0
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ integer, N_iter_max ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Max number of iterations for extrapolations
|
||||||
|
END_DOC
|
||||||
|
N_iter_max = 8
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ double precision, energy_iterations , (n_states,N_iter_max) ]
|
||||||
|
&BEGIN_PROVIDER [ double precision, pt2_iterations , (n_states,N_iter_max) ]
|
||||||
|
&BEGIN_PROVIDER [ double precision, extrapolated_energy, (N_iter_max,N_states) ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! The energy at each iteration for the extrapolations
|
||||||
|
END_DOC
|
||||||
|
|
||||||
|
energy_iterations = 0.d0
|
||||||
|
pt2_iterations = 0.d0
|
||||||
|
extrapolated_energy = 0.d0
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
subroutine increment_n_iter(e, pt2_data)
|
||||||
|
use selection_types
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Does what is necessary to increment n_iter
|
||||||
|
END_DOC
|
||||||
|
double precision, intent(in) :: e(*)
|
||||||
|
type(pt2_type), intent(in) :: pt2_data
|
||||||
|
integer :: k, i
|
||||||
|
|
||||||
|
if (N_det < N_states) return
|
||||||
|
|
||||||
|
if (N_iter < N_iter_max) then
|
||||||
|
N_iter += 1
|
||||||
|
else
|
||||||
|
do k=2,N_iter
|
||||||
|
energy_iterations(1:N_states,k-1) = energy_iterations(1:N_states,k)
|
||||||
|
pt2_iterations(1:N_states,k-1) = pt2_iterations(1:N_states,k)
|
||||||
|
enddo
|
||||||
|
endif
|
||||||
|
energy_iterations(1:N_states,N_iter) = e(1:N_states)
|
||||||
|
pt2_iterations(1:N_states,N_iter) = pt2_data % rpt2(1:N_states)
|
||||||
|
|
||||||
|
if (N_iter < 2) then
|
||||||
|
extrapolated_energy(1,:) = energy_iterations(:,1) + pt2_iterations(:,1)
|
||||||
|
extrapolated_energy(2,:) = energy_iterations(:,2) + pt2_iterations(:,2)
|
||||||
|
else
|
||||||
|
do i=1,N_states
|
||||||
call extrapolate_data(N_iter, &
|
call extrapolate_data(N_iter, &
|
||||||
energy_iterations(i,1:N_iter), &
|
energy_iterations(i,1:N_iter), &
|
||||||
pt2_iterations(i,1:N_iter), &
|
pt2_iterations(i,1:N_iter), &
|
||||||
extrapolated_energy(1:N_iter,i))
|
extrapolated_energy(1:N_iter,i))
|
||||||
enddo
|
enddo
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
|
|
||||||
subroutine save_iterations(e_, pt2_,n_)
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Update the energy in the EZFIO file.
|
|
||||||
END_DOC
|
|
||||||
integer, intent(in) :: n_
|
|
||||||
double precision, intent(in) :: e_(N_states), pt2_(N_states)
|
|
||||||
integer :: i
|
|
||||||
|
|
||||||
if (N_iter == 101) then
|
|
||||||
do i=2,N_iter-1
|
|
||||||
energy_iterations(1:N_states,N_iter-1) = energy_iterations(1:N_states,N_iter)
|
|
||||||
pt2_iterations(1:N_states,N_iter-1) = pt2_iterations(1:N_states,N_iter)
|
|
||||||
enddo
|
|
||||||
N_iter = N_iter-1
|
|
||||||
TOUCH N_iter
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
energy_iterations(1:N_states,N_iter) = e_(1:N_states)
|
|
||||||
pt2_iterations(1:N_states,N_iter) = pt2_(1:N_states)
|
|
||||||
n_det_iterations(N_iter) = n_
|
|
||||||
call ezfio_set_iterations_N_iter(N_iter)
|
|
||||||
call ezfio_set_iterations_energy_iterations(energy_iterations)
|
|
||||||
call ezfio_set_iterations_pt2_iterations(pt2_iterations)
|
|
||||||
call ezfio_set_iterations_n_det_iterations(n_det_iterations)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,10 +5,14 @@ subroutine print_extrapolated_energy
|
|||||||
END_DOC
|
END_DOC
|
||||||
|
|
||||||
integer :: i,k
|
integer :: i,k
|
||||||
|
integer :: N_states_p, N_iter_p
|
||||||
|
|
||||||
if (N_iter< 2) then
|
if (N_iter< 2) then
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
N_states_p = min(N_states,N_det)
|
||||||
|
N_iter_p = min(N_iter, 8)
|
||||||
|
|
||||||
write(*,'(A)') ''
|
write(*,'(A)') ''
|
||||||
write(*,'(A)') 'Extrapolated energies'
|
write(*,'(A)') 'Extrapolated energies'
|
||||||
write(*,'(A)') '------------------------'
|
write(*,'(A)') '------------------------'
|
||||||
@ -20,20 +24,20 @@ subroutine print_extrapolated_energy
|
|||||||
write(*,*) '=========== ', '==================='
|
write(*,*) '=========== ', '==================='
|
||||||
write(*,*) 'minimum PT2 ', 'Extrapolated energy'
|
write(*,*) 'minimum PT2 ', 'Extrapolated energy'
|
||||||
write(*,*) '=========== ', '==================='
|
write(*,*) '=========== ', '==================='
|
||||||
do k=2,min(N_iter,8)
|
do k=2,N_iter_p
|
||||||
write(*,'(F11.4,2X,F18.8)') pt2_iterations(1,N_iter+1-k), extrapolated_energy(k,1)
|
write(*,'(F11.4,2X,F18.8)') pt2_iterations(1,k), extrapolated_energy(k,1)
|
||||||
enddo
|
enddo
|
||||||
write(*,*) '=========== ', '==================='
|
write(*,*) '=========== ', '==================='
|
||||||
|
|
||||||
do i=2, min(N_states,N_det)
|
do i=2, N_states_p
|
||||||
print *, ''
|
print *, ''
|
||||||
print *, 'State ', i
|
print *, 'State ', i
|
||||||
print *, ''
|
print *, ''
|
||||||
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
|
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
|
||||||
write(*,*) 'minimum PT2 ', 'Extrapolated energy ', ' Excitation (a.u) ', ' Excitation (eV) '
|
write(*,*) 'minimum PT2 ', 'Extrapolated energy ', ' Excitation (a.u) ', ' Excitation (eV) '
|
||||||
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
|
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
|
||||||
do k=2,min(N_iter,8)
|
do k=2,N_iter_p
|
||||||
write(*,'(F11.4,X,3(X,F18.8))') pt2_iterations(i,N_iter+1-k), extrapolated_energy(k,i), &
|
write(*,'(F11.4,X,3(X,F18.8))') pt2_iterations(i,k), extrapolated_energy(k,i), &
|
||||||
extrapolated_energy(k,i) - extrapolated_energy(k,1), &
|
extrapolated_energy(k,i) - extrapolated_energy(k,1), &
|
||||||
(extrapolated_energy(k,i) - extrapolated_energy(k,1) ) * 27.211396641308d0
|
(extrapolated_energy(k,i) - extrapolated_energy(k,1) ) * 27.211396641308d0
|
||||||
enddo
|
enddo
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
[n_iter]
|
|
||||||
interface: ezfio
|
|
||||||
doc: Number of saved iterations
|
|
||||||
type:integer
|
|
||||||
default: 1
|
|
||||||
|
|
||||||
[n_det_iterations]
|
|
||||||
interface: ezfio, provider
|
|
||||||
doc: Number of determinants at each iteration
|
|
||||||
type: integer
|
|
||||||
size: (100)
|
|
||||||
|
|
||||||
[energy_iterations]
|
|
||||||
interface: ezfio, provider
|
|
||||||
doc: The variational energy at each iteration
|
|
||||||
type: double precision
|
|
||||||
size: (determinants.n_states,100)
|
|
||||||
|
|
||||||
[pt2_iterations]
|
|
||||||
interface: ezfio, provider
|
|
||||||
doc: The |PT2| correction at each iteration
|
|
||||||
type: double precision
|
|
||||||
size: (determinants.n_states,100)
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
BEGIN_PROVIDER [ integer, n_iter ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! number of iterations
|
|
||||||
END_DOC
|
|
||||||
|
|
||||||
logical :: has
|
|
||||||
PROVIDE ezfio_filename
|
|
||||||
if (mpi_master) then
|
|
||||||
|
|
||||||
double precision :: zeros(N_states,100)
|
|
||||||
integer :: izeros(100)
|
|
||||||
zeros = 0.d0
|
|
||||||
izeros = 0
|
|
||||||
call ezfio_set_iterations_n_iter(0)
|
|
||||||
call ezfio_set_iterations_energy_iterations(zeros)
|
|
||||||
call ezfio_set_iterations_pt2_iterations(zeros)
|
|
||||||
call ezfio_set_iterations_n_det_iterations(izeros)
|
|
||||||
n_iter = 1
|
|
||||||
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( n_iter, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
|
|
||||||
if (ierr /= MPI_SUCCESS) then
|
|
||||||
stop 'Unable to read n_iter with MPI'
|
|
||||||
endif
|
|
||||||
IRP_ENDIF
|
|
||||||
|
|
||||||
call write_time(6)
|
|
||||||
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
|||||||
BEGIN_PROVIDER [ double precision, extrapolated_energy, (N_iter,N_states) ]
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Extrapolated energy, using E_var = f(PT2) where PT2=0
|
|
||||||
END_DOC
|
|
||||||
! integer :: i
|
|
||||||
extrapolated_energy = 0.D0
|
|
||||||
END_PROVIDER
|
|
||||||
|
|
||||||
subroutine get_extrapolated_energy(Niter,ept2,pt1,extrap_energy)
|
|
||||||
implicit none
|
|
||||||
integer, intent(in) :: Niter
|
|
||||||
double precision, intent(in) :: ept2(Niter),pt1(Niter),extrap_energy(Niter)
|
|
||||||
call extrapolate_data(Niter,ept2,pt1,extrap_energy)
|
|
||||||
end
|
|
||||||
|
|
||||||
subroutine save_iterations(e_, pt2_,n_)
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Update the energy in the EZFIO file.
|
|
||||||
END_DOC
|
|
||||||
integer, intent(in) :: n_
|
|
||||||
double precision, intent(in) :: e_(N_states), pt2_(N_states)
|
|
||||||
integer :: i
|
|
||||||
|
|
||||||
if (N_iter == 101) then
|
|
||||||
do i=2,N_iter-1
|
|
||||||
energy_iterations(1:N_states,N_iter-1) = energy_iterations(1:N_states,N_iter)
|
|
||||||
pt2_iterations(1:N_states,N_iter-1) = pt2_iterations(1:N_states,N_iter)
|
|
||||||
enddo
|
|
||||||
N_iter = N_iter-1
|
|
||||||
TOUCH N_iter
|
|
||||||
endif
|
|
||||||
|
|
||||||
energy_iterations(1:N_states,N_iter) = e_(1:N_states)
|
|
||||||
pt2_iterations(1:N_states,N_iter) = pt2_(1:N_states)
|
|
||||||
n_det_iterations(N_iter) = n_
|
|
||||||
call ezfio_set_iterations_N_iter(N_iter)
|
|
||||||
call ezfio_set_iterations_energy_iterations(energy_iterations)
|
|
||||||
call ezfio_set_iterations_pt2_iterations(pt2_iterations)
|
|
||||||
call ezfio_set_iterations_n_det_iterations(n_det_iterations)
|
|
||||||
end
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
|||||||
subroutine print_extrapolated_energy
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Print the extrapolated energy in the output
|
|
||||||
END_DOC
|
|
||||||
|
|
||||||
integer :: i,k
|
|
||||||
|
|
||||||
if (N_iter< 2) then
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
write(*,'(A)') ''
|
|
||||||
write(*,'(A)') 'Extrapolated energies'
|
|
||||||
write(*,'(A)') '------------------------'
|
|
||||||
write(*,'(A)') ''
|
|
||||||
|
|
||||||
print *, ''
|
|
||||||
print *, 'State ', 1
|
|
||||||
print *, ''
|
|
||||||
write(*,*) '=========== ', '==================='
|
|
||||||
write(*,*) 'minimum PT2 ', 'Extrapolated energy'
|
|
||||||
write(*,*) '=========== ', '==================='
|
|
||||||
do k=2,min(N_iter,8)
|
|
||||||
write(*,'(F11.4,2X,F18.8)') pt2_iterations(1,N_iter+1-k), extrapolated_energy(k,1)
|
|
||||||
enddo
|
|
||||||
write(*,*) '=========== ', '==================='
|
|
||||||
|
|
||||||
do i=2, min(N_states,N_det)
|
|
||||||
print *, ''
|
|
||||||
print *, 'State ', i
|
|
||||||
print *, ''
|
|
||||||
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
|
|
||||||
write(*,*) 'minimum PT2 ', 'Extrapolated energy ', ' Excitation (a.u) ', ' Excitation (eV) '
|
|
||||||
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
|
|
||||||
do k=2,min(N_iter,8)
|
|
||||||
write(*,'(F11.4,X,3(X,F18.8))') pt2_iterations(i,N_iter+1-k), extrapolated_energy(k,i), &
|
|
||||||
extrapolated_energy(k,i) - extrapolated_energy(k,1), &
|
|
||||||
(extrapolated_energy(k,i) - extrapolated_energy(k,1) ) * 27.211396641308d0
|
|
||||||
enddo
|
|
||||||
write(*,*) '=========== ', '=================== ', '=================== ', '==================='
|
|
||||||
enddo
|
|
||||||
|
|
||||||
print *, ''
|
|
||||||
|
|
||||||
end subroutine
|
|
||||||
|
|
@ -1,104 +0,0 @@
|
|||||||
subroutine print_summary(e_,pt2_data,pt2_data_err,n_det_,n_configuration_,n_st,s2_)
|
|
||||||
use selection_types
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! Print the extrapolated energy in the output
|
|
||||||
END_DOC
|
|
||||||
|
|
||||||
integer, intent(in) :: n_det_, n_configuration_, n_st
|
|
||||||
double precision, intent(in) :: e_(n_st), s2_(n_st)
|
|
||||||
type(pt2_type) , intent(in) :: pt2_data, pt2_data_err
|
|
||||||
integer :: i, k
|
|
||||||
integer :: N_states_p
|
|
||||||
character*(9) :: pt2_string
|
|
||||||
character*(512) :: fmt
|
|
||||||
|
|
||||||
if (do_pt2) then
|
|
||||||
pt2_string = ' '
|
|
||||||
else
|
|
||||||
pt2_string = '(approx)'
|
|
||||||
endif
|
|
||||||
|
|
||||||
N_states_p = min(N_det_,n_st)
|
|
||||||
|
|
||||||
print *, ''
|
|
||||||
print '(A,I12)', 'Summary at N_det = ', N_det_
|
|
||||||
print '(A)', '-----------------------------------'
|
|
||||||
print *, ''
|
|
||||||
|
|
||||||
write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))'
|
|
||||||
write(*,fmt)
|
|
||||||
write(fmt,*) '(13X,', N_states_p, '(6X,A7,1X,I6,10X))'
|
|
||||||
write(*,fmt) ('State',k, k=1,N_states_p)
|
|
||||||
write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))'
|
|
||||||
write(*,fmt)
|
|
||||||
write(fmt,*) '(A13,', N_states_p, '(1X,F14.8,15X))'
|
|
||||||
write(*,fmt) '# E ', e_(1:N_states_p)
|
|
||||||
if (N_states_p > 1) then
|
|
||||||
write(*,fmt) '# Excit. (au)', e_(1:N_states_p)-e_(1)
|
|
||||||
write(*,fmt) '# Excit. (eV)', (e_(1:N_states_p)-e_(1))*27.211396641308d0
|
|
||||||
endif
|
|
||||||
write(fmt,*) '(A13,', 2*N_states_p, '(1X,F14.8))'
|
|
||||||
write(*,fmt) '# PT2 '//pt2_string, (pt2_data % pt2(k), pt2_data_err % pt2(k), k=1,N_states_p)
|
|
||||||
write(*,fmt) '# rPT2'//pt2_string, (pt2_data % rpt2(k), pt2_data_err % rpt2(k), k=1,N_states_p)
|
|
||||||
write(*,'(A)') '#'
|
|
||||||
write(*,fmt) '# E+PT2 ', (e_(k)+pt2_data % pt2(k),pt2_data_err % pt2(k), k=1,N_states_p)
|
|
||||||
write(*,fmt) '# E+rPT2 ', (e_(k)+pt2_data % rpt2(k),pt2_data_err % rpt2(k), k=1,N_states_p)
|
|
||||||
if (N_states_p > 1) then
|
|
||||||
write(*,fmt) '# Excit. (au)', ( (e_(k)+pt2_data % pt2(k)-e_(1)-pt2_data % pt2(1)), &
|
|
||||||
dsqrt(pt2_data_err % pt2(k)*pt2_data_err % pt2(k)+pt2_data_err % pt2(1)*pt2_data_err % pt2(1)), k=1,N_states_p)
|
|
||||||
write(*,fmt) '# Excit. (eV)', ( (e_(k)+pt2_data % pt2(k)-e_(1)-pt2_data % pt2(1))*27.211396641308d0, &
|
|
||||||
dsqrt(pt2_data_err % pt2(k)*pt2_data_err % pt2(k)+pt2_data_err % pt2(1)*pt2_data_err % pt2(1))*27.211396641308d0, k=1,N_states_p)
|
|
||||||
endif
|
|
||||||
write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))'
|
|
||||||
write(*,fmt)
|
|
||||||
print *, ''
|
|
||||||
|
|
||||||
print *, 'N_det = ', N_det_
|
|
||||||
print *, 'N_states = ', n_st
|
|
||||||
if (s2_eig) then
|
|
||||||
print *, 'N_cfg = ', N_configuration_
|
|
||||||
if (only_expected_s2) then
|
|
||||||
print *, 'N_csf = ', N_csf
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
print *, ''
|
|
||||||
|
|
||||||
do k=1, N_states_p
|
|
||||||
print*,'* State ',k
|
|
||||||
print *, '< S^2 > = ', s2_(k)
|
|
||||||
print *, 'E = ', e_(k)
|
|
||||||
print *, 'Variance = ', pt2_data % variance(k), ' +/- ', pt2_data_err % variance(k)
|
|
||||||
print *, 'PT norm = ', dsqrt(pt2_data % overlap(k,k)), ' +/- ', 0.5d0*dsqrt(pt2_data % overlap(k,k)) * pt2_data_err % overlap(k,k) / (pt2_data % overlap(k,k))
|
|
||||||
print *, 'PT2 = ', pt2_data % pt2(k), ' +/- ', pt2_data_err % pt2(k)
|
|
||||||
print *, 'rPT2 = ', pt2_data % rpt2(k), ' +/- ', pt2_data_err % rpt2(k)
|
|
||||||
print *, 'E+PT2 '//pt2_string//' = ', e_(k)+pt2_data % pt2(k), ' +/- ', pt2_data_err % pt2(k)
|
|
||||||
print *, 'E+rPT2'//pt2_string//' = ', e_(k)+pt2_data % rpt2(k), ' +/- ', pt2_data_err % rpt2(k)
|
|
||||||
print *, ''
|
|
||||||
enddo
|
|
||||||
|
|
||||||
print *, '-----'
|
|
||||||
if(n_st.gt.1)then
|
|
||||||
print *, 'Variational Energy difference (au | eV)'
|
|
||||||
do i=2, N_states_p
|
|
||||||
print*,'Delta E = ', (e_(i) - e_(1)), &
|
|
||||||
(e_(i) - e_(1)) * 27.211396641308d0
|
|
||||||
enddo
|
|
||||||
print *, '-----'
|
|
||||||
print*, 'Variational + perturbative Energy difference (au | eV)'
|
|
||||||
do i=2, N_states_p
|
|
||||||
print*,'Delta E = ', (e_(i)+ pt2_data % pt2(i) - (e_(1) + pt2_data % pt2(1))), &
|
|
||||||
(e_(i)+ pt2_data % pt2(i) - (e_(1) + pt2_data % pt2(1))) * 27.211396641308d0
|
|
||||||
enddo
|
|
||||||
print *, '-----'
|
|
||||||
print*, 'Variational + renormalized perturbative Energy difference (au | eV)'
|
|
||||||
do i=2, N_states_p
|
|
||||||
print*,'Delta E = ', (e_(i)+ pt2_data % rpt2(i) - (e_(1) + pt2_data % rpt2(1))), &
|
|
||||||
(e_(i)+ pt2_data % rpt2(i) - (e_(1) + pt2_data % rpt2(1))) * 27.211396641308d0
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
|
|
||||||
! call print_energy_components()
|
|
||||||
|
|
||||||
end subroutine
|
|
||||||
|
|
5
src/json/EZFIO.cfg
Normal file
5
src/json/EZFIO.cfg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[empty]
|
||||||
|
type: logical
|
||||||
|
doc: Needed to create the json directory
|
||||||
|
interface: ezfio
|
||||||
|
|
1
src/json/NEED
Normal file
1
src/json/NEED
Normal file
@ -0,0 +1 @@
|
|||||||
|
ezfio_files
|
5
src/json/README.rst
Normal file
5
src/json/README.rst
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
====
|
||||||
|
json
|
||||||
|
====
|
||||||
|
|
||||||
|
JSON files to simplify getting output information from QP.
|
45
src/json/json.irp.f
Normal file
45
src/json/json.irp.f
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
BEGIN_PROVIDER [ character*(128), json_filename ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Fortran unit of the JSON file
|
||||||
|
END_DOC
|
||||||
|
integer, external :: getUnitAndOpen
|
||||||
|
integer :: counter
|
||||||
|
character*(128) :: prefix
|
||||||
|
logical :: exists
|
||||||
|
|
||||||
|
prefix = trim(ezfio_filename)//'/json/'
|
||||||
|
|
||||||
|
call lock_io
|
||||||
|
exists = .True.
|
||||||
|
counter = 0
|
||||||
|
do while (exists)
|
||||||
|
counter += 1
|
||||||
|
write(json_filename, '(A,I5.5,A)') trim(prefix), counter, '.json'
|
||||||
|
INQUIRE(FILE=trim(json_filename), EXIST=exists)
|
||||||
|
enddo
|
||||||
|
call unlock_io
|
||||||
|
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ integer, json_unit]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Unit file for JSON output
|
||||||
|
END_DOC
|
||||||
|
integer, external :: getUnitAndOpen
|
||||||
|
call ezfio_set_json_empty(.False.)
|
||||||
|
call lock_io
|
||||||
|
json_unit = getUnitAndOpen(json_filename, 'w')
|
||||||
|
write(json_unit, '(A)') '{'
|
||||||
|
call unlock_io
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
subroutine json_close
|
||||||
|
call lock_io
|
||||||
|
write(json_unit, '(A)') '}'
|
||||||
|
close(json_unit)
|
||||||
|
call unlock_io
|
||||||
|
FREE json_unit
|
||||||
|
end
|
||||||
|
|
46
src/json/json_formats.irp.f
Normal file
46
src/json/json_formats.irp.f
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
BEGIN_PROVIDER [ character*(64), json_int_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_int_fmtx ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_real_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_real_fmtx ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_str_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_str_fmtx ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_true_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_true_fmtx ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_false_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_false_fmtx ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_array_open_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_array_uopen_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_array_close_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_array_close_uopen_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_array_close_fmtx ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_dict_open_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_dict_uopen_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_dict_close_uopen_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_dict_close_fmt ]
|
||||||
|
&BEGIN_PROVIDER [ character*(64), json_dict_close_fmtx ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Formats for JSON output.
|
||||||
|
! x: used to mark the last write (no comma)
|
||||||
|
END_DOC
|
||||||
|
json_int_fmt = '('' "'',A,''": '',I10,'','')'
|
||||||
|
json_int_fmtx = '('' "'',A,''": '',I10)'
|
||||||
|
json_real_fmt = '('' "'',A,''": '',E22.15,'','')'
|
||||||
|
json_real_fmtx = '('' "'',A,''": '',E22.15)'
|
||||||
|
json_str_fmt = '('' "'',A,''": "'',A,''",'')'
|
||||||
|
json_str_fmtx = '('' "'',A,''": "'',A,''"'')'
|
||||||
|
json_true_fmt = '('' "'',A,''": true,'')'
|
||||||
|
json_true_fmtx = '('' "'',A,''": true'')'
|
||||||
|
json_false_fmt = '('' "'',A,''": false,'')'
|
||||||
|
json_false_fmtx = '('' "'',A,''": false'')'
|
||||||
|
json_array_open_fmt = '('' "'',A,''": ['')'
|
||||||
|
json_array_uopen_fmt = '('' ['')'
|
||||||
|
json_array_close_fmt = '('' ],'')'
|
||||||
|
json_array_close_uopen_fmt = '('' ], ['')'
|
||||||
|
json_array_close_fmtx = '('' ]'')'
|
||||||
|
json_dict_open_fmt = '('' "'',A,''": {'')'
|
||||||
|
json_dict_uopen_fmt = '('' {'')'
|
||||||
|
json_dict_close_fmt = '('' },'')'
|
||||||
|
json_dict_close_uopen_fmt = '('' }, {'')'
|
||||||
|
json_dict_close_fmtx = '('' }'')'
|
||||||
|
END_PROVIDER
|
@ -90,7 +90,11 @@ subroutine run
|
|||||||
|
|
||||||
! Choose SCF algorithm
|
! Choose SCF algorithm
|
||||||
|
|
||||||
|
write(json_unit,*) '"scf" : ['
|
||||||
call Roothaan_Hall_SCF
|
call Roothaan_Hall_SCF
|
||||||
|
write(json_unit,*) ']'
|
||||||
|
|
||||||
|
call json_close
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -93,7 +93,10 @@ subroutine run
|
|||||||
|
|
||||||
level_shift += 1.d0
|
level_shift += 1.d0
|
||||||
touch level_shift
|
touch level_shift
|
||||||
|
write(json_unit,*) '"scf" : ['
|
||||||
call Roothaan_Hall_SCF
|
call Roothaan_Hall_SCF
|
||||||
|
write(json_unit,*) ']'
|
||||||
|
call json_close
|
||||||
call ezfio_set_kohn_sham_rs_energy(SCF_energy)
|
call ezfio_set_kohn_sham_rs_energy(SCF_energy)
|
||||||
|
|
||||||
write(*, '(A22,X,F16.10)') 'one_e_energy = ',one_e_energy
|
write(*, '(A22,X,F16.10)') 'one_e_energy = ',one_e_energy
|
||||||
|
16
src/mo_two_e_ints/cholesky.irp.f
Normal file
16
src/mo_two_e_ints/cholesky.irp.f
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
BEGIN_PROVIDER [ double precision, cholesky_mo, (mo_num, mo_num, cholesky_ao_num) ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! Cholesky vectors in MO basis
|
||||||
|
END_DOC
|
||||||
|
|
||||||
|
integer :: k
|
||||||
|
|
||||||
|
!$OMP PARALLEL DO PRIVATE(k)
|
||||||
|
do k=1,cholesky_ao_num
|
||||||
|
call ao_to_mo(cholesky_ao(1,1,k),ao_num,cholesky_mo(1,1,k),mo_num)
|
||||||
|
enddo
|
||||||
|
!$OMP END PARALLEL DO
|
||||||
|
|
||||||
|
END_PROVIDER
|
||||||
|
|
@ -377,6 +377,7 @@ integer function load_mo_integrals(filename)
|
|||||||
integer*8 :: n, j
|
integer*8 :: n, j
|
||||||
load_mo_integrals = 1
|
load_mo_integrals = 1
|
||||||
open(unit=66,file=filename,FORM='unformatted',STATUS='UNKNOWN')
|
open(unit=66,file=filename,FORM='unformatted',STATUS='UNKNOWN')
|
||||||
|
call lock_io()
|
||||||
read(66,err=98,end=98) iknd, kknd
|
read(66,err=98,end=98) iknd, kknd
|
||||||
if (iknd /= integral_kind) then
|
if (iknd /= integral_kind) then
|
||||||
print *, 'Wrong integrals kind in file :', iknd
|
print *, 'Wrong integrals kind in file :', iknd
|
||||||
@ -399,6 +400,7 @@ integer function load_mo_integrals(filename)
|
|||||||
n = mo_integrals_map%map(i)%n_elements
|
n = mo_integrals_map%map(i)%n_elements
|
||||||
read(66,err=99,end=99) (key(j), j=1,n), (val(j), j=1,n)
|
read(66,err=99,end=99) (key(j), j=1,n), (val(j), j=1,n)
|
||||||
enddo
|
enddo
|
||||||
|
call unlock_io()
|
||||||
call map_sort(mo_integrals_map)
|
call map_sort(mo_integrals_map)
|
||||||
load_mo_integrals = 0
|
load_mo_integrals = 0
|
||||||
return
|
return
|
||||||
|
@ -50,8 +50,10 @@ BEGIN_PROVIDER [ logical, mo_two_e_integrals_in_map ]
|
|||||||
call cpu_time(cpu_1)
|
call cpu_time(cpu_1)
|
||||||
|
|
||||||
if(no_vvvv_integrals)then
|
if(no_vvvv_integrals)then
|
||||||
! call four_idx_novvvv
|
|
||||||
call four_idx_novvvv_old
|
call four_idx_novvvv_old
|
||||||
|
else
|
||||||
|
if (do_ao_cholesky) then
|
||||||
|
call add_integrals_to_map_cholesky
|
||||||
else
|
else
|
||||||
if (dble(ao_num)**4 * 32.d-9 < dble(qp_max_mem)) then
|
if (dble(ao_num)**4 * 32.d-9 < dble(qp_max_mem)) then
|
||||||
call four_idx_dgemm
|
call four_idx_dgemm
|
||||||
@ -59,6 +61,7 @@ BEGIN_PROVIDER [ logical, mo_two_e_integrals_in_map ]
|
|||||||
call add_integrals_to_map(full_ijkl_bitmask_4)
|
call add_integrals_to_map(full_ijkl_bitmask_4)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
call wall_time(wall_2)
|
call wall_time(wall_2)
|
||||||
call cpu_time(cpu_2)
|
call cpu_time(cpu_2)
|
||||||
@ -175,7 +178,7 @@ subroutine add_integrals_to_map(mask_ijkl)
|
|||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! Adds integrals to tha MO map according to some bitmask
|
! Adds integrals to the MO map according to some bitmask
|
||||||
END_DOC
|
END_DOC
|
||||||
|
|
||||||
integer(bit_kind), intent(in) :: mask_ijkl(N_int,4)
|
integer(bit_kind), intent(in) :: mask_ijkl(N_int,4)
|
||||||
@ -450,13 +453,72 @@ subroutine add_integrals_to_map(mask_ijkl)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
subroutine add_integrals_to_map_cholesky
|
||||||
|
use bitmasks
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
BEGIN_DOC
|
||||||
|
! Adds integrals to the MO map using Cholesky vectors
|
||||||
|
END_DOC
|
||||||
|
|
||||||
|
integer :: i,j,k,l,m
|
||||||
|
integer :: size_buffer, n_integrals
|
||||||
|
size_buffer = min(mo_num*mo_num*mo_num,16000000)
|
||||||
|
|
||||||
|
double precision, allocatable :: Vtmp(:,:,:,:)
|
||||||
|
integer(key_kind) , allocatable :: buffer_i(:)
|
||||||
|
real(integral_kind), allocatable :: buffer_value(:)
|
||||||
|
|
||||||
|
if (.True.) then
|
||||||
|
! In-memory transformation
|
||||||
|
|
||||||
|
allocate (Vtmp(mo_num,mo_num,mo_num,mo_num))
|
||||||
|
|
||||||
|
call dgemm('N','T',mo_num*mo_num,mo_num*mo_num,cholesky_ao_num,1.d0, &
|
||||||
|
cholesky_mo, mo_num*mo_num, &
|
||||||
|
cholesky_mo, mo_num*mo_num, 0.d0, &
|
||||||
|
Vtmp, mo_num*mo_num)
|
||||||
|
|
||||||
|
!$OMP PARALLEL PRIVATE(i,j,k,l,n_integrals,buffer_value, buffer_i)
|
||||||
|
allocate (buffer_i(size_buffer), buffer_value(size_buffer))
|
||||||
|
n_integrals = 0
|
||||||
|
!$OMP DO
|
||||||
|
do l=1,mo_num
|
||||||
|
do k=1,l
|
||||||
|
do j=1,mo_num
|
||||||
|
do i=1,j
|
||||||
|
if (abs(Vtmp(i,j,k,l)) > mo_integrals_threshold) then
|
||||||
|
n_integrals += 1
|
||||||
|
buffer_value(n_integrals) = Vtmp(i,j,k,l)
|
||||||
|
!DIR$ FORCEINLINE
|
||||||
|
call mo_two_e_integrals_index(i,k,j,l,buffer_i(n_integrals))
|
||||||
|
if (n_integrals == size_buffer) then
|
||||||
|
call map_append(mo_integrals_map, buffer_i, buffer_value, n_integrals)
|
||||||
|
n_integrals = 0
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
enddo
|
||||||
|
!$OMP END DO
|
||||||
|
call map_append(mo_integrals_map, buffer_i, buffer_value, n_integrals)
|
||||||
|
deallocate(buffer_i, buffer_value)
|
||||||
|
!$OMP END PARALLEL
|
||||||
|
|
||||||
|
deallocate(Vtmp)
|
||||||
|
call map_unique(mo_integrals_map)
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
subroutine add_integrals_to_map_three_indices(mask_ijk)
|
subroutine add_integrals_to_map_three_indices(mask_ijk)
|
||||||
use bitmasks
|
use bitmasks
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
! Adds integrals to tha MO map according to some bitmask
|
! Adds integrals to the MO map according to some bitmask
|
||||||
END_DOC
|
END_DOC
|
||||||
|
|
||||||
integer(bit_kind), intent(in) :: mask_ijk(N_int,3)
|
integer(bit_kind), intent(in) :: mask_ijk(N_int,3)
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
mo_guess
|
mo_guess
|
||||||
bitmask
|
bitmask
|
||||||
|
json
|
||||||
|
@ -12,6 +12,7 @@ END_DOC
|
|||||||
|
|
||||||
integer :: iteration_SCF,dim_DIIS,index_dim_DIIS
|
integer :: iteration_SCF,dim_DIIS,index_dim_DIIS
|
||||||
|
|
||||||
|
logical :: converged
|
||||||
integer :: i,j
|
integer :: i,j
|
||||||
logical, external :: qp_stop
|
logical, external :: qp_stop
|
||||||
double precision, allocatable :: mo_coef_save(:,:)
|
double precision, allocatable :: mo_coef_save(:,:)
|
||||||
@ -50,10 +51,8 @@ END_DOC
|
|||||||
!
|
!
|
||||||
PROVIDE FPS_SPF_matrix_AO Fock_matrix_AO
|
PROVIDE FPS_SPF_matrix_AO Fock_matrix_AO
|
||||||
|
|
||||||
do while ( &
|
converged = .False.
|
||||||
( (max_error_DIIS > threshold_DIIS_nonzero) .or. &
|
do while ( .not.converged .and. (iteration_SCF < n_it_SCF_max) )
|
||||||
(dabs(Delta_energy_SCF) > thresh_SCF) &
|
|
||||||
) .and. (iteration_SCF < n_it_SCF_max) )
|
|
||||||
|
|
||||||
! Increment cycle number
|
! Increment cycle number
|
||||||
|
|
||||||
@ -144,17 +143,49 @@ END_DOC
|
|||||||
SOFT_TOUCH level_shift
|
SOFT_TOUCH level_shift
|
||||||
energy_SCF_previous = energy_SCF
|
energy_SCF_previous = energy_SCF
|
||||||
|
|
||||||
|
converged = ( (max_error_DIIS <= threshold_DIIS_nonzero) .and. &
|
||||||
|
(dabs(Delta_energy_SCF) <= thresh_SCF) )
|
||||||
|
|
||||||
! Print results at the end of each iteration
|
! Print results at the end of each iteration
|
||||||
|
|
||||||
write(6,'(I4, 1X, F16.10, 1X, F16.10, 1X, F16.10, 1X, F16.10, 1X, I3)') &
|
write(6,'(I4, 1X, F16.10, 1X, F16.10, 1X, F16.10, 1X, F16.10, 1X, I3)') &
|
||||||
iteration_SCF, energy_SCF, Delta_energy_SCF, max_error_DIIS, level_shift, dim_DIIS
|
iteration_SCF, energy_SCF, Delta_energy_SCF, max_error_DIIS, level_shift, dim_DIIS
|
||||||
|
|
||||||
|
! Write data in JSON file
|
||||||
|
|
||||||
|
call lock_io
|
||||||
|
if (iteration_SCF == 1) then
|
||||||
|
write(json_unit, json_dict_uopen_fmt)
|
||||||
|
else
|
||||||
|
write(json_unit, json_dict_close_uopen_fmt)
|
||||||
|
endif
|
||||||
|
write(json_unit, json_int_fmt) 'iteration', iteration_SCF
|
||||||
|
write(json_unit, json_real_fmt) 'energy', energy_SCF
|
||||||
|
write(json_unit, json_real_fmt) 'delta_energy_SCF', Delta_energy_SCF
|
||||||
|
write(json_unit, json_real_fmt) 'max_error_DIIS', max_error_DIIS
|
||||||
|
write(json_unit, json_real_fmt) 'level_shift', level_shift
|
||||||
|
write(json_unit, json_int_fmt) 'dim_DIIS', dim_DIIS
|
||||||
|
call unlock_io
|
||||||
|
|
||||||
if (Delta_energy_SCF < 0.d0) then
|
if (Delta_energy_SCF < 0.d0) then
|
||||||
call save_mos
|
call save_mos
|
||||||
|
write(json_unit, json_true_fmt) 'saved'
|
||||||
|
else
|
||||||
|
write(json_unit, json_false_fmt) 'saved'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call lock_io
|
||||||
|
if (converged) then
|
||||||
|
write(json_unit, json_true_fmtx) 'converged'
|
||||||
|
else
|
||||||
|
write(json_unit, json_false_fmtx) 'converged'
|
||||||
|
endif
|
||||||
|
call unlock_io
|
||||||
|
|
||||||
if (qp_stop()) exit
|
if (qp_stop()) exit
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
|
write(json_unit, json_dict_close_fmtx)
|
||||||
|
|
||||||
if (iteration_SCF < n_it_SCF_max) then
|
if (iteration_SCF < n_it_SCF_max) then
|
||||||
mo_label = 'Canonical'
|
mo_label = 'Canonical'
|
||||||
@ -166,6 +197,10 @@ END_DOC
|
|||||||
write(6,'(A4, 1X, A16, 1X, A16, 1X, A16, 1X, A16)') &
|
write(6,'(A4, 1X, A16, 1X, A16, 1X, A16, 1X, A16)') &
|
||||||
'====','================','================','================','================'
|
'====','================','================','================','================'
|
||||||
write(6,*)
|
write(6,*)
|
||||||
|
if (converged) then
|
||||||
|
write(6,*) 'SCF converged'
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
if(.not.frozen_orb_scf)then
|
if(.not.frozen_orb_scf)then
|
||||||
call mo_as_eigvectors_of_mo_matrix(Fock_matrix_mo,size(Fock_matrix_mo,1), &
|
call mo_as_eigvectors_of_mo_matrix(Fock_matrix_mo,size(Fock_matrix_mo,1), &
|
||||||
|
@ -1,80 +0,0 @@
|
|||||||
program print_e_conv
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! program that prints in a human readable format the convergence of the CIPSI algorithm.
|
|
||||||
!
|
|
||||||
! for all istate, this program produces
|
|
||||||
!
|
|
||||||
! * a file "EZFIO.istate.conv" containing the variational and var+PT2 energies as a function of N_det
|
|
||||||
!
|
|
||||||
! * for istate > 1, a file EZFIO.istate.delta_e.conv containing the energy difference (both var and var+PT2) with the ground state as a function of N_det
|
|
||||||
END_DOC
|
|
||||||
|
|
||||||
provide ezfio_filename
|
|
||||||
call routine_e_conv
|
|
||||||
end
|
|
||||||
|
|
||||||
subroutine routine_e_conv
|
|
||||||
implicit none
|
|
||||||
BEGIN_DOC
|
|
||||||
! routine called by :c:func:`print_e_conv`
|
|
||||||
END_DOC
|
|
||||||
integer :: N_iter_tmp
|
|
||||||
integer :: i,istate
|
|
||||||
character*(128) :: output
|
|
||||||
integer :: i_unit_output,getUnitAndOpen
|
|
||||||
character*(128) :: filename
|
|
||||||
|
|
||||||
integer, allocatable :: n_det_tmp(:)
|
|
||||||
call ezfio_get_iterations_N_iter(N_iter_tmp)
|
|
||||||
print*,'N_iter_tmp = ',N_iter_tmp
|
|
||||||
double precision, allocatable :: e(:,:),pt2(:,:)
|
|
||||||
allocate(e(N_states, 100),pt2(N_states, 100),n_det_tmp(100))
|
|
||||||
call ezfio_get_iterations_energy_iterations(e)
|
|
||||||
call ezfio_get_iterations_pt2_iterations(pt2)
|
|
||||||
call ezfio_get_iterations_n_det_iterations(n_det_tmp)
|
|
||||||
|
|
||||||
|
|
||||||
do istate = 1, N_states
|
|
||||||
if (istate.lt.10)then
|
|
||||||
write (filename, "(I1)")istate
|
|
||||||
else
|
|
||||||
write (filename, "(I2)")istate
|
|
||||||
endif
|
|
||||||
print*,filename
|
|
||||||
output=trim(ezfio_filename)//'.'//trim(filename)//'.conv'
|
|
||||||
output=trim(output)
|
|
||||||
print*,'output = ',trim(output)
|
|
||||||
i_unit_output = getUnitAndOpen(output,'w')
|
|
||||||
write(i_unit_output,*)'# N_det E_var E_var + PT2'
|
|
||||||
do i = 1, N_iter_tmp
|
|
||||||
write(i_unit_output,'(I9,X,3(F16.10,X))')n_det_tmp(i),e(istate,i),e(istate,i) + pt2(istate,i)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
|
|
||||||
if(N_states.gt.1)then
|
|
||||||
double precision, allocatable :: deltae(:,:),deltae_pt2(:,:)
|
|
||||||
allocate(deltae(N_states,100),deltae_pt2(N_states,100))
|
|
||||||
do i = 1, N_iter_tmp
|
|
||||||
do istate = 1, N_states
|
|
||||||
deltae(istate,i) = e(istate,i) - e(1,i)
|
|
||||||
deltae_pt2(istate,i) = e(istate,i) + pt2(istate,i) - (e(1,i) + pt2(1,i))
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
do istate = 2, N_states
|
|
||||||
if (istate.lt.10)then
|
|
||||||
write (filename, "(I1)")istate
|
|
||||||
else
|
|
||||||
write (filename, "(I2)")istate
|
|
||||||
endif
|
|
||||||
output=trim(ezfio_filename)//'.'//trim(filename)//'.delta_e.conv'
|
|
||||||
print*,'output = ',trim(output)
|
|
||||||
i_unit_output = getUnitAndOpen(output,'w')
|
|
||||||
write(i_unit_output,*)'# N_det Delta E_var Delta (E_var + PT2)'
|
|
||||||
do i = 1, N_iter_tmp
|
|
||||||
write(i_unit_output,'(I9,X,100(F16.10,X))')n_det_tmp(i),deltae(istate,i),deltae_pt2(istate,i)
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
endif
|
|
||||||
|
|
||||||
end
|
|
@ -9,7 +9,9 @@ subroutine write_array_two_rdm(n_orb,nstates,array_tmp,name_file)
|
|||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
output=trim(ezfio_filename)//'/work/'//trim(name_file)
|
output=trim(ezfio_filename)//'/work/'//trim(name_file)
|
||||||
i_unit_output = getUnitAndOpen(output,'W')
|
i_unit_output = getUnitAndOpen(output,'W')
|
||||||
|
call lock_io()
|
||||||
write(i_unit_output)array_tmp
|
write(i_unit_output)array_tmp
|
||||||
|
call unlock_io()
|
||||||
close(unit=i_unit_output)
|
close(unit=i_unit_output)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -23,7 +25,9 @@ subroutine read_array_two_rdm(n_orb,nstates,array_tmp,name_file)
|
|||||||
PROVIDE ezfio_filename
|
PROVIDE ezfio_filename
|
||||||
output=trim(ezfio_filename)//'/work/'//trim(name_file)
|
output=trim(ezfio_filename)//'/work/'//trim(name_file)
|
||||||
i_unit_output = getUnitAndOpen(output,'R')
|
i_unit_output = getUnitAndOpen(output,'R')
|
||||||
|
call lock_io()
|
||||||
read(i_unit_output)array_tmp
|
read(i_unit_output)array_tmp
|
||||||
|
call unlock_io()
|
||||||
close(unit=i_unit_output)
|
close(unit=i_unit_output)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ subroutine format_w_error(value,error,size_nb,max_nb_digits,format_value,str_err
|
|||||||
|
|
||||||
! out
|
! out
|
||||||
! | format_value | character | string FX.Y for the format |
|
! | format_value | character | string FX.Y for the format |
|
||||||
! | str_error | character | string of the error |
|
! | str_error | character | string of the error |
|
||||||
|
|
||||||
! internal
|
! internal
|
||||||
! | str_size | character | size in string format |
|
! | str_size | character | size in string format |
|
||||||
@ -33,6 +33,7 @@ subroutine format_w_error(value,error,size_nb,max_nb_digits,format_value,str_err
|
|||||||
character(len=20) :: str_size, str_nb_digits, str_exp
|
character(len=20) :: str_size, str_nb_digits, str_exp
|
||||||
integer :: nb_digits
|
integer :: nb_digits
|
||||||
|
|
||||||
|
call lock_io()
|
||||||
! max_nb_digit: Y max
|
! max_nb_digit: Y max
|
||||||
! size_nb = Size of the double: X (FX.Y)
|
! size_nb = Size of the double: X (FX.Y)
|
||||||
write(str_size,'(I3)') size_nb
|
write(str_size,'(I3)') size_nb
|
||||||
@ -67,5 +68,6 @@ subroutine format_w_error(value,error,size_nb,max_nb_digits,format_value,str_err
|
|||||||
|
|
||||||
! FX.Y just for the value
|
! FX.Y just for the value
|
||||||
format_value = 'F'//trim(adjustl(str_size))//'.'//trim(adjustl(str_nb_digits))
|
format_value = 'F'//trim(adjustl(str_size))//'.'//trim(adjustl(str_nb_digits))
|
||||||
|
call unlock_io()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1854,7 +1854,7 @@ do k = 1, N
|
|||||||
end do
|
end do
|
||||||
! TODO: It should be possible to use only one vector of size (1:rank) as a buffer
|
! TODO: It should be possible to use only one vector of size (1:rank) as a buffer
|
||||||
! to do the swapping in-place
|
! to do the swapping in-place
|
||||||
U = 0.00D+0
|
U(:,:) = 0.00D+0
|
||||||
do k = 1, N
|
do k = 1, N
|
||||||
l = piv(k)
|
l = piv(k)
|
||||||
U(l, :) = A(1:rank, k)
|
U(l, :) = A(1:rank, k)
|
||||||
|
@ -8,7 +8,9 @@ BEGIN_PROVIDER [ integer, qp_max_mem ]
|
|||||||
qp_max_mem = 2000
|
qp_max_mem = 2000
|
||||||
call getenv('QP_MAXMEM',env)
|
call getenv('QP_MAXMEM',env)
|
||||||
if (trim(env) /= '') then
|
if (trim(env) /= '') then
|
||||||
|
call lock_io()
|
||||||
read(env,*) qp_max_mem
|
read(env,*) qp_max_mem
|
||||||
|
call unlock_io()
|
||||||
endif
|
endif
|
||||||
call write_int(6,qp_max_mem,'Target maximum memory (GB)')
|
call write_int(6,qp_max_mem,'Target maximum memory (GB)')
|
||||||
|
|
||||||
@ -25,7 +27,7 @@ subroutine resident_memory(value)
|
|||||||
character*(32) :: key
|
character*(32) :: key
|
||||||
double precision, intent(out) :: value
|
double precision, intent(out) :: value
|
||||||
|
|
||||||
call omp_set_lock(file_lock)
|
call lock_io()
|
||||||
call usleep(10)
|
call usleep(10)
|
||||||
|
|
||||||
value = 0.d0
|
value = 0.d0
|
||||||
@ -40,7 +42,7 @@ subroutine resident_memory(value)
|
|||||||
20 continue
|
20 continue
|
||||||
close(iunit)
|
close(iunit)
|
||||||
value = value / (1024.d0*1024.d0)
|
value = value / (1024.d0*1024.d0)
|
||||||
call omp_unset_lock(file_lock)
|
call unlock_io()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
subroutine total_memory(value)
|
subroutine total_memory(value)
|
||||||
@ -53,6 +55,7 @@ subroutine total_memory(value)
|
|||||||
character*(32) :: key
|
character*(32) :: key
|
||||||
double precision, intent(out) :: value
|
double precision, intent(out) :: value
|
||||||
|
|
||||||
|
call lock_io()
|
||||||
iunit = getUnitAndOpen('/proc/self/status','r')
|
iunit = getUnitAndOpen('/proc/self/status','r')
|
||||||
do
|
do
|
||||||
read(iunit,*,err=10,end=20) key, value
|
read(iunit,*,err=10,end=20) key, value
|
||||||
@ -64,6 +67,7 @@ subroutine total_memory(value)
|
|||||||
20 continue
|
20 continue
|
||||||
close(iunit)
|
close(iunit)
|
||||||
value = value / (1024.d0*1024.d0)
|
value = value / (1024.d0*1024.d0)
|
||||||
|
call unlock_io()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
double precision function memory_of_double(n)
|
double precision function memory_of_double(n)
|
||||||
|
Loading…
Reference in New Issue
Block a user