51 use precisn,
only : wp
52 use consts,
only : zero => xzero, two => xtwo
53 use congen_data,
only :
mxtarg,
nx =>
nu,
ny,
nz,
jx,
jy,
jz,
ky,
kz,
ntcon,
test,
nrcon,
nobt, &
54 nsym,
nobi,
ift,
next, navail =>
nx,
icdi,
iexcon,
indi,
inodi,
iqnstr, &
55 irfcon,
ndel,
ndel1,
ndel2,
exref,
ntso,
nodimx,
cdimx,
ndimx,
megul,
nsoi,
nncsf, &
60 use iso_c_binding,
only : c_loc, c_f_pointer
65 real(wp),
allocatable,
dimension(:),
target :: bmx
66 real(wp),
pointer :: bmx_ptr
67 integer,
dimension(:),
pointer :: int_ptr, ndel_ptr, ndel1_ptr, ndel2_ptr, irfcon_ptr
68 integer :: byproj, cdimn, conmes, d, defltc, guold,
gutot, i, idiag, iposit, is, iscat, iso, isz, itu, j, lc, lcdi, &
69 lcdo, lcdt, ln, lndi, lndo, lndt, lpp, lsquare, ltri, maxtgsym, megu, mflag, mold, mt, n, nadel, nbmx, &
70 nconmx, ncsf0, ncupp, ndimn, ndpmax, ndpp, ndprod, negmax, negr, nelecg, nelect, nelp, nelr, nemax, nerfg, &
71 nerfs, nextk, nfto,
nndel, nobep, nodimn, npcupf, npmult, nrefo, nrefog, nrefop, nrerun, nrfgmx, nrfgoe, &
72 nrfoe, nrfomx, ns, nshgmx, nshlp0, nshlpt, nspf, nspi, nsymmx, nsymp, ntconp, err
73 integer,
dimension(3,jx) ::
cup, pqn
74 logical :: ene, ener, enob, enrefo, epsno, eqnt, erefd, error, errorg, espace, esymt, qmoln
75 logical,
dimension(11) :: erfg
76 logical,
dimension(9) :: erfs
77 character(len=80) :: gname, sname
78 integer,
dimension(mxtarg) :: gucont, mcont, mdegen, mrkorb, nctgt, notgt
80 integer,
dimension(jy) :: kdssv, nelecp, nshlp, nslsv
81 integer,
dimension(nx) :: nob, nob0, nob0l, nobl
82 integer,
dimension(nx) :: nobe, nobp, nobv
83 integer,
dimension(6) :: npflg
84 integer,
dimension(jz) :: nshcon
85 integer :: ntgsmx, ntgsym, nwfngp, pqn2,
symtyp
86 real(kind=wp) :: pin, r, s, sz, thres
88 integer,
dimension(nz) :: refdet
89 integer,
dimension(kz) :: refdtg
90 integer,
dimension(ny) :: refgu
91 integer,
dimension(ky) :: refgug
92 integer,
dimension(5,ny) :: reforb
93 integer,
dimension(5,ky) :: reforg
94 integer,
dimension(3,jx,jz) :: tcon
96 equivalence(reforg(1,1), reforb(1,1))
97 equivalence(refgu(1), refgug(1))
100 equivalence(erfs(1), esymt)
101 equivalence(erfs(2), enob)
102 equivalence(erfs(3), epsno)
103 equivalence(erfs(4), ene)
104 equivalence(erfs(5), enrefo)
105 equivalence(erfs(6), ener)
106 equivalence(erfs(7), erefd)
107 equivalence(erfs(8), eqnt)
108 equivalence(erfs(9), espace)
111 namelist /state /
megul, nrerun, lcdt, lndt, nfto, ltri, idiag, thres, megu, npflg,
nodimx,
ndimx,
cdimx, &
112 byproj, lcdo, lndo,
nftw, iscat, ntgsym, sname, lpp,
confpf,
symtyp,
qntot,
gutot, isz, &
113 npmult, nob, reforb, refgu, nrefo, nelect,
nndel, qmoln, &
114 iposit, nob0, nbmx, nobe, nobp, nobv
116 namelist /wfngrp/ nelecg, ndprod, nelecp, nshlp, gname, reforg, refgug, nrefog,
mshl,
gushl, pqn,
cup, defltc, &
196 reforb(1:5,1:nrfomx) = -2
197 erfs(1:nerfs) = .false.
205 read(
nftr, state, iostat = i)
209 write(
nftw,
'("1***** NO INPUT DATA FOR NAMELIST &STATE")')
215 if (iscat <= 0) idiag = 0
216 if (iscat > 0) idiag = 1
226 if (nobp(i) == 0)
then
229 nobep = nobe(i) + nobp(i)
230 if (nobep /= nob(i))
then
231 write(
nftw,*)
'ERROR on input:'
232 write(
nftw,*)
'not: NOB(i)=NOBE(i)+NOBP(i)'
233 write(
nftw,*)
'i=', i
234 write(
nftw,*)
'NOB(i)=', nob(i)
235 write(
nftw,*)
'NOBE(i)=', nobe(i)
236 write(
nftw,*)
'NOBP(i)=', nobp(i)
238 if (nobv(i) == 0)
then
241 if (nob0(i) > nob(i))
then
242 write(
nftw,*)
'ERROR on input:'
243 write(
nftw,*)
'NOB0(i) > NOB(i)'
244 write(
nftw,*)
'i=', i
245 write(
nftw,*)
'NOB(i)=', nob(i)
246 write(
nftw,*)
'NOB0(i)=', nob0(i)
253 if (nob(i) /= 0)
nsym = i
281 ene = (nelect <= 0 .or. nelect > nemax)
285 if (.not. any(erfs))
then
288 call getref (reforb, refgu, nrefo, nelect, refdet, nelr,
nsoi, nob,
shlmx1,
nsym,
symtyp, nrfomx, enrefo, ener, erefd)
292 if (.not. enrefo) nrefop = nrefo
294 if (isz == 0) isz =
qntot(1)
299 .or. (abs(isz - 1) >
qntot(1) - 1) &
318 navail = nbmx -
next + 1
334 write(
nftw,
'(" NBMX =",I9," WORDS")') nbmx
335 write(
nftw,
'(" ***** REGION USED FOR INPUT DATA ",I7," WORDS ",I5," K")')
next, nextk
336 write(
nftw,
'(" ***** LEFT ",I9," WORDS")') navail
339 espace = (navail <= 0)
344 call stwrit (nelect,
confpf,
qntot,
cdimx,
icdi,
ntso,
symtyp,
ndimx,
indi, nrefo,
nodimx,
inodi,
nsym,
gutot, nbmx, &
345 isz, navail, idiag, megu, thres, lcdt,
megul, lndt, nfto, nrerun, ltri, npflg,
nndel, nob,
nsoi, nsymp, &
346 refdet, nerfs, erfs, nrefop, reforb, refgu, nelp, lpp, sname, error, byproj, lndo, lcdo, iposit, nob0, &
347 npmult, ntgsym,
mxtarg, nobe, nobp, nobv)
351 bmx_ptr => bmx(
ndel) ;
call c_f_pointer (c_loc(bmx_ptr), ndel_ptr, (/1/))
352 bmx_ptr => bmx(
ndel1) ;
call c_f_pointer (c_loc(bmx_ptr), ndel1_ptr, (/1/))
353 bmx_ptr => bmx(
ndel2) ;
call c_f_pointer (c_loc(bmx_ptr), ndel2_ptr, (/1/))
354 call subdel (ndel_ptr, ndel1_ptr, ndel2_ptr,
nndel)
358 call wfnin (nwfngp, nadel,
nncsf,
ncsf, lcdi, lndi, nelecg, ndprod, nrefog, npcupf, negmax, refdtg, nrfgmx, refgug, &
359 ntcon, reforg, nshgmx, nsymmx,
mshl,
gushl, pqn,
cup, ndpmax, nshlp, nconmx,
test,
nrcon, nshcon, tcon, errorg)
372 wfngrp_loop:
do while (
nndel == 0 .or. nadel <
nndel)
375 call wfnin0 (nelecp, defltc, nerfg, erfg, gname,
qntar, errorg, ndpmax)
378 read(
nftr, wfngrp, iostat = i)
384 if (nwfngp == 0)
then
385 write(
nftw,
'(" ***** NO WFNGRP INPUT FOUND")')
388 write(
nftw,
'(" ***** END OF FILE ON INPUT")')
392 write(*,*)
'lsquare =', lsquare
395 nshlpt = sum(abs(nshlp(1:ndprod)))
398 if (iscat < 2 .or. mold < -1)
then
402 else if (mold ==
mshl(nshlpt) .and. (
symtyp /= 1 .or. guold ==
gushl(nshlpt)) .and. &
403 all(
qntar(1:3) == qntar1(1:3)) .and. pqn2 == pqn(2,nshlpt) .and. lsquare /= 1)
then
406 if (notgt(ntgsym) /= pqn(3,nshlpt) - pqn(2,nshlpt) + 1)
then
407 write(
nftw,
'(//," Attempt to perform CI target calculation with different length continua for same target:")')
408 write(
nftw,
'( " Number of continua, last WFNGRP",I4)') notgt(ntgsym)
409 write(
nftw,
'( " Number of continua, this WFNGRP",I4)') pqn(3,nshlpt) - pqn(2,nshlpt) + 1
410 write(
nftw,
'( " STOP")')
417 if (ntgsym >= 1)
then
418 nctgt(ntgsym) = (
ncsf - ncsf0) / notgt(ntgsym)
419 mrkorb(ntgsym) = nspi
422 if (
qntar(1) <= 0 .or. ntgsym == ntgsmx)
then
431 if (lsquare == 0) maxtgsym = maxtgsym + 1
432 write(
nftw,
'(/," Target state number",I3) ') ntgsym
433 write(
nftw,
'(" TARGET MULTIPLICITY =",I5,5X,"TARGET SYMMETRY =",I5,5X,"TARGET INVERSION SYMMETRY =",I5)')
qntar
434 write(
nftw,
'(" Coupling to continuum with M =",I3)')
mshl(nshlpt)
438 notgt(ntgsym) = pqn(3,nshlpt) - pqn(2,nshlpt) + 1
439 mcont(ntgsym) =
mshl(nshlpt)
446 mdegen(ntgsym) = max(
qntot(2),
qntar(2)) - mcont(ntgsym)
449 qntar1(1:3) =
qntar(1:3)
463 if (nelecg <= 0 .or. nelecg > negmax)
go to 150
465 ndprod = max(1, ndprod)
467 if (ndprod > ndpmax)
go to 150
472 nelecp(1:ndprod) = abs(nelecp(1:ndprod))
473 nshlp(1:ndprod) = abs(nshlp(1:ndprod))
474 negr = sum(nelecp(1:ndprod))
475 nshlpt = sum(nshlp(1:ndprod))
477 erfg(3) = (any(nshlp(1:ndprod) == 0))
479 nshlp0 = nshlpt - nshlp(ndprod)
480 if (nshlpt > nshgmx) erfg(3) = .true.
481 if (negr /= nelecg) erfg(4) = .true.
482 if (erfg(3) .or. erfg(4))
go to 150
485 call getref (reforg, refgug, nrefog, nelecg, refdtg, nelr,
nsoi, nob,
shlmx1, &
486 nsym,
symtyp, nshgmx, erfg(5), erfg(6), erfg(7))
488 if (.not. erfg(5)) nrefop = nrefog
489 if (.not. erfg(6)) nelp = nelecg
490 if (erfg(5) .or. erfg(6) .or. erfg(7))
go to 150
494 exref(refdet(1:nelect)) = 1
495 if (any(
exref(refdtg(1:nelecg)) == 0)) erfg(7) = .true.
496 exref(refdtg(1:nelecg)) = 0
497 if (erfg(7))
go to 150
501 if (iposit /= 0 .and. nelecp(ndprod) /= 1)
go to 150
506 if (abs(
gushl(i)) /= 1)
go to 150
508 if (mod(mt,2) == 0) itu = -1
509 mt = mt + mt - abs((
gushl(i) + itu) / 2)
512 if (mt >
nsym)
go to 150
513 if (pqn(1,i) /= 0)
then
517 d = pqn(3,i) - pqn(2,i)
519 shlmx(i) =
shlmx1(mt) * (d + 1)
521 nspf = nspi + shlmx(i) - 1
522 if (iposit /= 0 .and. i >= nshlp0) cycle
523 if (any(
exref(nspi:nspf) /= 0))
go to 150
524 if (pqn(3,i) > nob(mt))
then
525 write(
nftw,
'(//," Error: PQN number",i3," accesses orbital number",i3)') i, pqn(3,i)
526 write(
nftw,
'( " symmetry",i2," only contains",i3," orbitals")') mt, nob(mt)
534 call getcup (nshlpt, defltc, ndprod, nshlp,
cup(1,1), erfg(9))
535 if (erfg(9)) npcupf = 1
540 if (
ntcon == 0)
go to 150
543 navail = nbmx -
next + 1
545 write(
nftw,
'(" ***** REGION USED FOR DETERMINANTS ",I7," WORDS ",I5," K")')
next, nextk
546 write(
nftw,
'(" **** LEFT ",I7," WORDS")') navail
547 if (navail <= 0) erfg(11) = .true.
550 bmx_ptr => bmx(
irfcon) ;
call c_f_pointer (c_loc(bmx_ptr), irfcon_ptr, (/1/))
559 bmx_ptr => bmx(
irfcon) ;
call c_f_pointer (c_loc(bmx_ptr), irfcon_ptr, (/1/))
561 navail, nrefog, nelecp, nshlp,
qntar, nshlpt, nshgmx,
mshl, &
562 gushl, pqn,
cup, ncupp, npcupf, refdtg, nelp, ntconp, nshcon, &
564 erfg, ndpp, nrefop, errorg)
570 nqntot(1:3) =
qntot(1:3)
571 nqntar(1:3) =
qntar(1:3)
579 exref(refdtg(1:nelecg)) = 1
586 call distrb (nelecp, nshlp, shlmx,
occshl, nslsv, kdssv, loopf, ksss, pqn, &
592 bmx_ptr => bmx(1) ;
call c_f_pointer (c_loc(bmx_ptr), int_ptr, (/1/))
603 if (ntgsym >= 1)
then
605 nctgt(ntgsym) = (
ncsf - ncsf0) / notgt(ntgsym)
606 mrkorb(ntgsym) = nspi
613 if (mdegen(ntgsym) > 0) mdegen(ntgsym) = 0
615 if (mdegen(n) > 0)
then
616 if (mdegen(n-1) <= 0)
then
617 write(
nftw,
'(/," WARNING: for target state number",I3)') ntgsym
618 write(
nftw,
'( " Coupling to upper continuum only detected")')
619 write(
nftw,
'( " Calculation may give target phase problems")')
621 else if (nctgt(n) /= nctgt(n-1))
then
622 write(
nftw,
'(/," Target states",I3," and",I3)') n - 1, n
623 write(
nftw,
'( " analysed for degenerate coupling to the continuum")')
624 write(
nftw,
'( " But number of CSFs differ:",I6," and",I6," respectively: STOP")') nctgt(n-1), nctgt(n)
627 else if (mdegen(n) > 0)
then
628 if (mdegen(n-1) > 0) mdegen(n-1) = 0
630 if (mdegen(n) /= 0) mflag = max(mflag, nctgt(n))
638 write(
nftw,
'(" ********** TOTAL NUMBER OF CSF''S GENERATED IS ",I9)')
ncsf
644 if (qmoln .and. iscat < 2 .and.
megul == 70)
then
646 open(unit = conmes, status =
'unknown')
647 write(conmes,
'(/," *** TOTAL NUMBER OF GENERATED CSF''S FOR THE GROUND STATE IS ",I6)')
ncsf
649 if (
ncsf <= 600)
then
650 write(conmes,
'("*** This target calculation should not take long !",/)')
651 else if (
ncsf > 600 .and.
ncsf < 12000)
then
652 write(conmes,
'("*** This target calculation will take a few hours !")')
653 write(conmes,
'("*** You can have a cup of tea and come back later.",/)')
654 else if (
ncsf > 12000 .and.
ncsf <= 22000)
then
655 write(conmes,
'("*** Oops, This target calculation is very big !")')
656 write(conmes,
'("*** You can come back tomorrow.",/)')
657 else if (
ncsf > 22000 .and.
ncsf <= 80000)
then
658 write(conmes,
'("*** Oops, This target calculation is very big ")')
659 write(conmes,
'("*** and can take several days to run !",/)')
660 else if (
ncsf > 80000)
then
661 write(conmes,
'("*** Oops, This target calculation is too big ")')
662 write(conmes,
'("*** to be computationally possible !")')
663 write(conmes,
'("*** Rerun with a smaller basis or contact ")')
664 write(conmes,
'("*** technical support: support@quantemol.com")')
671 s = real(
qntot(1) - 1,kind = wp) / two
672 sz = real(isz - 1, kind = wp) / two
681 pin = real(
gutot, kind = wp)
685 nob(j) = nob(i) + nob(i+1)
686 nob0(j) = nob0(i) + nob0(i+1)
691 if (
allocated(bmx))
deallocate(bmx)
699 if (byproj > 0 .or. iscat > 0)
then
700 call projec (sname,
megul,
symtyp,
qntot(2), s, sz, r, pin,
ncsf, byproj, idiag, npflg, thres, nelect,
nsym, &
701 nob, refdet,
nftw, iposit, nob0, nobl, nob0l, iscat, ntgsym, notgt, nctgt, mcont, gucont, mrkorb, &
702 mdegen, mflag, nobe, nobp, nobv, maxtgsym)
707 call wrnmlt (megu, sname, nrerun,
megul,
symtyp,
qntot(2), s, sz, r, pin,
ncsf, byproj, lcdi, lndi, lcdo, lndo, &
708 lcdt, lndt, nfto, ltri, idiag, npflg, thres, nelect,
nsym, nob, refdet,
nftw, iposit, nob0, nobl, &
709 nob0l,
nx, nobe, nobp, nobv)
715 call wrnmlt (
nftw, sname, nrerun,
megul,
symtyp,
qntot(2), s, sz, r, pin,
ncsf, byproj, lcdi, lndi, lcdo, lndo, &
716 lcdt, lndt, nfto, ltri, idiag, npflg, thres, nelect,
nsym, nob, refdet,
nftw, iposit, nob0, nobl, &
717 nob0l,
nx, nobe, nobp, nobv)
752 subroutine csfout (ia, ib, megul, nndel, cr, nr)
754 use precisn,
only : wp
755 use congen_data,
only :
lratio,
iidis2,
lcdi,
lndi,
ni,
nid,
noi,
icdi,
indi,
inodi
757 integer :: ia, ib, megul, nndel
758 real(kind=wp),
dimension(*) :: cr
759 integer,
dimension(*) :: nr
760 intent (in) cr, megul, nndel, nr
765 if (
noi /= 0 .or.
ni /= 0 .or.
nid /= 0)
then
767 if (nndel == 0 .or.
iidis2 /= 0)
then
789 subroutine getcon (ntcon, nshcon, nrcon, nshgmx, npmax, nc, nelecg, nsym, nobt, nob, nobi, nsoi, shlmx1, exref, tcon, &
793 integer :: nc, nelecg, nobt, npmax, nshgmx, nsym, ntcon
794 integer,
dimension(*) :: exref, nob, nobi, nrcon, nshcon, nsoi, shlmx1
795 integer,
dimension(nobt,*) :: refcon
796 integer,
dimension(3,nshgmx,*) :: tcon
797 intent (in) exref, nelecg, nob, nobi, nobt, npmax, nrcon, nshgmx, nsoi, nsym, ntcon, shlmx1, tcon
799 intent (inout) nc, nshcon, refcon
801 integer :: ic, j, k, nel, nesym, net, netc, noc, ns, nshcr, nspf, nspi, pqnt, pqntm, symt
805 if (ntcon == 0)
return
813 if (nshcr <= nshgmx)
then
818 if (nrcon(ic) < 0 .or. nrcon(ic) > nelecg)
return
821 symt = tcon(1,j,ic) + 1
824 if (symt <= 0 .or. symt > nsym)
return
828 pqntm = pqnt + (net - 1) / nesym
829 if (pqnt <= 0 .or. pqntm > nob(symt))
return
830 nspi = nsoi(symt) + (pqnt - 1) * nesym
831 nspf = nspi + ((net + 1) / nesym) * nesym - 1
833 if (exref(ns) /= 0)
return
835 noc = nobi(symt) + pqnt - 1
839 if (refcon(noc,ic) /= 0)
return
840 refcon(noc,ic) = min(nesym, net)
844 if (netc /= nelecg)
return
853 subroutine getcup (nshlt, def, nd, nshlp, cup, error)
855 integer :: def, nd, nshlt
857 integer,
dimension(3,nshlt) :: cup
858 integer,
dimension(nd) :: nshlp
859 intent (in) def, nd, nshlp, nshlt
863 integer :: i, i1cup, i2cup, ifc, ifcup, ii, iicup, itest, j, nc, ncup, ncup2, ndm1, ns1, ns2, nsc1, nsc2
866 if (nshlt == 1)
return
897 nsc2 = nsc1 + (nshlp(i + 1) - 1)
902 if (nshlp(i) /= 1) i1cup = cup(3,nsc1)
903 if (nshlp(i+1) /= 1) i2cup = cup(3,nsc2)
904 if (i > 1) i1cup = cup(3,ifc-1)
920 if (cup(3,i) /= itest)
return
921 if (cup(1,i) >= itest .or. cup(2,i) >= itest)
return
928 if (cup(1,j) == i) nc = nc + 1
929 if (cup(2,j) == i) nc = nc + 1
967 subroutine getref (reforb, refgu, nrefo, nelec, refdet, nelr, nsoi, nob, shlmx, nsym, symtyp, nrfomx, e1, e2, e3)
969 logical :: e1, e2, e3
970 integer :: nelec, nelr, nrefo, nrfomx, nsym, symtyp
971 integer,
dimension(*) :: nob, nsoi, refdet, shlmx
972 integer,
dimension(*) :: refgu
973 integer,
dimension(5,*) :: reforb
974 intent (in) nelec, nob, nrefo, nrfomx, nsoi, nsym, refgu, reforb, shlmx, symtyp
975 intent (out) e1, e2, e3
976 intent (inout) nelr, refdet
978 integer :: i, isot, j, jj, ne, neb, nelrm1, neo, ner, nesr, pqnr, pqnrm, symr, t1, tgu
986 if (nrefo <= 0 .or. nrefo > nrfomx)
then
992 nelr = sum(abs(reforb(3,1:nrefo)))
993 if (nelr /= nelec)
then
1003 symr = reforb(1,i) + 1
1008 if (symtyp == 1)
then
1011 if (abs(tgu) /= 1)
then
1024 if (mod(symr,2) /= 0) tgu = -tgu
1025 symr = 2 * symr - (1 - tgu) / 2
1029 if (symr <= 0 .or. symr > nsym .or. ne <= 0)
then
1036 pqnrm = pqnr + (ne - 1) / nesr
1037 if (pqnr <= 0 .or. pqnrm > nob(symr))
then
1043 isot = nsoi(symr) + (pqnr - 1) * nesr - 1
1045 ner = nelr + ne - neo
1046 neb = min(neo, nesr - neo)
1058 if (all(reforb(3+1:3+neb,i) == -1)) cycle
1061 isot = isot - neo + 1
1064 if (neo == neb)
then
1066 if (reforb(3+j,i) < 0 .or. reforb(3+j,i) > nesr)
then
1072 refdet(ner) = isot + reforb(3+j,i)
1078 nesr_loop:
do j = 1, nesr
1080 if (reforb(3+jj,i) < 0 .or. reforb(3+jj,i) > nesr)
then
1084 if (reforb(3+jj,i) < j - 1) cycle nesr_loop
1088 refdet(ner) = isot + j - 1
1095 if (nelrm1 > 0)
then
1100 if (t1 == refdet(jj))
return
1101 if (t1 <= refdet(jj)) cycle
1103 refdet(jj) = refdet(i)
1125 use precisn,
only : wp
1126 use consts,
only : one => xone
1129 integer :: i, jj, js, lb, lb1
1149 end subroutine icgcf
1161 subroutine stwrit (nelect, confpf, qntot, cdimx, icdi, ntso, symtyp, ndimx, indi, nrefo, nodimx, inodi, nsym, gutot, nbmx, &
1162 isz, navail, idiag, megu, thres, lcdt, megul, lndt, nfto, nrerun, ltri, npflg, nndel, nob, nsoi, nsymp, &
1163 refdet, nerfs, erfs, nrefop, reforb, refgu, nelp, lpp, sname, error, byproj, lndo, lcdo, iposit, nob0, &
1164 npmult, ntgsym, mxtarg, nobe, nobp, nobv)
1166 use precisn,
only : wp
1167 use global_utils,
only : mprod
1171 integer :: byproj, cdimx, confpf, gutot, icdi, idiag, indi, inodi, &
1172 iposit, isz, lcdo, lcdt, lndo, lndt, lpp, ltri, megu, &
1173 megul, mxtarg, navail, nbmx, ndimx, nelect, nelp, &
1174 nerfs, nfto, nndel, nodimx, npmult, nrefo, nrefop, &
1175 nrerun, nsym, nsymp, ntgsym, ntso, symtyp
1177 character(len=80) :: sname
1178 real(kind=wp) :: thres
1179 logical,
dimension(9) :: erfs
1180 integer,
dimension(nu) :: nob, nob0, nobe, nobp, nobv, nsoi
1181 integer,
dimension(6) :: npflg
1182 integer,
dimension(3) :: qntot
1183 integer,
dimension(*) :: refdet, refgu
1184 integer,
dimension(5,*) :: reforb
1185 intent (in) byproj, cdimx, confpf, erfs, gutot, icdi, idiag, indi, &
1186 inodi, iposit, isz, lcdo, lcdt, lndo, lndt, ltri, &
1187 megu, megul, mxtarg, navail, nbmx, ndimx, nelect, &
1188 nelp, nerfs, nfto, nndel, nob, nob0, nobe, nobp, nobv, &
1189 nodimx, npflg, nrefo, nrefop, nrerun, nsoi, nsym, &
1190 nsymp, ntgsym, ntso, qntot, refdet, refgu, reforb, &
1192 intent (inout) error
1194 character(len=32),
dimension(9) :: ersnts
1195 character(len=30) :: head =
'CONGEN 1.0 IBM SAN JOSE '
1196 integer :: i, ii, imax, ip, it, junk, lsn = 64, nitem = 30
1198 data ersnts/
'SYMMETRY TYPE OUT OF RANGE ', &
1199 'NO ORBITALS GIVEN ', &
1200 'EXDET, EXREF ALLOCATION FAILED ', &
1201 'NELECT OUT OF RANGE ', &
1202 'NREFO OUT OF RANGE ', &
1203 'SUM NELEC IN REF ORBS NE NELECT ', &
1204 'ERROR IN REFORB DATA ', &
1205 'ERROR IN TOTAL QN DATA ', &
1206 'NO CORE FOR CDI, NDI, AND NODI '/
1208 call ctlpg1 (lpp, head, len(head), sname, lsn)
1212 write(
nftw,
'(T2,"NELECT",T8,I4,T15,"CONFPF",I3,T27,"MULT ",I2,T38,"CDIMX ",I5,T52,"ICDI ",I6)') &
1213 nelect, confpf, qntot(1), cdimx, icdi
1214 write(
nftw,
'(" NTSO ",I4,T15,"SYMTYP",I3,T27,"MVAL ",I2,T38,"NIDMX ",I5,T52,"INDI ",I6)') &
1215 ntso, symtyp, qntot(2), ndimx, indi
1216 write(
nftw,
'(" NREFO ",I4,T27,"REFLC",I3,T38,"NODIMX",I5,T52,"INODI",I6)') nrefo, qntot(3), nodimx, inodi
1217 write(
nftw,
'(" NSYM ",I4,T27,"GUTOT",I3,T38,"NCORE",I10)') nsym, gutot, nbmx
1218 write(
nftw,
'(T27,"ISZ ",I3,T38,"NAV ",I10)') isz, navail
1220 write(
nftw,
'(//,T14," DATA FOR SPEEDY INPUT")')
1221 write(
nftw,
'(/, T14,"IDIAG ",I4,T27,"MEGU ",I3,T38,"THRES ",1PE12.4)') idiag, megu, thres
1222 write(
nftw,
'(T14,"LCDT ",I4,T27,"MEGUL",I3)') lcdt, megul
1223 write(
nftw,
'(T14,"LNDT ",I4,T27,"NFTO ",I3)') lndt, nfto
1224 write(
nftw,
'(T14,"NRERUN",I4,T27,"LTRI ",I3)') nrerun, ltri
1225 write(
nftw,
'(/,T14,"NPFLG =",6I3,2X,"NNDEL = ",I5)') npflg, nndel
1229 write(
nftw,
'(T14,"BYPROJ",I2,3x,"LNDO",I10,3x,"LCDO",I10)') byproj, lndo, lcdo
1231 if (ntgsym < mxtarg)
then
1233 write(
nftw,
'(" ntgsym",I4)') ntgsym
1239 write(
nftw,
'(" NSYM",30I5)') (ip, ip=1,nsymp)
1240 write(
nftw,
'(" NOB ",30I5)') (nob(ip), ip=1,nsymp)
1241 if (iposit /= 0)
then
1243 write(
nftw,
'(" NOB0",30I5)') (nob0(ip), ip=1,nsymp)
1244 write(
nftw,
'(" NOBE",30I5)') (nobe(ip), ip=1,nsymp)
1245 write(
nftw,
'(" NOBP",30I5)') (nobp(ip), ip=1,nsymp)
1246 write(
nftw,
'(" NOBV",30I5)') (nobv(ip), ip=1,nsymp)
1248 write(
nftw,
'(" NSOI",30I5)') (nsoi(ip), ip=1,nsymp)
1250 if (iposit /= 0)
then
1252 write(
nftw,
'(5X,"POSITRON SCATTERING CASE: IPOSIT =",I3)') iposit
1257 if (symtyp == 1) it = 2
1258 do i = 1, nrefop, nitem
1259 imax = min(i + nitem - 1, nrefop)
1262 write(
nftw,
'(" REFERENCE DETERMINANT INPUT DATA")')
1265 write(
nftw,
'(1X,A4,I5,29I4)')
rhead(1), (ip,ip=i,imax)
1267 write(
nftw,
'(1X,A4,I5,29I4)')
rhead(ii+1), (reforb(ii,ip), ip=i,imax)
1269 if (symtyp == 1)
write(
nftw,
'(1X,A4,I5,29I4)')
rhead(7), (refgu(ip), ip=i,imax)
1273 it = (nelp + nitem - 1) / nitem
1274 if (mod(nelp,nitem) == 0) it = it + 1
1278 write(
nftw,
'(" REFDET =",30(I3,",")/(9X,30(I3,",")))') (refdet(ip), ip=1,nelp)
1282 if (symtyp >= 2 .and. npmult /= 0)
then
1284 junk = mprod(1, 1, npmult,
nftw)
1291 if (.not. error)
then
1294 write(
nftw,
'(" **** ERROR DATA FOR &STATE FOLLOWS (&WFNGRP NOT PROCESSED)"/12X,A32)') ersnts(i)
1298 write(
nftw,
'(12X,A32)') ersnts(i)
1308 subroutine subdel (ndel, ndel1, ndel2, nndel)
1313 integer,
dimension(*) :: ndel, ndel1, ndel2
1314 intent (inout) ndel, ndel1, ndel2, nndel
1316 integer :: i, j, k, m, nndel1
1318 read(
nftr,
'(16I5)') nndel
1319 read(
nftr,
'(16I5)') (ndel(i), i=1,nndel)
1321 read(
nftr,
'(16I5)') nndel1
1323 do while (nndel1 /= 0)
1325 read(
nftr,
'(16I5)') (ndel1(j), j=1,nndel1)
1333 if (ndel(i) <= ndel1(j))
then
1335 if (ndel(i) == ndel1(j)) j = j + 1
1339 ndel(1:k) = ndel2(1:k)
1352 if (j > nndel1)
then
1357 ndel(1:k) = ndel2(1:k)
1364 read(
nftr,
'(16I5)') nndel1
1368 write(
nftw,
'(" ***** NUMBER OF CHOSEN CONFIGURATIONS ***",I10)') nndel
1369 write(
nftw,
'(/,24I5)')(ndel(i),i=1,nndel)
1370 write(7,
'(16I5)') (ndel(i), i=1,nndel)
1377 subroutine wfnin (nwfngp, nadel, nncsf, ncsf, lcdi, lndi, nelecg, ndprod, nrefog, npcupf, negmax, refdtg, nrfgmx, refgug, &
1378 ntcon, reforg, nshgmx, nsymmx, mshl, gushl, pqn, cup, ndpmax, nshlp, nconmx, test, nrcon, nshcon, tcon, &
1382 integer :: lcdi, lndi, nadel, nconmx, ncsf, ndpmax, ndprod, negmax, nelecg, nncsf, npcupf, nrefog, nrfgmx, nshgmx, &
1383 nsymmx, ntcon, nwfngp
1384 integer,
dimension(3,*) :: cup, pqn
1385 integer,
dimension(*) :: gushl, mshl, nrcon, nshcon, nshlp, refdtg, refgug, test
1386 integer,
dimension(5,*) :: reforg
1387 integer,
dimension(3,nshgmx,*) :: tcon
1388 intent (in) nconmx, ndpmax, negmax, nrfgmx, nshgmx, nsymmx
1389 intent (out) cup, errorg, gushl, lcdi, lndi, mshl, nadel, ncsf, ndprod, nelecg, nncsf, npcupf, nrcon, nrefog, nshcon, &
1390 nshlp, ntcon, nwfngp, pqn, refdtg, refgug, reforg, tcon, test
1409 refdtg(1:negmax) = 0
1410 refgug(1:nrfgmx) = -2
1411 reforg(1:5,1:nrfgmx) = -2
1413 mshl(1:nshgmx) = nsymmx + 1
1414 gushl(1:nshgmx) = -2
1416 pqn(1:3,1:nshgmx) = -1
1417 cup(1:3,1:nshgmx) = -1
1423 nrcon(1:nconmx) = -1
1424 nshcon(1:nconmx) = 0
1426 tcon(1,1:nshgmx,1:nconmx) = -1
1427 tcon(2,1:nshgmx,1:nconmx) = 0
1428 tcon(3,1:nshgmx,1:nconmx) = 0
1430 end subroutine wfnin
1447 subroutine wfnin0 (nelecp, defltc, nerfg, erfg, gname, qntar, errorg, ndpmax)
1449 integer :: defltc, ndpmax, nerfg
1451 character(len=80) :: gname
1452 logical,
dimension(*) :: erfg
1453 integer,
dimension(*) :: nelecp
1454 integer,
dimension(3) :: qntar
1455 intent (in) ndpmax, nerfg
1456 intent (out) defltc, erfg, gname, nelecp, qntar
1458 nelecp(1:ndpmax) = -1
1459 erfg(1:nerfg) = .false.
1473 subroutine wrnmlt (k, sname, nrerun, megul, symtyp, mgvn, s, sz, r, pin, ncsf, byproj, lcdi, lndi, lcdo, lndo, lcdt, lndt, &
1474 nfto, ltri, idiag, npflg, thres, nelect, nsym, nob, refdet, nftw, iposit, nob0, nobl, nob0l, nx, nobe, &
1477 use precisn,
only : wp
1479 integer :: byproj, idiag, iposit, k, lcdi, lcdo, lcdt, lndi, lndo, lndt, ltri, megul, mgvn, ncsf, nelect, nfto, nftw, &
1480 nrerun, nsym, nx, symtyp
1481 real(kind=wp) :: pin, r, s, sz, thres
1482 character(len=80) :: sname
1483 integer,
dimension(*) :: nob, nob0, refdet
1484 integer,
dimension(nx) :: nob0l, nobl
1485 integer,
dimension(nx) :: nobe, nobp, nobv
1486 integer,
dimension(6) :: npflg
1487 intent (in) byproj, idiag, iposit, k, lcdi, lcdo, lcdt, lndi, lndo, lndt, ltri, megul, mgvn, ncsf, nelect, nfto, &
1488 nob, nob0, nob0l, nobe, nobl, nobp, nobv, npflg, nrerun, nsym, nx, pin, r, refdet, s, sname, symtyp, &
1491 character(len=4) :: blank1 =
' '
1494 write(k,
'(" &INPUT")')
1495 write(k,
'(" NAME=''",A80,"'',")') sname
1496 write(k,
'(" NRERUN=",I3,", MEGUL=",I3,", SYMTYP=",I3,",")') nrerun, megul, symtyp
1497 write(k,
'(" MGVN=",I3,", S=",F6.1,",SZ=",F6.1,", R=",F6.1,", PIN=",F6.1,", NOCSF=",I6,",")') mgvn, s, sz, r, pin, ncsf
1498 write(k,
'(" BYPROJ=",I2,",")') byproj
1499 write(k,
'(" LCDI=",I15,", LNDI=",I15,", LCDO=",I7,", LNDO=",I15,","," LCDT=",I7,", LNDT=",I7,",")') &
1500 lcdi, lndi, lcdo, lndo, lcdt, lndt
1501 write(k,
'(" NFTO=",I3,", LTRI=",I5,", IDIAG=",I3,", NPFLG=",5(I2,",")," NPMSPD =",I2,",")') nfto, ltri, idiag, npflg
1502 write(k,
'(" THRES=",1PD9.2,",")') thres
1503 write(k,
'(" NELT=",I4,", NSYM=",I3,", NOB=",10(I3,","))') nelect, nsym, (nob(j), j=1,nsym)
1504 write(k,
'(" NDTRF=",A1,12(I3,",",A1)/(8X,12(I3,",",A1)))') (blank1, refdet(j), j=1,nelect)
1505 write(k,
'(" NOBL=",10(I3,","))') nobl
1506 write(k,
'(" NOB0L=",10(I3,","))') nob0l
1508 if (iposit /= 0)
then
1509 write(k,
'(" IPOSIT=",I3)') iposit
1510 write(k,
'(" NOB0=",10(I3,","))') (nob0(j), j=1,nsym)
1511 write(k,
'(" NOBE=",10(I3,","))') (nobe(j), j=1,nsym)
1512 write(k,
'(" NOBP=",10(I3,","))') (nobp(j), j=1,nsym)
1513 write(k,
'(" NOBV=",10(I3,","))') (nobv(j), j=1,nsym)
1522 subroutine wvwrit (nwfngp, gname, nelecg, defltc, irfcon, ndprod, symtyp, ntcon, navail, nrefog, nelecp, nshlp, qntar, &
1523 nshlpt, nshgmx, mshl, gushl, pqn, cup, ncupp, npcupf, refdtg, nelp, ntconp, nshcon, nobt, reforb, &
1524 refgu, test, nrcon, tcon, refcon, nerfg, erfg, ndpp, nrefop, errorg)
1529 integer :: defltc, irfcon, navail, ncupp, ndpp, ndprod, nelecg, nelp, nerfg, nobt, npcupf, nrefog, nrefop, &
1530 nshgmx, nshlpt, ntcon, ntconp, nwfngp, symtyp
1532 character(len=80) :: gname
1533 integer,
dimension(3,*) :: cup, pqn
1534 logical,
dimension(11) :: erfg
1535 integer,
dimension(*) :: gushl, mshl, nelecp, nrcon, nshcon, nshlp, refcon, refdtg, refgu, test
1538 integer,
dimension(3) :: qntar
1539 integer,
dimension(5,*) :: reforb
1540 integer,
dimension(3,nshgmx,*) :: tcon
1542 intent (in) cup, defltc, erfg, gname, gushl, irfcon, mshl, navail, ncupp, ndpp, ndprod, nelecg, nelecp, nelp, &
1543 nerfg, nobt, npcupf, nrcon, nrefog, nrefop, nshcon, nshgmx, nshlp, nshlpt, ntcon, ntconp, nwfngp, pqn, &
1544 qntar, refcon, refdtg, refgu, reforb, symtyp, tcon
1545 intent (inout) errorg, test
1547 character(len=32),
dimension(11) :: ersntg
1548 character(len=4) :: hcup =
'CUP ', htcon =
'TCON', lpc =
' ( '
1549 integer :: i, i1, i2, ic, ii, iimax, imax, ip, ishp, it, jj, jnshl, nshcr, nit1 = 10, nit2 = 30
1551 data ersntg/
'NELECG OUT OF RANGE ', &
1552 'NDPROD TOO LARGE ', &
1553 'NSHLP OUT OF RANGE ', &
1554 'NELECG NE SUM OF NELEP ', &
1555 'NREF OUT OF RANGE ', &
1556 'NELECG NE SUM OVER NELEC IN REFO', &
1557 'ERROR IN REF ORB DATA ', &
1558 'ERROR IN SHELL DATA ', &
1559 'ERROR IN COUPLING DATA ', &
1560 'ERROR IN CONFIG CONSTRAINT DATA ', &
1561 'NO SPACE FOR REFCON ARRAY '/
1566 write(
nftw,
'(" WFN GROUP",I4,4X,A80)') nwfngp, gname
1567 write(
nftw,
'(" NELECG",I4,T15,"DEFLTC",I3,T27,"IRFCON",I6)') nelecg, defltc, irfcon
1568 write(
nftw,
'(" NDPROD",I4,T15,"NTCON ",I3,T27,"NAV ",I10)') ndprod, ntcon, navail
1569 write(
nftw,
'(" NREFOG",I4,/)') nrefog
1570 write(
nftw,
'(9X,9I3)') (i, i=1,ndpp)
1571 write(
nftw,
'(" NELECP =",9I3)') (nelecp(i), i=1,ndpp)
1572 write(
nftw,
'(" NSHLP =",9I3)') (nshlp(i), i=1,ndpp)
1574 if (qntar(1) /= -1)
then
1576 write(
nftw,
'(5X,"TARGET MULTIPLICITY =",I5,5X,"TARGET SYMMETRY =",I5,5X,"TARGET INVERSION SYMMETRY =",I5)') &
1582 if (ndprod /= 0 .and. nshlpt <= nshgmx)
then
1584 it = merge(1, 0, symtyp == 1)
1589 if (jnshl == 0)
then
1591 write(
nftw,
'(I4," ORBITALS IN GROUP",I2)') jnshl, ip
1594 do i = 1, jnshl, nit1
1595 imax = min(i + nit1 - 1, jnshl)
1598 write(
nftw,
'(I4," ORBITALS IN GROUP",I2)') jnshl, ip
1602 write(
nftw,
'(1X,A4,I8,9I12)')
rhead(1), (ii, ii=i,imax)
1603 write(
nftw,
'(1X,A4,I8,9I12)')
rhead(2), (mshl(ishp+ii), ii=i,imax)
1604 if (symtyp == 1)
write(
nftw,
'(1X,A4,I8,9I12)')
rhead(7), (gushl(ishp+ii), ii=i,imax)
1605 write(
nftw,
'(1X,A4,10(A3,I2,",",I2,",",I2,")"))')
rhead(3), (lpc,(pqn(jj,ishp+ii), jj=1,3), ii=i,imax)
1613 if (ncupp * npcupf /= 0)
then
1614 do i = 1, ncupp, nit1
1615 imax = min(i + nit1 - 1, ncupp)
1620 write(
nftw,
'(" COUPLING DATA")')
1624 write(
nftw,
'(1X,A4,I8,9I12)')
rhead(1), (ii, ii=i1,i2)
1625 write(
nftw,
'(1X,A4,10(A3,I2,",",I2,",",I2,")"))') hcup, (lpc,(cup(jj,ii), jj=1,3), ii=i,imax)
1630 it = merge(2, 1, symtyp == 1)
1632 do i = 1, nrefop, nit2
1633 imax = min(i + nit2 - 1, nrefop)
1636 write(
nftw,
'(" REFERENCE DETERMINANT INPUT DATA")')
1639 write(
nftw,
'(1X,A4,I5,29I4)')
rhead(1), (ip, ip=i,imax)
1641 write(
nftw,
'(1X,A4,I5,29I4)')
rhead(ii+1), (reforb(ii,ip), ip=i,imax)
1643 if (symtyp == 1)
write(
nftw,
'(1X,A4,I5,29I4)')
rhead(7), (refgu(ip), ip=i,imax)
1649 it = (nelp + nit2 - 1) / nit2
1650 if (mod(nelp, nit2) == 0) it = it + 1
1653 write(
nftw,
'(" REFDET =",30(I3,","),/,(9X,30(I3,",")))') (refdtg(ip), ip=1,nelp)
1660 it = 1 + 2 * ((nshcr + nit1 - 1) / nit1) + 1 + (nobt + nit2 - 1) / nit2
1661 if (mod(nobt, nit2) == 0) it = it + 1
1664 write(
nftw,
'(" EXITATION CONSTRAINTS / TCON(SYM,PQN,NE",/)')
1668 if (test(ic) /= 1)
then
1669 write(
nftw,
'(I3,10X,"GT",I3," REPLACEMENTS ALLOWED(INTERSECTION)")') ic, nrcon(ic)
1672 write(
nftw,
'(I3,10X,"LE",I3," REPLACEMENTS ALLOWED(UNION)")') ic, nrcon(ic)
1674 if (nshcr /= 0)
then
1675 do ii = 1, nshcr, nit1
1676 iimax = min(ii + nit1 - 1, nshcr)
1677 write(
nftw,
'(1X,A4,I8,9I12)')
rhead(1), (ip, ip=ii,iimax)
1678 write(
nftw,
'(1X,A4,10(A3,I2,",",I2,",",I2,")"))') htcon, (lpc,(tcon(jj,ip,ic), jj=1,3), ip=ii,iimax)
1681 write(
nftw,
'(" REFCON =",30(I3,",")/(9X,30(I3,",")))') (refcon(ip), ip=1,nobt)
1691 if (.not. erfg(i)) cycle
1692 if (.not. errorg)
then
1695 write(
nftw,
'(" **** ERROR DATA FOR &WFNGRP FOLLOWS",/,12X,A32)') ersntg(i)
1700 write(
nftw,
'(12X,A32)') ersntg(i)