10
0
mirror of https://gitlab.com/scemama/eplf synced 2024-12-22 04:14:17 +01:00

First working version.

This commit is contained in:
Anthony Scemama 2009-10-12 17:37:07 +02:00
parent 688fe8a722
commit 3e97da35f5
45 changed files with 1926 additions and 368 deletions

View File

@ -1,26 +0,0 @@
#!/usr/bin/env python
import sys,os,time
from resultsFile import *
# Check command line
if len(sys.argv) != 2:
print "usage: "+sys.argv[0]+" file.out"
sys.exit(2)
firstArg = sys.argv[1]
file = open("eplf_grid.data","w")
print >>file, "&eplf_grid"
print >>file, " Npoints=80,80,80"
print >>file, "/"
file.close()
file = getFile(firstArg)
print firstArg, 'recognized as', str(file).split('.')[-1].split()[0]
from qcio import qcio
write_qcioFile(file,"QCIO_File")

180
bin/to_ezfio.py Executable file
View File

@ -0,0 +1,180 @@
#!/usr/bin/env python
import sys,os,time
wd = os.path.dirname(__file__)
sys.path += [ wd+"../EZFIO/Python" ]
sys.path += [ "/home/scemama/resultsFile" ]
from resultsFile import *
# Check command line
if len(sys.argv) == 2:
State=0
elif len(sys.argv) == 3:
State=int(sys.argv[2])
else:
print "usage: "+sys.argv[0]+" file.out"
sys.exit(2)
firstArg = sys.argv[1]
file = getFile(firstArg)
print firstArg, 'recognized as', str(file).split('.')[-1].split()[0]
from ezfio import ezfio
def write_ezfioFile(res,filename):
ezfio.set_file(filename)
# Electrons
ezfio.set_electrons_elec_alpha_num(res.num_alpha)
ezfio.set_electrons_elec_beta_num(res.num_beta)
# Nuclei
ezfio.set_nuclei_nucl_num(len(res.geometry))
charge = []
coord = []
coord_x = []
coord_y = []
coord_z = []
for a in res.geometry:
charge.append(a.charge)
if res.units == 'BOHR':
coord_x.append(a.coord[0])
coord_y.append(a.coord[1])
coord_z.append(a.coord[2])
else:
coord_x.append(a.coord[0]/a0)
coord_y.append(a.coord[1]/a0)
coord_z.append(a.coord[2]/a0)
ezfio.set_nuclei_nucl_charge(charge)
ezfio.set_nuclei_nucl_coord(coord_x+coord_y+coord_z)
# AO Basis
import string
is_cartesian = True
at = []
num_prim = []
magnetic_number = []
angular_number = []
power_x = []
power_y = []
power_z = []
coefficient = []
exponent = []
for b in res.basis:
if '+' in b.sym or '-' in b.sym:
is_cartesian = False
names = ["s","p","d","f","g","h","i","j"]
for b in res.basis:
c = b.center
for i,atom in enumerate(res.geometry):
if atom.coord == c:
at.append(i+1)
num_prim.append(len(b.prim))
if is_cartesian:
s = b.sym
power_x.append( string.count(s,"x") )
power_y.append( string.count(s,"y") )
power_z.append( string.count(s,"z") )
else:
magnetic_number.append(names.index(b.sym[0]))
angular_number.append(int(b.sym[1:]))
coefficient.append( b.coef )
exponent.append( [ p.expo for p in b.prim ] )
if not is_cartesian:
print 'Only cartesian basis functions work...'
sys.exit(0)
ezfio.set_ao_basis_ao_num(len(res.basis))
ezfio.set_ao_basis_ao_nucl(at)
ezfio.set_ao_basis_ao_prim_num(num_prim)
ezfio.set_ao_basis_ao_power(power_x+power_y+power_z)
prim_num_max = ezfio.get_ao_basis_ao_prim_num_max()
len_res_basis = len(res.basis)
for i in range(len(res.basis)):
coefficient[i] += [ 0. for j in range(len(coefficient[i]),prim_num_max) ]
exponent[i] += [ 0. for j in range(len(exponent[i]),prim_num_max) ]
coefficient = reduce(lambda x, y: x+y, coefficient, [])
exponent = reduce(lambda x, y: x+y, exponent, [])
coef = []
expo = []
for i in range(prim_num_max):
for j in range(i,len(coefficient),prim_num_max):
coef.append ( coefficient[j] )
expo.append ( exponent[j] )
ezfio.set_ao_basis_ao_coef(coef)
ezfio.set_ao_basis_ao_expo(expo)
# MOs
NumOrbSym = [ s[1] for s in res.symmetries ]
mo_tot_num = sum(NumOrbSym)
ezfio.set_mo_basis_mo_tot_num(mo_tot_num)
if res.occ_num is not None:
ezfio.set_mo_basis_mo_occ(res.occ_num)
MoTag = res.mo_types[-1]
mo = res.mo_sets[MoTag]
if len(mo) < mo_tot_num:
newmo = orbital()
newmo.eigenvalue = 0.
newmo.vector = [0. for i in range(mo_tot_num)]
while len(mo) < mo_tot_num:
mo.append(newmo)
Energies = [ m.eigenvalue for m in mo ]
ezfio.set_mo_basis_mo_energy(Energies)
if res.occ_num is not None:
OccNum = res.occ_num[MoTag]
while len(OccNum) < mo_tot_num:
OccNum.append(0.)
ezfio.set_mo_basis_mo_occ(OccNum)
cls = [ "v" for i in mo ]
for i in res.closed_mos:
cls[i] = 'c'
for i in res.active_mos:
cls[i] = 'a'
ezfio.set_mo_basis_mo_classif(cls)
MoMatrix = []
for m in mo:
for coef in m.vector:
MoMatrix.append(coef)
while len(MoMatrix) < len(mo[0].vector)**2:
MoMatrix.append(0.)
ezfio.set_mo_basis_mo_coef(MoMatrix)
# Determinants
closed_mos = res.closed_mos
nactive = ezfio.get_mo_basis_mo_active_num()
dets_a = []
dets_b = []
for d in res.determinants:
dnew_a = []
dnew_b = []
for x in d['alpha']:
if x not in closed_mos:
dnew_a.append(x+1)
for x in d['beta']:
if x not in closed_mos:
dnew_b.append(x+1)
for x in range(nactive-len(dnew_b)):
dnew_b.append(0)
dets_a.append( dnew_a )
dets_b.append( dnew_b )
coef = reduce(lambda x, y: x+y,res.det_coefficients,[])
if len(dets_a[0]) > 0:
ezfio.set_determinants_det_num(len(dets_a))
ezfio.set_determinants_det_coef(coef)
ezfio.set_determinants_det_occ(dets_a+dets_b)
else:
ezfio.set_determinants_det_num(1)
ezfio.set_determinants_det_coef([1.])
ezfio.set_determinants_det_occ(dets_a+dets_b)
write_ezfioFile(file,firstArg+".ezfio")

40
eplf.config Normal file
View File

@ -0,0 +1,40 @@
electrons
elec_alpha_num integer
elec_beta_num integer
elec_num integer = electrons_elec_alpha_num + electrons_elec_beta_num
nuclei
nucl_num integer
nucl_charge real (nuclei_nucl_num)
nucl_coord real (nuclei_nucl_num,3)
determinants
det_num integer
det_occ integer (mo_basis_mo_active_num,determinants_det_num,2)
det_coef real (determinants_det_num)
ao_basis
ao_num integer
ao_prim_num integer (ao_basis_ao_num)
ao_nucl integer (ao_basis_ao_num)
ao_power integer (ao_basis_ao_num,3)
ao_prim_num_max integer = maxval(ao_basis_ao_prim_num)
ao_coef real (ao_basis_ao_num,ao_basis_ao_prim_num_max)
ao_expo real (ao_basis_ao_num,ao_basis_ao_prim_num_max)
mo_basis
mo_tot_num integer
mo_coef real (ao_basis_ao_num,mo_basis_mo_tot_num)
mo_classif character (mo_basis_mo_tot_num)
mo_closed_num integer =n_count_ch(mo_basis_mo_classif,size(mo_basis_mo_classif),'c')
mo_active_num integer =n_count_ch(mo_basis_mo_classif,size(mo_basis_mo_classif),'a')
mo_virtual_num integer =n_count_ch(mo_basis_mo_classif,size(mo_basis_mo_classif),'v')
mo_energy real (mo_basis_mo_tot_num)
mo_occ real (mo_basis_mo_tot_num)
grid
point_num integer (3)
step_size real (3)
origin real (3)
opposite real (3)

View File

@ -15,7 +15,7 @@ FCFLAGS= -O3
SRC=
OBJ=
LIB=-lqcio
LIB=../EZFIO/lib/libezfio.a
include irpf90.make

View File

@ -5,11 +5,11 @@ BEGIN_PROVIDER [ integer, ao_num ]
! Number of atomic orbitals
END_DOC
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_basis_num_contr(ao_num)
!$OMP END CRITICAL (qcio_critical)
assert (ao_num > 0)
ao_num = -1
call get_ao_basis_ao_num(ao_num)
if (ao_num <= 0) then
call abrt(irp_here,'Number of contracted gaussians should be > 0')
endif
END_PROVIDER
@ -20,10 +20,16 @@ BEGIN_PROVIDER [ integer, ao_prim_num, (ao_num) ]
! Number of primitives per atomic orbital
END_DOC
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_basis_num_prim(ao_prim_num)
!$OMP END CRITICAL (qcio_critical)
ao_prim_num = -1
call get_ao_basis_ao_prim_num(ao_prim_num)
integer :: i
character*(80) :: message
do i=1,ao_num
if (ao_prim_num(i) <= 0) then
write(message,'(A,I6,A)') 'Number of primitives of contraction ',i,' should be > 0'
call abrt(irp_here,message)
endif
enddo
END_PROVIDER
@ -34,10 +40,19 @@ BEGIN_PROVIDER [ integer, ao_nucl, (ao_num) ]
! Nucleus on which the atomic orbital is centered
END_DOC
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_basis_atom(ao_nucl)
!$OMP END CRITICAL (qcio_critical)
ao_nucl = -1
call get_ao_basis_ao_nucl(ao_nucl)
character*(80) :: message
character*(30) :: range
write(range,'(A,I5,A)') '(1,',nucl_num,')'
integer :: i
do i=1,ao_num
if ( (ao_nucl(i) <= 0) .or. (ao_nucl(i) > nucl_num) ) then
write(message,'(A,I6,A)') 'Contraction ',i,' should be centered on a nucleus in the range'//trim(range)
call abrt(irp_here,message)
endif
enddo
END_PROVIDER
@ -47,17 +62,17 @@ BEGIN_PROVIDER [ integer, ao_power, (ao_num,3) ]
BEGIN_DOC
! x,y,z powers of the atomic orbital
END_DOC
integer :: buffer(3,ao_num)
ao_power = 0
call get_ao_basis_ao_power(ao_power)
character*(80) :: message
integer :: i,j
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_basis_power(buffer)
!$OMP END CRITICAL (qcio_critical)
do i=1,3
do j=1,ao_num
ao_power(j,i) = buffer(i,j)
if (ao_power(j,i) < 0) then
write(message,'(A,I1,A,I6,A)') 'Power ',i,' of contraction ',j,' should be > 0'
call abrt(irp_here,message)
endif
enddo
enddo
END_PROVIDER
@ -103,38 +118,42 @@ BEGIN_PROVIDER [ integer, ao_prim_num_max ]
END_PROVIDER
BEGIN_PROVIDER [ real, ao_expo, (ao_prim_num_max,ao_num) ]
&BEGIN_PROVIDER [ real, ao_coef, (ao_prim_num_max,ao_num) ]
BEGIN_PROVIDER [ real, ao_expo, (ao_num,ao_prim_num_max) ]
&BEGIN_PROVIDER [ real, ao_coef, (ao_num,ao_prim_num_max) ]
implicit none
BEGIN_DOC
! Exponents and coefficients of the atomic orbitals
END_DOC
double precision :: buffer(ao_prim_num_max,ao_num)
integer :: i,j
ao_expo = 0.
call get_ao_basis_ao_expo(ao_expo)
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_basis_exponent(buffer)
!$OMP END CRITICAL (qcio_critical)
integer :: i,j
do i=1,ao_num
do j=1,ao_prim_num(i)
ao_expo(j,i) = buffer(j,i)
if (ao_expo(i,j) <= 0.) then
character*(80) :: message
write(message,'(A,I6,A,I6,A)') 'Exponent ',j,' of contracted gaussian ',i,' is < 0'
call abrt(irp_here,message)
endif
enddo
enddo
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_basis_coefficient(buffer)
!$OMP END CRITICAL (qcio_critical)
ao_coef = 0.
call get_ao_basis_ao_coef(ao_coef)
! Normalization of the AO coefficients
! ------------------------------------
double precision :: norm, norm2
double precision :: goverlap
integer :: pow(3), l
do i=1,ao_num
do j=1,ao_prim_num(i)
norm = goverlap(ao_expo(j,i),ao_expo(j,i),ao_power(i,:))
norm = sqrt(norm)
ao_coef(j,i) = buffer(j,i)/norm
pow(1) = ao_power(i,1)
pow(2) = ao_power(i,2)
pow(3) = ao_power(i,3)
norm = goverlap(ao_expo(i,j),ao_expo(i,j),pow)
ao_coef(i,j) = ao_coef(i,j)/sqrt(norm)
enddo
enddo

View File

@ -1,4 +1,4 @@
BEGIN_PROVIDER [ real, ao_oneD_prim_p, (ao_prim_num_max,ao_num) ]
BEGIN_PROVIDER [ real, ao_oneD_prim_p, (ao_num,ao_prim_num_max) ]
implicit none
include 'types.F'
@ -9,22 +9,24 @@ BEGIN_PROVIDER [ real, ao_oneD_prim_p, (ao_prim_num_max,ao_num) ]
real:: r2, rtemp
! Compute alpha*r or alpha*r^2
do i=1,ao_num
r2 = point_nucl_dist_2(ao_nucl(i))
do k=1,ao_prim_num(i)
ao_oneD_prim_p(k,i) = r2
do k=1,ao_prim_num_max
do i=1,ao_num
ao_oneD_prim_p(i,k) = point_nucl_dist_2(ao_nucl(i))
enddo
enddo
! Compute exp(-alpha*r) or exp(-alpha*r^2)
do i=1,ao_num
do k=1,ao_prim_num(i)
ao_oneD_prim_p(k,i) = exp(-ao_oneD_prim_p(k,i)*ao_expo(k,i))
do k=1,ao_prim_num_max
do i=1,ao_num
ao_oneD_prim_p(i,k) = exp(-ao_oneD_prim_p(i,k)*ao_expo(i,k))
enddo
! Cut below 1.d-12
do k=1,ao_prim_num(i)
if ( abs(ao_oneD_prim_p(k,i)) < 1.e-12 ) then
ao_oneD_prim_p(k,i) = 0.
enddo
! Cut below 1.d-12
do k=1,ao_prim_num_max
do i=1,ao_num
if ( abs(ao_oneD_prim_p(i,k)) < 1.e-12 ) then
ao_oneD_prim_p(i,k) = 0.
endif
enddo
enddo
@ -43,15 +45,17 @@ BEGIN_PROVIDER [ real, ao_oneD_p, (ao_num) ]
do i=1,ao_num
ao_oneD_p(i) = 0.
do k=1,ao_prim_num(i)
ao_oneD_p(i) = ao_oneD_p(i) + ao_coef(k,i)*ao_oneD_prim_p(k,i)
enddo
do k=1,ao_prim_num_max
do i=1,ao_num
ao_oneD_p(i) = ao_oneD_p(i) + ao_coef(i,k)*ao_oneD_prim_p(i,k)
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ real, ao_oneD_prim_grad_p, (ao_prim_num_max,ao_num,3) ]
BEGIN_PROVIDER [ real, ao_oneD_prim_grad_p, (ao_num,ao_prim_num_max,3) ]
implicit none
include 'types.F'
@ -61,10 +65,10 @@ BEGIN_PROVIDER [ real, ao_oneD_prim_grad_p, (ao_prim_num_max,ao_num,3) ]
integer :: i, k, l
real:: factor
do l=1,3
do i=1,ao_num
factor = -2.*point_nucl_dist_vec(ao_nucl(i),l)
do k=1,ao_prim_num(i)
ao_oneD_prim_grad_p(k,i,l) = factor*ao_expo(k,i)*ao_oneD_prim_p(k,i)
do k=1,ao_prim_num_max
do i=1,ao_num
factor = -2.*point_nucl_dist_vec(ao_nucl(i),l)
ao_oneD_prim_grad_p(i,k,l) = factor*ao_expo(i,k)*ao_oneD_prim_p(i,k)
enddo
enddo
enddo
@ -82,15 +86,17 @@ BEGIN_PROVIDER [ real, ao_oneD_grad_p, (ao_num,3) ]
do l=1,3
do i=1,ao_num
ao_oneD_grad_p(i,l) = 0.
do k=1,ao_prim_num(i)
ao_oneD_grad_p(i,l) = ao_oneD_grad_p(i,l) + ao_coef(k,i)*ao_oneD_prim_grad_p(k,i,l)
enddo
enddo
do k=1,ao_prim_num_max
do i=1,ao_num
ao_oneD_grad_p(i,l) = ao_oneD_grad_p(i,l) + ao_coef(i,k)*ao_oneD_prim_grad_p(i,k,l)
enddo
enddo
enddo
END_PROVIDER
BEGIN_PROVIDER [ real, ao_oneD_prim_lapl_p, (ao_prim_num_max,ao_num) ]
BEGIN_PROVIDER [ real, ao_oneD_prim_lapl_p, (ao_num,ao_prim_num_max) ]
implicit none
include 'types.F'
@ -98,10 +104,10 @@ BEGIN_PROVIDER [ real, ao_oneD_prim_lapl_p, (ao_prim_num_max,ao_num) ]
! Laplacian of the one-dimensional component of the primitive AOs
END_DOC
integer :: i, k, l
do i=1,ao_num
do k=1,ao_prim_num(i)
ao_oneD_prim_lapl_p(k,i) = ao_oneD_prim_p(k,i) * ao_expo(k,i) * &
( 4.*ao_expo(k,i)*point_nucl_dist_2(ao_nucl(i)) - 6. )
do k=1,ao_prim_num_max
do i=1,ao_num
ao_oneD_prim_lapl_p(i,k) = ao_oneD_prim_p(i,k) * ao_expo(i,k) * &
( 4.*ao_expo(i,k)*point_nucl_dist_2(ao_nucl(i)) - 6. )
enddo
enddo
@ -119,8 +125,10 @@ BEGIN_PROVIDER [ real, ao_oneD_lapl_p, (ao_num) ]
do i=1,ao_num
ao_oneD_lapl_p(i) = 0.
do k=1,ao_prim_num(i)
ao_oneD_lapl_p(i) = ao_oneD_lapl_p(i) + ao_coef(k,i)*ao_oneD_prim_lapl_p(k,i)
enddo
do k=1,ao_prim_num_max
do i=1,ao_num
ao_oneD_lapl_p(i) = ao_oneD_lapl_p(i) + ao_coef(i,k)*ao_oneD_prim_lapl_p(i,k)
enddo
enddo

View File

@ -4,10 +4,10 @@ program debug
integer :: i,j
integer :: k
print *, ''
print *, 'Occupation numbers'
do k=1,mo_num
print *, k, mo_occ(k)
enddo
!print *, 'Occupation numbers'
!do k=1,mo_num
! print *, k, mo_occ(k)
!enddo
read(*,*) i,j
print *, ''

33
src/det.irp.f Normal file
View File

@ -0,0 +1,33 @@
BEGIN_PROVIDER [ integer, det_num ]
implicit none
include "types.F"
BEGIN_DOC
! Number of determinants
END_DOC
det_num = 1
call get_determinants_det_num(det_num)
if (det_num < 1) then
call abrt(irp_here,'det_num should be > 0')
endif
END_PROVIDER
BEGIN_PROVIDER [ integer, det, (elec_alpha_num-mo_closed_num,det_num,2) ]
&BEGIN_PROVIDER [ real, det_coef, (det_num) ]
implicit none
BEGIN_DOC
! det : Description of the active orbitals of the determinants
! det_coef : Determinant coefficients
END_DOC
det = 0
det_coef = 0.
call get_determinants_det_occ(det)
call get_determinants_det_coef(det_coef)
END_PROVIDER

View File

@ -1,48 +1,41 @@
BEGIN_PROVIDER [ integer, elec_alpha_num ]
BEGIN_DOC
implicit none
BEGIN_DOC
! Number of alpha electrons
END_DOC
implicit none
elec_alpha_num = -1
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_system_num_alpha(elec_alpha_num)
!$OMP END CRITICAL (qcio_critical)
ASSERT (elec_alpha_num > 0)
END_DOC
elec_alpha_num = -1
call get_electrons_elec_alpha_num(elec_alpha_num)
if (elec_alpha_num <= 0) then
call abrt(irp_here,'Number of alpha electrons should be > 0')
endif
END_PROVIDER
BEGIN_PROVIDER [ integer, elec_beta_num ]
BEGIN_DOC
implicit none
BEGIN_DOC
! Number of beta electrons
END_DOC
implicit none
elec_beta_num = -1
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_system_num_beta(elec_beta_num)
!$OMP END CRITICAL (qcio_critical)
ASSERT (elec_beta_num >= 0)
END_DOC
elec_beta_num = 0
call get_electrons_elec_beta_num(elec_beta_num)
if (elec_beta_num < 0) then
call abrt(irp_here,'Number of beta electrons should be >= 0')
endif
END_PROVIDER
BEGIN_PROVIDER [ integer, elec_num ]
BEGIN_DOC
implicit none
BEGIN_DOC
! Number of electrons
END_DOC
implicit none
END_DOC
elec_num = elec_alpha_num + elec_beta_num
ASSERT ( elec_num > 0 )
elec_num = elec_alpha_num + elec_beta_num
ASSERT ( elec_num > 0 )
END_PROVIDER
BEGIN_PROVIDER [ integer, elec_num_2, (2) ]
BEGIN_DOC

View File

@ -1,5 +1,5 @@
program eplf
provide mpi_rank
call write_grid_eplf()
call finish()
end

View File

@ -5,7 +5,7 @@ BEGIN_PROVIDER [ real, eplf_gamma ]
END_DOC
real :: eps
eps = -real(dlog(tiny(1.d0)))
eplf_gamma = density_p**(2./3.) * 100.*eps
eplf_gamma = density_p**(2./3.) * eps
END_PROVIDER
BEGIN_PROVIDER [ double precision, ao_eplf_integral_matrix, (ao_num,ao_num) ]
@ -34,7 +34,7 @@ BEGIN_PROVIDER [ double precision, mo_eplf_integral_matrix, (mo_num,mo_num) ]
PROVIDE mo_coef
do i=1,mo_num
do j=i,mo_num
mo_eplf_integral_matrix(j,i) = 0.
mo_eplf_integral_matrix(j,i) = 0.d0
enddo
@ -72,8 +72,8 @@ END_PROVIDER
double precision :: thr
thr = 1.d-12 / eplf_gamma
eplf_up_up = 0.
eplf_up_dn = 0.
eplf_up_up = 0.d0
eplf_up_dn = 0.d0
PROVIDE mo_coef_transp
@ -178,34 +178,34 @@ double precision function ao_eplf_integral_numeric(i,j,gmma,center)
real :: gmma, center(3), c
ao_eplf_integral_numeric = 0.
ao_eplf_integral_numeric = 0.d0
do q=1,ao_prim_num(j)
do p=1,ao_prim_num(i)
c = ao_coef(p,i)*ao_coef(q,j)
c = ao_coef(i,p)*ao_coef(j,q)
integral = &
ao_eplf_integral_primitive_oneD_numeric( &
ao_expo(p,i), &
ao_expo(i,p), &
nucl_coord(ao_nucl(i),1), &
ao_power(i,1), &
ao_expo(q,j), &
ao_expo(j,q), &
nucl_coord(ao_nucl(j),1), &
ao_power(j,1), &
gmma, &
center(1)) * &
ao_eplf_integral_primitive_oneD_numeric( &
ao_expo(p,i), &
ao_expo(i,p), &
nucl_coord(ao_nucl(i),2), &
ao_power(i,2), &
ao_expo(q,j), &
ao_expo(j,q), &
nucl_coord(ao_nucl(j),2), &
ao_power(j,2), &
gmma, &
center(2)) * &
ao_eplf_integral_primitive_oneD_numeric( &
ao_expo(p,i), &
ao_expo(i,p), &
nucl_coord(ao_nucl(i),3), &
ao_power(i,3), &
ao_expo(q,j), &
ao_expo(j,q), &
nucl_coord(ao_nucl(j),3), &
ao_power(j,3), &
gmma, &
@ -216,60 +216,60 @@ double precision function ao_eplf_integral_numeric(i,j,gmma,center)
end function
double precision function ao_eplf_integral_primitive_oneD2(a,xa,i,b,xb,j,gmma,xr)
implicit none
include 'constants.F'
real, intent(in) :: a,b,gmma ! Exponents
real, intent(in) :: xa,xb,xr ! Centers
integer, intent(in) :: i,j ! Powers of xa and xb
integer :: ii, jj, kk, ll
real :: xp1,xp
real :: p1,p
double precision :: S(0:i+1,0:j+1)
double precision :: inv_p, di(max(i,j)), dj(j), c, c1
ASSERT (a>0.)
ASSERT (b>0.)
ASSERT (i>=0)
ASSERT (j>=0)
! Gaussian product
call gaussian_product(a,xa,b,xb,c1,p1,xp1)
call gaussian_product(p1,xp1,gmma,xr,c,p,xp)
inv_p = 1.d0/p
S(0,0) = dsqrt(pi*inv_p)*c*c1
! Obara-Saika recursion
do ii=1,max(i,j)
di(ii) = 0.5d0*inv_p*dble(ii)
enddo
S(1,0) = (xp-xa) * S(0,0)
if (i>1) then
do ii=1,i-1
S(ii+1,0) = (xp-xa) * S(ii,0) + di(ii)*S(ii-1,0)
enddo
endif
S(0,1) = (xp-xb) * S(0,0)
if (j>1) then
do jj=1,j-1
S(0,jj+1) = (xp-xb) * S(0,jj) + di(jj)*S(0,jj-1)
enddo
endif
do jj=1,j
S(1,jj) = (xp-xa) * S(0,jj) + di(jj) * S(0,jj-1)
do ii=2,i
S(ii,jj) = (xp-xa) * S(ii-1,jj) + di(ii-1) * S(ii-2,jj) + di(jj) * S(ii-1,jj-1)
enddo
enddo
ao_eplf_integral_primitive_oneD2 = S(i,j)
end function
!double precision function ao_eplf_integral_primitive_oneD(a,xa,i,b,xb,j,gmma,xr)
! implicit none
! include 'constants.F'
!
! real, intent(in) :: a,b,gmma ! Exponents
! real, intent(in) :: xa,xb,xr ! Centers
! integer, intent(in) :: i,j ! Powers of xa and xb
! integer :: ii, jj, kk, ll
! real :: xp1,xp
! real :: p1,p
! double precision :: S(0:i+1,0:j+1)
! double precision :: inv_p, di(max(i,j)), dj(j), c, c1
!
! ASSERT (a>0.)
! ASSERT (b>0.)
! ASSERT (i>=0)
! ASSERT (j>=0)
!
! ! Gaussian product
! call gaussian_product(a,xa,b,xb,c1,p1,xp1)
! call gaussian_product(p1,xp1,gmma,xr,c,p,xp)
! inv_p = 1.d0/p
! S(0,0) = dsqrt(pi*inv_p)*c*c1
!
! ! Obara-Saika recursion
!
! do ii=1,max(i,j)
! di(ii) = 0.5d0*inv_p*dble(ii)
! enddo
!
! S(1,0) = (xp-xa) * S(0,0)
! if (i>1) then
! do ii=1,i-1
! S(ii+1,0) = (xp-xa) * S(ii,0) + di(ii)*S(ii-1,0)
! enddo
! endif
!
! S(0,1) = (xp-xb) * S(0,0)
! if (j>1) then
! do jj=1,j-1
! S(0,jj+1) = (xp-xb) * S(0,jj) + di(jj)*S(0,jj-1)
! enddo
! endif
!
! do jj=1,j
! S(1,jj) = (xp-xa) * S(0,jj) + di(jj) * S(0,jj-1)
! do ii=2,i
! S(ii,jj) = (xp-xa) * S(ii-1,jj) + di(ii-1) * S(ii-2,jj) + di(jj) * S(ii-1,jj-1)
! enddo
! enddo
!
! ao_eplf_integral_primitive_oneD = S(i,j)
!
!end function
double precision function ao_eplf_integral_primitive_oneD(a,xa,i,b,xb,j,gmma,xr)
implicit none
@ -351,39 +351,39 @@ double precision function ao_eplf_integral(i,j,gmma,center)
do p=1,ao_prim_num(i)
integral = &
ao_eplf_integral_primitive_oneD( &
ao_expo(p,i), &
ao_expo(i,p), &
nucl_coord(ao_nucl(i),1), &
ao_power(i,1), &
ao_expo(q,j), &
ao_expo(j,q), &
nucl_coord(ao_nucl(j),1), &
ao_power(j,1), &
gmma, &
center(1)) * &
ao_eplf_integral_primitive_oneD( &
ao_expo(p,i), &
ao_expo(i,p), &
nucl_coord(ao_nucl(i),2), &
ao_power(i,2), &
ao_expo(q,j), &
ao_expo(j,q), &
nucl_coord(ao_nucl(j),2), &
ao_power(j,2), &
gmma, &
center(2)) * &
ao_eplf_integral_primitive_oneD( &
ao_expo(p,i), &
ao_expo(i,p), &
nucl_coord(ao_nucl(i),3), &
ao_power(i,3), &
ao_expo(q,j), &
ao_expo(j,q), &
nucl_coord(ao_nucl(j),3), &
ao_power(j,3), &
gmma, &
center(3))
ao_eplf_integral = ao_eplf_integral + integral*ao_coef(p,i)*ao_coef(q,j)
ao_eplf_integral = ao_eplf_integral + integral*ao_coef(i,p)*ao_coef(j,q)
enddo
enddo
end function
double precision function mo_eplf_integral(i,j)
double precision function mo_eplf_integral(i,j)
implicit none
integer :: i, j, k, l
PROVIDE ao_eplf_integral_matrix
@ -399,5 +399,5 @@ end function
endif
enddo
end function
end function

View File

@ -1,10 +1,3 @@
BEGIN_PROVIDER [ character*(100), grid_data_filename ]
BEGIN_DOC
! Name of the file containing the parameters of the grid
END_DOC
grid_data_filename = 'eplf_grid.data'
END_PROVIDER
BEGIN_PROVIDER [ character*(100), grid_cube_filename ]
BEGIN_DOC
! Name of the file containing the parameters of the grid
@ -29,23 +22,16 @@ END_PROVIDER
real :: origin(3)
real :: opposite(3)
namelist /eplf_grid/ Npoints, step_size, origin, opposite
Npoints (:) = 80
origin (:) = UNDEFINED
opposite (:) = UNDEFINED
step_size(:) = UNDEFINED
logical :: do_next
inquire(file=grid_data_filename,exist=do_next)
if (do_next) then
open(99,file=grid_data_filename,action='READ',status='OLD')
read(99,eplf_grid,end=90,err=80)
close(99)
endif
90 continue
call get_grid_point_num(Npoints)
call get_grid_origin(origin)
call get_grid_opposite(opposite)
call get_grid_step_size(step_size)
if (origin(1) == UNDEFINED) then
integer :: i,l
do l=1,3
@ -81,12 +67,6 @@ END_PROVIDER
grid_eplf_y_num = Npoints(2)
grid_eplf_z_num = Npoints(3)
return
80 continue
print *, 'Error in input file'
stop 1
END_PROVIDER
BEGIN_PROVIDER [ real, grid_eplf, (grid_eplf_x_num,grid_eplf_y_num,grid_eplf_z_num) ]
@ -114,7 +94,7 @@ BEGIN_PROVIDER [ real, grid_eplf, (grid_eplf_x_num,grid_eplf_y_num,grid_eplf_z_n
icount = mpi_size
do iz=1,grid_eplf_z_num
if (mpi_master) then
print *, iz
print *, int(100*dble(iz)/dble(grid_eplf_z_num)), '%'
endif
point(3) = grid_eplf_origin(3)+(iz-1)*grid_eplf_step(3)
do iy=1,grid_eplf_y_num
@ -135,20 +115,19 @@ BEGIN_PROVIDER [ real, grid_eplf, (grid_eplf_x_num,grid_eplf_y_num,grid_eplf_z_n
IRP_IF MPI
integer :: dim, ierr
real :: buffer(grid_eplf_x_num*grid_eplf_y_num*grid_eplf_z_num)
icount = 0
do iz=1,grid_eplf_z_num
real :: buffer(grid_eplf_x_num*grid_eplf_y_num)
icount = 0
do iy=1,grid_eplf_y_num
do ix=1,grid_eplf_x_num
buffer(icount+ix) = grid_eplf(ix,iy,iz)
enddo
icount = icount + grid_eplf_x_num
enddo
enddo
dim = grid_eplf_x_num * grid_eplf_y_num * grid_eplf_z_num
call MPI_REDUCE(buffer,grid_eplf,dim,mpi_real, &
dim = grid_eplf_x_num * grid_eplf_y_num
call MPI_REDUCE(buffer,grid_eplf(1,1,iz),dim,mpi_real, &
mpi_sum,0,MPI_COMM_WORLD,ierr)
call MPI_BARRIER(MPI_COMM_WORLD,ierr)
enddo
IRP_ENDIF
END_PROVIDER

122
src/ezfio_interface.irp.f Normal file
View File

@ -0,0 +1,122 @@
BEGIN_SHELL [ /usr/bin/python ]
data = [ \
("nuclei_nucl_num" , "integer" , "" ),
("nuclei_nucl_charge" , "real" , "(nucl_num)" ),
("nuclei_nucl_coord" , "real" , "(nucl_num,3)" ),
("mo_basis_mo_coef" , "real" , "(ao_num,mo_tot_num)" ),
("mo_basis_mo_occ" , "real" , "(mo_tot_num)" ),
("electrons_elec_alpha_num" , "integer" , "" ),
("electrons_elec_beta_num" , "integer" , "" ),
("ao_basis_ao_num" , "integer" , "" ),
("ao_basis_ao_prim_num" , "integer" , "(ao_num)" ),
("ao_basis_ao_nucl" , "integer" , "(ao_num)" ),
("ao_basis_ao_power" , "integer" , "(ao_num,3)" ),
("ao_basis_ao_expo" , "real" , "(ao_num,ao_prim_num_max)" ),
("ao_basis_ao_coef" , "real" , "(ao_num,ao_prim_num_max)" ),
("determinants_det_num" , "integer" , "" ),
("determinants_det_coef" , "real" , "(det_num)" ),
("determinants_det_occ" , "integer" , "(elec_alpha_num-mo_closed_num,det_num,2)" ),
("grid_point_num" , "integer" , "(3)" ),
("grid_step_size" , "real" , "(3)" ),
("grid_origin" , "real" , "(3)" ),
("grid_opposite" , "real" , "(3)" ),
]
data_no_set = [\
("mo_basis_mo_tot_num" , "integer" , "" ),
("mo_basis_mo_active_num" , "integer" , "" ),
("mo_basis_mo_closed_num" , "integer" , "" ),
]
def do_subst(t0,d):
t = t0
t = t.replace("$X",d[0])
t = t.replace("$T",d[1])
t = t.replace("$D",d[2])
if d[1].startswith("character"):
size = d[1].split("*")[1][1:-1]
u = "character"
elif d[1].startswith("double precision"):
u = d[1].replace(" ","_")
size = "1"
elif "*" in d[1]:
size = "1"
u = d[1].replace("*","")
else:
size = "1"
u = d[1]
t = t.replace("$U",u)
if d[2] == "":
t = t.replace("$S",size)
else:
if size == "1":
t = t.replace("$S","size(res)")
else:
t = t.replace("$S","%s*size(res)"%(size))
print t
t0 = """
subroutine get_$X(res)
implicit none
IRP_IF MPI
include 'mpif.h'
IRP_ENDIF
$T :: res$D
integer :: ierr
logical :: exists
!$OMP CRITICAL (ezfio_critical)
PROVIDE ezfio_filename
if (mpi_master) then
call ezfio_has_$X(exists)
if (exists) then
call ezfio_get_$X(res)
else
call ezfio_set_$X(res)
endif
endif
IRP_IF MPI
call MPI_BCAST(res,$S,MPI_$U,0,MPI_COMM_WORLD,ierr)
if (ierr /= MPI_SUCCESS) then
call abrt(irp_here,'Unable to broadcast $X')
endif
IRP_ENDIF
!$OMP END CRITICAL (ezfio_critical)
end
"""
t1 = """
subroutine get_$X(res)
implicit none
IRP_IF MPI
include 'mpif.h'
IRP_ENDIF
$T :: res$D
integer :: ierr
!$OMP CRITICAL (ezfio_critical)
PROVIDE ezfio_filename
if (mpi_master) then
call ezfio_get_$X(res)
endif
IRP_IF MPI
call MPI_BCAST(res,$S,MPI_$U,0,MPI_COMM_WORLD,ierr)
if (ierr /= MPI_SUCCESS) then
call abrt(irp_here,'Unable to broadcast $X')
endif
IRP_ENDIF
!$OMP END CRITICAL (ezfio_critical)
end
"""
for d in data:
do_subst(t0,d)
for d in data_no_set:
do_subst(t1,d)
END_SHELL

View File

@ -1,24 +1,31 @@
BEGIN_PROVIDER [ character*(128), qcio_filename ]
implicit none
BEGIN_DOC
! Name of the QCIO file
BEGIN_PROVIDER [ character*(64), ezfio_filename ]
BEGIN_DOC
! Name of the ezfio file
END_DOC
integer :: iargc
IRP_IF MPI
include 'mpif.h'
integer :: ierr
IRP_ENDIF
if (mpi_master) then
call getarg(1,ezfio_filename)
if (ezfio_filename == '') then
call ezfio_get_filename(ezfio_filename)
endif
endif
IRP_IF MPI
PROVIDE mpi_rank
call MPI_BCAST(ezfio_filename,64,MPI_character,0,MPI_COMM_WORLD,ierr)
if (ierr /= MPI_SUCCESS) then
call abrt(irp_here,'Unable to broadcast ezfio_filename')
endif
IRP_ENDIF
call getarg(1,qcio_filename)
if (qcio_filename /= '') then
call qcio_set_file(qcio_filename)
else
call qcio_get_filename(qcio_filename)
endif
call ezfio_set_file(ezfio_filename)
if (.not.mpi_master) then
call qcio_set_read_only(.True.)
call ezfio_set_read_only(.True.)
endif
call barrier
END_PROVIDER

View File

@ -1,59 +1,39 @@
BEGIN_PROVIDER [ integer, mo_closed_num ]
implicit none
implicit none
BEGIN_DOC
! Number of closed shell Molecular orbitals
END_DOC
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_mo_num_closed(mo_closed_num)
!$OMP END CRITICAL (qcio_critical)
ASSERT (mo_closed_num >= 0)
ASSERT (mo_closed_num <= elec_alpha_num)
ASSERT (mo_closed_num <= elec_beta_num)
mo_closed_num = -1
call get_mo_basis_mo_closed_num(mo_closed_num)
if (mo_closed_num < 0) then
call abrt(irp_here,'Number of closed-shell MOs should be >=0')
endif
if (mo_closed_num > elec_alpha_num) then
call abrt(irp_here,'Number of closed-should MOs should be <= Number of alpha electrons')
endif
if (mo_closed_num > elec_beta_num) then
call abrt(irp_here,'Number of closed-should MOs should be <= Number of beta electrons')
endif
END_PROVIDER
BEGIN_PROVIDER [ integer, mo_active_num ]
implicit none
implicit none
BEGIN_DOC
! Number of active Molecular orbitals
END_DOC
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_mo_num_active(mo_active_num)
!$OMP END CRITICAL (qcio_critical)
ASSERT (mo_active_num >= 0)
END_PROVIDER
BEGIN_PROVIDER [ real, mo_occ, (mo_num) ]
implicit none
BEGIN_DOC
! Occupation numbers of molecular orbitals
END_DOC
double precision, allocatable :: buffer(:)
allocate ( buffer(mo_tot_num) )
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_mo_occupation(buffer)
!$OMP END CRITICAL (qcio_critical)
integer :: i
do i=1,mo_num
mo_occ(i) = buffer(i)
enddo
deallocate(buffer)
mo_active_num = -1
call get_mo_basis_mo_active_num(mo_active_num)
if (mo_active_num < 0) then
call abrt(irp_here,'Number of active MOs should be >=0')
endif
END_PROVIDER
BEGIN_PROVIDER [ integer, mo_num ]
implicit none
implicit none
BEGIN_DOC
! Number of Molecular orbitals
END_DOC
@ -63,42 +43,29 @@ BEGIN_PROVIDER [ integer, mo_num ]
END_PROVIDER
BEGIN_PROVIDER [ real, mo_coef, (ao_num,mo_num) ]
implicit none
BEGIN_PROVIDER [ real, mo_occ, (mo_tot_num) ]
implicit none
BEGIN_DOC
! Molecular orbital coefficients
! Occupation numbers of molecular orbitals
END_DOC
integer :: i, j
double precision, allocatable :: buffer(:,:)
allocate (buffer(ao_num,mo_tot_num))
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_mo_matrix(buffer)
!$OMP END CRITICAL (qcio_critical)
do j=1,mo_num
do i=1,ao_num
mo_coef(i,j) = buffer(i,j)
enddo
enddo
deallocate (buffer)
call get_mo_basis_mo_occ(mo_occ)
END_PROVIDER
BEGIN_PROVIDER [ logical, mo_non_zero, (mo_num,ao_num) ]
BEGIN_PROVIDER [ real, mo_coef, (ao_num,mo_num) ]
implicit none
BEGIN_DOC
! Values where the mo coefficients are /= 0.
! Molecular orbital coefficients
END_DOC
integer :: i, j
real :: buffer(ao_num,mo_tot_num)
integer :: i, j, k
do j=1,ao_num
do k=1,mo_num
mo_non_zero(k,j) = mo_coef_transp(j,k) /= 0.
buffer = 0.
call get_mo_basis_mo_coef(buffer)
do i=1,mo_num
do j=1,ao_num
mo_coef(j,i) = buffer(j,i)
enddo
enddo
@ -130,39 +97,36 @@ BEGIN_PROVIDER [ logical, mo_is_closed, (mo_num) ]
! mo_is_active : True if mo(i) is an active orbital
END_DOC
character, allocatable :: buffer(:)
allocate (buffer(mo_num))
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_mo_classif(buffer)
!$OMP END CRITICAL
character :: buffer(mo_tot_num)
integer :: i
do i=1,mo_num
if ( buffer(i) == 'c' ) then
mo_is_closed(i) = .True.
mo_is_closed(i) = .True.
mo_is_active(i) = .False.
else if ( buffer(i) == 'a' ) then
mo_is_closed(i) = .False.
mo_is_closed(i) = .False.
mo_is_active(i) = .True.
else
mo_is_closed(i) = .False.
mo_is_active(i) = .False.
endif
enddo
deallocate (buffer)
END_PROVIDER
BEGIN_PROVIDER [ integer, mo_tot_num ]
BEGIN_DOC
! Total number of MOs in the QCIO file
! Total number of MOs in the EZFIO file
END_DOC
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_mo_num_orb_tot(mo_tot_num)
!$OMP END CRITICAL (qcio_critical)
ASSERT (mo_tot_num > 0)
mo_tot_num = -1
call get_mo_basis_mo_tot_num(mo_tot_num)
if (mo_tot_num <= 0) then
call abrt(irp_here,'Tota number of MOs can''t be <0')
endif
END_PROVIDER

View File

@ -62,8 +62,6 @@ BEGIN_PROVIDER [ integer, mpi_size ]
IRP_ENDIF
call iinfo(irp_here,'mpi_size',mpi_size)
END_PROVIDER

View File

@ -5,11 +5,11 @@ BEGIN_PROVIDER [ integer, nucl_num ]
! Number of nuclei
END_DOC
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_geometry_num_atom(nucl_num)
!$OMP END CRITICAL (qcio_critical)
assert (nucl_num > 0)
nucl_num = -1
call get_nuclei_nucl_num(nucl_num)
if (nucl_num <= 0) then
call abrt(irp_here,'Number of nuclei should be > 0')
endif
END_PROVIDER
@ -20,19 +20,16 @@ BEGIN_PROVIDER [ real, nucl_charge, (nucl_num) ]
! Nuclear charge
END_DOC
double precision,allocatable :: buffer(:)
allocate(buffer(nucl_num))
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_geometry_charge(buffer)
!$OMP END CRITICAL (qcio_critical)
nucl_charge = -1.d0
call get_nuclei_nucl_charge(nucl_charge)
integer :: i
do i=1,nucl_num
nucl_charge(i) = buffer(i)
if (nucl_charge(i) <= 0.) then
call abrt(irp_here,'Nuclear charges should be > 0')
endif
enddo
deallocate(buffer)
END_PROVIDER
END_PROVIDER
BEGIN_PROVIDER [ real, nucl_coord, (nucl_num,3) ]
implicit none
@ -40,24 +37,13 @@ BEGIN_PROVIDER [ real, nucl_coord, (nucl_num,3) ]
BEGIN_DOC
! Nuclear coordinates
END_DOC
double precision, allocatable :: buffer(:,:)
allocate (buffer(3,nucl_num))
!$OMP CRITICAL (qcio_critical)
PROVIDE qcio_filename
call qcio_get_geometry_coord(buffer)
!$OMP END CRITICAL (qcio_critical)
integer :: i,j
do i=1,3
do j=1,nucl_num
nucl_coord(j,i) = buffer(i,j)
enddo
enddo
deallocate(buffer)
nucl_coord = 0.
call get_nuclei_nucl_coord(nucl_coord)
END_PROVIDER
BEGIN_PROVIDER [ real, nucl_dist_2, (nucl_num,nucl_num) ]
&BEGIN_PROVIDER [ real, nucl_dist_vec, (nucl_num,nucl_num,3) ]
implicit none

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
T

View File

@ -1 +0,0 @@
35

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
2.032531471843000E+01

View File

@ -1 +0,0 @@
3

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +0,0 @@
4

View File

@ -1 +0,0 @@
-7.614196870000001E+01

View File

@ -1 +0,0 @@
7

View File

@ -1 +0,0 @@
6

View File

@ -1 +0,0 @@
titre

Binary file not shown.

1264
test/c2h.out Normal file

File diff suppressed because it is too large Load Diff