2
c ==============================================
3
c Create effective Hamiltonian
4
c ==============================================
6
subroutine tce_heff(d_em,k_e_offsetm,k_r1_offsetm,
7
1 k_r2_offsetm,k_r3_offsetm,k_r4_offsetm,d_r1m,d_r2m,d_r3m,d_r4m,
8
2 needt1,needt2,needr3act,needr4act,rtdb)
11
#include "mafdecls.fh"
16
#include "tce_mrcc.fh"
18
#include "tce_main.fh"
21
integer k_e_offsetm(maxref)
25
integer k_r1_offsetm(maxref)
26
integer k_r2_offsetm(maxref)
27
integer k_r3_offsetm(maxref)
28
integer k_r4_offsetm(maxref)
29
integer d_r1m(maxref),d_r2m(maxref)
30
integer d_r3m(maxref),d_r4m(maxref)
31
logical needt1,needt2,needr3act
35
nodezero = (ga_nodeid().eq.0)
37
if(lusesub)call ga_zero(g_heff)
40
dbl_mb(k_heff+i-1) = 0.0d0
45
if((int_mb(k_refafi+iref-1).eq.int_mb(k_innodes
46
1 +ga_nnodes()+ga_nodeid())).or.(.not.lusesub)) then
48
call get_block(d_em(iref),corr,1,0)
49
dbl_mb(k_heff+iref-1+(iref-1)*nref) = corr+duhfens(iref)
53
c write(6,*)ga_nodeid(),corr+duhfens(iref),iref
54
call ga_put(g_heff,nref*(iref-1)+iref,nref*(iref-1)+iref,1,1,
55
1 corr+duhfens(iref),1)
62
call tce_heff_offdiagonal(k_r1_offsetm,k_r2_offsetm,
63
1 k_r3_offsetm,k_r4_offsetm,d_r1m,d_r2m,d_r3m,d_r4m,needt1,
64
2 needt2,needr3act,needr4act,rtdb)
67
c call ma_print(dbl_mb(k_heff),nref,nref,'Heff')
73
c ==============================================
74
c Add offdiagonal elements of Heff
75
c ==============================================
77
subroutine tce_heff_offdiagonal(k_r1_offsetm,
78
1 k_r2_offsetm,k_r3_offsetm,k_r4_offsetm,d_r1m,d_r2m,d_r3m,
79
2 d_r4m,needt1,needt2,needr3act,needr4act,rtdb)
82
#include "mafdecls.fh"
87
#include "tce_mrcc.fh"
89
#include "tce_main.fh"
93
integer k_r1_offsetm(maxref)
94
integer k_r2_offsetm(maxref)
95
integer k_r3_offsetm(maxref)
96
integer k_r4_offsetm(maxref)
97
integer d_r1m(maxref),d_r2m(maxref)
101
integer i,j,p5b,h6b,k
103
integer l_r1,k_r1,l_r2,k_r2
106
integer p1b,p2b,h3b,h4b
112
integer h1,h2,h3,p4,p5,p6
116
integer ioccnew(maxorb,2)
119
logical needt1,needt2,needr3act
122
integer is,iocc0(maxorb,2)
124
double precision dsmult
134
nodezero = (ga_nodeid().eq.0)
137
c if (.not.rtdb_get(rtdb,'mrcc:usescffermiv',mt_log,1,lusescffv))
138
c 1 lusescffv = .false.
139
c if (.not.rtdb_get(rtdb,'mrcc:improvetiling',mt_log,1,limprovet))
140
c 1 limprovet = .false.
144
if(i.le.nocc(is)) then
154
if((int_mb(k_refafi+iref-1).eq.int_mb(k_innodes
155
1 +ga_nnodes()+ga_nodeid())).or.(.not.lusesub)) then
158
k_offset = k_offsetm(iref)
159
k_range = k_rangem(iref)
160
k_spin = k_spinm(iref)
161
k_movecs_sorted = k_movecs_sortedm(iref)
162
k_active = k_active_tmpm(iref)
176
do p5b = noab+1,noab+nvab
181
if (int_mb(k_spin+p5b-1) .eq. int_mb(k_spin+h6b-1)) then
182
if (ieor(int_mb(k_sym+p5b-1),int_mb(k_sym+h6b-1)).eq.irrep_t)then
183
if ((.not.restricted).or.(int_mb(k_spin+p5b-1)+int_mb(k_spin+h6b-1
185
if(log_mb(k_isactive(iref)+p5b-1).and.
186
&log_mb(k_isactive(iref)+h6b-1)) then
188
size = int_mb(k_range+h6b-1) * int_mb(k_range+p5b-1)
190
if (.not.ma_push_get(mt_dbl,size,'r1mi',l_r1,k_r1))
191
1 call errquit('tce_mrcc_iface_r1: MA problem',0,MA_ERR)
193
call get_hash_block(d_r1m(iref),dbl_mb(k_r1),size,
194
1 int_mb(k_r1_offsetm(iref)),h6b-1+noab*(p5b-noab-1))
197
do i=1,int_mb(k_range+p5b-1)
198
do j=1,int_mb(k_range+h6b-1)
201
orbspin(1) = int_mb(k_spin+p5b-1)-1
202
orbspin(2) = int_mb(k_spin+h6b-1)-1
204
orbindex(1) = (1 - orbspin(1)+
205
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p5b-1)+i-1))/2
206
orbindex(2) = (1 - orbspin(2)+
207
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h6b-1)+j-1))/2
209
orbindex(1) = moindexes(orbindex(1),orbspin(1)+1,iref)
210
orbindex(2) = moindexes(orbindex(2),orbspin(2)+1,iref)
212
cjb ===========================================================================
214
if(isactive(orbindex(1),orbspin(1)+1).and.
215
1 isactive(orbindex(2),orbspin(2)+1).or.(.not.limprovet)) then
218
c if(nodezero)write(6,"('ACTIVITY: ',2L2)")
219
c 1 isactive(orbindex(1),orbspin(1)+1),
220
c 1 isactive(orbindex(2),orbspin(2)+1)
221
c if(nodezero)write(6,"('DEBUG: ',5I4)")
222
c 1 orbindex(1),orbspin(1),
223
c 1 orbindex(2),orbspin(2),iref
228
ioccnew(n,iu) = iocc(n,iref,iu)
232
if(iocc(orbindex(1),iref,orbspin(1)+1).eq.
233
1 iocc(orbindex(2),iref,orbspin(2)+1)) then
237
ioccnew(orbindex(1),orbspin(1)+1) = iocc(orbindex(2),iref,
239
ioccnew(orbindex(2),orbspin(2)+1) = iocc(orbindex(1),iref,
246
isfound = isfound.and.(iocc(o,n,iu).eq.ioccnew(o,iu))
250
c write(LuOut,"('Internal amplitude',I4,'->',I4)")iref,n
251
c write(LuOut,"('1Internal amplitude',I4,'->',I4,2F16.12)")iref,n,
258
ioccnew(i1,iu) = iocc(i1,iref,iu)
263
do i1=min(orbindex(1),orbindex(2)),
264
1 max(orbindex(1),orbindex(2))
266
if(i2.lt.abs(orbindex(1)-orbindex(2))) then
267
if(iocc(i1+1,iref,orbspin(1)+1).eq.1) then
275
if(mod(dist,2).eq.1) dsmult = -dsmult
277
dbl_mb(k_heff+n-1+(iref-1)*nref) = dbl_mb(k_r1+k-1)*dsmult
278
c 1 dbl_mb(k_heff+n-1+(iref-1)*nref)
281
call ga_put(g_heff,nref*(iref-1)+n,nref*(iref-1)+n,1,1,
282
1 dbl_mb(k_r1+k-1)*dsmult,1)
292
if((.not.isfound).and.(abs(dbl_mb(k_r1+k-1)).gt.1.0d-5)) then
294
write(LuOut,"('DEBUG: ',4F16.12)")dbl_mb(k_r1+k-1)
295
write(LuOut,"('YOU ARE USING INCOMPLETE MODEL SPACE!')")
297
c call errquit('YOU ARE USING INCOMPLETE MODEL SPACE!',1,MA_ERR)
305
if (.not.ma_pop_stack(l_r1))
306
1 call errquit('tce_mrcc_iface_r1: MA problem',1,MA_ERR)
323
nprocs=GA_pgroup_NNODES(mypgid)
324
nxt=NXTASKsub(nprocs,1,mypgid)
332
DO p1b = noab+1,noab+nvab
333
DO p2b = p1b,noab+nvab
337
IF ((nxt.eq.count).or.(.not.limprovet)) THEN
339
IF (int_mb(k_spin+p1b-1)+int_mb(k_spin+p2b-1) .eq. int_mb(k_spin+h
340
&3b-1)+int_mb(k_spin+h4b-1)) THEN
342
IF (ieor(int_mb(k_sym+p1b-1),ieor(int_mb(k_sym+p2b-1),ieor(int_mb(
343
&k_sym+h3b-1),int_mb(k_sym+h4b-1)))) .eq. irrep_t) THEN
345
IF ((.not.restricted).or.(int_mb(k_spin+p1b-1)+int_mb(k_spin+p2b-1
346
&)+int_mb(k_spin+h3b-1)+int_mb(k_spin+h4b-1).ne.8)) THEN
348
if(log_mb(k_isactive(iref)+p1b-1).and.
349
1 log_mb(k_isactive(iref)+p2b-1).and.
350
2 log_mb(k_isactive(iref)+h3b-1).and.
351
3 log_mb(k_isactive(iref)+h4b-1)) then
353
size = int_mb(k_range+p1b-1) * int_mb(k_range+p2b-1) * int_
354
&mb(k_range+h3b-1) * int_mb(k_range+h4b-1)
356
if (.not.ma_push_get(mt_dbl,size,'r2mi',l_r2,k_r2))
357
1 call errquit('tce_mrcc_iface_r2: MA problem',0,MA_ERR)
359
call get_hash_block(d_r2m(iref),dbl_mb(k_r2),size,
360
1 int_mb(k_r2_offsetm(iref)),h4b-1+noab*(h3b-1+noab*(p2b-
361
&noab-1+nvab*(p1b - noab - 1))))
363
c write(LuOut,"(I4,L3,L3,L3,L3)")
364
c 1 iref,log_mb(k_isactive(iref)+p1b-1),
365
c 1 log_mb(k_isactive(iref)+p2b-1),log_mb(k_isactive(iref)+h3b-1),
366
c 1 log_mb(k_isactive(iref)+h4b-1)
369
do i=1,int_mb(k_range+p1b-1)
370
do j=1,int_mb(k_range+p2b-1)
371
do k=1,int_mb(k_range+h3b-1)
372
do l=1,int_mb(k_range+h4b-1)
374
c write(LuOut,"(I4,'(',I4,I4,I4,I4,'):',2F16.12)")
375
c 1 iref,i,j,k,l,dbl_mb(k_r2+m-1)
376
c write(LuOut,*)int_mb(k_spin+p1b-1)
378
orbspin(1) = int_mb(k_spin+p1b-1)-1
379
orbspin(2) = int_mb(k_spin+p2b-1)-1
380
orbspin(3) = int_mb(k_spin+h3b-1)-1
381
orbspin(4) = int_mb(k_spin+h4b-1)-1
383
orbindex(1) = (1 - orbspin(1)+
384
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p1b-1)+i-1))/2
385
orbindex(2) = (1 - orbspin(2)+
386
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p2b-1)+j-1))/2
387
orbindex(3) = (1 - orbspin(3)+
388
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h3b-1)+k-1))/2
389
orbindex(4) = (1 - orbspin(4)+
390
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h4b-1)+l-1))/2
392
orbindex(1) = moindexes(orbindex(1),orbspin(1)+1,iref)
393
orbindex(2) = moindexes(orbindex(2),orbspin(2)+1,iref)
394
orbindex(3) = moindexes(orbindex(3),orbspin(3)+1,iref)
395
orbindex(4) = moindexes(orbindex(4),orbspin(4)+1,iref)
397
cjb ===========================================================================
399
if(isactive(orbindex(1),orbspin(1)+1).and.
400
1 isactive(orbindex(2),orbspin(2)+1).and.
401
2 isactive(orbindex(3),orbspin(3)+1).and.
402
3 isactive(orbindex(4),orbspin(4)+1).or.(.not.limprovet)) then
404
c write(LuOut,"('Real indexes: [',I4,I4,I4,I4,']',
405
c 1 '[',I2,I2,I2,I2,']')")
406
c 1 orbindex(1),orbindex(2),orbindex(3),orbindex(4),
407
c 1 orbspin(1),orbspin(2),orbspin(3),orbspin(4)
411
ioccnew(n,iu) = iocc(n,iref,iu)
415
if(((orbindex(1).eq.orbindex(2)).and.(orbspin(1).eq.orbspin(2)))
416
1 .or.((orbindex(3).eq.orbindex(4)).and.(orbspin(3).eq.
421
ioccnew(orbindex(1),orbspin(1)+1) = iocc(orbindex(3),iref,
423
ioccnew(orbindex(2),orbspin(2)+1) = iocc(orbindex(4),iref,
425
ioccnew(orbindex(3),orbspin(3)+1) = iocc(orbindex(1),iref,
427
ioccnew(orbindex(4),orbspin(4)+1) = iocc(orbindex(2),iref,
434
isfound = isfound.and.(iocc(o,n,iu).eq.ioccnew(o,iu))
438
c write(LuOut,"('2Internal amplitude',I4,'->',I4,2F16.12)")iref,n,
445
ioccnew(i1,iu) = iocc(i1,iref,iu)
450
do i1=min(orbindex(1),orbindex(3)),
451
1 max(orbindex(1),orbindex(3))
453
if(i2.lt.abs(orbindex(1)-orbindex(3))) then
454
if(iocc(i1+1,iref,orbspin(1)+1).eq.1) then
460
ioccnew(orbindex(1),orbspin(1)+1) = iocc(orbindex(3),iref,
462
ioccnew(orbindex(3),orbspin(3)+1) = iocc(orbindex(1),iref,
466
do i1=min(orbindex(2),orbindex(4)),
467
1 max(orbindex(2),orbindex(4))
469
if(i2.lt.abs(orbindex(2)-orbindex(4))) then
470
if(ioccnew(i1+1,orbspin(2)+1).eq.1) then
477
if(mod(dist,2).eq.1) dsmult = -dsmult
480
dbl_mb(k_heff+n-1+(iref-1)*nref) = dbl_mb(k_r2+m-1)*dsmult
481
c 1 dbl_mb(k_heff+n-1+(iref-1)*nref)
484
call ga_put(g_heff,nref*(iref-1)+n,nref*(iref-1)+n,1,1,
485
1 dbl_mb(k_r2+m-1)*dsmult,1)
496
if((.not.isfound).and.(abs(dbl_mb(k_r2+m-1)).gt.1.0d-5)) then
498
write(LuOut,"('DEBUG: ',4F16.12)")dbl_mb(k_r2+m-1)
499
write(LuOut,"('YOU ARE USING INCOMPLETE MODEL SPACE!')")
501
c call errquit('YOU ARE USING INCOMPLETE MODEL SPACE!',2,MA_ERR)
511
if (.not.ma_pop_stack(l_r2))
512
1 call errquit('tce_mrcc_iface_r2: MA problem',1,MA_ERR)
519
nxt=NXTASKsub(nprocs,1,mypgid)
525
if(limprovet)count = count + 1
533
nxt=NXTASKsub(-nprocs,1,mypgid)
534
call GA_Pgroup_SYNC(mypgid)
536
nxt=NXTASKsub(-nprocs,1)
546
DO p4b = noab+1,noab+nvab
547
DO p5b = p4b,noab+nvab
548
DO p6b = p5b,noab+nvab
552
IF ((.not.restricted).or.(int_mb(k_spin+p4b-1)+int_mb(k_spin+p5b-1
553
&)+int_mb(k_spin+p6b-1)+int_mb(k_spin+h1b-1)+int_mb(k_spin+h2b-1)+i
554
&nt_mb(k_spin+h3b-1).ne.12)) THEN
555
IF (int_mb(k_spin+p4b-1)+int_mb(k_spin+p5b-1)+int_mb(k_spin+p6b-1)
556
& .eq. int_mb(k_spin+h1b-1)+int_mb(k_spin+h2b-1)+int_mb(k_spin+h3b-
558
IF (ieor(int_mb(k_sym+p4b-1),ieor(int_mb(k_sym+p5b-1),ieor(int_mb(
559
&k_sym+p6b-1),ieor(int_mb(k_sym+h1b-1),ieor(int_mb(k_sym+h2b-1),int
560
&_mb(k_sym+h3b-1)))))) .eq. ieor(irrep_v,irrep_t)) THEN
561
IF ((log_mb(k_active+p4b-1).eqv..true.).and.(log_mb(k_active+p5b-1
562
&).eqv..true.).and.(log_mb(k_active+p6b-1).eqv..true.).and.(log_mb(
563
&k_active+h1b-1).eqv..true.).and.(log_mb(k_active+h2b-1).eqv..true.
564
&).and.(log_mb(k_active+h3b-1).eqv..true.)) THEN
566
size = int_mb(k_range+p4b-1) * int_mb(k_range+p5b-1) * int_
567
&mb(k_range+p6b-1) * int_mb(k_range+h1b-1) * int_mb(k_range+h2b-1)
568
&* int_mb(k_range+h3b-1)
570
if (.not.ma_push_get(mt_dbl,size,'r3mi',l_r3,k_r3))
571
1 call errquit('tce_mrcc_iface_r3: MA problem',0,MA_ERR)
573
call get_hash_block(d_r3m(iref),dbl_mb(k_r3),size,
574
1 int_mb(k_r3_offsetm(iref)),h3b - 1 + noab * (h2b - 1 + noab *
575
1 (h1b - 1 + noab * (p6b - noab - 1 + nvab * (p5b - noab - 1 +
576
1 nvab * (p4b - noab - 1))))))
580
orbspin(1) = int_mb(k_spin+p4b-1)-1
581
orbspin(2) = int_mb(k_spin+p5b-1)-1
582
orbspin(3) = int_mb(k_spin+p6b-1)-1
583
orbspin(4) = int_mb(k_spin+h1b-1)-1
584
orbspin(5) = int_mb(k_spin+h2b-1)-1
585
orbspin(6) = int_mb(k_spin+h3b-1)-1
587
do p4=1,int_mb(k_range+p4b-1)
588
do p5=1,int_mb(k_range+p5b-1)
589
do p6=1,int_mb(k_range+p6b-1)
590
do h1=1,int_mb(k_range+h1b-1)
591
do h2=1,int_mb(k_range+h2b-1)
592
do h3=1,int_mb(k_range+h3b-1)
596
orbindex(1) = (1 - orbspin(1)+
597
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p4b-1)+p4-1))/2
598
orbindex(2) = (1 - orbspin(2)+
599
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p5b-1)+p5-1))/2
600
orbindex(3) = (1 - orbspin(3)+
601
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p6b-1)+p6-1))/2
602
orbindex(4) = (1 - orbspin(4)+
603
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h1b-1)+h1-1))/2
604
orbindex(5) = (1 - orbspin(5)+
605
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h2b-1)+h2-1))/2
606
orbindex(6) = (1 - orbspin(6)+
607
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h3b-1)+h3-1))/2
609
orbindex(1) = moindexes(orbindex(1),orbspin(1)+1,iref)
610
orbindex(2) = moindexes(orbindex(2),orbspin(2)+1,iref)
611
orbindex(3) = moindexes(orbindex(3),orbspin(3)+1,iref)
612
orbindex(4) = moindexes(orbindex(4),orbspin(4)+1,iref)
613
orbindex(5) = moindexes(orbindex(5),orbspin(5)+1,iref)
614
orbindex(6) = moindexes(orbindex(6),orbspin(6)+1,iref)
616
c write(LuOut,"('Real indexes: [',I4,I4,I4,I4,I4,I4,']')")
617
c 1 orbindex(1),orbindex(2),orbindex(3),orbindex(4),orbindex(5),
619
c write(LuOut,"('Spin indexes : [',I4,I4,I4,I4,I4,I4,']')")
620
c 1 orbspin(1),orbspin(2),orbspin(3),orbspin(4),orbspin(5),orbspin(6)
624
ioccnew(n,iu) = iocc(n,iref,iu)
628
if((iocc(orbindex(1),iref,orbspin(1)+1).eq.
629
1 iocc(orbindex(4),iref,orbspin(4)+1)).or.
630
2 (iocc(orbindex(2),iref,orbspin(2)+1).eq.
631
3 iocc(orbindex(5),iref,orbspin(5)+1)).or.
632
4 (iocc(orbindex(3),iref,orbspin(3)+1).eq.
633
1 iocc(orbindex(6),iref,orbspin(6)+1))) then
637
if((orbspin(1).ne.orbspin(4)).or.
638
1 (orbspin(2).ne.orbspin(5)).or.
639
2 (orbspin(3).ne.orbspin(6))) then
644
1 ((orbindex(1).eq.orbindex(2)).and.(orbspin(1).eq.orbspin(2))).or.
645
1 ((orbindex(1).eq.orbindex(3)).and.(orbspin(1).eq.orbspin(3))).or.
646
1 ((orbindex(2).eq.orbindex(3)).and.(orbspin(2).eq.orbspin(3))).or.
647
1 ((orbindex(4).eq.orbindex(5)).and.(orbspin(4).eq.orbspin(5))).or.
648
1 ((orbindex(4).eq.orbindex(6)).and.(orbspin(4).eq.orbspin(6))).or.
649
1 ((orbindex(5).eq.orbindex(6)).and.(orbspin(5).eq.orbspin(6)))
654
ioccnew(orbindex(1),orbspin(1)+1) = iocc(orbindex(4),iref,
656
ioccnew(orbindex(2),orbspin(2)+1) = iocc(orbindex(5),iref,
658
ioccnew(orbindex(3),orbspin(3)+1) = iocc(orbindex(6),iref,
660
ioccnew(orbindex(4),orbspin(4)+1) = iocc(orbindex(1),iref,
662
ioccnew(orbindex(5),orbspin(5)+1) = iocc(orbindex(2),iref,
664
ioccnew(orbindex(6),orbspin(6)+1) = iocc(orbindex(3),iref,
672
isfound = isfound.and.(iocc(o,n,iu).eq.ioccnew(o,iu))
676
c write(LuOut,"('Internal amplitude',I4,'->',I4,2F16.12)")iref,n,
683
ioccnew(i1,iu) = iocc(i1,iref,iu)
688
do i1=min(orbindex(1),orbindex(4)),
689
1 max(orbindex(1),orbindex(4))
691
if(i2.lt.abs(orbindex(1)-orbindex(4))) then
692
if(iocc(i1+1,iref,orbspin(1)+1).eq.1) then
698
ioccnew(orbindex(1),orbspin(1)+1) = iocc(orbindex(4),iref,
700
ioccnew(orbindex(4),orbspin(4)+1) = iocc(orbindex(1),iref,
704
do i1=min(orbindex(2),orbindex(5)),
705
1 max(orbindex(2),orbindex(5))
707
if(i2.lt.abs(orbindex(2)-orbindex(5))) then
708
if(ioccnew(i1+1,orbspin(5)+1).eq.1) then
714
ioccnew(orbindex(2),orbspin(2)+1) = iocc(orbindex(5),iref,
716
ioccnew(orbindex(5),orbspin(5)+1) = iocc(orbindex(2),iref,
720
do i1=min(orbindex(3),orbindex(6)),
721
1 max(orbindex(3),orbindex(6))
723
if(i2.lt.abs(orbindex(3)-orbindex(6))) then
724
if(ioccnew(i1+1,orbspin(6)+1).eq.1) then
731
if(mod(dist,2).eq.1) dsmult = -dsmult
734
dbl_mb(k_heff+n-1+(iref-1)*nref) =
735
1 dbl_mb(k_r3+m-1)*dsmult
751
if (.not.ma_pop_stack(l_r3))
752
1 call errquit('tce_mrcc_iface_r3: MA problem',1,MA_ERR)
771
c DO p5b = noab+1,noab+nvab
772
c DO p6b = p5b,noab+nvab
773
c DO p7b = noab+1,noab+nvab
774
c DO p8b = p7b,noab+nvab
780
DO p5b = noab+1,noab+nvab
781
DO p6b = p5b,noab+nvab
782
DO p7b = p6b,noab+nvab
783
DO p8b = p7b,noab+nvab
789
IF ((.not.restricted).or.(int_mb(k_spin+p5b-1)+int_mb(k_spin+p6b-1
790
&)+int_mb(k_spin+p7b-1)+int_mb(k_spin+p8b-1)+int_mb(k_spin+h1b-1)+i
791
&nt_mb(k_spin+h2b-1)+int_mb(k_spin+h3b-1)+int_mb(k_spin+h4b-1).ne.1
793
IF (int_mb(k_spin+p5b-1)+int_mb(k_spin+p6b-1)+int_mb(k_spin+p7b-1)
794
&+int_mb(k_spin+p8b-1) .eq. int_mb(k_spin+h1b-1)+int_mb(k_spin+h2b-
795
&1)+int_mb(k_spin+h3b-1)+int_mb(k_spin+h4b-1)) THEN
796
IF (ieor(int_mb(k_sym+p5b-1),ieor(int_mb(k_sym+p6b-1),ieor(int_mb(
797
&k_sym+p7b-1),ieor(int_mb(k_sym+p8b-1),ieor(int_mb(k_sym+h1b-1),ieo
798
&r(int_mb(k_sym+h2b-1),ieor(int_mb(k_sym+h3b-1),int_mb(k_sym+h4b-1)
799
&))))))) .eq. ieor(irrep_v,ieor(irrep_t,irrep_t))) THEN
800
IF ((log_mb(k_active+p5b-1).eqv..true.).and.(log_mb(k_active+p6b-1
801
&).eqv..true.).and.(log_mb(k_active+p7b-1).eqv..true.).and.(log_mb(
802
&k_active+p8b-1).eqv..true.).and.(log_mb(k_active+h1b-1).eqv..true.
803
&).and.(log_mb(k_active+h2b-1).eqv..true.).and.(log_mb(k_active+h3b
804
&-1).eqv..true.).and.(log_mb(k_active+h4b-1).eqv..true.)) THEN
806
size = int_mb(k_range+p5b-1) * int_mb(k_range+p6b-1) * int_
807
&mb(k_range+p7b-1) * int_mb(k_range+p8b-1) * int_mb(k_range+h1b-1)
808
&* int_mb(k_range+h2b-1) * int_mb(k_range+h3b-1) * int_mb(k_range+h
811
if (.not.ma_push_get(mt_dbl,size,'r4mi',l_r4,k_r4))
812
1 call errquit('tce_mrcc_iface_r4: MA problem',0,MA_ERR)
814
call get_hash_block(d_r4m(iref),dbl_mb(k_r4),size,
815
1 int_mb(k_r4_offsetm(iref)),(h4b - 1 + noab * (h3b - 1 + noab *
816
1(h2b - 1 + noab * (h1b - 1 + noab * (p8b - noab - 1 + nvab * (p7b
817
1 - noab - 1 + nvab * (p6b - noab - 1 + nvab * (p5b - noab - 1))))
822
orbspin(1) = int_mb(k_spin+p5b-1)-1
823
orbspin(2) = int_mb(k_spin+p6b-1)-1
824
orbspin(3) = int_mb(k_spin+p7b-1)-1
825
orbspin(4) = int_mb(k_spin+p8b-1)-1
826
orbspin(5) = int_mb(k_spin+h1b-1)-1
827
orbspin(6) = int_mb(k_spin+h2b-1)-1
828
orbspin(7) = int_mb(k_spin+h3b-1)-1
829
orbspin(8) = int_mb(k_spin+h4b-1)-1
831
do p5=1,int_mb(k_range+p5b-1)
832
do p6=1,int_mb(k_range+p6b-1)
833
do p7=1,int_mb(k_range+p7b-1)
834
do p8=1,int_mb(k_range+p8b-1)
835
do h1=1,int_mb(k_range+h1b-1)
836
do h2=1,int_mb(k_range+h2b-1)
837
do h3=1,int_mb(k_range+h3b-1)
838
do h4=1,int_mb(k_range+h4b-1)
842
orbindex(1) = (1 - orbspin(1)+
843
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p5b-1)+p5-1))/2
844
orbindex(2) = (1 - orbspin(2)+
845
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p6b-1)+p6-1))/2
846
orbindex(3) = (1 - orbspin(3)+
847
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p7b-1)+p7-1))/2
848
orbindex(4) = (1 - orbspin(4)+
849
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p8b-1)+p8-1))/2
850
orbindex(5) = (1 - orbspin(5)+
851
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h1b-1)+h1-1))/2
852
orbindex(6) = (1 - orbspin(6)+
853
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h2b-1)+h2-1))/2
854
orbindex(7) = (1 - orbspin(7)+
855
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h3b-1)+h3-1))/2
856
orbindex(8) = (1 - orbspin(8)+
857
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h4b-1)+h4-1))/2
859
orbindex(1) = moindexes(orbindex(1),orbspin(1)+1,iref)
860
orbindex(2) = moindexes(orbindex(2),orbspin(2)+1,iref)
861
orbindex(3) = moindexes(orbindex(3),orbspin(3)+1,iref)
862
orbindex(4) = moindexes(orbindex(4),orbspin(4)+1,iref)
863
orbindex(5) = moindexes(orbindex(5),orbspin(5)+1,iref)
864
orbindex(6) = moindexes(orbindex(6),orbspin(6)+1,iref)
865
orbindex(7) = moindexes(orbindex(7),orbspin(7)+1,iref)
866
orbindex(8) = moindexes(orbindex(8),orbspin(8)+1,iref)
870
ioccnew(n,iu) = iocc(n,iref,iu)
874
if((iocc(orbindex(1),iref,orbspin(1)+1).eq.
875
1 iocc(orbindex(5),iref,orbspin(5)+1)).or.
876
2 (iocc(orbindex(2),iref,orbspin(2)+1).eq.
877
3 iocc(orbindex(6),iref,orbspin(6)+1)).or.
878
4 (iocc(orbindex(3),iref,orbspin(3)+1).eq.
879
1 iocc(orbindex(7),iref,orbspin(7)+1)).or.
880
2 (iocc(orbindex(4),iref,orbspin(4)+1).eq.
881
3 iocc(orbindex(8),iref,orbspin(8)+1))) then
885
if((orbspin(1).ne.orbspin(5)).or.
886
1 (orbspin(2).ne.orbspin(6)).or.
887
2 (orbspin(3).ne.orbspin(7)).or.
888
3 (orbspin(4).ne.orbspin(8))) then
893
1 ((orbindex(1).eq.orbindex(2)).and.(orbspin(1).eq.orbspin(2))).or.
894
1 ((orbindex(1).eq.orbindex(3)).and.(orbspin(1).eq.orbspin(3))).or.
895
1 ((orbindex(1).eq.orbindex(4)).and.(orbspin(1).eq.orbspin(4))).or.
896
1 ((orbindex(2).eq.orbindex(3)).and.(orbspin(2).eq.orbspin(3))).or.
897
1 ((orbindex(2).eq.orbindex(4)).and.(orbspin(2).eq.orbspin(4))).or.
898
1 ((orbindex(3).eq.orbindex(4)).and.(orbspin(3).eq.orbspin(4))).or.
899
1 ((orbindex(5).eq.orbindex(6)).and.(orbspin(5).eq.orbspin(6))).or.
900
1 ((orbindex(5).eq.orbindex(7)).and.(orbspin(5).eq.orbspin(7))).or.
901
1 ((orbindex(5).eq.orbindex(8)).and.(orbspin(5).eq.orbspin(8))).or.
902
1 ((orbindex(6).eq.orbindex(7)).and.(orbspin(6).eq.orbspin(7))).or.
903
1 ((orbindex(6).eq.orbindex(8)).and.(orbspin(6).eq.orbspin(8))).or.
904
1 ((orbindex(7).eq.orbindex(8)).and.(orbspin(7).eq.orbspin(8)))
909
ioccnew(orbindex(1),orbspin(1)+1) = iocc(orbindex(5),iref,
911
ioccnew(orbindex(2),orbspin(2)+1) = iocc(orbindex(6),iref,
913
ioccnew(orbindex(3),orbspin(3)+1) = iocc(orbindex(7),iref,
915
ioccnew(orbindex(4),orbspin(4)+1) = iocc(orbindex(8),iref,
917
ioccnew(orbindex(5),orbspin(5)+1) = iocc(orbindex(1),iref,
919
ioccnew(orbindex(6),orbspin(6)+1) = iocc(orbindex(2),iref,
921
ioccnew(orbindex(7),orbspin(7)+1) = iocc(orbindex(3),iref,
923
ioccnew(orbindex(8),orbspin(8)+1) = iocc(orbindex(4),iref,
930
isfound = isfound.and.(iocc(o,n,iu).eq.ioccnew(o,iu))
934
c write(LuOut,"('Internal amplitude',I4,'->',I4,2F16.12)")iref,n,
941
ioccnew(i1,iu) = iocc(i1,iref,iu)
946
do i1=min(orbindex(1),orbindex(5)),
947
1 max(orbindex(1),orbindex(5))
949
if(i2.lt.abs(orbindex(1)-orbindex(5))) then
950
if(iocc(i1+1,iref,orbspin(1)+1).eq.1) then
956
ioccnew(orbindex(1),orbspin(1)+1) = iocc(orbindex(5),iref,
958
ioccnew(orbindex(5),orbspin(5)+1) = iocc(orbindex(1),iref,
962
do i1=min(orbindex(2),orbindex(6)),
963
1 max(orbindex(2),orbindex(6))
965
if(i2.lt.abs(orbindex(2)-orbindex(6))) then
966
if(iocc(i1+1,iref,orbspin(2)+1).eq.1) then
972
ioccnew(orbindex(2),orbspin(2)+1) = iocc(orbindex(6),iref,
974
ioccnew(orbindex(6),orbspin(6)+1) = iocc(orbindex(2),iref,
978
do i1=min(orbindex(3),orbindex(7)),
979
1 max(orbindex(3),orbindex(7))
981
if(i2.lt.abs(orbindex(3)-orbindex(7))) then
982
if(iocc(i1+1,iref,orbspin(3)+1).eq.1) then
988
ioccnew(orbindex(3),orbspin(3)+1) = iocc(orbindex(7),iref,
990
ioccnew(orbindex(7),orbspin(7)+1) = iocc(orbindex(3),iref,
994
do i1=min(orbindex(4),orbindex(8)),
995
1 max(orbindex(4),orbindex(8))
997
if(i2.lt.abs(orbindex(4)-orbindex(8))) then
998
if(iocc(i1+1,iref,orbspin(4)+1).eq.1) then
1005
if(mod(dist,2).eq.1) dsmult = -dsmult
1008
c write(6,"('T4 iref/n:',2I4,f4.1)")iref,n,dsmult
1011
dbl_mb(k_heff+n-1+(iref-1)*nref) =
1012
1 dbl_mb(k_r4+m-1)*dsmult
1029
if (.not.ma_pop_stack(l_r4))
1030
1 call errquit('tce_mrcc_iface_r4: MA problem',1,MA_ERR)
1054
c ==============================================
1055
c Diagonalize effective Hamiltonian
1056
c ==============================================
1058
subroutine tce_diagonalize_heff(rtdb)
1060
#include "global.fh"
1061
#include "mafdecls.fh"
1065
#include "errquit.fh"
1067
#include "tce_mrcc.fh"
1068
#include "tce_main.fh"
1070
#include "tcgmsg.fh"
1071
#include "msgtypesf.h"
1072
#include "msgids.fh"
1075
double precision heff(nref,nref)
1076
double precision vl(nref,nref)
1077
double precision vr(nref,nref)
1078
double precision er(nref)
1079
double precision ei(nref)
1080
double precision work(4*nref)
1086
integer rtdb,itarget
1088
double precision dvalue,dsum
1089
double precision dfin
1091
integer l_buff,k_buff
1093
double precision isum
1094
integer ddblsize,inntsize
1096
nodezero = (ga_nodeid().eq.0)
1097
ddblsize=MA_sizeof(MT_DBL,1,MT_BYTE)
1098
inntsize=MA_sizeof(MT_INT,1,MT_BYTE)
1104
dbl_mb(k_heff+i-1) = 0.0d0
1107
call ga_get(g_heff,1,nref*nref,1,1,
1109
c call ga_print(g_heff)
1114
x = dbl_mb(k_heff+j-1+(i-1)*nref)
1128
if(nodezero.and.(nref.lt.21)) then
1129
c call ma_print(dbl_mb(k_heff),nref,nref,'Heff')
1131
write(LuOut,"(/,'Heff',/,
1132
1 '=============================================')")
1134
write(LuOut,"(i5,i5,100F14.8)")ga_nodeid(),i,
1135
1 (dbl_mb(k_heff+(j-1)*nref+i-1),j=1,nref)
1140
c call util_flush(LuOut)
1141
c if((ga_nodeid().eq.5).and.(nref.lt.21)) then
1142
c call ma_print(dbl_mb(k_heff),nref,nref,'Heff')
1144
c write(LuOut,"(/,'Heff 5',/,
1145
c 1 '=============================================')")
1147
c write(LuOut,"(i5,i5,100F14.8)")ga_nodeid(),i,
1148
c 1 (dbl_mb(k_heff+(j-1)*nref+i-1),j=1,nref)
1152
c call util_flush(LuOut)
1155
c call util_flush(LuOut)
1156
c write(6,*)'BEFORE',ga_nodeid()
1157
c call util_flush(LuOut)
1159
c if(nodezero)write(6,*)'TEST 3'
1161
c call DGEEV('V','V',nref,heff,nref,er,ei,vl,nref,vr,
1162
call util_dgeev('V','V',nref,heff,nref,er,ei,vl,nref,vr,
1163
$ nref,work,4*nref,info)
1164
if(info .ne. 0) call errquit('Heff diagonalization',0,CALC_ERR)
1165
call amp_stabilization(vl,vr,nref)
1167
c if(nodezero)write(6,*)'TEST 4'
1170
c call util_flush(LuOut)
1171
c write(6,*)'AFTER',ga_nodeid()
1172
c call util_flush(LuOut)
1174
c if(nodezero.and..not.lconverged) then
1175
c call ma_print(dbl_mb(k_heff),nref,nref,'Heff')
1178
c if(lconverged.and.nodezero) then
1182
write(LuOut,"(/,'Eigenvalues (real and imaginary)',/,
1183
1 '=============================================')")
1185
write(LuOut,"(F18.12,100F14.8)")er(i),ei(i)
1188
write(LuOut,"(/,'Left eigenvectors',/,
1189
1 '=============================================')")
1191
write(LuOut,"(i5,100F14.8)")i,(vl(i,j),j=1,nref)
1194
c write(LuOut,"(/,'Left eigenvectors - squares',/,
1195
c 1 '=============================================')")
1197
c write(LuOut,"(i5,35f18.12)")i,((vl(i,j)*vl(i,j)),j=1,nref)
1203
write(LuOut,"(/,'Right eigenvectors',/,
1204
1 '=============================================')")
1206
write(LuOut,"('VR',i5,100F14.8)")i,(vr(i,j),j=1,nref)
1214
dbl_mb(k_sqc+(i-1)*nref+j-1)=vr(i,j)
1215
dbl_mb(k_sqcl+(i-1)*nref+j-1)=vl(i,j)
1219
call ga_brdcst(Msg_Vec_EVal+21,dbl_mb(k_sqc),
1220
1 ddblsize*nref*nref, 0)
1222
call ga_brdcst(Msg_Vec_EVal+20,dbl_mb(k_sqcl),
1223
1 ddblsize*nref*nref, 0)
1226
if (.not.rtdb_get(rtdb,'mrcc:zignore',mt_int,1,iignore))
1229
if(.not.nodezero) then
1232
vr(i,j) = dbl_mb(k_sqc+(i-1)*nref+j-1)
1233
vl(i,j) = dbl_mb(k_sqcl+(i-1)*nref+j-1)
1244
isum = isum + vr(j,i)
1246
if((iignore.eq.0).or.(abs(isum).gt.1.0d-5)) then
1247
if(epsilon.gt.min(epsilon,er(i)))mkroot=i
1248
epsilon = min(epsilon,er(i))
1254
if (.not.rtdb_get(rtdb,'mrcc:rootmuc',mt_int,1,nrootmuc))
1257
if(nrootmuc.gt.0) then ! 1
1264
isum = isum + vr(i,j)
1266
if((iignore.eq.0).or.(abs(isum).gt.1.0d-5)) then
1269
if (.not.rtdb_get(rtdb,'mrcc:rootmuc'//ds,mt_dbl,1,dvalue))
1271
if(dvalue.lt.0.0d0) then
1272
if(abs(vr(i,j)).lt.abs(dvalue))
1273
1 dsum = dsum + abs(dvalue)*abs(vr(i,j))
1275
dsum = dsum + abs(dvalue)*abs(vr(i,j))
1278
c write(6,"('SUM:',I4,4F16.12)")j,
1280
if(dfin.lt.abs(dsum)) then
1281
c write(6,"('I am watching reference #',I4,4F16.12)")j
1291
if (rtdb_get(rtdb,'bwcc:targetroot',mt_int,1,itarget)) then
1297
c if(abs(vr(j,i)).lt.1.0d-8)
1298
isum = isum + vr(j,i)
1300
if((iignore.eq.0).or.(abs(isum).gt.1.0d-5)) then
1309
c if(abs(vr(l,j)).lt.1.0d-8)
1310
isum = isum + vr(l,j)
1312
if((iignore.eq.0).or.(abs(isum).gt.1.0d-5)) then
1315
if(er(j).lt.er(i))k=k+1
1321
if(k.eq.(itarget-1)) then
1333
epsilon = er(itarget)
1338
if (nodezero.and.(nref.lt.21)) then
1339
write(6,"('Target root: ',I4)")mkroot
1342
ckbn Introduce some checks before proceeding further.
1344
ckbn check of mkroot, crash if mkroot gt nref
1346
if(mkroot.gt.nref) call errquit
1347
+ ('root followed is greater than total number of references',0,
1352
ckbn check whether there is imaginary eigen values
1354
c write(LuOut,'(A,F17.10)')'Imaginary eigenvalue',ei(i)
1355
c if (nodezero) call util_flush(LuOut)
1356
if(abs(ei(i)).ge.toleiimag) then
1357
write(LuOut,'(A,F15.10)')
1358
+ 'Warning: complex Heff eigenvalue detected',ei(i)
1359
if(i.eq.mkroot) then
1360
write(LuOut,*) "ignorecomplex1 ", ignorecomplex
1361
c if (rtdb_get(rtdb,'mrcc:ignorecomplex',mt_log,1,
1362
c + ignorecomplex)) ignorecomplex = .true.
1363
c call errquit('Complex root found and no ignorecomplex option',
1366
c if(nodezero) write(*,*) "ignorecomplex1. ", ignorecomplex
1367
c ignorecomplex = .true.
1369
c if(nodezero) write(*,*) "ignorecomplex2 ", ignorecomplex
1370
if(ignorecomplex) then
1371
write(LuOut,'(A,F15.10)')
1372
+ 'Warning: Proceeding with complex Heff eigenvalue ',ei(i)
1374
call errquit('Warning:complex Heff eigenvalue detected',0,
1385
if(nodezero)write(LuOut,"(/,'Right eigenvector for target',I7,
1387
c if (.not.ma_push_get(mt_dbl,nref,'buff',l_buff,k_buff))
1388
c 1 call errquit('tce_mrcc_iface_buff: MA problem',0,MA_ERR)
1390
if(abs(vr(i,mkroot)).gt.0.05d0) then
1391
if(nodezero)write(LuOut,"(I7,' ',F11.8)")i,vr(i,mkroot)
1394
c if (.not.ma_pop_stack(l_buff))
1395
c 1 call errquit('tce_mrcc_iface_buff: MA problem',1,MA_ERR)
1399
if (nodezero) call util_flush(LuOut)
1403
call ga_brdcst(Msg_Vec_EVal+MSGINT+30,mkroot,inntsize, 0)
1404
call ga_brdcst(Msg_Vec_EVal+MSGDBL+31,epsilon,ddblsize, 0)
1407
c write(LuOut,"(/,'Epsilon: ',2F16.12,/)") epsilon
1413
c ==============================================
1414
c Clean internal amplitudes
1415
c ==============================================
1417
subroutine tce_internal_t_zero(d_t1m,d_t2m,k_t1_offsetm,
1418
1 k_t2_offsetm,lneedt3,d_t3m,k_t3_offsetm,rtdb)
1419
c 1 k_t2_offsetm,nref,lneedt3,d_t3m,k_t3_offsetm,rtdb)
1421
#include "global.fh"
1422
#include "mafdecls.fh"
1426
#include "errquit.fh"
1428
#include "tce_mrcc.fh"
1429
#include "tce_main.fh"
1432
integer d_t1m(maxref),d_t2m(maxref)
1433
integer d_t3m(maxref)
1434
integer k_t1_offsetm(maxref),k_t2_offsetm(maxref)
1435
integer k_t3_offsetm(maxref)
1436
integer size,p5b,h6b
1443
integer p1b,p2b,h3b,h4b
1444
integer p3b,p4b,h5b,p6b
1446
c logical lneedt3,limprovet
1448
integer orbindex(6),orbspin(6)
1457
c if (.not.rtdb_get(rtdb,'mrcc:improvetiling',mt_log,1,limprovet))
1458
c 1 limprovet = .false.
1462
if((int_mb(k_refafi+iref-1).eq.int_mb(k_innodes
1463
1 +ga_nnodes()+ga_nodeid())).or.(.not.lusesub)) then
1465
k_sym = k_symm(iref)
1466
k_offset = k_offsetm(iref)
1467
k_range = k_rangem(iref)
1468
k_spin = k_spinm(iref)
1469
k_movecs_sorted = k_movecs_sortedm(iref)
1471
noa = nblcks(1,iref)
1472
nob = nblcks(2,iref)
1473
nva = nblcks(3,iref)
1474
nvb = nblcks(4,iref)
1479
do p5b = noab+1,noab+nvab
1482
if (int_mb(k_spin+p5b-1) .eq. int_mb(k_spin+h6b-1)) then
1483
if (ieor(int_mb(k_sym+p5b-1),int_mb(k_sym+h6b-1)).eq.irrep_t)then
1484
if ((.not.restricted).or.(int_mb(k_spin+p5b-1)+int_mb(k_spin+h6b-1
1486
if(log_mb(k_isactive(iref)+p5b-1).and.
1487
&log_mb(k_isactive(iref)+h6b-1)) then
1489
size = int_mb(k_range+h6b-1) * int_mb(k_range+p5b-1)
1490
if (.not.ma_push_get(mt_dbl,size,'t1',l_t1,k_t1))
1491
1 call errquit('tce_mrcc_iface_t1: MA problem',0,MA_ERR)
1493
c call dfill(size,0.0d0,dbl_mb(k_t1),1)
1495
dbl_mb(k_t1+i-1)=0.0d0
1498
cjb ============================
1502
call get_hash_block(d_t1m(iref),dbl_mb(k_t1),size,
1503
1 int_mb(k_t1_offsetm(iref)),h6b-1+noab*(p5b-noab-1))
1506
do i=1,int_mb(k_range+p5b-1)
1507
do j=1,int_mb(k_range+h6b-1)
1510
orbspin(1) = int_mb(k_spin+p5b-1)-1
1511
orbspin(2) = int_mb(k_spin+h6b-1)-1
1513
orbindex(1) = (1 - orbspin(1)+
1514
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p5b-1)+i-1))/2
1515
orbindex(2) = (1 - orbspin(2)+
1516
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h6b-1)+j-1))/2
1518
orbindex(1) = moindexes(orbindex(1),orbspin(1)+1,iref)
1519
orbindex(2) = moindexes(orbindex(2),orbspin(2)+1,iref)
1521
if(isactive(orbindex(1),orbspin(1)+1).and.
1522
1 isactive(orbindex(2),orbspin(2)+1).or.(.not.limprovet)) then
1524
dbl_mb(k_t1+k-1) = 0.0d0
1532
c =============================
1535
c dbl_mb(k_t1+i-1) = 0.0d0
1538
call put_hash_block(d_t1m(iref),dbl_mb(k_t1),size,
1539
1 int_mb(k_t1_offsetm(iref)),((p5b-noab-1)*noab+h6b-1))
1541
if (.not.ma_pop_stack(l_t1))
1542
1 call errquit('tce_mrcc_iface_t1: MA problem',1,MA_ERR)
1556
nprocs=GA_pgroup_NNODES(mypgid)
1557
nxt=NXTASKsub(nprocs,1,mypgid)
1560
nxt=NXTASK(nprocs,1)
1565
DO p1b = noab+1,noab+nvab
1566
DO p2b = p1b,noab+nvab
1570
IF ((nxt.eq.count).or.(.not.limprovet)) THEN
1572
IF (int_mb(k_spin+p1b-1)+int_mb(k_spin+p2b-1) .eq. int_mb(k_spin+h
1573
&3b-1)+int_mb(k_spin+h4b-1)) THEN
1574
IF (ieor(int_mb(k_sym+p1b-1),ieor(int_mb(k_sym+p2b-1),ieor(int_mb(
1575
&k_sym+h3b-1),int_mb(k_sym+h4b-1)))) .eq. irrep_t) THEN
1576
IF ((.not.restricted).or.(int_mb(k_spin+p1b-1)+int_mb(k_spin+p2b-1
1577
&)+int_mb(k_spin+h3b-1)+int_mb(k_spin+h4b-1).ne.8)) THEN
1578
if(log_mb(k_isactive(iref)+p1b-1).and.
1579
1 log_mb(k_isactive(iref)+p2b-1).and.
1580
2 log_mb(k_isactive(iref)+h3b-1).and.
1581
3 log_mb(k_isactive(iref)+h4b-1)) then
1583
size = int_mb(k_range+p1b-1) * int_mb(k_range+p2b-1) * int_
1584
&mb(k_range+h3b-1) * int_mb(k_range+h4b-1)
1586
if (.not.ma_push_get(mt_dbl,size,'t2',l_t2,k_t2))
1587
1 call errquit('tce_mrcc_iface_t2: MA problem',0,MA_ERR)
1589
c call dfill(size,0.0d0,dbl_mb(k_t2),1)
1591
dbl_mb(k_t2+i-1)=0.0d0
1594
c ===============================================================
1598
call get_hash_block(d_t2m(iref),dbl_mb(k_t2),size,
1599
1 int_mb(k_t2_offsetm(iref)),h4b-1+noab*(h3b-1+noab*(p2b-
1600
&noab-1+nvab*(p1b - noab - 1))))
1603
do i=1,int_mb(k_range+p1b-1)
1604
do j=1,int_mb(k_range+p2b-1)
1605
do k=1,int_mb(k_range+h3b-1)
1606
do l=1,int_mb(k_range+h4b-1)
1609
orbspin(1) = int_mb(k_spin+p1b-1)-1
1610
orbspin(2) = int_mb(k_spin+p2b-1)-1
1611
orbspin(3) = int_mb(k_spin+h3b-1)-1
1612
orbspin(4) = int_mb(k_spin+h4b-1)-1
1614
orbindex(1) = (1 - orbspin(1)+
1615
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p1b-1)+i-1))/2
1616
orbindex(2) = (1 - orbspin(2)+
1617
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+p2b-1)+j-1))/2
1618
orbindex(3) = (1 - orbspin(3)+
1619
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h3b-1)+k-1))/2
1620
orbindex(4) = (1 - orbspin(4)+
1621
1 int_mb(k_mo_indexm(iref)+int_mb(k_offset+h4b-1)+l-1))/2
1623
orbindex(1) = moindexes(orbindex(1),orbspin(1)+1,iref)
1624
orbindex(2) = moindexes(orbindex(2),orbspin(2)+1,iref)
1625
orbindex(3) = moindexes(orbindex(3),orbspin(3)+1,iref)
1626
orbindex(4) = moindexes(orbindex(4),orbspin(4)+1,iref)
1628
if(isactive(orbindex(1),orbspin(1)+1).and.
1629
1 isactive(orbindex(2),orbspin(2)+1).and.
1630
2 isactive(orbindex(3),orbspin(3)+1).and.
1631
3 isactive(orbindex(4),orbspin(4)+1).or.(.not.limprovet)) then
1633
dbl_mb(k_t2+m-1)=0.0d0
1643
c ===============================================================
1646
c write(LuOut,*)dbl_mb(k_t2+i-1),'->','0.00000000'
1647
c dbl_mb(k_t2+i-1) = 0.0d0
1650
call put_hash_block(d_t2m(iref),dbl_mb(k_t2),size,
1651
1 int_mb(k_t2_offsetm(iref)),((((p1b-noab-1)*nvab+p2b-noab-1)
1652
2 *noab+h3b-1)*noab+h4b-1))
1654
if (.not.ma_pop_stack(l_t2))
1655
1 call errquit('tce_mrcc_iface_t2: MA problem',1,MA_ERR)
1664
nxt=NXTASKsub(nprocs,1,mypgid)
1666
nxt=NXTASK(nprocs,1)
1672
if(limprovet)count = count + 1
1681
nxt=NXTASKsub(-nprocs,1,mypgid)
1682
call GA_Pgroup_SYNC(mypgid)
1684
nxt=NXTASKsub(-nprocs,1)
1691
DO p2b = noab+1,noab+nvab
1692
DO p3b = p2b,noab+nvab
1693
DO p4b = p3b,noab+nvab
1697
IF (int_mb(k_spin+p2b-1)+int_mb(k_spin+p3b-1)+int_mb(k_spin+p4b-1)
1698
& .eq. int_mb(k_spin+h1b-1)+int_mb(k_spin+h5b-1)+int_mb(k_spin+h6b-
1700
IF (ieor(int_mb(k_sym+p2b-1),ieor(int_mb(k_sym+p3b-1),ieor(int_mb(
1701
&k_sym+p4b-1),ieor(int_mb(k_sym+h1b-1),ieor(int_mb(k_sym+h5b-1),int
1702
&_mb(k_sym+h6b-1)))))) .eq. irrep_t) THEN
1703
IF ((.not.restricted).or.(int_mb(k_spin+p2b-1)+int_mb(k_spin+p3b-1
1704
&)+int_mb(k_spin+p4b-1)+int_mb(k_spin+h1b-1)+int_mb(k_spin+h5b-1)+i
1705
&nt_mb(k_spin+h6b-1).ne.12)) THEN
1706
IF ((log_mb(k_isactive(iref)+p2b-1).eqv..true.).and.
1707
1 (log_mb(k_isactive(iref)+p3b-1).eqv..true.).and.
1708
2 (log_mb(k_isactive(iref)+p4b-1).eqv..true.).and.
1709
3 (log_mb(k_isactive(iref)+h1b-1).eqv..true.).and.
1710
4 (log_mb(k_isactive(iref)+h5b-1).eqv..true.).and.
1711
5 (log_mb(k_isactive(iref)+h6b-1).eqv..true.)) THEN
1713
size = int_mb(k_range+p2b-1) * int_mb(k_range+p3b-1) * int_
1714
&mb(k_range+p4b-1) * int_mb(k_range+h1b-1) * int_mb(k_range+h5b-1)
1715
&* int_mb(k_range+h6b-1)
1717
if (.not.ma_push_get(mt_dbl,size,'t3',l_t3,k_t3))
1718
1 call errquit('tce_mrcc_iface_t3: MA problem',0,MA_ERR)
1721
dbl_mb(k_t3+i-1) = 0.0d0
1723
call put_hash_block(d_t3m(iref),dbl_mb(k_t3),size,
1724
1 int_mb(k_t3_offsetm(iref)),(h6b - 1 + noab *
1725
2 (h5b - 1 + noab * (h1b
1726
&- 1 + noab * (p4b - noab - 1 + nvab * (p3b - noab - 1 + nvab * (p2
1727
&b - noab - 1)))))))
1729
if (.not.ma_pop_stack(l_t3))
1730
1 call errquit('tce_mrcc_iface_t3: MA problem',1,MA_ERR)
1745
c write(6,"('CPU BEFORE',I4,F16.12)")ga_nodeid(),util_cpusec()
1747
if(lusesub) call ga_pgroup_sync(
1748
1 int_mb(k_innodes+ga_nnodes()+ga_nodeid()))
1749
c write(6,"('CPU AFTER',I4,F16.12)")ga_nodeid(),util_cpusec()