53 subroutine assign (nshl, ndist, nused, refcon, excon, qnstor, nx, nftw)
65 use congen_data,
only :
ntcon,
test,
nrcon,
nobt,
nst,
nshsym,
nobi,
ift,
occshl, pqn =>
pqnst, sshl =>
sshlst,
qnshlr
67 integer :: ndist, nftw, nshl, nused, nx
68 integer,
dimension(nobt) :: excon
69 integer,
dimension(*) :: qnstor
70 integer,
dimension(nobt,max(ntcon,1)) :: refcon
71 intent (in) nftw, nshl, nx, refcon
72 intent (out) nused, qnstor
73 intent (inout) excon, ndist
75 integer,
save :: allow, i, ic, it, ita, itest, j, ks, kss, mrun, mt, nav, navm1, ndrop, nrep, nshrun, nt
89 do while (nshrun /= nshl)
93 if (mrun == sshl(i))
then
122 qnshlr(ks) >= pqn(2,kss) .and. &
123 qnshlr(kss) <= pqn(3,ks))
go to 200
126 if (ks < nshl)
go to 100
142 nt = excon(i) - refcon(i,ic)
143 nrep = abs(nt) + nrep
145 if (
test(ic) /= 1)
then
150 itest = itest +
test(ic)
153 if (allow == 0 .and. itest /= 0)
go to 200
157 if (ndrop + nshl >= navm1)
then
158 write(nftw,
'("1",31("*"),/," ",31("*"),"STORAGE OVERFLOW IN ASSIGN:",I8, " WORDS AVAILABLE")') nx
170 200
do while (ks > 0)
174 if (
qnshlr(ks) <= pqn(3,ks))
go to 120
197 subroutine cgcoef (j1, j2, j3, m3, n, ms, c, intpfg)
199 use precisn,
only : wp
200 use consts,
only : xzero, xone
203 integer :: intpfg, j1, j2, j3, m3, n
204 real(kind=wp),
dimension(*) :: c
205 integer,
dimension(2,*) :: ms
206 intent (in) intpfg, j1, j2, j3, m3
207 intent (inout) c, ms, n
209 real(kind=wp) :: a, b, t
210 integer :: i, i1, i2, ii, jj, js, lb, lb1, lb2, lbh, lbl, m, m1, m2
211 integer,
dimension(3) :: j, k, l
213 js = (j1 + j2 + j3 - 1) / 2
222 if (j3 - 1 < abs(m - 1))
return
223 if (any(k < 0))
return
225 l(3) = (j3 + m3 - 2) / 2
230 if (abs(m2 - 1) <= j2 - 1)
then
235 l(2) = (j2 + m2 - 2) / 2
241 i1 = max(l(1) - k(1), l(2) - k(3), 0)
242 i2 = min(l(1), l(2), k(2))
245 lbl =
ind(k(2) + 1) + i1
246 lbh =
ind(k(2) + 1) + i2
247 lb1 =
ind(k(1) + 1) + l(1) - i1
248 lb2 =
ind(k(3) + 1) + l(2) - i1
255 c(n) = b * t * (-xone)**i2
256 if (abs(c(n)) <=
thresh1) n = n - 1
261 if (intpfg /= 0)
then
262 write(
nftw,
'(" CGCOEF : CLEBSCH-GORDAN COEFFICIENTS FOR")')
263 write(
nftw,
'(" J1 =",I4," J2 =",I4," J3 =",I4," M3 =",I4,/)') j1, j2, j3, m3
264 write(
nftw,
'(/(E25.15,2I5))') (c(i), ms(1,i), ms(2,i), i=1,n)
289 subroutine getsa (ne, l, is, isz, m, nc, c, iso)
291 use precisn,
only : wp
292 use consts,
only : one => xone
295 integer :: is, isz, l, m, nc, ne
296 real(kind=wp),
dimension(*) :: c
297 integer,
dimension(*) :: iso
298 intent (in) is, isz, l, m, ne
309 if (m < 0) iso(1) = iso(1) + 2
311 else if (ne == 2)
then
317 if (isz + m /= 1)
then
319 iso(1) = 1 - (l + l) / m
323 iso(1) = (3 - isz) / 4
334 if (is == 1) c(2) = -
root2
374 subroutine getsm (ne, isz, nc, c, iso)
376 use precisn,
only : wp
377 use consts,
only : one => xone
379 integer :: isz, nc, ne
380 real(kind=wp),
dimension(*) :: c
381 integer,
dimension(*) :: iso
383 intent (out) c, iso, nc
389 if (ne == 1) iso(1) = 1 - isz / 2
416 subroutine getso (ns, intpfg, nti, iqns, ci, nd, id, cd, last)
418 use precisn,
only : wp
421 integer :: intpfg, last, nd, ns, nti
422 real(kind=wp),
dimension(*) :: cd, ci
423 integer,
dimension(*) :: id
424 integer,
dimension(2,ns,*) :: iqns
425 intent (in) ci, intpfg, iqns, last, ns, nti
426 intent (inout) cd, id, nd
428 real(kind=wp),
dimension(100) :: c
429 real(kind=wp),
dimension(ns) :: cs
430 integer :: i, ie1, ie2, is, isz, iti, kc, ke, kso, ld, ld1, ld2, ml, nc
431 integer,
dimension(200) :: iso
432 integer,
dimension(150) :: jso
433 integer,
dimension(ns+1) :: lc, lso
434 integer,
dimension(ns) :: lcs, lsos
437 if (intpfg /= 0)
then
438 write(
nftw,
'(" GETSO : NTI =",I10,/," IQNS :",/)') nti
440 write(
nftw,
'(20I5)') (iqns(1,is,iti), is=1,ns)
441 write(
nftw,
'(20I5)') (iqns(2,is,iti), is=1,ns)
457 call getsa (nes(is), ms(is), iqn(1,is), isz, ml, nc, c(kc), iso(kso))
459 call getsm (nes(is), isz, nc, c(kc), iso(kso))
464 kso = kso + nc * nes(is)
476 if (nes(is) == 0)
go to 415
487 t = cs(is) * c(lcs(is))
488 lcs(is) = lcs(is) + 1
490 if (is <= ns)
go to 300
494 write(
nftw,
'("0storage overflow")')
509 if (lcs(is) < lc(is + 1))
go to 400
514 if (intpfg /= 0)
then
515 write(
nftw,
'(" GETSO : ND =",I6,/," CD, ID :",/)') nd
520 write(
nftw,
'(E25.15,20I5)') cd(i), (id(ld), ld=ld1,ld2)
574 subroutine cplea (nncsf, nadel, x, nftw)
576 use iso_c_binding,
only : c_loc, c_f_pointer
577 use precisn,
only : wp
578 use congen_data,
only :
lg,
next,
nx,
icdi,
iexcon,
indi,
inodi,
iqnstr,
irfcon,
ndel,
confpf,
ndist,
nshl, &
579 nstate,
occshl,
mshl,
gushl,
cup,
qnshl,
spnmin,
kslim,
mclim,
shlmx1,
qntot, &
582 integer :: nadel, nftw, nncsf
583 real(wp),
dimension(*),
target :: x
584 integer,
dimension(:),
pointer :: int_ptr, irfcon_ptr, iexcon_ptr, iqnstr_ptr, nodi_ptr, ndi_ptr, ndel_ptr, nnext_ptr
585 integer,
dimension(2,3,lg) :: qntmp
587 integer :: gutry, i, idumm, iidis1, iidist, iocc, kc, kclim, kcs, kcsp, ks, &
588 m, mtry, nav, nnext, nused, shl1, shl2, spntry, z1=1
590 real(wp),
pointer :: x_ptr
600 if (
gushl(i) > 0) cycle
601 if (iand(
occshl(i), z1) /= 0) gutry = -gutry
603 if (gutry /=
gutot)
return
609 if (
gutot /= 0 ) m = m + m
612 spntry = spntry + iocc
613 mtry = mtry + iocc *
mshl(i)
615 if (spntry >
qntot(1))
return
616 if (mtry -
qntot(2) > 0 .or. iand(mtry -
qntot(2), z1) /= 0)
return
632 if (
gutot /= 0) m = m + m
639 mtry = mtry +
mshl(i)
647 mtry = mtry -
mshl(i)
654 if (
kslim(2,ks) == 1)
go to 120
660 if (ks <
nshl)
go to 100
662 if (spntry <
qntot(1) .or. mtry <
qntot(2))
go to 600
665 if (kclim /= 0)
go to 300
675 qntmp(1,2,kc) = abs(
qnshl(2,shl1) -
qnshl(2,shl2))
681 if (qntmp(1,1,kc) == qntmp(1,2,kc))
go to 320
683 if (qntmp(1,2,kc) /= 0)
go to 320
688 if (kc < kclim)
go to 300
696 if (
qnshl(2,kcs) /=
qntot(2) .and. qntmp(1,2,kc) /=
qntot(2))
go to 500
699 if (qntmp(1,1,kc) /= 0)
go to 420
700 qnshl(3,kcs) = qntmp(2,1,kc)
705 420
if (
qntar(1) >= 0)
then
707 if (kcs == 3) kcsp = 1
713 if (
nstate /= 1)
go to 400
716 x_ptr => x(
irfcon) ;
call c_f_pointer (c_loc(x_ptr), irfcon_ptr, (/1/))
717 x_ptr => x(
iexcon) ;
call c_f_pointer (c_loc(x_ptr), iexcon_ptr, (/1/))
718 x_ptr => x(
iqnstr) ;
call c_f_pointer (c_loc(x_ptr), iqnstr_ptr, (/1/))
730 if (
nndel /= 0)
go to 405
736 x_ptr => x(
inodi) ;
call c_f_pointer (c_loc(x_ptr), nodi_ptr, (/1/))
737 x_ptr => x(
indi) ;
call c_f_pointer (c_loc(x_ptr), ndi_ptr, (/1/))
738 x_ptr => x(
ndel) ;
call c_f_pointer (c_loc(x_ptr), ndel_ptr, (/1/))
739 x_ptr => x(
iqnstr) ;
call c_f_pointer (c_loc(x_ptr), iqnstr_ptr, (/1/))
740 x_ptr => x(nnext) ;
call c_f_pointer (c_loc(x_ptr), nnext_ptr, (/1/))
742 call wfn (nncsf, nadel, iidist, iidis1, nodi_ptr, ndi_ptr, x(
icdi), ndel_ptr, iqnstr_ptr, x(nnext), nnext_ptr, nav)
744 if (
nndel > 0 .and. nadel >
nndel .and. iidis1 == 0)
return
745 if (
nndel == 0)
go to 500
746 if (iidist == 0)
go to 500
748 if (
confpf >= 10 .and. iidis1 /= 0)
call print2 (iidis1)
754 if (kc == 0)
go to 600
767 if (ks == 0)
go to 900
770 if (
kslim(1,ks) == 3)
go to 625
783 625 mtry = mtry -
qnshl(2,ks)
788 900
if (
nndel /= 0 .and. iidis1 /= 0)
call print3 (iidis1, 1)
801 subroutine cplem (nncsf, nadel, x, nftw)
803 use iso_c_binding,
only : c_loc, c_f_pointer
804 use precisn,
only : wp
805 use global_utils,
only : mprod
806 use congen_data,
only :
lg,
next,
nx,
icdi,
iexcon,
indi,
inodi,
iqnstr,
irfcon,
ndel,
confpf,
ndist,
nshl, &
827 integer :: nadel, nftw, nncsf
828 real(wp),
dimension(*),
target :: x
829 integer,
dimension(:),
pointer :: int_ptr, nodi_ptr, ndi_ptr, ndel_ptr, irfcon_ptr, iexcon_ptr, iqnstr_ptr, nnext_ptr
830 real(wp),
pointer :: x_ptr
832 integer :: i, idumm, iidis1, iidist, kc, kclim, kcs, kcsp, mtry, mu1, mu2, nav, nnext, nused, spntry
833 integer,
dimension(2*lg) :: qntmp
851 mtry = mprod(mtry + 1, qntmp(i) + 1, 0, nftw) - 1
854 if (spntry <
qntot(1))
return
855 if (mtry /=
qntot(2))
return
866 qntmp(kcs) = mprod(qntmp(
cup(1,i)) + 1, qntmp(
cup(2,i)) + 1, 0, nftw) - 1
876 300
do while (kc <
nshl - 1)
881 qnshl(1,kcs) = mu1 + mu2 - 1
882 spnmin(kc) = abs(mu1 - mu2) + 1
892 360
if (
qntar(1) >= 0)
then
894 if (kcs == 3) kcsp = 1
906 x_ptr => x(
irfcon) ;
call c_f_pointer (c_loc(x_ptr), irfcon_ptr, (/1/))
907 x_ptr => x(
iexcon) ;
call c_f_pointer (c_loc(x_ptr), iexcon_ptr, (/1/))
908 x_ptr => x(
iqnstr) ;
call c_f_pointer (c_loc(x_ptr), iqnstr_ptr, (/1/))
925 x_ptr => x(
inodi) ;
call c_f_pointer (c_loc(x_ptr), nodi_ptr, (/1/))
926 x_ptr => x(
indi) ;
call c_f_pointer (c_loc(x_ptr), ndi_ptr, (/1/))
927 x_ptr => x(
ndel) ;
call c_f_pointer (c_loc(x_ptr), ndel_ptr, (/1/))
928 x_ptr => x(
iqnstr) ;
call c_f_pointer (c_loc(x_ptr), iqnstr_ptr, (/1/))
929 x_ptr => x(nnext) ;
call c_f_pointer (c_loc(x_ptr), nnext_ptr, (/1/))
931 call wfn (nncsf, nadel, iidist, iidis1, nodi_ptr, ndi_ptr, x(
icdi), ndel_ptr, iqnstr_ptr, x(nnext), nnext_ptr, nav)
933 if (
nndel > 0 .and. nadel >
nndel .and. iidis1 == 0)
return
935 if (
nndel /= 0 .and. iidist /= 0)
then
937 if (
confpf >= 10 .and. iidis1 /= 0)
call print2 (iidis1)
942 500
do while (kc > 1)
949 if (
nndel /= 0 .and. iidis1 /= 0)
call print3 (iidis1, 1)
994 subroutine distrb (nelecp, nshlp, shlmx, occshl, nslsv, kdssv, loopf, ksss, pqn, occst, shlmx1, pqnst, mshl, mshlst, &
995 gushl, gushst, cup, cupst, ndprod, symtyp, confpf, sshl, sshlst, ncsf, nncsf, nadel, nndel, x, nftw)
997 use precisn,
only : wp
1000 integer ::
confpf, nadel,
ncsf, ndprod, nftw, nncsf, nndel, symtyp
1001 integer,
dimension(3,*) :: cup, cupst, pqn, pqnst
1002 integer,
dimension(*) :: gushl, gushst, kdssv, ksss, loopf, mshl, mshlst, nelecp, nshlp, nslsv, occshl, &
1003 occst, shlmx, shlmx1, sshl, sshlst
1004 real(kind=wp),
dimension(*) :: x
1005 intent (in) confpf, cup, gushl, mshl,
ncsf, ndprod, nelecp, nndel, nshlp, pqn, shlmx, shlmx1, sshl, symtyp
1006 intent (out) gushst, mshlst, pqnst, sshlst
1007 intent (inout) cupst, kdssv, ksss, loopf, nslsv, occshl, occst
1009 integer :: i, ibias, ic1, id, idd, it, it1, it2, ita, j, kds, kdsb, kdst, kprod, krun, ksi, kss, nadd, nadd2, ncrun, &
1010 nela, neleft, ninitx, nshlw, nslots
1018 ninitx = sum(nshlp(1:ndprod))
1020 orbital_set_loop:
do
1024 neleft = nelecp(kprod)
1025 nshlw = nshlp(kprod)
1026 nslots = sum(shlmx(ibias + 1 : ibias + nshlw))
1027 occshl(ibias + 1 : ibias + nshlw) = 0
1033 occshl(kdsb) = min(neleft, shlmx(kdsb))
1035 neleft = neleft - occshl(kdsb)
1036 nslots = nslots - shlmx(kdsb)
1038 if (neleft /= 0)
then
1039 if (nslots >= neleft) cycle shell_loop
1040 do while (nslots <= neleft .and. kds /= 0)
1041 neleft = neleft + occshl(kdsb)
1043 nslots = nslots + shlmx(kdsb)
1048 else if (kprod /= ndprod)
then
1049 nslsv(kprod) = nslots
1051 ibias = ibias + nshlp(kprod)
1052 cycle orbital_set_loop
1057 where (occshl(1:ninitx) == 0 .or. pqn(1,1:ninitx) /= 0)
1072 if (ksi == ninitx)
then
1077 cupst(1:3,1:ncrun) = cup(1:3,1:ncrun)
1080 all_shell_loop:
do i = 1, ninitx
1082 if (ksss(i) < 1)
then
1085 if (cupst(1,id) == krun)
then ; it1 = cupst(2,id) ; it2 = cupst(3,id) ;
exit ;
end if
1086 if (cupst(2,id) == krun)
then ; it1 = cupst(1,id) ; it2 = cupst(3,id) ;
exit ;
end if
1092 cupst(1:3,idd) = cupst(1:3,idd+1)
1096 if (cupst(1,idd) == it2)
then ; cupst(1,idd) = it1 ;
exit ;
end if
1097 if (cupst(2,idd) == it2)
then ; cupst(2,idd) = it1 ;
exit ;
end if
1102 if (cupst(j,idd) <= krun) cycle
1103 cupst(j,idd) = cupst(j,idd) - 1
1104 if (cupst(j,idd) >= it2) cupst(j,idd) = cupst(j,idd) - 1
1110 else if (ksss(i) > 1)
then
1115 cupst(3,idd) = cupst(3,idd) + nadd2
1117 if (cupst(j,idd) == krun)
then
1118 cupst(j,idd) = nshrun + nadd2
1119 else if (cupst(j,idd) > krun .and. cupst(j,idd) <= nshrun)
then
1120 cupst(j,idd) = cupst(j,idd) + nadd
1121 else if (cupst(j,idd) > krun .and. cupst(j,idd) > nshrun)
then
1122 cupst(j,idd) = cupst(j,idd) + nadd2
1127 nshrun = nshrun + nadd
1129 cupst(1,ncrun+idd) = ic1
1130 cupst(2,ncrun+idd) = krun + idd
1131 cupst(3,ncrun+idd) = nshrun + idd
1134 ncrun = ncrun + nadd
1137 end do all_shell_loop
1141 do while (i /= cupst(3,i) - kdst)
1142 it = cupst(3,i) - kdst
1145 cupst(j,it) = cupst(j,i)
1153 if (symtyp < 2)
then
1154 call cplea (nncsf, nadel, x, nftw)
1156 call cplem (nncsf, nadel, x, nftw)
1161 if (loopf(ksi) == 0)
then
1164 kdst = kdst - ksss(ksi)
1171 if (occshl(ksi) == 0) cycle ksi_loop
1172 if (occshl(ksi) /= 0)
continue
1177 410 kss_loop:
do while (kss <= pqn(3,ksi) - pqn(2,ksi))
1180 occst(kdst) = min(nela, shlmx1(sshl(ksi)))
1181 if (kss /= 1 .and. kdst > 1) occst(kdst) = min(nela, occst(kdst-1))
1182 pqnst(1:3,kdst) = pqn(1:3,ksi)
1183 mshlst(kdst) = mshl(ksi)
1184 gushst(kdst) = gushl(ksi)
1185 sshlst(kdst) = sshl(ksi)
1186 nela = nela - occst(kdst)
1197 occst(kdst) = occst(kdst) - 1
1199 if (occst(kdst) /= 0)
go to 410
1212 if (ksi <= 0)
exit ksi_loop
1213 if (loopf(ksi) == 0)
then
1217 kdst = kdst - ksss(ksi)
1228 120
if (occshl(kdsb) == 0)
go to 140
1229 occshl(kdsb) = occshl(kdsb) - 1
1231 if (nndel /= 0 .and. nadel > nndel)
exit orbital_set_loop
1232 if (kds < nshlp(kprod)) cycle shell_loop
1233 neleft = neleft + occshl(kdsb)
1235 nslots = nslots + shlmx(kdsb)
1239 130 unkds_loop:
do while (kds /= 0)
1240 if (occshl(kdsb) /= 0)
then
1241 occshl(kdsb) = occshl(kdsb) - 1
1243 if (nndel /= 0 .and. nadel > nndel)
exit orbital_set_loop
1246 nslots = nslots + shlmx(kdsb)
1251 140 kprod = kprod - 1
1252 if (kprod == 0)
exit orbital_set_loop
1253 ibias = ibias - nshlp(kprod)
1254 nslots = nslsv(kprod)
1261 end do orbital_set_loop
1282 use precisn,
only : wp
1284 integer :: ni, nj, nt
1285 real(kind=wp),
dimension(*) :: ci, cj
1286 integer,
dimension(2,ni,*) :: iqn
1287 integer,
dimension(2,nj,*) :: jqn
1288 intent (in) ci, iqn, ni, nj, nt
1289 intent (out) cj, jqn
1291 jqn(1:2,1:nj,1:nt) = iqn(1:2,1:nj,1:nt)
1301 use global_utils,
only : getin
1302 use congen_data ,
only :
confpf,
ndist,
ne,
nshl,
ntyp,
occshl, pqnr =>
pqnst,
mshl,
gushl,
qnshl, &
1306 integer,
dimension(*),
intent(in) :: qnstor
1309 integer :: i, ii, imax, j, jj, k, kf, ki, klabel, lt, lta, nlex, nstar
1310 character(len=4),
dimension(3,4) :: label = reshape((/
' NTY',
'P=XX',
'X ', &
1311 ' NDI',
'ST=Y',
'YYY ', &
1312 ' NST',
'ATE=',
'ZZZ ', &
1313 ' ',
' ',
' ' /) , (/ 3, 4/))
1314 character(len=16),
parameter :: frmt =
'(3A4,A8,I8,8I12)'
1315 character(len=1),
dimension(12,4) :: labell
1317 equivalence(label(1,1), labell(1,1))
1323 if (
symtyp == 1) nlex = 1
1327 call getin (
ntyp, 3, labell(7,1), 0)
1342 call addl (5 + nlex)
1343 write(
nftw,frmt) (label(j,klabel), j=1,3),
header(1), (j, j=i,imax)
1351 write(
nftw,
'(3A4,A8,9(A3,2(I2,","),I2,")"))')
blnk43,
header(5), (
lp, (pqnr(jj,j), jj=1,3), j=i,imax)
1353 write(
nftw,
'(3A4,A8,9(A3,2(I2,","),I2,")"))')
blnk43,
header(6), (
lp, (
qnshl(jj,j), jj=1,3), j=i,imax)
1367 if (lt > 0)
write(
nftw,
'(" ",132A1)') (
star, j=1,nstar)
1372 call getin (ii, 4, labell(8,2), 0)
1375 call addl (4 + nlex)
1376 write(
nftw,frmt) (label(j,klabel), j=1,3),
header(1), (j, j=i,imax)
1382 kf = ki + (imax - i)
1393 write(
nftw,
'(" ",19("*"),5X,"TOTAL NUMBER OF DISTRIBUTIONS FOR NTYP =",I3," IS",I5)')
ntyp,
ndist
1400 if (lt > 0)
write(
nftw,
'(" ",132A1)') (
star, j=1,nstar)
1410 use global_utils,
only : getin
1411 use congen_data,
only :
confpf,
ncsf,
ndist,
nshl,
nstate,
cup,
qnshl,
symtyp,
nftw,
blnk43,
header,
lp,
nitem
1417 integer :: i, imax, j, jj, kf, ki, klabel, ncsff, ncsfi, nshlm1
1418 character(len=4),
dimension(3,4) :: label = reshape((/
' NTY',
'P=XX',
'X ', &
1419 ' NDI',
'ST=Y',
'YYY ', &
1420 ' NST',
'ATE=',
'ZZZ ', &
1421 ' ',
' ',
' '/) , (/ 3, 4/))
1422 character(len=1),
dimension(12,4) :: labell
1424 equivalence(label(1,1), labell(1,1))
1430 call getin (
nstate, 3, labell(9,3), 0)
1431 if (nshlm1 <= 0)
then
1433 write(
nftw,
'(3A4,A8,I8,8I12)') (label(j,3), j=1,3)
1438 do i = 1, nshlm1,
nitem
1439 imax = min(i +
nitem - 1, nshlm1)
1441 write(
nftw,
'(3A4,A8,9(A3,2(I2,","),I2,")"))') (label(j,klabel), j=1,3),
header(7), (
lp, (
cup(jj,j), jj=1,3), j=i,imax)
1444 kf = ki + (imax - i)
1445 write(
nftw,
'(3A4,A8,9(A3,2(I2,","),I2,")"))')
blnk43,
header(6), (
lp, (
qnshl(jj,j), jj=1,3), j=ki,kf)
1447 write(
nftw,
'(3A4,A8,9(A3,2(I2,","),I2,")"))')
blnk43,
header(6), (
lp, (
qnshl(jj,j), jj=1,3), j=ki,kf)
1456 if (iidis1 /= 0)
then
1457 ncsfi =
ncsf - iidis1 + 1
1465 write(
nftw,
'(" ",19("*"),5X,"CSF NUMBERS",I6," TO",I6," GENERATED FOR NSTATE=",I3)') ncsfi, ncsff,
nstate
1478 integer,
intent(in) :: i13, iidis1
1480 integer :: i, j, lt, ncsfi, nstar, nstot
1489 ncsfi =
ncsf + 1 - nstot
1493 write(
nftw,
'(" ",19("*"),5X,"TOTAL NUMBER OF STATES FOR NTYP=",I3," IS",I4)')
ntyp,
nstate
1494 write(
nftw,
'(20X,"CSF NUMBERS",I10," TO",I10," (",I9," CSFS) GENERATED")') ncsfi,
ncsf, nstot
1499 if (lt > 0)
write(
nftw,
'(" ",132A1)') (
star, j=1,nstar)
1509 use precisn,
only : wp
1514 integer,
dimension(*) :: ix
1515 real(kind=wp),
dimension(*) :: x
1516 intent (in) ix, nd, x
1518 integer :: ie, ind, ip, ipi, it, j, nl, nitem
1525 nl = (
ne + nitem - 1) / nitem
1530 write(
nftw,
'(30X,"NUMBER OF DET IS",I3)') nd
1533 do ie = 1,
ne, nitem
1535 ipi = ip + min(nitem - 1,
ne - ie)
1537 write(
nftw,
'(45X,20I4)') (ix(j), j=ip,ipi)
1539 write(
nftw,
'(I25,5X,E15.8,20I4)') ind, x(ind), (ix(j), j=ip,ipi)
1557 integer,
dimension(*) :: ndi
1560 integer :: ind, ip, ipi, j, nrep
1567 write(
nftw,
'(35X,2I5)') ind, nrep
1577 write(
nftw,
'(35X,2I5,21I4/(45X,21I4))') ind, nrep, (ndi(j), j=ipi,ip)
1579 write(
nftw,
'(30X,3I5,21I4/(45X,21I4))')
ncsf, ind, nrep, (ndi(j), j=ipi,ip)
1585 write(
nftw,
'(45X,21I4)') (ndi(j), j = ipi,ip)
1602 subroutine state (ns, x, last, nd, confpf)
1604 use iso_c_binding,
only : c_loc, c_f_pointer
1605 use precisn,
only : wp
1608 integer :: confpf, last, nd, ns
1609 real(kind=wp),
dimension(*),
target :: x
1610 intent (in) confpf, last
1611 intent (inout) nd, x
1613 integer :: ic, id, intpfg, iqns, jqns, lc, ld, ldp, ldq, nam, ndmx, nt, ntmx
1615 real(wp),
pointer :: x_ptr
1616 integer,
pointer,
dimension(:) :: iqns_ptr, jqns_ptr, ld_ptr
1620 intpfg = merge(1, 0, confpf > 40)
1624 ntmx = last / (nam + nam + 1)
1629 x_ptr => x(iqns) ;
call c_f_pointer (c_loc(x_ptr), iqns_ptr, (/1/))
1631 call wfcple (nam, iqn, isz,
cup, iqns_ptr, x(ic), ntmx, nt, intpfg)
1635 jqns = last - 2 * ns * nt + 1
1639 x_ptr => x(jqns) ;
call c_f_pointer (c_loc(x_ptr), jqns_ptr, (/1/))
1641 call packdet (iqns_ptr, nam, jqns_ptr, ns, x(1), x(lc), nt)
1643 ndmx = (lc - 1) / (
ne + 1)
1647 x_ptr => x(ld) ;
call c_f_pointer (c_loc(x_ptr), ld_ptr, (/1/))
1649 call getso (ns, intpfg, nt, jqns_ptr, x(lc), nd, ld_ptr, x(ic), ndmx)
1662 end subroutine state
1667 subroutine wfcple (nam, iqn, isz, icup, iqns, c, last, lc2, intpfg)
1669 use precisn,
only : wp
1670 use consts,
only : one => xone
1673 integer :: intpfg, isz, last, lc2, nam
1674 real(kind=wp),
dimension(*) :: c
1675 integer,
dimension(3,lg) :: icup
1676 integer,
dimension(3,*) :: iqn
1677 integer,
dimension(2,nam,*) :: iqns
1678 intent (in) icup, isz, last, nam
1679 intent (inout) c, iqns, lc2
1681 integer :: i, iam, ic, init, j, l, lc, lc1, lc3, m, mp, ms, n, n1, n2, n3, nc, niam, niam1
1682 logical,
dimension(nam) :: ind
1683 integer,
dimension(2,200) :: iszt
1684 real(kind=wp) :: sign
1687 iqns(2,nam,1) = iqn(2,nam)
1690 if (nam == 1)
return
1694 niam = (nam + 1) / 2
1696 110
if (ind(n3))
then
1697 if (n3 <= niam)
go to 299
1699 init = last - lc2 + 1
1703 iqns(1:2,1:nam,l) = iqns(1:2,1:nam,lc)
1709 300
if (icup(3,n) == n3)
then
1712 if (n1 > n3 .or. n2 > n3)
go to 299
1713 if (.not.ind(n1) .or. .not.ind(n2))
go to 299
1714 if (n1 <= niam) ind(n1) = .false.
1715 if (n2 <= niam) ind(n2) = .false.
1718 iqns(2,n1,l) = iqn(2,n1)
1719 iqns(2,n2,l) = iqn(2,n2)
1721 if (abs(m) /= iqn(2,n1) + iqn(2,n2))
then
1722 mp = iqn(2,n1) - iqn(2,n2)
1723 if (abs(m) /= abs(mp))
go to 511
1726 iqns(2,n,l) = -iqns(2,n,l)
1727 else if (iqns(2,n3,l) < 0)
then
1728 iqns(2,n1,l) = -iqns(2,n1,l)
1729 iqns(2,n2,l) = -iqns(2,n2,l)
1733 call cgcoef (iqn(1,n1), iqn(1,n2), iqn(1,n3), ms, nc, iszt, c(lc1), intpfg)
1736 if (lc2 >= l)
go to 899
1739 iqns(1:2,1:nam,lc) = iqns(1:2,1:nam,l)
1740 iqns(1,n1,lc) = iszt(1,ic)
1741 iqns(1,n2,lc) = iszt(2,ic)
1743 c(lc) = c(lc) * c(l)
1745 if (iqns(2,n3,l) < 0)
then
1746 if (iqn(3,n1) >= 0 .and. iqn(3,n2) >= 0) cycle
1747 c(lc1:lc2) = -c(lc1:lc2)
1748 else if (iqns(2,n3,l) == 0)
then
1749 if (iqn(2,n1) /= 0)
then
1750 if (lc2 + nc >= l)
go to 899
1753 if (iqn(3,n3) < 0) sign = -one
1756 iqns(1:2,1:nam,lc2) = iqns(1:2,1:nam,lc)
1757 iqns(2,n1,lc2) = -iqns(2,n1,lc2)
1758 iqns(2,n2,lc2) = -iqns(2,n2,lc2)
1759 c(lc) = c(lc) *
root2
1760 c(lc2) = c(lc) * sign
1764 if (iqn(3,n1) * iqn(3,n2) /= iqn(3,n3))
go to 511
1773 if (n < niam)
go to 300
1777 if (n3 > 0)
go to 110
1780 299 niam1 = niam - 1
1781 write(
nftw,
'("0ERROR IN COUPLING TREE"//(3I5))') ((icup(i,j), i=1,3), j=1,niam1)
1785 511
write(
nftw,
'("0COUPLING IMPOSSIBLE MULTIPLICITIES FOLLOW"//(3I5))') (iqn(i,n1), iqn(i,n2), iqn(i,n3), i=1,3)
1789 899
write(
nftw,
'("0STORAGE OVERFLOW IN VECTOR COUPLING")')
1814 subroutine wfn (nncsf, nadel, iidist, iidis3, nodi, ndi, cdi, ndel, pqnshl, x, ix, nx)
1820 use precisn,
only : wp
1821 use congen_data,
only :
lratio,
iidis2,
lcdi,
lndi,
ni,
nid,
noi,
exdet,
exref,
norep,
nonew,
ntso, &
1825 integer :: iidis3, iidist, nadel, nncsf, nx
1826 real(kind=wp),
dimension(*) :: cdi, x
1827 integer,
dimension(*) :: ix, ndel, ndi, nodi, pqnshl
1828 intent (in) ndel, pqnshl
1830 intent (inout) cdi, iidist, nadel, ndi, nncsf, nodi
1832 integer :: det, i, ia, ib, id, idist, iidis1, irep, j, k, k1, kshl, kshlst, lf, li, nd, nii
1838 if (
ncall == 1)
then
1853 write(
nftw,
'("1","******* ERROR IN WFN ND=0"//)')
1858 if (
ndist == 0)
return
1870 if (
nndel /= 0 .and. ndel(nadel) /= nncsf)
then
1871 kshlst = kshlst +
nshl
1876 if (
nndel /= 0)
then
1882 ia = nd * (2 * nelec + 1) +
ni
1886 if (ia > jmx .or. ib > nidmx .or. k1 > noimx)
then
1910 det = ix(k) +
nsoi(sshl(i)) + (pqnshl(kshl) - 1) *
shlmx1(sshl(i))
1930 if (
ni + 2 * irep >
ndimx)
then
1931 write(
nftw,
'("******* ERROR IN WFN, NDIMX TOO SMALL",2I10)')
ni + 2 * irep,
ndimx
1950 if (
noi > noimx)
then
1951 write(
nftw,
'("******* ERROR IN WFN, NODIMX TOO SMALL",2I10)')
noi, noimx
1959 if (
nid + nd > nidmx)
then
1960 write(
nftw,
'("******* ERROR IN WFN, CDIMX TOO SMALL",2I10)')
nid + nd, nidmx
1973 iidis1 = iidis1 + iidist