66 subroutine cntrct (nelt, no, ndo, cdo, thres)
68 use precisn,
only : wp
71 real(kind=wp) :: thres
72 real(kind=wp),
dimension(*) :: cdo
73 integer,
dimension(*) :: ndo
74 intent (in) nelt, thres
75 intent (inout) cdo, ndo, no
77 integer :: i, j, md, mdd, mov
85 if (abs(cdo(i)) <= thres)
then
87 else if (mov /= 0)
then
90 ndo(mdd+1:mdd+nelt) = ndo(md+1:md+nelt)
107 subroutine dophz (nftw, nocsf, nelt, ndtrf, nconf, indo, ndo, lenndo, icdo, cdo, lencdo, iphz, leniphz, iphz0, &
108 leniphz0, nctarg, nctgt, notgt, mrkorb, mdegen, ntgsym, mcont, symtyp, npflg)
110 use precisn,
only : wp
112 integer :: symtyp,i,n,ntci,nt,marked,nc,mb,md,m,na,mark1,iloc,inum, &
113 ntci1, ntci0,nftw,nctarg,iph,npflg,nocsf,nelt, &
114 leniphz,leniphz0,ntgsym,lenndo,lencdo
115 integer,
dimension(nelt) :: ndtrf,nconf
116 integer,
dimension(lenndo) :: ndo
117 integer,
dimension(nocsf) :: indo,icdo
118 real(kind=wp),
allocatable :: cdo(:)
119 integer,
dimension(leniphz) :: iphz
120 integer,
dimension(ntgsym) :: nctgt,mrkorb,mcont,notgt,mdegen
121 integer,
dimension(leniphz0) :: iphz0
122 real(kind=wp),
parameter :: zero = 0.0_wp
123 logical,
parameter :: zdebug = .false.
126 write(nftw,
'(/,5x,"Phase analysis for total wavefunction:",/)')
127 write(nftw,
'( 5x," ")')
128 write(nftw,
'( 5x," Number of CSFS (nocsf) = ",I8)') nocsf
129 write(nftw,
'( 5x," Number of electrons (nelt) = ",I8)') nelt
130 write(nftw,
'( 5x," Number of target states (ntgsym) = ",I8)') ntgsym
131 write(nftw,
'( 5x," Spatial group type (symtyp) = ",I8)') symtyp
132 write(nftw,
'( 5x," Size of packed dets (lenndo) = ",I8)') lenndo
133 write(nftw,
'( 5x," Size of cdo (#dets) (lencdo) = ",I8)') lencdo
134 write(nftw,
'( 5x," (nctarg) = ",I8,/)') nctarg
135 write(nftw,
'( 5x,"Structure of wavefunction:",/)')
136 write(nftw,
'( 5x,"Target #CSFs #Continuum Spatial Sym ")')
137 write(nftw,
'( 5x,"State targ functions continuum ")')
138 write(nftw,
'( 5x,"------ ------- ---------- ----------- ")')
140 write(nftw,
'(5x,I6,2x,I7,3x,I10,2x,I10)') i, nctgt(i), notgt(i), mcont(i)
142 write(nftw,
'(/,5x,"**** End of structure of wavefunction",/)')
155 nconf(1:nelt) = ndtrf(1:nelt)
164 if (na == ndtrf(i))
then
165 nconf(i) = ndo(mb + md + m)
169 write(nftw,*)
'DOPHZ: help I should not have got here!!! na =', na
170 write(nftw,*)
' ndtrf ', ndtrf
171 write(nftw,*)
' nconf ', nconf
175 m = merge(4, 2, symtyp <= 1 .or. mcont(nt) /= 0)
176 do mark1 = marked + 0, marked + m
177 if (mark1 == marked + m)
then
179 write(nftw,*)
' Configuration is ', nconf
181 else if (any(nconf(1:nelt) == mark1))
then
189 inum = count(nconf(1:nelt) > mark1)
190 if (mdegen(nt) >= 0)
then
191 iph = merge(
iphase(nconf,nelt), -
iphase(nconf,nelt), cdo(icdo(n)) > zero)
192 iphz(ntci) = merge(iph, -iph, mod(inum, 2) == 0)
196 iphz(ntci) = merge(iphz0(nc), -iphz0(nc), mod(inum, 2) == 0)
205 write(nftw,
'(//," Phase factors for CI target states:")')
209 ntci1 = ntci1 + nctgt(nt)
210 write(nftw,
'(/," Target symmetry",I3,/)') nt
211 write(nftw,
'(25I3)') (iphz(ntci), ntci=ntci0,ntci1)
218 write(nftw,
'(/,5x,"***** dophz() - completed ",/)')
232 subroutine dophz0 (nftw, nocsf, nelt, ndtrf, nconf, indo, ndo, lenndo, icdo, cdo, lencdo, iphz, npflg)
234 use precisn,
only : wp
236 integer :: n, i, mb, md, m, na, nftw, npflg, nocsf, nelt, lenndo, lencdo
237 integer,
dimension(nelt) :: ndtrf,nconf
238 integer,
dimension(nocsf) :: indo,icdo,iphz
239 integer,
dimension(lenndo) :: ndo
240 real(kind=wp),
parameter :: zero = 0.0_wp
241 real(kind=wp),
dimension(lencdo) :: cdo(lencdo)
246 nconf(1:nelt) = ndtrf(1:nelt)
255 if (na == ndtrf(i))
then
256 nconf(i) = ndo(mb + md + m)
260 write(nftw,*)
'DOPHZ0: help I should not have got here!!! na =', na
261 write(nftw,*)
' ndtrf ', ndtrf
262 write(nftw,*)
' nconf ', nconf
266 iphz(n) = merge(
iphase(nconf,nelt), -
iphase(nconf,nelt), cdo(icdo(n)) > zero)
271 write(nftw,
'(5x,"Phz factor, per target CSF (",I7,"), for future use:")') nocsf
272 write(nftw,
'((5x,15(I3,1x)))') (iphz(n), n=1,nocsf)
287 integer,
dimension(nelt) :: nconf
288 intent (in) nconf, nelt
290 integer :: iso, iswap, m, n, nst
298 else if (nconf(n) > nconf(n+1))
then
307 if (nconf(n) /= n)
exit
313 do m = nelt, nst + 1, -1
316 if (iso < nconf(n)) iswap = iswap + 1
321 iphase = merge(1, -1, mod(iswap, 2) == 0)
372 subroutine mkorbs (nob, nsym, mn, mg, mm, ms, norb, nsrb_in, map, mpos, iposit, nobl, nob0l, symtyp)
374 use precisn,
only : wp
383 integer :: mn(nsrb_in)
384 integer :: mg(nsrb_in)
385 integer :: mm(nsrb_in)
386 integer :: ms(nsrb_in)
388 integer :: mpos(nsrb_in)
390 integer :: nob0l(nsym)
392 integer i, ik, ikp, ipos, is, ic, iso
394 integer m, ma, mb, m1, n, nep
399 integer,
allocatable :: noblj(:)
400 integer,
parameter :: iwrite = 6
401 logical,
parameter :: zdebug = .false.
406 write(
nftw,
'(/,10x,"====> mkorbs() <====",/)')
407 write(
nftw,
'(/,10x,"Input data: " )')
408 write(
nftw,
'( 10x," nsym = ",I6 )') nsym
409 write(
nftw,
'( 10x," symtyp = ",I6 )') symtyp
410 write(
nftw,
'( 10x," iposit = ",I6 )') iposit
411 write(
nftw,
'( 10x," norbs = ",I6 )') norb
412 write(
nftw,
'( 10x," nsrb_in = ",I6,/)') nsrb_in
413 write(
nftw,
'(12x,"nob: ",1x,20(I3,1x))') (nob(i), i=1,nsym)
414 if (symtyp == 1)
then
415 write(
nftw,
'(12x,"nobl: ",1x,20(I3,1x))') (nobl(i), i=1,nsym)
417 write(
nftw,
'(12x,"nobl: ",1x,20(I3,1x))') (nobl(i), i=1,2*nsym)
419 write(
nftw,
'(/,10x,"**** End of input data",/)')
428 if (symtyp == 1)
then
434 allocate(noblj(len_noblj), stat = ierr)
437 write(
nftw,
'(/,10x,"**** Error in mkorbs() ",/)')
438 write(
nftw,
'(/,10x,"Cannot allocate noblj - ierr = ",I6,/)') ierr
442 noblj(1:len_noblj) = nobl(1:len_noblj)
444 if (iposit /= 0)
then
446 noblj(is) = nobl(is) / 2
456 if (symtyp == 0)
then
459 else if (symtyp == 1)
then
466 if (iposit /= 0)
then
468 noblj(is) = nobl(is) / 2
523 do m = ic + 1, nsym * ic
539 if (symtyp <= 1)
then
557 if (iposit /= 0)
then
558 write(
nftw,*)
' MAP : OLD, NEW'
565 write(
nftw,*)
' MAP : OLD, NEW'
567 write(
nftw,*) n,map(n)
587 write(
nftw,*)
' I N G M S MPOS '
590 write(iwrite,
'(10x,7I10)') j, mn(j), mg(j), mm(j), ms(j), mpos(j)
593 if (nsrb /= nsrb_in)
then
594 write(iwrite,
'(" HELP!!! MKORBS: NSRB, NSRBD = ",2I6)') nsrb, nsrb_in
602 if (
allocated(noblj))
then
603 deallocate(noblj, stat = ierr)
606 write(iwrite,
'(/,10x,"**** Error in mkorbs() ",/)')
607 write(iwrite,
'(/,10x,"Cannot deallocate noblj - ierr = ",I6,/)') ierr
613 write(iwrite,
'(/,10x,"***** Completed - mkorbs() ",/)')
655 subroutine pkwf (nod, ieltp, cdo, mdo, idopl, mdop, idcpl, mdcp, nftw, ndo, ndto, len_ndto, ithis_csf)
657 use precisn,
only : wp
661 integer idopl, mdop(idopl)
662 integer idcpl, mdcp(idcpl)
663 integer mdo(nod*ieltp)
665 integer len_ndto, ndto(len_ndto)
669 real(kind=wp) :: cdo(nod)
671 integer i, j, k, n, nc, nd, md, mdopi
672 integer mdi(idcpl+ieltp)
675 logical,
parameter :: zdebug = .false.
679 write(nftw,
'(/,10x,"====> PKWF() <====",/)')
680 write(nftw,
'( 10x,"Input data: ")')
681 write(nftw,
'( 10x," No. of determinants (nod) = ",I5)') nod
682 write(nftw,
'( 10x," No of electrons per det (ieltp) = ",I5)') ieltp
683 write(nftw,
'( 10x," Input determinants: ")')
686 write(nftw,
'(/,10x," Determinant ",I5," Coeffcient = ",F13.6,/)') i, cdo(i)
687 write(nftw,
'( 10x," Spin orbs: ",20(I3,1x),/,(25x,20(I3,1x)))') (mdo(md+j), j=1,ieltp)
690 write(nftw,
'(/,10x," No. spin orbs in the reference det ")')
691 write(nftw,
'( 10x," but not present in this CSF (idopl) = ",I5,/)') idopl
692 write(nftw,
'( 10x," mdop: ",10(I3,1x),/,(16x,10(i3,1x)))') (mdop(i), i=1,idopl)
693 write(nftw,
'(/,10x," No. spin orbs in this CSF but ")')
694 write(nftw,
'( 10x," not present in ref det (idcpl) = ",I5,/)') idcpl
695 write(nftw,
'( 10x," mdcp: ",10(I3,1x),/,(16x,10(I3,1x)))') (mdcp(i), i=1,idcpl)
696 write(nftw,
'(/,10x,"Space available in ndto() = ",I10,/)') len_ndto
719 mdi(1:idcpl) = mdcp(1:idcpl)
726 mdi(nd) = mdo(md + i)
736 outer_loop:
do i = 1, idopl
738 inner_loop:
do j = 1, idopl
739 if (mdi(j) == mdopi)
then
761 if (ndo + 2 * nd > len_ndto)
then
762 write(nftw,
'(/,10x,"***** Error in: PKWF() ",/)')
763 write(nftw,
'( 10x,"There is not enough space in NDTO to store the ")')
764 write(nftw,
'( 10x,"present determinant (",I4," of ",I4," ). ")') k, nod
765 write(nftw,
'( 10x,"Space needed = ",I8," Given (len_ndto) = ",I8)') ndo+2*nd, len_ndto
766 write(nftw,
'( 10x,"This present CSF number = ",I10,/)') ithis_csf
778 ndto(ndo+i) = mdop(n)
783 write(nftw,
'(/,10x,"Packed format for determinant ",I5,": ",/)') k
784 write(nftw,
'( 10x,20(I3,1x))') (ndto(i), i =ndo,ndo+2*nd)
787 ndo = ndo + nd + nd + 1
799 write(nftw,
'(/,10x,"On output: ")')
800 write(nftw,
'( 10x," Highest location in ndto() (ndo) = ",i10,/)') ndo
801 write(nftw,
'(/,10x,"**** PKWF() - completed",/)')
809 subroutine pmkorbs (nob, nobe, nsym, mn, mg, mm, ms, nsrb, norb, nsrbd, map, mpos, iposit, symtyp)
813 integer :: symtyp, maxspin, imo, emo, ispin, iso, ipos, isym, j, jmo, maxmo, minmo, n, amo, nsrbd, &
814 nsym, iposit, norb, nsrb
815 integer :: nob(nsym), nobe(nsym), mpos(nsrb), map(norb)
816 integer :: mn(nsrb), mg(nsrb), mm(nsrb), ms(nsrb)
828 if (symtyp /= 2)
then
829 write(
nftw,*)
' ERROR in PMKORBS: calculation with positrons'
830 write(
nftw,*)
' only possible for SYMTYP=2'
831 write(
nftw,*)
' (abelian groups).'
832 write(
nftw,*)
' here: SYMTYP=',symtyp
858 do ispin = 1, maxspin
870 minmo = nobe(isym) + 1
874 do jmo = minmo, maxmo
879 do ispin = 1, maxspin
894 write(
nftw,*)
' MAP : OLD, NEW'
896 write(
nftw,*) n, map(n)
899 write(6,*)
' I N G M S MPOS '
902 write(6,
'(10X,7I10)') j, mn(j), mg(j), mm(j), ms(j), mpos(j)
906 write(6,*)
'GIVEN NSRBD=', nsrbd
907 write(6,*)
'CALCULATED NSRB=', nsrb
909 if (nsrb /= nsrbd)
then
910 write(6,
'(" HELP!!! MKORBS: NSRB, NSRBD = ",2I6)') nsrb, nsrbd
949 subroutine popnwf (nsrb, nsrbs, nelt, ndtrf, mopmx, mdop, mdcp, mop, mdc, mdo, ndta, nod, nda, idop, idcp, ieltp, flip, nalm)
951 use precisn,
only : wp
963 integer :: ndtrf(nelt)
966 integer :: ndta(nsrb)
968 integer :: mop(mopmx)
969 integer :: mdop(nelt)
970 integer :: mdcp(nelt)
974 integer idop, idcp, ieltp
976 integer i, k, m, md, me, n, na, nb, ndo, ndc, nod2, nd, no, no0
977 integer ndop, ndcp, neltp
979 integer,
parameter :: nftw = 6
981 logical,
parameter :: zdebug = .false.
985 write(nftw,
'(/,25x,"====> POPNWF() <====",/)')
986 write(nftw,
'(/,25x,"Input data: ")')
987 write(nftw,
'( 25x," No. of spin orbitals (nsrb) = ",I10)') nsrb
988 write(nftw,
'( 25x," No .of sigma-type spin orbs (nsrbs) = ",I10)') nsrbs
989 write(nftw,
'( 25x," No. of electrons (nelt) = ",I10)') nelt
990 write(nftw,
'( 25x," Units available in mop() (mopmx) = ",I10)') mopmx
991 write(nftw,
'( 25x," No. of dets in this CSF (nod) = ",I10,/)') nod
992 write(nftw,
'( 25x," Ref det = ",10(I5,1x),/,(37x,10(I5,1x)))') (ndtrf(i), i=1,nelt)
1021 ndta(ndtrf(1:nelt)) = nod
1035 do k = md + 1, md + m
1036 ndta( nda(k) ) = ndta( nda(k) ) - 1
1037 ndta( nda(k+m) ) = ndta( nda(k+m) ) + 1
1047 write(nftw,
'(/,25x,"Expanded determinant (NDTA) representation after")')
1048 write(nftw,
'( 25x,"processing all (",I6,") dets within the ")') nod
1049 write(nftw,
'( 25x,"present CSF. ",/)')
1050 write(nftw,
'( 25x,"Spin Orb. Count ")')
1051 write(nftw,
'( 25x,"--------- -------")')
1052 write(nftw,
'( (25x,I9,2x,I7))') (i, ndta(i), i=1,nsrb)
1083 if (ndta(i) + ndta(i+1) == nod2)
then
1088 if (ndta(i) /= 0)
then
1093 if (ndta(i+1) /= 0)
then
1105 do i = nsrbs + 1, nsrb, 4
1106 nd = ndta(i) + ndta(i+1) + ndta(i+2) + ndta(i+3)
1108 if (nd == nod2)
then
1115 if (ndta(k) /= 0)
then
1124 write(nftw,
'(/,25x,"After step 2 we have; ",/)')
1125 write(nftw,
'( 25x," Number of closed orbtials (ndc) = ",I6)') ndc
1126 write(nftw,
'( 25x," Number of open orbitals (ndo) = ",I6,/)') ndo
1127 write(nftw,
'( 25x,"Closed orbitals: ",20(I4,1x),/,(20x,20(I4,1x)))') (mdc(i), i=1,ndc)
1128 write(nftw,
'( 25x,"Open orbitals: ",20(I4,1x),/,(20x,20(I4,1x)))') (mdo(i), i=1,ndo)
1141 ndta(ndtrf(1:nelt)) = 1
1144 mdop(1:nelt) = ndtrf(1:nelt)
1150 ndta(n) = ndta(n) + 1
1156 if (ndta(n) == 2) cycle
1164 if (ndta(n) == 2) cycle
1172 if (neltp /= 0)
then
1178 ndta(ndtrf(1:nelt)) = 1
1182 ndta(n) = ndta(n) + 1
1200 ndta(na) = ndta(na) - 1
1201 ndta(nb) = ndta(nb) + 1
1209 if (ndta(n) == 2)
then
1217 if (no > mopmx)
then
1218 write(nftw,
'(/,25x,"**** Error in; POPNWF() ",/)')
1219 write(nftw,
'(/,25x,"Exceeded size of mop() ",/)')
1220 write(nftw,
'( 25x," Determinant num (i) = ",I6)') i
1221 write(nftw,
'( 25x," spin orbital (no) = ",I6)') no
1222 write(nftw,
'( 25x," mopmx = ",I6,/)') mopmx
1235 flip(i) = mod(
qsort(no-no0, mop(no0+1:no)), 2) /= 0
1239 if (mod(no, nod) /= 0)
then
1240 write(nftw,
'(/,25x,"**** Error in; POPNWF() ",/)')
1248 if (neltp == 0 .and. nod /= 1)
then
1268 write(nftw,
'(/,25x,"Output data: ")')
1269 write(nftw,
'( 25x," (idop) = ",I10)') idop
1270 write(nftw,
'( 25x," (idcp) = ",I10)') idcp
1271 write(nftw,
'( 25x," No. electrons in open shells (ieltp) = ",I10,/)') ieltp
1273 write(nftw,
'( 27x,"Spin orbitals in DR but not DC: ",/)')
1274 write(nftw,
'( 27x,9(I4,1x))') (mdop(i), i=1,idop)
1275 write(nftw,
'(/,27x,"Spin orbitals in DC but not DR: ",/)')
1276 write(nftw,
'( 27x,9(I4,1x))') (mdcp(i), i=1,idcp)
1278 write(nftw,
'(/,25x,"Return code (nalm) = ",I10,/)') nalm
1279 write(nftw,
'(/,25x,"**** Completed - POPNWF() ",/)')
1310 subroutine prjct (nelt, mxss, nodi, ndo, cdi, nodo, cdo, maxcdo, mgvn, iss, isd, thres, r, ndtr, mm, ms, maxndo, symtyp, nsrb)
1312 use precisn,
only : wp
1315 real(kind=wp) :: fcta,fctb,fctc,fctr,tmp
1316 real(kind=wp),
parameter :: zero = 0.0_wp
1317 real(kind=wp),
parameter :: one = 1.0_wp
1318 real(kind=wp),
parameter :: four = 4.0_wp
1331 real(kind=wp) :: thres
1332 real(kind=wp) :: cdi(*)
1333 real(kind=wp) :: cdo(maxcdo)
1338 integer,
target :: ndo(maxndo)
1339 integer :: ndtr(nsrb)
1343 integer :: i, ia, ib, id, idet, is, issp, istart, ma, mb, mga, mgb, nd, ninitial_dets
1345 integer,
pointer :: ndo_ptr(:)
1346 logical,
parameter :: zdebug = .false.
1353 write(6,
'(/,20x,"====> prjct() - project wavefunction <====",/)')
1354 write(6,
'( 20x,"Input data: ")')
1355 write(6,
'( 20x," # electrons open shell (nelt) = ",I7)') nelt
1356 write(6,
'( 20x," Maximum S for projection (mxss) = ",I7)') mxss
1357 write(6,
'( 20x," Lambda value for Wavefn (mgvn) = ",I7)') mgvn
1358 write(6,
'( 20x," Required Spin value (iss) = ",I7)') iss
1359 write(6,
'( 20x," Required Sz value (isd) = ",I7)') isd
1360 write(6,
'( 20x," Threshold (thres) = ",D13.6)') thres
1361 write(6,
'( 20x," Dimension of cdo() (maxcdo) = ",I7)') maxcdo
1362 write(6,
'( 20x," Dimension of ndo() (maxndo) = ",I7)') maxndo
1363 write(6,
'( 20x," Abelian/C-inf-v flag (symtyp) = ",I7)') symtyp
1364 write(6,
'( 20x," Number of spin orbs (nsrb) = ",I7,/)') nsrb
1365 write(6,
'( 20x,"No. of dets in this CSF (nodi) = ",I7)') nodi
1368 istart = (idet - 1) * nelt
1369 write(6,
'(/,20x,"Det No = ",I7," Coeff (cdi) = ",D13.6,/)') idet, cdi(idet)
1370 write(6,
'( 20x," Sp. orbs in open shells (ndi) = ",20(I4,1x))') (ndo(istart+i), i=1,nelt)
1376 ninitial_dets = nodi
1379 fcta = -nelt * (nelt - 4)
1380 fctb = iss * (iss + 2)
1387 cdo(1:nodi) = cdi(1:nodi)
1390 ndo_ptr => ndo(1:maxndo)
1391 call bst % init(ndo_ptr, nelt)
1393 call bst % insert(id)
1395 write(6,
'(/,20x,"Bstree after add det #",I0,": ")') id
1396 call bst % output(22)
1402 write(6,
'(/,20x,"Entering loop over components of spin",/)')
1403 write(6,
'( 20x," fcta = ",D13.6)') fcta
1404 write(6,
'( 20x," fctb = ",D13.6)') fctb
1405 write(6,
'( 20x," issp = ",I6,/)') issp
1411 spin_loop:
do is = isd + 1, mxss + 1, 2
1414 if (is == issp) cycle
1417 fctc = (is - 1) * (is + 1)
1418 fctr = (fcta - fctc) / (fctb - fctc)
1421 write(6,
'(/,20x,"Working on Spin Iteration (is) = ",I5,/)') is
1422 write(6,
'( 20x," Factor fctc = ",D13.6)') fctc
1423 write(6,
'( 20x," Factor fctr = ",D13.6,/)') fctr
1428 cdo(1:nodi) = fctr * cdi(1:nodi)
1438 determinant_loop:
do id = 1, nodi
1440 fctr = four * cdi(id) / (fctb - fctc)
1443 write(6,
'(23x,"Working on determinant (id) = ",I5," of ",I5)') id, nodi
1444 write(6,
'(23x,"Coefficient, cdi() = ",D13.6 )') cdi(id)
1445 write(6,
'(23x,"Factor (fctr) = ",D13.6,/)') fctr
1446 write(6,
'(23x,"Current op-shl det: ",20(I3,1x),/,(20x,20(I3,1x)) )') (ndo(nd+i), i=1,nelt)
1452 first_electron_loop:
do ia = 2, nelt
1453 second_electron_loop:
do ib = 1, ia - 1
1457 ndtr(1:nelt) = ndo(nd+1:nd+nelt)
1469 write(6,
'(23x,"Evaluating electron pair: ")')
1470 write(6,
'(23x," #1: idx(ia) = ",I3,"sporb(ma) = ",I3," Sz (mga) = ",I3 )') ia, ma, mga
1471 write(6,
'(23x," #2: idx(ib) = ",I3,"sporb(mb) = ",I3," Sz (mgb) = ",I3,/)') ib, mb, mgb
1499 if (mga == mgb)
then
1500 cdo(id) = cdo(id) + fctr
1516 flip = (mod(
qsort(nelt, ndtr(1:nelt)), 2) /= 0)
1519 write(6,
'(23x,"New valid determinant produced by this pair",/)')
1520 write(6,
'(23x,"New open shell det: ",20(I3,1x),/,(20x,20(I3,1x)) )') (ndtr(i), i=1,nelt)
1527 if (ndtr(i) == ma .and. i /= ia) cycle
1528 if (ndtr(i) == mb .and. i /= ib) cycle
1540 call stmrg (nelt, maxcdo, maxndo, ndo, cdo, nodo, ndtr, merge(-fctr, fctr, flip), bst)
1542 end do second_electron_loop
1543 end do first_electron_loop
1550 end do determinant_loop
1555 call cntrct (nelt, nodo, ndo, cdo, thres)
1560 write(6,
'(/,10x,"**** Error in prjct() ",/)')
1561 write(6,
'( 10x,"After removing all determinants with expansion ")')
1562 write(6,
'( 10x,"coefficients less than (thres) = ",D13.6)') thres
1563 write(6,
'( 10x,"there are no determinants left in this CSF",/)')
1575 cdi(1:nodi) = cdo(1:nodi)
1582 if (symtyp <= 1 .and. mgvn == 0)
then
1583 if (zdebug)
write(6,
'(/,20x,"Analysis of Reflection operator required",/)')
1586 cdi(1:nodi) = cdo(1:nodi)
1588 call rfltn (nelt, nodi, ndo, cdi, r, maxcdo, maxndo, thres, nodo, cdo, ndtr, mm, bst)
1591 write(6,
'(/,10x,"**** Error in prjct() ",/)')
1592 write(6,
'( 10x,"After reflection analysis there are no ")')
1593 write(6,
'( 10x,"no determinants left in the CSF",/)')
1602 write(6,
'(/,20x,"Coefficients after projection ")')
1603 write(6,
'( 20x," (but not yet normalized) ",/)')
1604 write(6,
'( 20x," No. of determinants (nodi) = ",I6,/)') nodi
1605 write(6,
'(20x,I4,2x,D13.6)') (i, cdi(i), i=1,nodi)
1610 tmp =
snrm2(nodo, cdo, 1)
1611 tmp = one / sqrt(tmp)
1614 cdo(i) = cdo(i) * tmp
1622 write(6,
'(20x,"Final number of determinants in CSF (nodo) = ",I5,/)') nodo
1624 if (nodo /= ninitial_dets)
then
1625 ia = nodo - ninitial_dets
1626 write(6,
'(20x,"The length of the CSF has changed: ")')
1627 write(6,
'(20x," Initial number of dets = ",I6)') ninitial_dets
1628 write(6,
'(20x," # of dets added = ",I6," by projection",/)') ia
1630 write(6,
'(20x,"# of dets in the CSF has NOT changed ",/)')
1633 write(6,
'(/,20x,"**** prjct() - completed",/)')
1636 end subroutine prjct
1646 subroutine projec (sname, megul, symtyp, mgvn, s, sz, r, pin, nocsf, byproj, idiag, npflg, thres, &
1647 nelt, nsym, nob, ndtrf, nftw, iposit, nob0, nob1, nob01, iscat, ntgsym, notgt, &
1648 nctgt, mcont, gucont, mrkorb, mdegen, mflag, nobe, nobp, nobv, maxtgsym)
1650 use precisn,
only : wp
1651 use global_utils,
only : mprod
1653 integer,
intent(in) :: iscat, mflag
1654 integer,
intent(inout) :: ntgsym
1655 integer :: byproj, idiag, iposit, megul, mgvn, nelt, nftw, nocsf, &
1656 nsym, symtyp, npflg(6), num_csfs_unproj, num_dets_unproj, &
1658 real(kind=wp) :: pin, r, s, sz, thres
1659 character(len=80) :: sname
1660 integer,
dimension(ntgsym) :: gucont, mcont, mdegen, mrkorb, nctgt, notgt
1661 integer,
dimension(nsym) :: nob, nob0, nob01, nobe, nobp, nobv
1662 integer,
dimension(nelt) :: ndtrf
1663 integer,
dimension(*) :: nob1
1665 integer :: i,nalm,nb,nctarg,nd,nl,norb,junk, isd,iss,n,k,msum,isum,m,ierr, &
1666 num_dets,nreps,maxndi,maxcdi, maxndo,maxcdo,lenndo,lencdo, &
1667 leniphase,leniphase0,maxtgsym
1673 integer :: wfn_unproj_num_csfs, &
1674 wfn_unproj_num_dets, &
1675 wfn_unproj_len_pkd_dets
1676 integer,
allocatable :: wfn_unproj_dets_per_csf(:), &
1677 wfn_unproj_packed_dets(:), &
1678 wfn_unproj_indx_1st_det_per_csf(:), &
1679 wfn_unproj_indx_1st_coeff_per_csf(:)
1680 real(kind=wp),
allocatable :: wfn_unproj_coefficients_per_det(:)
1686 integer :: wfn_proj_num_csfs, &
1687 wfn_proj_num_dets, &
1688 wfn_proj_len_pkd_dets
1689 integer,
allocatable :: wfn_proj_dets_per_csf(:), &
1690 wfn_proj_packed_dets(:), &
1691 wfn_proj_indx_1st_det_per_csf(:), &
1692 wfn_proj_indx_1st_coeff_per_csf(:)
1693 real(kind=wp),
allocatable :: wfn_proj_coefficients_per_det(:)
1699 integer :: nsrb,noarg
1700 integer,
allocatable :: itab_sporb_indx_in_sym(:), &
1701 itab_sporb_gu_value(:), &
1702 itab_sporb_sym(:), &
1703 itab_sporb_isz(:), &
1704 itab_sporb_mpos(:), &
1711 integer,
allocatable :: nconf(:),
iphase(:),iphase0(:)
1721 logical :: zbypass_wfn_projection, &
1722 zadjust_wfn_phase_for_scattering, &
1723 zpositrons,ztarget_state_calculation, &
1724 zscattering_calculation,zabelian
1726 integer :: num_csfs_proj, num_dets_proj, len_pkd_dets_proj
1729 if (symtyp >= 2)
then
1730 write(nftw,
'(" MOLECULE SYMMETRY CASE, symtyp =",I2)') symtyp
1731 junk = mprod(1, 1, npflg(6), nftw)
1747 zbypass_wfn_projection = byproj == 0
1748 zadjust_wfn_phase_for_scattering = iscat > 0
1749 zpositrons = iposit /= 0
1750 zabelian = symtyp == 2
1756 nsrb = sum(nob(1:nsym))
1765 allocate(itab_sporb_indx_in_sym(nsrb), stat = ierr)
1768 write(nftw,9950)
'itab_sporb_indx_in_sym', ierr
1772 allocate(itab_sporb_gu_value(nsrb),stat = ierr)
1775 write(nftw,9950)
'itab_sporb_gu_value', ierr
1779 allocate(itab_sporb_sym(nsrb), stat = ierr)
1782 write(nftw,9950)
'itab_sporb_sym', ierr
1786 allocate(itab_sporb_isz(nsrb), stat = ierr)
1789 write(nftw,9950)
'itab_sporb_isz', ierr
1793 allocate(itab_sporb_mpos(nsrb), stat = ierr)
1796 write(nftw,9950)
'itab_sporb_mpos', ierr
1800 allocate(map_orbitals(norb), stat = ierr)
1803 write(nftw,9950)
'mpos_orbitals', ierr
1816 if (zpositrons .and. zabelian)
then
1817 call pmkorbs (nob, nobe, nsym, &
1818 itab_sporb_indx_in_sym, &
1819 itab_sporb_gu_value, &
1827 call mkorbs (nob, nsym, &
1828 itab_sporb_indx_in_sym, &
1829 itab_sporb_gu_value, &
1832 norb, nsrb, map_orbitals, &
1834 iposit, nob1, nob01, symtyp)
1842 if (.not. zabelian)
then
1846 msum = msum + itab_sporb_sym(m)
1847 isum = isum + 1 - itab_sporb_isz(m) - itab_sporb_isz(m)
1853 msum = mprod(msum, itab_sporb_sym(m) + 1, 0, nftw)
1854 isum = isum + 1 - itab_sporb_isz(m) - itab_sporb_isz(m)
1863 if (abs(msum) /= mgvn)
then
1869 if (abs(isum) /= isd)
then
1885 call rdwf_getsize (megul, wfn_unproj_num_csfs, wfn_unproj_num_dets, wfn_unproj_len_pkd_dets)
1896 allocate(wfn_unproj_dets_per_csf(wfn_unproj_num_csfs), stat = ierr)
1899 write(nftw,9950)
'wfn_unproj_dets_per_csf', ierr
1907 allocate(wfn_unproj_coefficients_per_det(wfn_unproj_num_dets), stat = ierr)
1910 write(nftw,9950)
'wfn_unproj_coefficients_per_det',ierr
1918 allocate(wfn_unproj_packed_dets(wfn_unproj_len_pkd_dets), stat = ierr)
1921 write(nftw,9950)
'wfn_unproj_packed_dets', ierr
1931 allocate(wfn_unproj_indx_1st_det_per_csf(wfn_unproj_num_csfs+1), stat = ierr)
1934 write(nftw,9950)
'wfn_unproj_indx_1st_det_per_csf',ierr
1944 allocate(wfn_unproj_indx_1st_coeff_per_csf(wfn_unproj_num_csfs+1), stat = ierr)
1947 write(nftw,9950)
'wfn_unproj_indx_1st_coeff_per_csf', ierr
1957 call rdwf (megul, num_csfs_unproj, wfn_unproj_dets_per_csf, &
1958 num_dets_unproj, wfn_unproj_coefficients_per_det, &
1959 len_pkd_dets_unproj, wfn_unproj_packed_dets)
1965 if (num_csfs_unproj /= wfn_unproj_num_csfs)
then
1966 write(nftw,*)
' Error 1 '
1970 if (num_dets_unproj /= wfn_unproj_num_dets)
then
1971 write(nftw,*)
' Error 2 '
1975 if (len_pkd_dets_unproj /= wfn_unproj_len_pkd_dets)
then
1976 write(nftw,*)
' Error 3 '
1995 wfn_unproj_indx_1st_coeff_per_csf(1) = 1
1997 do n = 2, num_csfs_unproj
1998 wfn_unproj_indx_1st_coeff_per_csf(n) = &
1999 wfn_unproj_indx_1st_coeff_per_csf(n-1) + &
2000 wfn_unproj_dets_per_csf(n-1)
2003 wfn_unproj_indx_1st_coeff_per_csf(num_csfs_unproj+1) = &
2004 wfn_unproj_indx_1st_coeff_per_csf(num_csfs_unproj) + &
2005 wfn_unproj_dets_per_csf(num_csfs_unproj)
2011 wfn_unproj_indx_1st_det_per_csf(1) = 1
2013 do n = 1, num_csfs_unproj
2014 num_dets = wfn_unproj_dets_per_csf(n)
2016 nreps = wfn_unproj_packed_dets(k)
2017 k = k + (2*nreps + 1)
2019 if (n <= num_csfs_unproj)
then
2020 wfn_unproj_indx_1st_det_per_csf(n+1) = k
2028 if (npflg(1) > 5)
then
2029 write(nftw,1285) megul
2030 call ptpwf (nftw,num_csfs_unproj,nelt,ndtrf, &
2031 wfn_unproj_dets_per_csf, &
2032 wfn_unproj_indx_1st_det_per_csf, &
2033 wfn_unproj_indx_1st_coeff_per_csf, &
2034 wfn_unproj_packed_dets, &
2035 wfn_unproj_coefficients_per_det)
2057 if (zbypass_wfn_projection)
then
2058 wfn_proj_num_csfs = wfn_unproj_num_csfs
2059 wfn_proj_num_dets = wfn_unproj_num_dets
2060 wfn_proj_len_pkd_dets = wfn_unproj_len_pkd_dets
2062 wfn_proj_num_csfs = wfn_unproj_num_csfs
2063 wfn_proj_num_dets = 10 * wfn_unproj_num_dets
2064 wfn_proj_len_pkd_dets = 10 * wfn_unproj_len_pkd_dets
2075 allocate(wfn_proj_dets_per_csf(wfn_proj_num_csfs), stat = ierr)
2078 write(nftw,9950)
'wfn_proj_dets_per_csf', ierr
2086 allocate(wfn_proj_coefficients_per_det(wfn_proj_num_dets), stat = ierr)
2089 write(nftw,9950)
'wfn_proj_coefficients_per_det', ierr
2097 allocate(wfn_proj_packed_dets(wfn_proj_len_pkd_dets), stat=ierr)
2100 write(nftw,9950)
'wfn_proj_packed_dets', ierr
2112 allocate(wfn_proj_indx_1st_det_per_csf(wfn_proj_num_csfs+1), stat = ierr)
2115 write(nftw,9950)
'wfn_proj_indx_1st_det_per_csf', ierr
2124 allocate(wfn_proj_indx_1st_coeff_per_csf(wfn_proj_num_csfs+1), stat = ierr)
2127 write(nftw,9950)
'wfn_proj_indx_1st_coeff_per_csf', ierr
2140 if (zbypass_wfn_projection)
then
2141 wfn_proj_dets_per_csf = wfn_unproj_dets_per_csf
2142 wfn_proj_packed_dets = wfn_unproj_packed_dets
2143 wfn_proj_coefficients_per_det = wfn_unproj_coefficients_per_det
2144 wfn_proj_indx_1st_det_per_csf = wfn_unproj_indx_1st_det_per_csf
2145 wfn_proj_indx_1st_coeff_per_csf = wfn_unproj_indx_1st_det_per_csf
2148 maxndi =
size(wfn_unproj_packed_dets)
2149 maxcdi =
size(wfn_unproj_coefficients_per_det)
2150 maxndo =
size(wfn_proj_packed_dets)
2151 maxcdo =
size(wfn_proj_coefficients_per_det)
2153 if (maxndi <= 0 .or. maxcdi <= 0) stop 901
2154 if (maxndo <= 0 .or. maxcdo <= 0) stop 902
2156 call wfgntr (mgvn, iss, isd, thres, r, symtyp, nelt, &
2157 nsym, nob, nob1, nob01, nobe, norb, nsrb, &
2158 itab_sporb_indx_in_sym, &
2159 itab_sporb_gu_value, &
2162 iposit, map_orbitals, itab_sporb_mpos, &
2163 wfn_unproj_num_csfs, &
2165 wfn_unproj_dets_per_csf, &
2166 wfn_unproj_packed_dets, &
2167 wfn_unproj_coefficients_per_det, &
2168 wfn_unproj_indx_1st_det_per_csf, &
2169 wfn_unproj_indx_1st_coeff_per_csf, &
2171 wfn_proj_dets_per_csf, &
2172 wfn_proj_packed_dets, &
2173 wfn_proj_coefficients_per_det, &
2174 wfn_proj_indx_1st_det_per_csf, &
2175 wfn_proj_indx_1st_coeff_per_csf, &
2176 maxndo, maxcdo, lenndo, lencdo, &
2177 npflg, byproj, nftw, nalm)
2191 if (npflg(3) /= 0)
then
2192 write(nftw,
'("1 OUTPUT FUNCTIONS IN PACKED FORM")')
2193 call ptpwf (nftw, wfn_proj_num_csfs, nelt, ndtrf, &
2194 wfn_proj_dets_per_csf, &
2195 wfn_proj_indx_1st_det_per_csf, &
2196 wfn_proj_indx_1st_coeff_per_csf, &
2197 wfn_proj_packed_dets, &
2198 wfn_proj_coefficients_per_det)
2209 deallocate(wfn_unproj_dets_per_csf, stat = ierr)
2212 write(nftw, 9960)
'wfn_unproj_dets_per_csf', ierr
2216 deallocate(wfn_unproj_coefficients_per_det, stat = ierr)
2219 write(nftw, 9960)
'wfn_unproj_coefficients_per_det', ierr
2223 deallocate(wfn_unproj_packed_dets, stat = ierr)
2226 write(nftw, 9960)
'wfn_unproj_packed_dets', ierr
2230 deallocate(wfn_unproj_indx_1st_det_per_csf, stat = ierr)
2233 write(nftw, 9960)
'wfn_unproj_indx_1st_det_per_csf', ierr
2237 deallocate(wfn_unproj_indx_1st_coeff_per_csf, stat = ierr)
2240 write(nftw, 9960)
'wfn_unproj_1st_coeff_per_csf', ierr
2251 ztarget_state_calculation = iscat == 1
2252 zscattering_calculation = iscat > 1
2262 allocate(nconf(nelt), stat = ierr)
2266 write(nftw, 9950)
'nconf', ierr
2274 if (ztarget_state_calculation)
then
2277 leniphase = sum(nctgt(1:ntgsym))
2280 allocate(
iphase(leniphase), stat = ierr)
2283 write(nftw, 9950)
'iphase', ierr
2293 allocate(iphase0(3*nocsf), stat = ierr)
2297 write(nftw, 9950)
'iphase0', ierr
2306 if (ztarget_state_calculation)
then
2313 call dophz0 (nftw, nocsf, nelt, ndtrf, nconf, &
2314 wfn_proj_indx_1st_det_per_csf, &
2315 wfn_proj_packed_dets, &
2317 wfn_proj_indx_1st_coeff_per_csf, &
2318 wfn_proj_coefficients_per_det, &
2323 else if (zscattering_calculation)
then
2326 write(nftw, 3110) ntgsym,notgt
2327 write(nftw, 3120) nctgt
2328 write(nftw, 3130) mcont
2330 if (symtyp == 1)
write(nftw, 3140) gucont
2331 if (npflg(5) > 0)
write(nftw, 3150) mrkorb
2332 if (symtyp <= 1 .and. mgvn > 0)
write(nftw, 3160) mdegen
2339 nctarg = sum(nctgt(1:ntgsym))
2345 call dophz (nftw, nocsf, nelt, ndtrf, nconf, &
2346 wfn_proj_indx_1st_det_per_csf, &
2347 wfn_proj_packed_dets, &
2349 wfn_proj_indx_1st_coeff_per_csf, &
2350 wfn_proj_coefficients_per_det, &
2356 nctarg, nctgt, notgt, mrkorb, &
2357 mdegen, ntgsym, mcont, &
2363 write(nftw,*)
'neither a target state nor a scattering run'
2378 write(nftw, 3167) megul
2379 call wrnfto (sname, mgvn, s, sz, r, pin, norb, nsrb, &
2380 nocsf, nelt, idiag, nsym, symtyp, &
2381 nob, ndtrf, wfn_proj_dets_per_csf, &
2383 wfn_proj_indx_1st_coeff_per_csf, &
2384 wfn_proj_indx_1st_det_per_csf, &
2385 wfn_proj_packed_dets, &
2387 wfn_proj_coefficients_per_det, &
2389 megul, nob1, 2 * nsym, &
2390 npflg, thres, iposit, nob0, nob01, nctarg, &
2391 ntgsym, notgt, nctgt, mcont, gucont,
iphase, &
2392 nobe, nobp, nobv, maxtgsym)
2393 write(nftw, 3170) megul
2395 write(nftw, 3168) megul
2398 wfn_proj_dets_per_csf, &
2400 wfn_proj_coefficients_per_det, &
2401 len_pkd_dets_proj, &
2402 wfn_proj_packed_dets)
2409 if (
allocated(nconf))
then
2410 deallocate(nconf, stat = ierr)
2413 write(nftw, 9960)
'nconf', ierr
2418 if (
allocated(
iphase))
then
2419 deallocate(
iphase, stat = ierr)
2422 write(nftw, 9960)
'iphase', ierr
2427 if (
allocated(iphase0))
then
2428 deallocate(iphase0, stat = ierr)
2431 write(nftw, 9960)
'iphase0', ierr
2444 deallocate(itab_sporb_indx_in_sym, stat = ierr)
2447 write(nftw, 9960)
'itab_sporb_indx_in_sym', ierr
2451 deallocate(itab_sporb_gu_value, stat = ierr)
2454 write(nftw, 9960)
'itab_sporb_gu_value', ierr
2458 deallocate(itab_sporb_sym, stat = ierr)
2461 write(nftw, 9960)
'itab_sporb_sym', ierr
2465 deallocate(itab_sporb_isz, stat = ierr)
2468 write(nftw, 9960)
'itab_sporb_isz', ierr
2472 deallocate(itab_sporb_mpos, stat = ierr)
2475 write(nftw, 9960)
'itab_sporb_mpos', ierr
2479 deallocate(map_orbitals, stat = ierr)
2482 write(nftw, 9960)
'mpos_orbitals', ierr
2492 40
format(.LT.
' SSZ')
2493 1000
format(/,5x,
'Projection and phase alignment of wavefunction ',/, &
2494 5x,
'============================================== ',//,&
2495 5x,
'Input data: ',/)
2496 1005
format(5x,
' Sname = ',a,/, &
2497 5x,
' Mgvn = ',i10,/, &
2498 5x,
' S = ',f10.4,/, &
2499 5x,
' Sz = ',f10.4,/, &
2500 5x,
' R = ',f10.4,/, &
2501 5x,
' Pin = ',f10.4,/, &
2502 5x,
' Nocsf = ',i10,/, &
2503 5x,
' Idiag = ',i10,//)
2504 1007
format(5x,
' Number of electrons in system (nelt) = ',i5,//, &
2505 5x,
' Reference determinant: ',//, &
2506 5x,
' (refdet) = ',10(i5,1x),/, &
2509 1020
format(5x,
' Point group (symmetry) of nuclear framework (symtyp) = ',i3,/)
2510 1021
format(5x,
' This is the C-inf-v point group',/)
2511 1022
format(5x,
' This is the D-inf-h point',/)
2512 1023
format(5x,
' This is an Abelian point group ',/)
2514 1030
format(5x,.eq.
' Bypassing wavefunction projection (byproj 0)',/)
2515 1031
format(5x,.ne.
' Wavefunction will be projected (byproj 0)',/)
2517 1035
format(5x,.gt.
' Adjusting phase of wavefunction for scattering (iscat 0)',/)
2518 1036
format(5x,.le.
' Not adjusting phase of wavefunction for scattering (iscat 0)',/)
2520 1038
format(/,5x,
' Print flags (npflg) ',/,&
2521 5x,
' ------------------- ',/,&
2522 5x,
' 1. Unprojec and projec wavefunctions : ',i5,/,&
2526 5x,
' 5. Target or scattering phase compute : ',i5,/,&
2527 5x,
' 6. Abelian point grp multiplctn table : ',i5,/)
2529 1099
format(/,5x,
'**** End of the input data',/)
2531 1100
format(5x,
'Orbitals per symmetry (nob):',/,(6x,i3,
'. ',i3))
2532 1110
format(/,5x,
'Total number of orbitals (norb) = ',i8,/, &
2533 5x,
'Triangulation of norb (norbb) = ',i8)
2534 1120
format(/,5x,
'Total number of spin-orbs (nsrb) = ',i8,/)
2535 1130
format(5x,
'Spin orbitals table of quantum numbers',//, &
2536 5x,
' I N G M S MPOS ',/,&
2537 5x,
'----- ----- ----- ----- ----- ----- ')
2538 1140
format((5x,6(i5,2x)))
2539 1145
format(/,5x,
'**** End of table of spin-orbitals ',/)
2541 1160
format(/,5x,
'User defined quantum numbers of ref determinant :',//,&
2542 5x,
' mgvn = ',i5,/, &
2543 5x,
' S = ',f8.3,/, &
2544 5x,
' Sz = ',f8.3,//, &
2545 5x,
'and locally computed vars for spin from S,Sz: ',//,&
2546 5x,
' iss = ',i5,/, &
2548 1170
format(/,5x,
'For check, computed q-numbers of ref det:',//,&
2549 5x,
' 2*Sz + 1 = ',i5)
2550 1180
format( 5x,
' irreducible representation = ',i5,//,&
2551 5x,
' (Note: totally symmetric representation = 0) ',/)
2553 1185
format(5x,
' Lambda value = ',i5,/)
2554 1190
format(5x,
' Symmetry quantum number in refdet is not MGVN')
2555 1195
format(5x,
' Sz in refdet is not = SZ')
2557 1270
format(/,5x,
'Starting to build indexes for the wavefunction',/)
2558 1280
format(/,5x,
'Finished building indexes for the wavefunction',/)
2559 1285
format(/,5x,
'Wavefunctions read from input file on unit ',i5,/)
2561 2000
format(/,5x,
'The wavefunction will be projected',//, &
2562 5x,
'This means that the wavefunction on unit ',i5,
' is an',/,&
2563 5x,
'unprojected wavefunction.',/)
2564 2010
format(5x,
'Data read from the wavefunction on unit: ',i5,//, &
2565 5x,
' number of CSFs = ',i10,/, &
2566 5x,
' number of determinants = ',i10,/, &
2567 5x,
' length of packed determinants = ',i10,//, &
2568 5x,
'This data will be used to allocate dynamic storage',/,&
2569 5x,
'in which to hold the wavefunction.',/)
2570 2100
format(5x,
'Projected CSFs in packed format:',/)
2571 3000
format(/,5x,
'Computing phase for target state',/)
2572 3100
format(/,5x,
'Performing phase correction for target',/,&
2573 5x,
'states in a scattering run',/)
2574 46
format(
' DUE TO ALARM CONDITION THIS RUN WAS TERMINATED')
2575 3110
format(/
' CI target data for SCATCI:', &
2576 //
' Number of target symmetries in expansion, NTGSYM =',&
2577 i5/
' Number of continuum orbs for each state, NOTGT =',&
2579 3120
format(
' Number of CI components for each state, NCTGT =',20i5,/,(
' ',20i5))
2580 3130
format(
' Continuum M projection for each state, MCONT =',20i5,/,(
' ',20i5))
2581 3140
format(
' Continuum G/U symmetry for each state, GUCONT =',20i5,/,(
' ',20i5))
2582 3150
format(
' Marked continuum orbital for each state, MRKORB =',20i5,/,(
' ',20i5))
2583 3160
format(
' Degenerate coupling case flag MDEGEN =',20i5,/,(
' ',20i5))
2585 3167
format(5x,
'Writing projected CSFs to unit ',i5,
' in format',/,&
2586 5x,
'required by the SCATCI/DENPROP programs ',/)
2587 3168
format(5x,
'Writing projected CSFs to unit ',i5,
' in format',/,&
2588 5x,
'required by the SPEEDY program ',/)
2589 3170
format(5x,
'Data on CSFs has been written to file (MEGUL) = ',i5/)
2590 8000
format(5x,
'***** Wavefn projection (projec()) - completed',/)
2591 9900
format(/,5x,
'***** Error in: projec() ',//)
2592 9950
format(5x,
'Cannot allocate space for array ',a,//,&
2593 5x,
'Return status from allocate() = ',i8,/)
2594 9960
format(5x,
'Cannot de-allocate space for array ',a,//,&
2595 5x,
'Return status from deallocate() = ',i8,/)
2614 subroutine ptpwf (nftw, nocsf, nelt, ndtrf, nodi, indi, icdi, ndi, cdi)
2616 use precisn,
only: wp
2618 integer :: nelt, nftw, nocsf
2619 real(kind=wp),
dimension(*) :: cdi
2620 integer,
dimension(*) :: icdi, indi, ndi, ndtrf, nodi
2621 intent (in) cdi, icdi, indi, ndi, ndtrf, nelt, nftw, nocsf, nodi
2623 integer :: i, k, ma, mb, mc, md, n
2625 write(nftw,
'(" REFERENCE DETERMINANT"//(1X,20I5))') (ndtrf(i), i=1,nelt)
2626 write(nftw,
'(" CSF",9X,"COEFFICIENT",2X,"NSO"/)')
2632 write(nftw,
'(1x,i4,d20.10,i5,2x,20i5/(32x,20i5))') n, cdi(mc+1), md, (ndi(mb+i), i=1,2*md)
2633 mb = mb + md + md + 1
2636 write(nftw,
'(5x,d20.10,i5,2x,20i5/(32x,20i5))') cdi(mc+k), md, (ndi(mb+i), i=1,2*md)
2637 mb = mb + md + md + 1
2641 end subroutine ptpwf
2657 integer function qsort (n, a)
result (swaps)
2659 integer,
intent(in) :: n
2660 integer,
dimension(n),
intent(inout) :: a
2662 integer :: b, i, j, k
2669 if (a(j) <= a(i)) cycle
2673 if (b < a(j - 1))
then
2685 swaps = swaps + i - j
2699 subroutine rdwf (nft, k1, nodi, k2, cdi, k3, ndi)
2701 use precisn,
only : wp
2703 integer :: k1, k2, k3, n1, n2, n3, i, nft, st
2704 integer,
dimension(*) :: nodi, ndi
2705 real(kind=wp),
dimension(*) :: cdi
2714 read(nft, iostat = st) n1, (nodi(k1+i), i=1,n1)
2718 read(nft, iostat = st) n2, (cdi(k2+i), i=1,n2)
2722 read(nft, iostat = st) n3, (ndi(k3+i), i=1,n3)
2750 use precisn,
only : wp
2752 integer :: iunit, num_csfs, num_dets, len_dets
2753 integer :: ncsfs, ndets, ldets, ios, ntemp
2765 read(iunit, iostat = ios) ntemp
2767 ncsfs = ncsfs + ntemp
2770 read(iunit, iostat = ios) ntemp
2772 ndets = ndets + ntemp
2775 read(iunit, iostat = ios) ntemp
2777 ldets = ldets + ntemp
2794 subroutine rfltn (nelt, nodi, ndi, cdi, r, mxnd, ndmxp, thres, nodo, cdo, ndtr, mm, bst)
2796 use precisn,
only : wp
2797 use consts,
only : half => xhalf
2800 integer :: mxnd, ndmxp, nelt, nodi, nodo
2801 real(kind=wp) :: r, thres
2802 real(kind=wp),
dimension(*) :: cdi, cdo
2803 integer,
dimension(*) :: mm, ndi, ndtr
2805 intent (in) cdi, mm, nodi, r
2806 intent (inout) nodo, bst
2808 real(kind=wp) :: cfd
2809 integer :: i, j, ma, nd
2811 cdo(1:nodi) = half * cdi(1:nodi)
2816 cfd = half * r * cdi(i)
2819 if (mm(ma) /= 0) ma = ma + sign(2, mm(ma))
2822 if (mod(
qsort(nelt, ndtr(1:nelt)), 2) /= 0) cfd = -cfd
2823 call stmrg (nelt, mxnd, ndmxp, ndi, cdo, nodo, ndtr, cfd, bst)
2824 if (nodo < 0)
return
2828 call cntrct (nelt, nodo, ndi, cdo, thres)
2830 end subroutine rfltn
2846 use precisn,
only : wp
2847 use consts,
only : zero => xzero
2850 real(kind=wp),
dimension(*) :: array
2851 real(kind=wp) ::
snrm2
2852 intent (in) array, istep, n
2888 subroutine stmrg (nelt, maxcdo, maxndo, ndo, cdo, nodo, ndi, cdi, bst)
2890 use precisn,
only : wp
2893 real(kind=wp),
parameter :: one = 1.0_wp
2900 integer :: ndo(maxndo)
2903 integer :: ndi(nelt)
2905 real(kind=wp) :: cdo(maxcdo)
2906 real(kind=wp) :: cdi
2908 integer i, ibase, idet, n
2910 logical,
parameter :: zdebug = .false.
2915 write(6,
'(/,30x,"===> STMRG() <====",/)')
2916 write(6,
'( 30x,"Input data: ")')
2917 write(6,
'( 30x," nelt = ",I6)') nelt
2918 write(6,
'( 30x," maxcdo = ",I6)') maxcdo
2919 write(6,
'( 30x," maxndo = ",I6)') maxndo
2920 write(6,
'( 30x," cdi = ",D13.6)') cdi
2921 write(6,
'(/,30x,"# of dets in current (cdo,ndo) list (nodo) = ",I5,/)') nodo
2925 write(6,
'( 30x,I5,2x,D13.6,20(I4,1x))') idet, cdo(idet), (ndo(ibase+i), i=1,nelt)
2926 ibase = ibase + nelt
2933 n = bst % locate_det(ndi)
2940 write(6,
'(/,30x,"New determinant found in ""existing"" list:")')
2941 write(6,
'( 30x," Found in exisiting list at n = ",I6)') n
2942 write(6,
'( 30x," Coefficient cdo(n) = ",D13.6)') cdo(n)
2943 write(6,
'( 30x," Augment coeff, cdi*sign = ",D13.6,/)') cdi
2946 cdo(n) = cdo(n) + cdi
2953 write(6,
'(30x,"Adding new determinant to end of list",/)')
2956 if (nodo + 1 > maxcdo .or. (nodo + 1) * nelt > maxndo)
then
2957 write(6,
'(/,10x,"**** Error in stmrg(): ",/)')
2958 write(6,
'( 10x,"Insufficient space to add extra determinant onto")')
2959 write(6,
'( 10x,"end of list.")')
2960 write(6,
'( 10x," cdo() : required ",I10," available ",I10)') nodo + 1, maxcdo
2961 write(6,
'( 10x," ndo() : required ",I10," available ",I10,/)') (nodo + 1) * nelt, maxndo
2966 ndo(nodo * nelt + 1 : nodo * nelt + nelt) = ndi(1:nelt)
2969 call bst % insert(nodo)
2972 write(6,
'(30x,"Bstree after stmrg: ")')
2973 call bst % output(32)
2981 write(6,
'(/,30x,"# of dets in current (cdo,ndo) list (nodo) = ",I5,/)') nodo
2985 write(6,
'( 30x,I5,2x,D13.6,20(I4,1x))') idet, cdo(idet), (ndo(ibase+i), i=1,nelt)
2986 ibase = ibase + nelt
2989 write(6,
'(/,30x,"***** STMRG() - completed ",/)')
2992 end subroutine stmrg
3003 subroutine wfgntr (mgvn, iss, isd, thres, r, symtyp, nelt, nsyml, nob, nobl, nob0l, nobe, norb, nsrb, &
3004 mn, mg, mm, ms, iposit, map, mpos, nocsf, ndtrf, nodi, ndi, cdi, indil, icdil, maxndi, maxcdi, &
3005 nodo, ndo, cdo, indo, icdo, maxndo, maxcdo, lenndo, lencdo, npflg, byproj, nftw, nalm)
3007 use precisn,
only : wp
3008 use global_utils,
only : mprod
3013 integer,
parameter :: len_cdit = 5000
3014 real(kind=wp) :: cdit(len_cdit)
3018 real(kind=wp),
parameter :: verysmall = 1.0d-30
3023 integer :: symtyp, byproj
3038 integer :: nocsf,nsrb
3039 integer :: maxndi,maxcdi
3040 integer,
dimension(nsyml) :: nob(nsyml),nobl(nsyml),nob0l(nsyml), nobe(nsyml)
3041 integer,
dimension(nsrb) :: mn,mg,mm,ms,map,mpos
3042 integer,
dimension(nelt) :: ndtrf
3044 real(kind=wp) :: r,thres
3068 integer,
dimension(nocsf) :: nodi
3069 integer,
dimension(maxndi) :: ndi
3070 integer,
dimension(nocsf+1) :: indil, icdil
3071 real(kind=wp),
dimension(maxcdi) :: cdi
3075 integer,
dimension(nocsf) :: nodo
3076 integer,
dimension(maxndi) :: ndo
3077 integer,
dimension(nocsf+1) :: indo, icdo
3078 real(kind=wp),
dimension(maxcdi) :: cdo
3081 integer :: n, i, num_dets_input, ipos_dets_input, ipos_coeffs_out, ipos_coeffs_in, &
3082 ipos_dets_out, idet, isum, msum, nsrbs, needed, ierr, lenmop, nalm, &
3083 ipos_this_det, nreps, me, mf, idop, idcp, ieltp, num_dets_final, mxss
3084 integer,
dimension(nelt) :: mdop, mdcp
3085 integer,
dimension(nsrb) :: mdc, mdo, ndta
3086 logical,
allocatable :: flip(:)
3089 real(kind=wp) :: mysum
3091 integer,
allocatable :: mop(:)
3094 integer :: icsf_with_max(1)
3095 integer :: max_num_dets_input
3096 integer :: max_num_dets_output
3099 logical,
parameter :: zdebug = .false.
3102 intrinsic :: sqrt, maxloc, minloc
3107 write(nftw,1010) mgvn,iss,isd,thres,r,nsyml,nelt,nocsf,nsrb
3108 write(nftw,1020) norb, ndmx, ncmx, ndmxp
3109 write(nftw,1030) maxcdo, maxndo
3111 write(nftw,1036) (i,mn(i),mg(i),mm(i),ms(i),mpos(i),i=1,nsrb)
3120 select case (symtyp)
3121 case (0) ; nsrbs = 2 * nob(1)
3122 case (1) ; nsrbs = 2 * (nob(1) + nob(2))
3123 case (2) ; nsrbs = 2 * sum(nob(1:nsyml))
3124 case default ;
write(nftw, 9900) ; stop
3128 write(nftw,1040) nsrbs
3140 max_num_dets_input = maxval(nodi)
3141 icsf_with_max = maxloc(nodi)
3149 lenmop = 7 * nelt * max_num_dets_input
3150 allocate(mop(lenmop), stat = ierr)
3153 write(nftw,9925) lenmop
3159 allocate(flip(max_num_dets_input), stat = ierr)
3162 write(nftw,9926) max_num_dets_input
3181 num_dets_input = nodi(n)
3182 ipos_dets_input = indil(n)
3183 icdo(n) = ipos_coeffs_out
3184 indo(n) = ipos_dets_out
3187 write(nftw,3010) n, nocsf, num_dets_input, ipos_dets_input, ipos_coeffs_out, ipos_dets_out
3201 ipos_this_det = ipos_dets_input
3203 do idet = 1, num_dets_input
3204 nreps = ndi(ipos_this_det)
3207 write(nftw,3020) n, idet, num_dets_input, nreps
3210 if (nreps /= 0)
then
3212 write(nftw,3030) (ndi(ipos_this_det+i), i=1,nreps)
3213 write(nftw,3035) (ndi(ipos_this_det+nreps+i), i=1,nreps)
3218 select case (symtyp)
3224 me = ndi(ipos_this_det + i)
3225 mf = ndi(ipos_this_det + nreps + i)
3226 isum = isum + ms(me) - ms(mf)
3227 msum = msum + mm(me) - mm(mf)
3234 me = ndi(ipos_this_det + i)
3235 mf = ndi(ipos_this_det + nreps + i)
3236 isum = isum + ms(me) - ms(mf)
3237 msum = mprod(msum, mprod(mm(me)+1, mm(mf)+1, 0, nftw), 0, nftw)
3250 write(nftw, 9214) idet, n
3256 write(nftw,9215) idet, n
3268 ipos_this_det = ipos_this_det + nreps + nreps + 1
3288 num_dets_input = nodi(n)
3289 ipos_dets_input = indil(n)
3291 call popnwf (nsrb, nsrbs, nelt, ndtrf, lenmop, mdop, mdcp, mop, mdc, mdo, ndta, &
3292 num_dets_input, ndi(ipos_dets_input), idop, idcp, ieltp, flip, ierr)
3297 write(nftw,4010) ieltp
3302 case (1) ;
write(nftw,233) n
3303 case (2) ;
write(nftw,235) n
3304 case (3:) ;
write(nftw,237) n
3317 ipos_coeffs_in = icdil(n) - 1
3320 do i = 1, num_dets_input
3321 if (flip(i)) cdi(ipos_coeffs_in + i) = -cdi(ipos_coeffs_in + i)
3328 if (ieltp <= 1)
then
3333 write (nftw,4522) ipos_coeffs_in, ipos_coeffs_out
3334 write (nftw,4525) (i, cdi(ipos_coeffs_in+1+i-1), i=1,num_dets_input)
3337 mysum =
snrm2(num_dets_input, cdi(ipos_coeffs_in+1), 1)
3339 if (zdebug)
write(nftw,4530) mysum
3341 if (mysum < verysmall)
then
3343 write(nftw, 2222) mysum
3347 mysum = 1.0_wp/sqrt(mysum)
3349 do i = 1, num_dets_input
3350 cdo(ipos_coeffs_out+i-1) = mysum * cdi(ipos_coeffs_in+1+i-1)
3353 num_dets_final = num_dets_input
3357 write(nftw,4525) (i, cdo(ipos_coeffs_out+i-1), i=1,num_dets_final)
3369 write(nftw,4522) ipos_coeffs_in, ipos_coeffs_out
3370 write(nftw,4525) (i, cdi(ipos_coeffs_in+1+i-1), i=1,num_dets_input)
3374 if (num_dets_input > len_cdit)
then
3376 write(nftw,9935) n, num_dets_input, len_cdit
3379 do i = 1, num_dets_input
3380 cdit(i) = cdi(ipos_coeffs_in + i)
3386 write(nftw,4525) (i, cdit(i), i=1,num_dets_input)
3402 lencdo = maxcdo - ipos_coeffs_out + 1
3405 call prjct (ieltp, mxss, num_dets_input, mop, cdit, num_dets_final, cdo(ipos_coeffs_out), &
3406 lencdo, mgvn, iss, isd, thres, r, ndta, mm, ms, lenmop, symtyp, nsrb)
3410 write(nftw,4525) (i, cdo(ipos_coeffs_out+i-1), i=1,num_dets_final)
3422 write(nftw, 4062) num_dets_final, ieltp, idop, idcp, ipos_dets_out, maxndo
3425 call pkwf (num_dets_final, ieltp, cdo(ipos_coeffs_out), mop, idop, mdop, idcp, mdcp, &
3426 nftw, ipos_dets_out, ndo, maxndo, n)
3432 nodo(n) = num_dets_final
3433 ipos_coeffs_out = ipos_coeffs_out + num_dets_final
3437 if (ipos_dets_out >= maxndo)
then
3439 write(nftw,9981) n, maxndo
3443 if (ipos_coeffs_out >= maxcdo)
then
3445 write(nftw,9982) n, maxcdo
3463 if (
allocated(mop))
then
3464 deallocate(mop, stat = ierr)
3467 write(nftw,9927) lenmop
3473 if (
allocated(flip))
then
3474 deallocate(flip, stat = ierr)
3477 write(nftw,9928) max_num_dets_input
3484 indo(nocsf+1) = ipos_dets_out
3485 icdo(nocsf+1) = ipos_coeffs_out
3488 lenndo = ipos_dets_out - 1
3489 lencdo = ipos_coeffs_out - 1
3492 max_num_dets_output = maxval( nodo )
3493 icsf_with_max = maxloc( nodo )
3495 write(nftw,2992) icsf_with_max(1), max_num_dets_output
3498 write(nftw,7990) lenndo, maxndo, lencdo, maxcdo
3502 233
format(i6,
' TH WF IN ERROR, (NO. OF OPEN SO NOT =)')
3503 237
format(i6,
' TH WF IN ERROR,(NELTP=0,BUT NOD GT. 1)')
3504 235
format(
' NEED MORE SPACE FOR MOP IN',i5,
' TH WF',/, &
3505 ' Increase parameter LNDT in input')
3506 1000
format(/,10x,
'====> WFGNTR() <====',/)
3507 1010
format( 10x,
'Input data: ',/, &
3508 10x,
' mgvn = ',i10,/, &
3509 10x,
' iss = ',i10,/, &
3510 10x,
' isd = ',i10,/, &
3511 10x,
' thres = ',f12.5,/, &
3512 10x,
' r = ',f12.5,/, &
3513 10x,
' nsyml = ',i10,/, &
3514 10x,
' nelt = ',i10,/, &
3515 10x,
' nocsf = ',i10,/, &
3517 1020
format( 10x,
' norb = ',i10,/, &
3518 10x,
' ndmx = ',i10,/, &
3519 10x,
' ncmx = ',i10,/, &
3520 10x,
' ndmxp = ',i10,/)
3521 1030
format( 10x,
' maxcdo = ',i10,/, &
3522 10x,
' maxndo = ',i10,/)
3523 1035
format(5x,
'Spin orbitals table of quantum numbers',//, &
3524 5x,
' I N G M S MPOS ',/, &
3525 5x,
'----- ----- ----- ----- ----- ----- ')
3526 1036
format((5x,6(i5,2x)))
3527 1037
format(/,5x,
'**** End of table of spin-orbitals ',/)
3528 1040
format(10x,
'No. non-degenerate spin orbitals (nsrbs) = ',i6,/)
3529 1055
format(10x,
'Allocating ',i8,
' integers for array mop() ',/)
3530 1500
format(/,10x,
'Allocated ',i10,
' integer units to array nr() ',/)
3531 2222
format(/,
' Sum IN WFGNTR =',e20.12,//)
3532 2990
format(/,10x,
'On input CSF ',i7,
' has the largest ',/, &
3533 10x,
'number of determinants = ',i7,/)
3534 2992
format(/,10x,
'On output CSF ',i7,
' has the largest ',/, &
3535 10x,
'number of determinants = ',i7,/)
3536 3000
format(/,10x,
'Entering loop over CSFs ',/)
3537 3010
format(/,10x,
'>>>> Processing input CSF ',i10,
' of ',i10,//, &
3538 10x,
'Number of determinants (num_dets_input) = ',i7,/, &
3539 10x,
'1st in pkd dets array (ipos_dets_input) = ',i7,//, &
3540 10x,
'1st in Out coefs arry (ipos_coeffs_out) = ',i7,/, &
3541 10x,
'1st in Output dets arry (ipos_dets_out) = ',i7)
3542 3020
format(/,15x,
'CSF ',i7,
' - Det. ',i6,
' of ',i6,//, &
3543 20x,
'Number of replacements (nreps) = ',i5,/)
3544 3030
format(20x,
'Replaced spin orbs : ',20(i3,1x))
3545 3035
format(20x,
'Replacments spin. orbs: ',20(i3,1x))
3546 3090
format(/,15x,
'Quantum numbers for all determinants in this CSF',/, &
3547 15x,
'have been validated.',/)
3548 4010
format(15x,
'Number of electrons in open shells (ieltp) = ',i5,/)
3549 4050
format(15x,
'The expansion coefficients for each determinant ',/ &
3550 15x,
'have been normalized.',/)
3551 4060
format(/,15x,
'This projected CSF will now be packed into',/ &
3552 15x,
'into the array holding all output packed CSF',/)
3553 4062
format(15x,
'Data sent into PKWF() follows: (old name/new name)',/, &
3554 15x,
' nod (num_dets_final) = ',i10,/, &
3555 15x,
' neltp (ieltp) = ',i10,/, &
3556 15x,
' idop (idop) = ',i10,/, &
3557 15x,
' idcp (idcp) = ',i10,/, &
3558 15x,
' no (ipos_dets_out) = ',i10,/, &
3559 15x,
' ndmx (maxndo) = ',i10,/)
3560 4510
format(15x,
'Normalizing CSF expansion coefficients using ',/, &
3561 15x,
'the SNRM2 function. Projection is not needed.'/)
3562 4520
format(/,15x,
'CSF coefficients before normalization: ',/)
3563 4522
format(15x,
'Storage locs for input and output coefficients: ',//, &
3564 15x,
' For cdi(), ipos_coeffs_in = ',i7,//, &
3565 15x,
' For cdo(), ipos_coeffs_out = ',i7,/)
3566 4525
format(15x,i6,
'. ',2x,f13.7)
3567 4530
format(/,15x,
'Sum - sqrs of coefficients (this CSF) = ',d13.6,/)
3568 4540
format(/,15x,
'CSF coefficients after normalization: ',/)
3569 4610
format(15x,
'Normalizing CSF expansion coefficients using ',/, &
3570 15x,
'projection because it has >= 2 electrons in ',/, &
3571 15x,
'open shells. '/)
3572 4625
format(/,15x,
'Coefficients have been copied into CDIT(): ',/)
3573 4690
format(/,10x,
'<<<< Completed processing of CSF number ',i6,/)
3574 7990
format(/,10x,
'At end of wfgntr(), usage of memory in output',/, &
3575 10x,
'arrays is as follows: ',//, &
3576 10x,
' Array Used Max avail ',/, &
3577 10x,
' ----- --------- --------- ',/, &
3578 10x,
' ndo() ',i9,2x,i9,/, &
3579 10x,
' cdo() ',i9,2x,i9,/)
3580 8000
format(/,10x,
'**** WFGNTR() - completed ',/)
3583 9214
format(5x,
'Spatial symmetry for determinant ',i5,/, &
3584 5x,
'in CSF ',i5,
' does not match ref determinant',/)
3585 9215
format(5x,
'Sz quantum number for determinant ',i5,/, &
3586 5x,
'in CSF ',i5,
' does not match ref determinant',/)
3587 9900
format(/,5x,
'***** Error in: wfngtr() ',//)
3588 9925
format(5x,
'Cannot allocate array mop() of length (lenmop) ',i8,/)
3589 9926
format(5x,
'Cannot allocate array flip() of length (max_num_dets_input) ',i8,/)
3590 9927
format(5x,
'Cannot de-alloc array mop() of length (lenmop) ',i8,/)
3591 9928
format(5x,
'Cannot de-alloc array flip() of length (max_num_dets_input) ',i8,/)
3592 9935
format(5x,
'Insufficient space in cdit() for projection ',/, &
3593 5x,
'CSF ',i10,
' has ',i10,
' determinants ',/, &
3594 5x,
'cdit() holds the expansion coefficient ',/, &
3595 5x,
'for each determinant and len_cdit must be ',/, &
3596 5x,
'at least as big as the number of determinants',/, &
3597 5x,
'Currenttly it is fixed at ',i10,/)
3598 9955
format(5x,
'WFNGTR() has received an error on return',/, &
3599 5x,
'fromPOPNWF(). Code is terminating now.',/)
3600 9981
format(5x,
'CSF ',i7,
' has exhausted space available in ndo',/, &
3601 5x,
'Available (maxndo) = ',i10)
3602 9982
format(5x,
'CSF ',i7,
' has exhausted space available in cdo',/, &
3603 5x,
'Available (maxcdo) = ',i10)
3615 subroutine wrnfto (sname, mgvn, s, sz, r, pin, norb, nsrb, nocsf, nelt, idiag, nsym, symtyp, &
3616 nob, ndtrf, nodo, m, icdo, indo, ndo, lndi, cdo, lcdi, nfto, nobl, nx, &
3617 npflg, thres, iposit, nob0, nob0l, nctarg, ntgsym, notgt, nctgt, mcont, &
3618 gucont, iphz, nobe, nobp, nobv, maxtgsym)
3620 use precisn,
only : wp
3622 integer :: symtyp, i, nfto, iposit, norb, nsrb, idiag, itg, maxtgsym, mgvn, &
3623 norbw, nsrbw, lcdi, lndi, nsym, nelt, m, nx, nctarg, ntgsym, nocsf
3624 integer,
parameter :: iwrite = 6
3625 integer,
dimension(nsym) :: nob, nob0, nobe, nobp, nobv
3626 integer,
dimension(nelt) :: ndtrf
3627 integer,
dimension(nocsf) :: nodo
3628 integer,
dimension(m) :: icdo, indo
3629 integer,
dimension(lndi) :: ndo
3630 integer,
dimension(ntgsym) :: notgt, nctgt, mcont, gucont
3631 integer,
dimension(nctarg) :: iphz
3632 integer,
dimension(20) :: nobw
3633 integer,
dimension(nx) :: nobl, nob0l
3634 integer,
dimension(6) :: npflg
3635 real(kind=wp),
dimension(lcdi) :: cdo
3636 real(kind=wp) :: s, sz, r, pin, thres
3637 character(120) :: name
3638 character(80) :: sname
3644 write(iwrite,
'(/,5x,"Writing final results to disk (wrnfto) ")')
3645 write(iwrite,
'( 5x,"-------------------------------------- ")')
3646 write(iwrite,
'( 5x," Logical unit (nfto) = ",I8)') nfto
3647 write(iwrite,
'( 5x," Positrons present (iposit) = ",I8)') iposit
3648 write(iwrite,
'( 5x," Number of electrons (nelt) = ",I8)') nelt
3649 write(iwrite,
'( 5x," Number of CSFs (nocsf) = ",I8)') nocsf
3650 write(iwrite,
'( 5x," Number of symmetries (nsym) = ",I8)') nsym
3651 write(iwrite,
'( 5x," Point group flag (symtyp) = ",I8)') symtyp
3652 write(iwrite,
'( 5x," Orbitals per symm (nob) : ",(20(I3,1x)))') (nob(i), i=1,nsym)
3653 write(iwrite,
'( 5x," Total # of orbitals (norb) = ",I8)') norb
3654 write(iwrite,
'( 5x," Total # of spin orbs (nsrb) = ",I8)') nsrb
3656 write(iwrite,
'(/,5x," Length of index arrays - icdo,indo (m) = ",I8)') m
3657 write(iwrite,
'( 5x," Length of coeff. array - cdo (lcdi) = ",I8)') lcdi
3658 write(iwrite,
'( 5x," (equals # dets in wfn)")')
3659 write(iwrite,
'( 5x," Length of packed dets array - ndo (lndi) = ",I8)') lndi
3661 write(iwrite,
'(/,5x," Spin quantum number (s) = ",F8.2)') s
3662 write(iwrite,
'( 5x," Z-projection of spin (sz) = ",F8.2)') sz
3663 write(iwrite,
'( 5x," Reflection quant. # (r) = ",F8.2)') r
3664 write(iwrite,
'( 5x," Pin (pin) = ",F8.2)') pin
3665 write(iwrite,
'( 5x," (idiag) = ",I8,/)') idiag
3673 nobw(1:nsym) = nob(1:nsym)
3685 if (iposit == 0)
then
3686 write(nfto) name, mgvn, s, sz, r, pin, norbw, nsrbw, nocsf, nelt, lcdi, idiag, &
3687 nsym, symtyp, lndi, npflg, thres, nctarg, ntgsym
3688 if (ntgsym > 0)
write(nfto) iphz, nctgt, notgt, mcont, gucont
3689 if (ntgsym <= 0)
write(nfto) iphz
3690 write(nfto) (nobw(i), i=1,nsym), ndtrf, nodo, iposit, nob0, nobl, nob0l
3692 write(nfto) name, mgvn, s, sz, r, pin, norbw, nsrbw, nocsf, nelt, lcdi, idiag, &
3693 nsym, symtyp, lndi, npflg, thres, nctarg, maxtgsym
3694 if (maxtgsym > 0)
then
3696 write(nfto) (nctgt(itg), itg=1,maxtgsym)
3697 write(nfto) (notgt(itg), itg=1,maxtgsym)
3698 write(nfto) (mcont(itg), itg=1,maxtgsym)
3699 write(nfto) (gucont(itg), itg=1,maxtgsym)
3701 if (maxtgsym <= 0)
write(nfto) iphz
3702 write(nfto) (nobw(i), i=1,nsym), ndtrf, nodo, iposit, nob0, nobl, nob0l
3703 write(nfto) (nobe(i), i=1,nsym)
3704 write(nfto) (nobp(i), i=1,nsym)
3705 write(nfto) (nobv(i), i=1,nsym)
3712 write(nfto) icdo, indo
3739 subroutine wrwf (nft, n1, nodo, n2, cdo, n3, ndo)
3741 use precisn,
only : wp
3743 integer :: n1, n2, n3, nft
3744 real(kind=wp),
dimension(n2) :: cdo
3745 integer,
dimension(n3) :: ndo
3746 integer,
dimension(n1) :: nodo
3747 intent (in) cdo, n1, n2, n3, ndo, nft, nodo