This repository has been archived by the owner on Jul 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wicked_contractions.py
966 lines (934 loc) · 98.4 KB
/
wicked_contractions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
import numpy as np
import time
def H_T_C0(C1, C2, F, V, T1, T2, gamma1, eta1, lambda2, lambda3, mf, verbose=False, scale=1.0):
# 24 lines
t0 = time.time()
C0 = .0j
hc = mf.hc
ha = mf.ha
pa = mf.pa
pv = mf.pv
c = mf.core
a = mf.active
v = mf.virt
C0 += scale * +1.00000000 * np.einsum('ui,iv,vu->', F[a,c], T1[hc,pa], eta1, optimize='optimal')
C0 += scale * -0.50000000 * np.einsum('ui,ivwx,wxuv->', F[a,c], T2[hc,ha,pa,pa], lambda2, optimize='optimal')
C0 += scale * +1.00000000 * np.einsum('ai,ia->', F[v,c], T1[hc,pv], optimize='optimal')
C0 += scale * +1.00000000 * np.einsum('au,va,uv->', F[v,a], T1[ha,pv], gamma1, optimize='optimal')
C0 += scale * -0.50000000 * np.einsum('au,vwxa,uxvw->', F[v,a], T2[ha,ha,pa,pv], lambda2, optimize='optimal')
C0 += scale * -0.50000000 * np.einsum('iu,vwix,uxvw->', T1[hc,pa], V[a,a,c,a], lambda2, optimize='optimal')
C0 += scale * -0.50000000 * np.einsum('ua,vawx,wxuv->', T1[ha,pv], V[a,v,a,a], lambda2, optimize='optimal')
C0 += scale * +0.25000000 * np.einsum('ijuv,wxij,vx,uw->', T2[hc,hc,pa,pa], V[a,a,c,c], eta1, eta1, optimize='optimal')
C0 += scale * +0.12500000 * np.einsum('ijuv,wxij,uvwx->', T2[hc,hc,pa,pa], V[a,a,c,c], lambda2, optimize='optimal')
C0 += scale * +0.50000000 * np.einsum('iuvw,xyiz,wy,vx,zu->', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, eta1, gamma1, optimize='optimal')
C0 += scale * +1.00000000 * np.einsum('iuvw,xyiz,wy,vzux->', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, lambda2, optimize='optimal')
C0 += scale * +0.25000000 * np.einsum('iuvw,xyiz,zu,vwxy->', T2[hc,ha,pa,pa], V[a,a,c,a], gamma1, lambda2, optimize='optimal')
C0 += scale * +0.25000000 * np.einsum('iuvw,xyiz,vwzuxy->', T2[hc,ha,pa,pa], V[a,a,c,a], lambda3, optimize='optimal')
C0 += scale * +0.50000000 * np.einsum('ijua,vaij,uv->', T2[hc,hc,pa,pv], V[a,v,c,c], eta1, optimize='optimal')
C0 += scale * +1.00000000 * np.einsum('iuva,waix,vw,xu->', T2[hc,ha,pa,pv], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C0 += scale * +1.00000000 * np.einsum('iuva,waix,vxuw->', T2[hc,ha,pa,pv], V[a,v,c,a], lambda2, optimize='optimal')
C0 += scale * +0.50000000 * np.einsum('uvwa,xayz,wx,zv,yu->', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, gamma1, gamma1, optimize='optimal')
C0 += scale * +0.25000000 * np.einsum('uvwa,xayz,wx,yzuv->', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, lambda2, optimize='optimal')
C0 += scale * +1.00000000 * np.einsum('uvwa,xayz,zv,wyux->', T2[ha,ha,pa,pv], V[a,v,a,a], gamma1, lambda2, optimize='optimal')
C0 += scale * -0.25000000 * np.einsum('uvwa,xayz,wyzuvx->', T2[ha,ha,pa,pv], V[a,v,a,a], lambda3, optimize='optimal')
C0 += scale * +0.25000000 * np.einsum('ijab,abij->', T2[hc,hc,pv,pv], V[v,v,c,c], optimize='optimal')
C0 += scale * +0.50000000 * np.einsum('iuab,abiv,vu->', T2[hc,ha,pv,pv], V[v,v,c,a], gamma1, optimize='optimal')
C0 += scale * +0.25000000 * np.einsum('uvab,abwx,xv,wu->', T2[ha,ha,pv,pv], V[v,v,a,a], gamma1, gamma1, optimize='optimal')
C0 += scale * +0.12500000 * np.einsum('uvab,abwx,wxuv->', T2[ha,ha,pv,pv], V[v,v,a,a], lambda2, optimize='optimal')
t1 = time.time()
if verbose: print("H_T_C0 took {:.4f} seconds to run.".format(t1-t0))
return C0
def H_T_C1_aa(C1, C2, F, V, T1, T2, gamma1, eta1, lambda2, lambda3, mf, verbose=False, scale=1.0):
# 26 lines
t0 = time.time()
hc = mf.hc
ha = mf.ha
pa = mf.pa
pv = mf.pv
c = mf.core
a = mf.active
v = mf.virt
C1 += scale * -1.00000000 * np.einsum('ui,iv->uv', F[a,c], T1[hc,pa], optimize='optimal')
C1 += scale * -1.00000000 * np.einsum('ui,ivwx,xu->vw', F[a,c], T2[hc,ha,pa,pa], eta1, optimize='optimal')
C1 += scale * -1.00000000 * np.einsum('ai,iuva->uv', F[v,c], T2[hc,ha,pa,pv], optimize='optimal')
C1 += scale * +1.00000000 * np.einsum('au,va->vu', F[v,a], T1[ha,pv], optimize='optimal')
C1 += scale * +1.00000000 * np.einsum('au,vwxa,uw->vx', F[v,a], T2[ha,ha,pa,pv], gamma1, optimize='optimal')
C1 += scale * -1.00000000 * np.einsum('iu,vwix,uw->vx', T1[hc,pa], V[a,a,c,a], eta1, optimize='optimal')
C1 += scale * -1.00000000 * np.einsum('ia,uaiv->uv', T1[hc,pv], V[a,v,c,a], optimize='optimal')
C1 += scale * +1.00000000 * np.einsum('ua,vawx,xu->vw', T1[ha,pv], V[a,v,a,a], gamma1, optimize='optimal')
C1 += scale * -0.50000000 * np.einsum('ijuv,wxij,vx->wu', T2[hc,hc,pa,pa], V[a,a,c,c], eta1, optimize='optimal')
C1 += scale * +0.50000000 * np.einsum('iuvw,xyiz,wzxy->uv', T2[hc,ha,pa,pa], V[a,a,c,a], lambda2, optimize='optimal')
C1 += scale * -1.00000000 * np.einsum('iuvw,xyiz,wy,zu->xv', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, gamma1, optimize='optimal')
C1 += scale * -1.00000000 * np.einsum('iuvw,xyiz,wzuy->xv', T2[hc,ha,pa,pa], V[a,a,c,a], lambda2, optimize='optimal')
C1 += scale * -0.50000000 * np.einsum('ijua,vaij->vu', T2[hc,hc,pa,pv], V[a,v,c,c], optimize='optimal')
C1 += scale * -1.00000000 * np.einsum('iuva,waix,xu->wv', T2[hc,ha,pa,pv], V[a,v,c,a], gamma1, optimize='optimal')
C1 += scale * -0.50000000 * np.einsum('uvwa,xayz,yzvx->uw', T2[ha,ha,pa,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1 += scale * -0.50000000 * np.einsum('uvwa,xayz,zv,yu->xw', T2[ha,ha,pa,pv], V[a,v,a,a], gamma1, gamma1, optimize='optimal')
C1 += scale * -0.25000000 * np.einsum('uvwa,xayz,yzuv->xw', T2[ha,ha,pa,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1 += scale * +0.50000000 * np.einsum('iuvw,xyiz,wy,vx->uz', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, eta1, optimize='optimal')
C1 += scale * +0.25000000 * np.einsum('iuvw,xyiz,vwxy->uz', T2[hc,ha,pa,pa], V[a,a,c,a], lambda2, optimize='optimal')
C1 += scale * -0.50000000 * np.einsum('iuvw,xyiz,vwuy->xz', T2[hc,ha,pa,pa], V[a,a,c,a], lambda2, optimize='optimal')
C1 += scale * +1.00000000 * np.einsum('iuva,waix,vw->ux', T2[hc,ha,pa,pv], V[a,v,c,a], eta1, optimize='optimal')
C1 += scale * +1.00000000 * np.einsum('uvwa,xayz,wx,zv->uy', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, gamma1, optimize='optimal')
C1 += scale * +1.00000000 * np.einsum('uvwa,xayz,wzvx->uy', T2[ha,ha,pa,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1 += scale * +0.50000000 * np.einsum('uvwa,xayz,wzuv->xy', T2[ha,ha,pa,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1 += scale * +0.50000000 * np.einsum('iuab,abiv->uv', T2[hc,ha,pv,pv], V[v,v,c,a], optimize='optimal')
C1 += scale * +0.50000000 * np.einsum('uvab,abwx,xv->uw', T2[ha,ha,pv,pv], V[v,v,a,a], gamma1, optimize='optimal')
t1 = time.time()
if verbose: print("H_T_C1_aa took {:.4f} seconds to run.".format(t1-t0))
def H_T_C2_aaaa(C1, C2, F, V, T1, T2, gamma1, eta1, lambda2, lambda3, mf, verbose=False, scale=1.0):
# 11 lines
t0 = time.time()
hc = mf.hc
ha = mf.ha
pa = mf.pa
pv = mf.pv
c = mf.core
a = mf.active
v = mf.virt
C2 += scale * -0.50000000 * np.einsum('ui,ivwx->uvwx', F[a,c], T2[hc,ha,pa,pa], optimize='optimal')
C2 += scale * -0.50000000 * np.einsum('au,vwxa->vwux', F[v,a], T2[ha,ha,pa,pv], optimize='optimal')
C2 += scale * -0.50000000 * np.einsum('iu,vwix->vwux', T1[hc,pa], V[a,a,c,a], optimize='optimal')
C2 += scale * -0.50000000 * np.einsum('ua,vawx->uvwx', T1[ha,pv], V[a,v,a,a], optimize='optimal')
C2 += scale * +0.12500000 * np.einsum('ijuv,wxij->wxuv', T2[hc,hc,pa,pa], V[a,a,c,c], optimize='optimal')
C2 += scale * +0.25000000 * np.einsum('iuvw,xyiz,zu->xyvw', T2[hc,ha,pa,pa], V[a,a,c,a], gamma1, optimize='optimal')
C2 += scale * +1.00000000 * np.einsum('iuvw,xyiz,wy->uxvz', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, optimize='optimal')
C2 += scale * +1.00000000 * np.einsum('iuva,waix->uwvx', T2[hc,ha,pa,pv], V[a,v,c,a], optimize='optimal')
C2 += scale * +1.00000000 * np.einsum('uvwa,xayz,zv->uxwy', T2[ha,ha,pa,pv], V[a,v,a,a], gamma1, optimize='optimal')
C2 += scale * +0.25000000 * np.einsum('uvwa,xayz,wx->uvyz', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, optimize='optimal')
C2 += scale * +0.12500000 * np.einsum('uvab,abwx->uvwx', T2[ha,ha,pv,pv], V[v,v,a,a], optimize='optimal')
t1 = time.time()
if verbose: print("H_T_C2_aaaa took {:.4f} seconds to run.".format(t1-t0))
def H1_T1_C1(C1, C2, F, V, T1, T2, gamma1, eta1, lambda2, lambda3, mf, verbose=False, scale=1.0):
# 24 lines
t0 = time.time()
hc = mf.hc
ha = mf.ha
pa = mf.pa
pv = mf.pv
c = mf.core
a = mf.active
v = mf.virt
C1[a,a] += scale * -1.00000000 * np.einsum('ui,iv->uv', F[a,c], T1[hc,pa], optimize='optimal')
C1[a,a] += scale * +1.00000000 * np.einsum('au,va->vu', F[v,a], T1[ha,pv], optimize='optimal')
C1[a,c] += scale * +1.00000000 * np.einsum('ai,ua->ui', F[v,c], T1[ha,pv], optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('ui,ia->ua', F[a,c], T1[hc,pv], optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('uv,wa,vw->ua', F[a,a], T1[ha,pv], eta1, optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('uv,wa,vw->ua', F[a,a], T1[ha,pv], gamma1, optimize='optimal')
C1[a,v] += scale * +1.00000000 * np.einsum('ab,ua->ub', F[v,v], T1[ha,pv], optimize='optimal')
C1[c,a] += scale * -1.00000000 * np.einsum('ij,ju->iu', F[c,c], T1[hc,pa], optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('uv,iw,wu->iv', F[a,a], T1[hc,pa], eta1, optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('uv,iw,wu->iv', F[a,a], T1[hc,pa], gamma1, optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('au,ia->iu', F[v,a], T1[hc,pv], optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('ui,jv,vu->ji', F[a,c], T1[hc,pa], eta1, optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('ui,jv,vu->ji', F[a,c], T1[hc,pa], gamma1, optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('ai,ja->ji', F[v,c], T1[hc,pv], optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('ij,ja->ia', F[c,c], T1[hc,pv], optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('iu,va,uv->ia', F[c,a], T1[ha,pv], eta1, optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('iu,va,uv->ia', F[c,a], T1[ha,pv], gamma1, optimize='optimal')
C1[c,v] += scale * +1.00000000 * np.einsum('ua,iv,vu->ia', F[a,v], T1[hc,pa], eta1, optimize='optimal')
C1[c,v] += scale * +1.00000000 * np.einsum('ua,iv,vu->ia', F[a,v], T1[hc,pa], gamma1, optimize='optimal')
C1[c,v] += scale * +1.00000000 * np.einsum('ab,ia->ib', F[v,v], T1[hc,pv], optimize='optimal')
C1[v,a] += scale * -1.00000000 * np.einsum('ai,iu->au', F[v,c], T1[hc,pa], optimize='optimal')
C1[v,v] += scale * -1.00000000 * np.einsum('ai,ib->ab', F[v,c], T1[hc,pv], optimize='optimal')
C1[v,v] += scale * -1.00000000 * np.einsum('au,vb,uv->ab', F[v,a], T1[ha,pv], eta1, optimize='optimal')
C1[v,v] += scale * -1.00000000 * np.einsum('au,vb,uv->ab', F[v,a], T1[ha,pv], gamma1, optimize='optimal')
t1 = time.time()
if verbose: print("H1_T1_C1 took {:.4f} seconds to run.".format(t1-t0))
def H1_T2_C1(C1, C2, F, V, T1, T2, gamma1, eta1, lambda2, lambda3, mf, verbose=False, scale=1.0):
# 18 lines
t0 = time.time()
hc = mf.hc
ha = mf.ha
pa = mf.pa
pv = mf.pv
c = mf.core
a = mf.active
v = mf.virt
C1[a,a] += scale * -1.00000000 * np.einsum('ui,ivwx,xu->vw', F[a,c], T2[hc,ha,pa,pa], eta1, optimize='optimal')
C1[a,a] += scale * -1.00000000 * np.einsum('ai,iuva->uv', F[v,c], T2[hc,ha,pa,pv], optimize='optimal')
C1[a,a] += scale * +1.00000000 * np.einsum('au,vwxa,uw->vx', F[v,a], T2[ha,ha,pa,pv], gamma1, optimize='optimal')
C1[a,v] += scale * +1.00000000 * np.einsum('ui,ivwa,wu->va', F[a,c], T2[hc,ha,pa,pv], eta1, optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('ai,iuba->ub', F[v,c], T2[hc,ha,pv,pv], optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('uv,wxya,yu,vx->wa', F[a,a], T2[ha,ha,pa,pv], eta1, gamma1, optimize='optimal')
C1[a,v] += scale * +1.00000000 * np.einsum('uv,wxya,vx,yu->wa', F[a,a], T2[ha,ha,pa,pv], eta1, gamma1, optimize='optimal')
C1[a,v] += scale * +1.00000000 * np.einsum('au,vwba,uw->vb', F[v,a], T2[ha,ha,pv,pv], gamma1, optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('ui,jivw,wu->jv', F[a,c], T2[hc,hc,pa,pa], eta1, optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('ai,jiua->ju', F[v,c], T2[hc,hc,pa,pv], optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('uv,iwxy,yu,vw->ix', F[a,a], T2[hc,ha,pa,pa], eta1, gamma1, optimize='optimal')
C1[c,a] += scale * -1.00000000 * np.einsum('uv,iwxy,vw,yu->ix', F[a,a], T2[hc,ha,pa,pa], eta1, gamma1, optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('au,ivwa,uv->iw', F[v,a], T2[hc,ha,pa,pv], gamma1, optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('ui,jiva,vu->ja', F[a,c], T2[hc,hc,pa,pv], eta1, optimize='optimal')
C1[c,v] += scale * +1.00000000 * np.einsum('ai,jiba->jb', F[v,c], T2[hc,hc,pv,pv], optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('uv,iwxa,xu,vw->ia', F[a,a], T2[hc,ha,pa,pv], eta1, gamma1, optimize='optimal')
C1[c,v] += scale * +1.00000000 * np.einsum('uv,iwxa,vw,xu->ia', F[a,a], T2[hc,ha,pa,pv], eta1, gamma1, optimize='optimal')
C1[c,v] += scale * +1.00000000 * np.einsum('au,ivba,uv->ib', F[v,a], T2[hc,ha,pv,pv], gamma1, optimize='optimal')
t1 = time.time()
if verbose: print("H1_T2_C1 took {:.4f} seconds to run.".format(t1-t0))
def H2_T1_C1(C1, C2, F, V, T1, T2, gamma1, eta1, lambda2, lambda3, mf, verbose=False, scale=1.0):
# 27 lines
t0 = time.time()
hc = mf.hc
ha = mf.ha
pa = mf.pa
pv = mf.pv
c = mf.core
a = mf.active
v = mf.virt
C1[a,a] += scale * -1.00000000 * np.einsum('iu,vwix,uw->vx', T1[hc,pa], V[a,a,c,a], eta1, optimize='optimal')
C1[a,a] += scale * -1.00000000 * np.einsum('ia,uaiv->uv', T1[hc,pv], V[a,v,c,a], optimize='optimal')
C1[a,a] += scale * +1.00000000 * np.einsum('ua,vawx,xu->vw', T1[ha,pv], V[a,v,a,a], gamma1, optimize='optimal')
C1[a,c] += scale * +1.00000000 * np.einsum('iu,vwji,uw->vj', T1[hc,pa], V[a,a,c,c], eta1, optimize='optimal')
C1[a,c] += scale * +1.00000000 * np.einsum('ia,uaji->uj', T1[hc,pv], V[a,v,c,c], optimize='optimal')
C1[a,c] += scale * +1.00000000 * np.einsum('ua,vaiw,wu->vi', T1[ha,pv], V[a,v,c,a], gamma1, optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('iu,vwia,uw->va', T1[hc,pa], V[a,a,c,v], eta1, optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('ia,uaib->ub', T1[hc,pv], V[a,v,c,v], optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('ua,vawb,wu->vb', T1[ha,pv], V[a,v,a,v], gamma1, optimize='optimal')
C1[c,a] += scale * -1.00000000 * np.einsum('iu,jviw,uv->jw', T1[hc,pa], V[c,a,c,a], eta1, optimize='optimal')
C1[c,a] += scale * -1.00000000 * np.einsum('ia,jaiu->ju', T1[hc,pv], V[c,v,c,a], optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('ua,iavw,wu->iv', T1[ha,pv], V[c,v,a,a], gamma1, optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('iu,jvki,uv->jk', T1[hc,pa], V[c,a,c,c], eta1, optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('ia,jaki->jk', T1[hc,pv], V[c,v,c,c], optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('ua,iajv,vu->ij', T1[ha,pv], V[c,v,c,a], gamma1, optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('iu,jvia,uv->ja', T1[hc,pa], V[c,a,c,v], eta1, optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('ia,jaib->jb', T1[hc,pv], V[c,v,c,v], optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('ua,iavb,vu->ib', T1[ha,pv], V[c,v,a,v], gamma1, optimize='optimal')
C1[v,a] += scale * +1.00000000 * np.einsum('iu,vaiw,uv->aw', T1[hc,pa], V[a,v,c,a], eta1, optimize='optimal')
C1[v,a] += scale * -1.00000000 * np.einsum('ia,baiu->bu', T1[hc,pv], V[v,v,c,a], optimize='optimal')
C1[v,a] += scale * +1.00000000 * np.einsum('ua,bavw,wu->bv', T1[ha,pv], V[v,v,a,a], gamma1, optimize='optimal')
C1[v,c] += scale * -1.00000000 * np.einsum('iu,vaji,uv->aj', T1[hc,pa], V[a,v,c,c], eta1, optimize='optimal')
C1[v,c] += scale * +1.00000000 * np.einsum('ia,baji->bj', T1[hc,pv], V[v,v,c,c], optimize='optimal')
C1[v,c] += scale * +1.00000000 * np.einsum('ua,baiv,vu->bi', T1[ha,pv], V[v,v,c,a], gamma1, optimize='optimal')
C1[v,v] += scale * +1.00000000 * np.einsum('iu,vaib,uv->ab', T1[hc,pa], V[a,v,c,v], eta1, optimize='optimal')
C1[v,v] += scale * -1.00000000 * np.einsum('ia,baic->bc', T1[hc,pv], V[v,v,c,v], optimize='optimal')
C1[v,v] += scale * -1.00000000 * np.einsum('ua,bavc,vu->bc', T1[ha,pv], V[v,v,a,v], gamma1, optimize='optimal')
t1 = time.time()
if verbose: print("H2_T1_C1 took {:.4f} seconds to run.".format(t1-t0))
def H2_T2_C1(C1, C2, F, V, T1, T2, gamma1, eta1, lambda2, lambda3, mf, verbose=False, scale=1.0):
# 158 lines
t0 = time.time()
hc = mf.hc
ha = mf.ha
pa = mf.pa
pv = mf.pv
c = mf.core
a = mf.active
v = mf.virt
C1[a,a] += scale * -0.50000000 * np.einsum('ijuv,wxij,vx->wu', T2[hc,hc,pa,pa], V[a,a,c,c], eta1, optimize='optimal')
C1[a,a] += scale * +0.50000000 * np.einsum('iuvw,xyiz,wzxy->uv', T2[hc,ha,pa,pa], V[a,a,c,a], lambda2, optimize='optimal')
C1[a,a] += scale * -1.00000000 * np.einsum('iuvw,xyiz,wy,zu->xv', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, gamma1, optimize='optimal')
C1[a,a] += scale * -1.00000000 * np.einsum('iuvw,xyiz,wzuy->xv', T2[hc,ha,pa,pa], V[a,a,c,a], lambda2, optimize='optimal')
C1[a,a] += scale * -0.50000000 * np.einsum('ijua,vaij->vu', T2[hc,hc,pa,pv], V[a,v,c,c], optimize='optimal')
C1[a,a] += scale * -1.00000000 * np.einsum('iuva,waix,xu->wv', T2[hc,ha,pa,pv], V[a,v,c,a], gamma1, optimize='optimal')
C1[a,a] += scale * -0.50000000 * np.einsum('uvwa,xayz,yzvx->uw', T2[ha,ha,pa,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1[a,a] += scale * -0.50000000 * np.einsum('uvwa,xayz,zv,yu->xw', T2[ha,ha,pa,pv], V[a,v,a,a], gamma1, gamma1, optimize='optimal')
C1[a,a] += scale * -0.25000000 * np.einsum('uvwa,xayz,yzuv->xw', T2[ha,ha,pa,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1[a,a] += scale * +0.50000000 * np.einsum('iuvw,xyiz,wy,vx->uz', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, eta1, optimize='optimal')
C1[a,a] += scale * +0.25000000 * np.einsum('iuvw,xyiz,vwxy->uz', T2[hc,ha,pa,pa], V[a,a,c,a], lambda2, optimize='optimal')
C1[a,a] += scale * -0.50000000 * np.einsum('iuvw,xyiz,vwuy->xz', T2[hc,ha,pa,pa], V[a,a,c,a], lambda2, optimize='optimal')
C1[a,a] += scale * +1.00000000 * np.einsum('iuva,waix,vw->ux', T2[hc,ha,pa,pv], V[a,v,c,a], eta1, optimize='optimal')
C1[a,a] += scale * +1.00000000 * np.einsum('uvwa,xayz,wx,zv->uy', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, gamma1, optimize='optimal')
C1[a,a] += scale * +1.00000000 * np.einsum('uvwa,xayz,wzvx->uy', T2[ha,ha,pa,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1[a,a] += scale * +0.50000000 * np.einsum('uvwa,xayz,wzuv->xy', T2[ha,ha,pa,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1[a,a] += scale * +0.50000000 * np.einsum('iuab,abiv->uv', T2[hc,ha,pv,pv], V[v,v,c,a], optimize='optimal')
C1[a,a] += scale * +0.50000000 * np.einsum('uvab,abwx,xv->uw', T2[ha,ha,pv,pv], V[v,v,a,a], gamma1, optimize='optimal')
C1[a,c] += scale * -0.50000000 * np.einsum('iuvw,xyji,wy,vx->uj', T2[hc,ha,pa,pa], V[a,a,c,c], eta1, eta1, optimize='optimal')
C1[a,c] += scale * -0.25000000 * np.einsum('iuvw,xyji,vwxy->uj', T2[hc,ha,pa,pa], V[a,a,c,c], lambda2, optimize='optimal')
C1[a,c] += scale * +0.50000000 * np.einsum('iuvw,xyji,vwuy->xj', T2[hc,ha,pa,pa], V[a,a,c,c], lambda2, optimize='optimal')
C1[a,c] += scale * -1.00000000 * np.einsum('iuva,waji,vw->uj', T2[hc,ha,pa,pv], V[a,v,c,c], eta1, optimize='optimal')
C1[a,c] += scale * +1.00000000 * np.einsum('uvwa,xaiy,wx,yv->ui', T2[ha,ha,pa,pv], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C1[a,c] += scale * +1.00000000 * np.einsum('uvwa,xaiy,wyvx->ui', T2[ha,ha,pa,pv], V[a,v,c,a], lambda2, optimize='optimal')
C1[a,c] += scale * +0.50000000 * np.einsum('uvwa,xaiy,wyuv->xi', T2[ha,ha,pa,pv], V[a,v,c,a], lambda2, optimize='optimal')
C1[a,c] += scale * -0.50000000 * np.einsum('iuab,abji->uj', T2[hc,ha,pv,pv], V[v,v,c,c], optimize='optimal')
C1[a,c] += scale * +0.50000000 * np.einsum('uvab,abiw,wv->ui', T2[ha,ha,pv,pv], V[v,v,c,a], gamma1, optimize='optimal')
C1[a,v] += scale * +0.50000000 * np.einsum('iuvw,xyia,wy,vx->ua', T2[hc,ha,pa,pa], V[a,a,c,v], eta1, eta1, optimize='optimal')
C1[a,v] += scale * +0.25000000 * np.einsum('iuvw,xyia,vwxy->ua', T2[hc,ha,pa,pa], V[a,a,c,v], lambda2, optimize='optimal')
C1[a,v] += scale * -0.50000000 * np.einsum('iuvw,xyia,vwuy->xa', T2[hc,ha,pa,pa], V[a,a,c,v], lambda2, optimize='optimal')
C1[a,v] += scale * +0.50000000 * np.einsum('ijua,vwij,uw->va', T2[hc,hc,pa,pv], V[a,a,c,c], eta1, optimize='optimal')
C1[a,v] += scale * -0.50000000 * np.einsum('iuva,wxiy,vywx->ua', T2[hc,ha,pa,pv], V[a,a,c,a], lambda2, optimize='optimal')
C1[a,v] += scale * +1.00000000 * np.einsum('iuva,wxiy,vx,yu->wa', T2[hc,ha,pa,pv], V[a,a,c,a], eta1, gamma1, optimize='optimal')
C1[a,v] += scale * +1.00000000 * np.einsum('iuva,wxiy,vyux->wa', T2[hc,ha,pa,pv], V[a,a,c,a], lambda2, optimize='optimal')
C1[a,v] += scale * -0.50000000 * np.einsum('uvwa,xyzr,rv,wzxy->ua', T2[ha,ha,pa,pv], V[a,a,a,a], eta1, lambda2, optimize='optimal')
C1[a,v] += scale * +0.50000000 * np.einsum('uvwa,xyzr,wy,zrvx->ua', T2[ha,ha,pa,pv], V[a,a,a,a], eta1, lambda2, optimize='optimal')
C1[a,v] += scale * -0.50000000 * np.einsum('uvwa,xyzr,rv,wzxy->ua', T2[ha,ha,pa,pv], V[a,a,a,a], gamma1, lambda2, optimize='optimal')
C1[a,v] += scale * -0.50000000 * np.einsum('uvwa,xyzr,wx,zrvy->ua', T2[ha,ha,pa,pv], V[a,a,a,a], gamma1, lambda2, optimize='optimal')
C1[a,v] += scale * +0.50000000 * np.einsum('uvwa,xyzr,rv,zu,wy->xa', T2[ha,ha,pa,pv], V[a,a,a,a], eta1, eta1, gamma1, optimize='optimal')
C1[a,v] += scale * +1.00000000 * np.einsum('uvwa,xyzr,rv,wzuy->xa', T2[ha,ha,pa,pv], V[a,a,a,a], eta1, lambda2, optimize='optimal')
C1[a,v] += scale * +0.50000000 * np.einsum('uvwa,xyzr,wy,rv,zu->xa', T2[ha,ha,pa,pv], V[a,a,a,a], eta1, gamma1, gamma1, optimize='optimal')
C1[a,v] += scale * +0.25000000 * np.einsum('uvwa,xyzr,wy,zruv->xa', T2[ha,ha,pa,pv], V[a,a,a,a], eta1, lambda2, optimize='optimal')
C1[a,v] += scale * +1.00000000 * np.einsum('uvwa,xyzr,rv,wzuy->xa', T2[ha,ha,pa,pv], V[a,a,a,a], gamma1, lambda2, optimize='optimal')
C1[a,v] += scale * +0.25000000 * np.einsum('uvwa,xyzr,wy,zruv->xa', T2[ha,ha,pa,pv], V[a,a,a,a], gamma1, lambda2, optimize='optimal')
C1[a,v] += scale * +1.00000000 * np.einsum('iuva,waib,vw->ub', T2[hc,ha,pa,pv], V[a,v,c,v], eta1, optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('uvwa,xayb,wx,yv->ub', T2[ha,ha,pa,pv], V[a,v,a,v], eta1, gamma1, optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('uvwa,xayb,wyvx->ub', T2[ha,ha,pa,pv], V[a,v,a,v], lambda2, optimize='optimal')
C1[a,v] += scale * -0.50000000 * np.einsum('uvwa,xayb,wyuv->xb', T2[ha,ha,pa,pv], V[a,v,a,v], lambda2, optimize='optimal')
C1[a,v] += scale * -0.50000000 * np.einsum('ijab,ubij->ua', T2[hc,hc,pv,pv], V[a,v,c,c], optimize='optimal')
C1[a,v] += scale * -1.00000000 * np.einsum('iuab,vbiw,wu->va', T2[hc,ha,pv,pv], V[a,v,c,a], gamma1, optimize='optimal')
C1[a,v] += scale * -0.50000000 * np.einsum('uvab,wbxy,xyvw->ua', T2[ha,ha,pv,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1[a,v] += scale * -0.50000000 * np.einsum('uvab,wbxy,yv,xu->wa', T2[ha,ha,pv,pv], V[a,v,a,a], gamma1, gamma1, optimize='optimal')
C1[a,v] += scale * -0.25000000 * np.einsum('uvab,wbxy,xyuv->wa', T2[ha,ha,pv,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1[a,v] += scale * +0.50000000 * np.einsum('iuab,abic->uc', T2[hc,ha,pv,pv], V[v,v,c,v], optimize='optimal')
C1[a,v] += scale * -0.50000000 * np.einsum('uvab,abwc,wv->uc', T2[ha,ha,pv,pv], V[v,v,a,v], gamma1, optimize='optimal')
C1[c,a] += scale * -0.50000000 * np.einsum('ijuv,wxjy,vywx->iu', T2[hc,hc,pa,pa], V[a,a,c,a], lambda2, optimize='optimal')
C1[c,a] += scale * +0.50000000 * np.einsum('iuvw,xyzr,ru,wzxy->iv', T2[hc,ha,pa,pa], V[a,a,a,a], eta1, lambda2, optimize='optimal')
C1[c,a] += scale * -0.50000000 * np.einsum('iuvw,xyzr,wy,zrux->iv', T2[hc,ha,pa,pa], V[a,a,a,a], eta1, lambda2, optimize='optimal')
C1[c,a] += scale * +0.50000000 * np.einsum('iuvw,xyzr,ru,wzxy->iv', T2[hc,ha,pa,pa], V[a,a,a,a], gamma1, lambda2, optimize='optimal')
C1[c,a] += scale * +0.50000000 * np.einsum('iuvw,xyzr,wx,zruy->iv', T2[hc,ha,pa,pa], V[a,a,a,a], gamma1, lambda2, optimize='optimal')
C1[c,a] += scale * -0.50000000 * np.einsum('ijuv,kwij,vw->ku', T2[hc,hc,pa,pa], V[c,a,c,c], eta1, optimize='optimal')
C1[c,a] += scale * -1.00000000 * np.einsum('iuvw,jxiy,wx,yu->jv', T2[hc,ha,pa,pa], V[c,a,c,a], eta1, gamma1, optimize='optimal')
C1[c,a] += scale * -1.00000000 * np.einsum('iuvw,jxiy,wyux->jv', T2[hc,ha,pa,pa], V[c,a,c,a], lambda2, optimize='optimal')
C1[c,a] += scale * -0.50000000 * np.einsum('iuva,waxy,xyuw->iv', T2[hc,ha,pa,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1[c,a] += scale * -0.50000000 * np.einsum('ijua,kaij->ku', T2[hc,hc,pa,pv], V[c,v,c,c], optimize='optimal')
C1[c,a] += scale * -1.00000000 * np.einsum('iuva,jaiw,wu->jv', T2[hc,ha,pa,pv], V[c,v,c,a], gamma1, optimize='optimal')
C1[c,a] += scale * -0.50000000 * np.einsum('uvwa,iaxy,yv,xu->iw', T2[ha,ha,pa,pv], V[c,v,a,a], gamma1, gamma1, optimize='optimal')
C1[c,a] += scale * -0.25000000 * np.einsum('uvwa,iaxy,xyuv->iw', T2[ha,ha,pa,pv], V[c,v,a,a], lambda2, optimize='optimal')
C1[c,a] += scale * -0.50000000 * np.einsum('ijuv,wxjy,vx,uw->iy', T2[hc,hc,pa,pa], V[a,a,c,a], eta1, eta1, optimize='optimal')
C1[c,a] += scale * -0.25000000 * np.einsum('ijuv,wxjy,uvwx->iy', T2[hc,hc,pa,pa], V[a,a,c,a], lambda2, optimize='optimal')
C1[c,a] += scale * +0.50000000 * np.einsum('iuvw,xyzr,ru,wy,vx->iz', T2[hc,ha,pa,pa], V[a,a,a,a], eta1, gamma1, gamma1, optimize='optimal')
C1[c,a] += scale * +0.25000000 * np.einsum('iuvw,xyzr,ru,vwxy->iz', T2[hc,ha,pa,pa], V[a,a,a,a], eta1, lambda2, optimize='optimal')
C1[c,a] += scale * +0.50000000 * np.einsum('iuvw,xyzr,wy,vx,ru->iz', T2[hc,ha,pa,pa], V[a,a,a,a], eta1, eta1, gamma1, optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('iuvw,xyzr,wy,vrux->iz', T2[hc,ha,pa,pa], V[a,a,a,a], eta1, lambda2, optimize='optimal')
C1[c,a] += scale * +0.25000000 * np.einsum('iuvw,xyzr,ru,vwxy->iz', T2[hc,ha,pa,pa], V[a,a,a,a], gamma1, lambda2, optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('iuvw,xyzr,wy,vrux->iz', T2[hc,ha,pa,pa], V[a,a,a,a], gamma1, lambda2, optimize='optimal')
C1[c,a] += scale * -0.50000000 * np.einsum('iuvw,jxiy,vwux->jy', T2[hc,ha,pa,pa], V[c,a,c,a], lambda2, optimize='optimal')
C1[c,a] += scale * -1.00000000 * np.einsum('ijua,vajw,uv->iw', T2[hc,hc,pa,pv], V[a,v,c,a], eta1, optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('iuva,waxy,vw,yu->ix', T2[hc,ha,pa,pv], V[a,v,a,a], eta1, gamma1, optimize='optimal')
C1[c,a] += scale * +1.00000000 * np.einsum('iuva,waxy,vyuw->ix', T2[hc,ha,pa,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1[c,a] += scale * +0.50000000 * np.einsum('uvwa,iaxy,wyuv->ix', T2[ha,ha,pa,pv], V[c,v,a,a], lambda2, optimize='optimal')
C1[c,a] += scale * -0.50000000 * np.einsum('ijab,abju->iu', T2[hc,hc,pv,pv], V[v,v,c,a], optimize='optimal')
C1[c,a] += scale * +0.50000000 * np.einsum('iuab,abvw,wu->iv', T2[hc,ha,pv,pv], V[v,v,a,a], gamma1, optimize='optimal')
C1[c,c] += scale * +0.50000000 * np.einsum('ijuv,wxkj,vx,uw->ik', T2[hc,hc,pa,pa], V[a,a,c,c], eta1, eta1, optimize='optimal')
C1[c,c] += scale * +0.25000000 * np.einsum('ijuv,wxkj,uvwx->ik', T2[hc,hc,pa,pa], V[a,a,c,c], lambda2, optimize='optimal')
C1[c,c] += scale * +0.50000000 * np.einsum('iuvw,xyjz,zu,wy,vx->ij', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, gamma1, gamma1, optimize='optimal')
C1[c,c] += scale * +0.25000000 * np.einsum('iuvw,xyjz,zu,vwxy->ij', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, lambda2, optimize='optimal')
C1[c,c] += scale * +0.50000000 * np.einsum('iuvw,xyjz,wy,vx,zu->ij', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, eta1, gamma1, optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('iuvw,xyjz,wy,vzux->ij', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, lambda2, optimize='optimal')
C1[c,c] += scale * +0.25000000 * np.einsum('iuvw,xyjz,zu,vwxy->ij', T2[hc,ha,pa,pa], V[a,a,c,a], gamma1, lambda2, optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('iuvw,xyjz,wy,vzux->ij', T2[hc,ha,pa,pa], V[a,a,c,a], gamma1, lambda2, optimize='optimal')
C1[c,c] += scale * +0.50000000 * np.einsum('iuvw,jxki,vwux->jk', T2[hc,ha,pa,pa], V[c,a,c,c], lambda2, optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('ijua,vakj,uv->ik', T2[hc,hc,pa,pv], V[a,v,c,c], eta1, optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('iuva,wajx,vw,xu->ij', T2[hc,ha,pa,pv], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C1[c,c] += scale * +1.00000000 * np.einsum('iuva,wajx,vxuw->ij', T2[hc,ha,pa,pv], V[a,v,c,a], lambda2, optimize='optimal')
C1[c,c] += scale * +0.50000000 * np.einsum('uvwa,iajx,wxuv->ij', T2[ha,ha,pa,pv], V[c,v,c,a], lambda2, optimize='optimal')
C1[c,c] += scale * +0.50000000 * np.einsum('ijab,abkj->ik', T2[hc,hc,pv,pv], V[v,v,c,c], optimize='optimal')
C1[c,c] += scale * +0.50000000 * np.einsum('iuab,abjv,vu->ij', T2[hc,ha,pv,pv], V[v,v,c,a], gamma1, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('ijuv,wxja,vx,uw->ia', T2[hc,hc,pa,pa], V[a,a,c,v], eta1, eta1, optimize='optimal')
C1[c,v] += scale * -0.25000000 * np.einsum('ijuv,wxja,uvwx->ia', T2[hc,hc,pa,pa], V[a,a,c,v], lambda2, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('iuvw,xyza,zu,wy,vx->ia', T2[hc,ha,pa,pa], V[a,a,a,v], eta1, gamma1, gamma1, optimize='optimal')
C1[c,v] += scale * -0.25000000 * np.einsum('iuvw,xyza,zu,vwxy->ia', T2[hc,ha,pa,pa], V[a,a,a,v], eta1, lambda2, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('iuvw,xyza,wy,vx,zu->ia', T2[hc,ha,pa,pa], V[a,a,a,v], eta1, eta1, gamma1, optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('iuvw,xyza,wy,vzux->ia', T2[hc,ha,pa,pa], V[a,a,a,v], eta1, lambda2, optimize='optimal')
C1[c,v] += scale * -0.25000000 * np.einsum('iuvw,xyza,zu,vwxy->ia', T2[hc,ha,pa,pa], V[a,a,a,v], gamma1, lambda2, optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('iuvw,xyza,wy,vzux->ia', T2[hc,ha,pa,pa], V[a,a,a,v], gamma1, lambda2, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('iuvw,jxia,vwux->ja', T2[hc,ha,pa,pa], V[c,a,c,v], lambda2, optimize='optimal')
C1[c,v] += scale * +0.50000000 * np.einsum('ijua,vwjx,uxvw->ia', T2[hc,hc,pa,pv], V[a,a,c,a], lambda2, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('iuva,wxyz,zu,vywx->ia', T2[hc,ha,pa,pv], V[a,a,a,a], eta1, lambda2, optimize='optimal')
C1[c,v] += scale * +0.50000000 * np.einsum('iuva,wxyz,vx,yzuw->ia', T2[hc,ha,pa,pv], V[a,a,a,a], eta1, lambda2, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('iuva,wxyz,zu,vywx->ia', T2[hc,ha,pa,pv], V[a,a,a,a], gamma1, lambda2, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('iuva,wxyz,vw,yzux->ia', T2[hc,ha,pa,pv], V[a,a,a,a], gamma1, lambda2, optimize='optimal')
C1[c,v] += scale * +0.50000000 * np.einsum('ijua,kvij,uv->ka', T2[hc,hc,pa,pv], V[c,a,c,c], eta1, optimize='optimal')
C1[c,v] += scale * +1.00000000 * np.einsum('iuva,jwix,vw,xu->ja', T2[hc,ha,pa,pv], V[c,a,c,a], eta1, gamma1, optimize='optimal')
C1[c,v] += scale * +1.00000000 * np.einsum('iuva,jwix,vxuw->ja', T2[hc,ha,pa,pv], V[c,a,c,a], lambda2, optimize='optimal')
C1[c,v] += scale * +0.50000000 * np.einsum('uvwa,ixyz,zv,yu,wx->ia', T2[ha,ha,pa,pv], V[c,a,a,a], eta1, eta1, gamma1, optimize='optimal')
C1[c,v] += scale * +1.00000000 * np.einsum('uvwa,ixyz,zv,wyux->ia', T2[ha,ha,pa,pv], V[c,a,a,a], eta1, lambda2, optimize='optimal')
C1[c,v] += scale * +0.50000000 * np.einsum('uvwa,ixyz,wx,zv,yu->ia', T2[ha,ha,pa,pv], V[c,a,a,a], eta1, gamma1, gamma1, optimize='optimal')
C1[c,v] += scale * +0.25000000 * np.einsum('uvwa,ixyz,wx,yzuv->ia', T2[ha,ha,pa,pv], V[c,a,a,a], eta1, lambda2, optimize='optimal')
C1[c,v] += scale * +1.00000000 * np.einsum('uvwa,ixyz,zv,wyux->ia', T2[ha,ha,pa,pv], V[c,a,a,a], gamma1, lambda2, optimize='optimal')
C1[c,v] += scale * +0.25000000 * np.einsum('uvwa,ixyz,wx,yzuv->ia', T2[ha,ha,pa,pv], V[c,a,a,a], gamma1, lambda2, optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('ijua,vajb,uv->ib', T2[hc,hc,pa,pv], V[a,v,c,v], eta1, optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('iuva,waxb,vw,xu->ib', T2[hc,ha,pa,pv], V[a,v,a,v], eta1, gamma1, optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('iuva,waxb,vxuw->ib', T2[hc,ha,pa,pv], V[a,v,a,v], lambda2, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('uvwa,iaxb,wxuv->ib', T2[ha,ha,pa,pv], V[c,v,a,v], lambda2, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('iuab,vbwx,wxuv->ia', T2[hc,ha,pv,pv], V[a,v,a,a], lambda2, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('ijab,kbij->ka', T2[hc,hc,pv,pv], V[c,v,c,c], optimize='optimal')
C1[c,v] += scale * -1.00000000 * np.einsum('iuab,jbiv,vu->ja', T2[hc,ha,pv,pv], V[c,v,c,a], gamma1, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('uvab,ibwx,xv,wu->ia', T2[ha,ha,pv,pv], V[c,v,a,a], gamma1, gamma1, optimize='optimal')
C1[c,v] += scale * -0.25000000 * np.einsum('uvab,ibwx,wxuv->ia', T2[ha,ha,pv,pv], V[c,v,a,a], lambda2, optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('ijab,abjc->ic', T2[hc,hc,pv,pv], V[v,v,c,v], optimize='optimal')
C1[c,v] += scale * -0.50000000 * np.einsum('iuab,abvc,vu->ic', T2[hc,ha,pv,pv], V[v,v,a,v], gamma1, optimize='optimal')
C1[v,a] += scale * +0.50000000 * np.einsum('ijuv,waij,vw->au', T2[hc,hc,pa,pa], V[a,v,c,c], eta1, optimize='optimal')
C1[v,a] += scale * +1.00000000 * np.einsum('iuvw,xaiy,wx,yu->av', T2[hc,ha,pa,pa], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C1[v,a] += scale * +1.00000000 * np.einsum('iuvw,xaiy,wyux->av', T2[hc,ha,pa,pa], V[a,v,c,a], lambda2, optimize='optimal')
C1[v,a] += scale * -0.50000000 * np.einsum('ijua,baij->bu', T2[hc,hc,pa,pv], V[v,v,c,c], optimize='optimal')
C1[v,a] += scale * -1.00000000 * np.einsum('iuva,baiw,wu->bv', T2[hc,ha,pa,pv], V[v,v,c,a], gamma1, optimize='optimal')
C1[v,a] += scale * -0.50000000 * np.einsum('uvwa,baxy,yv,xu->bw', T2[ha,ha,pa,pv], V[v,v,a,a], gamma1, gamma1, optimize='optimal')
C1[v,a] += scale * -0.25000000 * np.einsum('uvwa,baxy,xyuv->bw', T2[ha,ha,pa,pv], V[v,v,a,a], lambda2, optimize='optimal')
C1[v,a] += scale * +0.50000000 * np.einsum('iuvw,xaiy,vwux->ay', T2[hc,ha,pa,pa], V[a,v,c,a], lambda2, optimize='optimal')
C1[v,a] += scale * +0.50000000 * np.einsum('uvwa,baxy,wyuv->bx', T2[ha,ha,pa,pv], V[v,v,a,a], lambda2, optimize='optimal')
C1[v,c] += scale * -0.50000000 * np.einsum('iuvw,xaji,vwux->aj', T2[hc,ha,pa,pa], V[a,v,c,c], lambda2, optimize='optimal')
C1[v,c] += scale * +0.50000000 * np.einsum('uvwa,baix,wxuv->bi', T2[ha,ha,pa,pv], V[v,v,c,a], lambda2, optimize='optimal')
C1[v,v] += scale * +0.50000000 * np.einsum('iuvw,xaib,vwux->ab', T2[hc,ha,pa,pa], V[a,v,c,v], lambda2, optimize='optimal')
C1[v,v] += scale * -0.50000000 * np.einsum('ijua,vbij,uv->ba', T2[hc,hc,pa,pv], V[a,v,c,c], eta1, optimize='optimal')
C1[v,v] += scale * -1.00000000 * np.einsum('iuva,wbix,vw,xu->ba', T2[hc,ha,pa,pv], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C1[v,v] += scale * -1.00000000 * np.einsum('iuva,wbix,vxuw->ba', T2[hc,ha,pa,pv], V[a,v,c,a], lambda2, optimize='optimal')
C1[v,v] += scale * -0.50000000 * np.einsum('uvwa,xbyz,zv,yu,wx->ba', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, eta1, gamma1, optimize='optimal')
C1[v,v] += scale * -1.00000000 * np.einsum('uvwa,xbyz,zv,wyux->ba', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, lambda2, optimize='optimal')
C1[v,v] += scale * -0.50000000 * np.einsum('uvwa,xbyz,wx,zv,yu->ba', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, gamma1, gamma1, optimize='optimal')
C1[v,v] += scale * -0.25000000 * np.einsum('uvwa,xbyz,wx,yzuv->ba', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, lambda2, optimize='optimal')
C1[v,v] += scale * -1.00000000 * np.einsum('uvwa,xbyz,zv,wyux->ba', T2[ha,ha,pa,pv], V[a,v,a,a], gamma1, lambda2, optimize='optimal')
C1[v,v] += scale * -0.25000000 * np.einsum('uvwa,xbyz,wx,yzuv->ba', T2[ha,ha,pa,pv], V[a,v,a,a], gamma1, lambda2, optimize='optimal')
C1[v,v] += scale * -0.50000000 * np.einsum('uvwa,baxc,wxuv->bc', T2[ha,ha,pa,pv], V[v,v,a,v], lambda2, optimize='optimal')
C1[v,v] += scale * -0.50000000 * np.einsum('ijab,cbij->ca', T2[hc,hc,pv,pv], V[v,v,c,c], optimize='optimal')
C1[v,v] += scale * -1.00000000 * np.einsum('iuab,cbiv,vu->ca', T2[hc,ha,pv,pv], V[v,v,c,a], gamma1, optimize='optimal')
C1[v,v] += scale * -0.50000000 * np.einsum('uvab,cbwx,xv,wu->ca', T2[ha,ha,pv,pv], V[v,v,a,a], gamma1, gamma1, optimize='optimal')
C1[v,v] += scale * -0.25000000 * np.einsum('uvab,cbwx,wxuv->ca', T2[ha,ha,pv,pv], V[v,v,a,a], lambda2, optimize='optimal')
t1 = time.time()
if verbose: print("H2_T2_C1 took {:.4f} seconds to run.".format(t1-t0))
def H1_T2_C2(C1, C2, F, V, T1, T2, gamma1, eta1, lambda2, lambda3, mf, verbose=False, scale=1.0):
# 96 lines
t0 = time.time()
hc = mf.hc
ha = mf.ha
pa = mf.pa
pv = mf.pv
c = mf.core
a = mf.active
v = mf.virt
C2[a,a,a,a] += scale * -0.50000000 * np.einsum('ui,ivwx->uvwx', F[a,c], T2[hc,ha,pa,pa], optimize='optimal')
C2[a,a,a,a] += scale * -0.50000000 * np.einsum('au,vwxa->vwux', F[v,a], T2[ha,ha,pa,pv], optimize='optimal')
C2[a,a,c,a] += scale * -0.50000000 * np.einsum('ai,uvwa->uviw', F[v,c], T2[ha,ha,pa,pv], optimize='optimal')
C2[a,a,a,v] += scale * -1.00000000 * np.einsum('ui,ivwa->uvwa', F[a,c], T2[hc,ha,pa,pv], optimize='optimal')
C2[a,a,a,v] += scale * +0.50000000 * np.einsum('uv,wxya,yu->wxva', F[a,a], T2[ha,ha,pa,pv], eta1, optimize='optimal')
C2[a,a,a,v] += scale * +0.50000000 * np.einsum('uv,wxya,yu->wxva', F[a,a], T2[ha,ha,pa,pv], gamma1, optimize='optimal')
C2[a,a,a,v] += scale * -0.50000000 * np.einsum('au,vwba->vwub', F[v,a], T2[ha,ha,pv,pv], optimize='optimal')
C2[a,a,a,v] += scale * +1.00000000 * np.einsum('uv,wxya,vx->uwya', F[a,a], T2[ha,ha,pa,pv], eta1, optimize='optimal')
C2[a,a,a,v] += scale * +1.00000000 * np.einsum('uv,wxya,vx->uwya', F[a,a], T2[ha,ha,pa,pv], gamma1, optimize='optimal')
C2[a,a,a,v] += scale * +0.50000000 * np.einsum('ab,uvwa->uvwb', F[v,v], T2[ha,ha,pa,pv], optimize='optimal')
C2[a,a,c,v] += scale * +0.50000000 * np.einsum('ui,vwxa,xu->vwia', F[a,c], T2[ha,ha,pa,pv], eta1, optimize='optimal')
C2[a,a,c,v] += scale * +0.50000000 * np.einsum('ui,vwxa,xu->vwia', F[a,c], T2[ha,ha,pa,pv], gamma1, optimize='optimal')
C2[a,a,c,v] += scale * -0.50000000 * np.einsum('ai,uvba->uvib', F[v,c], T2[ha,ha,pv,pv], optimize='optimal')
C2[a,a,v,v] += scale * -0.50000000 * np.einsum('ui,ivab->uvab', F[a,c], T2[hc,ha,pv,pv], optimize='optimal')
C2[a,a,v,v] += scale * +0.50000000 * np.einsum('uv,wxab,vx->uwab', F[a,a], T2[ha,ha,pv,pv], eta1, optimize='optimal')
C2[a,a,v,v] += scale * +0.50000000 * np.einsum('uv,wxab,vx->uwab', F[a,a], T2[ha,ha,pv,pv], gamma1, optimize='optimal')
C2[a,a,v,v] += scale * +0.50000000 * np.einsum('ua,vwxb,xu->vwab', F[a,v], T2[ha,ha,pa,pv], eta1, optimize='optimal')
C2[a,a,v,v] += scale * +0.50000000 * np.einsum('ua,vwxb,xu->vwab', F[a,v], T2[ha,ha,pa,pv], gamma1, optimize='optimal')
C2[a,a,v,v] += scale * -0.50000000 * np.einsum('ab,uvca->uvbc', F[v,v], T2[ha,ha,pv,pv], optimize='optimal')
C2[a,v,a,a] += scale * +0.50000000 * np.einsum('ai,iuvw->uavw', F[v,c], T2[hc,ha,pa,pa], optimize='optimal')
C2[a,v,a,v] += scale * +1.00000000 * np.einsum('ai,iuvb->uavb', F[v,c], T2[hc,ha,pa,pv], optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('au,vwxb,uw->vaxb', F[v,a], T2[ha,ha,pa,pv], eta1, optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('au,vwxb,uw->vaxb', F[v,a], T2[ha,ha,pa,pv], gamma1, optimize='optimal')
C2[a,v,v,v] += scale * +0.50000000 * np.einsum('ai,iubc->uabc', F[v,c], T2[hc,ha,pv,pv], optimize='optimal')
C2[a,v,v,v] += scale * -0.50000000 * np.einsum('au,vwbc,uw->vabc', F[v,a], T2[ha,ha,pv,pv], eta1, optimize='optimal')
C2[a,v,v,v] += scale * -0.50000000 * np.einsum('au,vwbc,uw->vabc', F[v,a], T2[ha,ha,pv,pv], gamma1, optimize='optimal')
C2[c,a,a,a] += scale * -0.50000000 * np.einsum('ij,juvw->iuvw', F[c,c], T2[hc,ha,pa,pa], optimize='optimal')
C2[c,a,a,a] += scale * -0.50000000 * np.einsum('ui,jivw->juvw', F[a,c], T2[hc,hc,pa,pa], optimize='optimal')
C2[c,a,a,a] += scale * -1.00000000 * np.einsum('uv,iwxy,yu->iwvx', F[a,a], T2[hc,ha,pa,pa], eta1, optimize='optimal')
C2[c,a,a,a] += scale * -1.00000000 * np.einsum('uv,iwxy,yu->iwvx', F[a,a], T2[hc,ha,pa,pa], gamma1, optimize='optimal')
C2[c,a,a,a] += scale * -1.00000000 * np.einsum('au,ivwa->ivuw', F[v,a], T2[hc,ha,pa,pv], optimize='optimal')
C2[c,a,a,a] += scale * -0.50000000 * np.einsum('uv,iwxy,vw->iuxy', F[a,a], T2[hc,ha,pa,pa], eta1, optimize='optimal')
C2[c,a,a,a] += scale * -0.50000000 * np.einsum('uv,iwxy,vw->iuxy', F[a,a], T2[hc,ha,pa,pa], gamma1, optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('ui,jvwx,xu->jviw', F[a,c], T2[hc,ha,pa,pa], eta1, optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('ui,jvwx,xu->jviw', F[a,c], T2[hc,ha,pa,pa], gamma1, optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('ai,juva->juiv', F[v,c], T2[hc,ha,pa,pv], optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('ij,juva->iuva', F[c,c], T2[hc,ha,pa,pv], optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('ui,jiva->juva', F[a,c], T2[hc,hc,pa,pv], optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('uv,iwxa,xu->iwva', F[a,a], T2[hc,ha,pa,pv], eta1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('uv,iwxa,xu->iwva', F[a,a], T2[hc,ha,pa,pv], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('au,ivba->ivub', F[v,a], T2[hc,ha,pv,pv], optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('iu,vwxa,uw->ivxa', F[c,a], T2[ha,ha,pa,pv], eta1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('iu,vwxa,uw->ivxa', F[c,a], T2[ha,ha,pa,pv], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('uv,iwxa,vw->iuxa', F[a,a], T2[hc,ha,pa,pv], eta1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('uv,iwxa,vw->iuxa', F[a,a], T2[hc,ha,pa,pv], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('ua,ivwx,xu->ivwa', F[a,v], T2[hc,ha,pa,pa], eta1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('ua,ivwx,xu->ivwa', F[a,v], T2[hc,ha,pa,pa], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('ab,iuva->iuvb', F[v,v], T2[hc,ha,pa,pv], optimize='optimal')
C2[c,a,c,v] += scale * +1.00000000 * np.einsum('ui,jvwa,wu->jvia', F[a,c], T2[hc,ha,pa,pv], eta1, optimize='optimal')
C2[c,a,c,v] += scale * +1.00000000 * np.einsum('ui,jvwa,wu->jvia', F[a,c], T2[hc,ha,pa,pv], gamma1, optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('ai,juba->juib', F[v,c], T2[hc,ha,pv,pv], optimize='optimal')
C2[c,a,v,v] += scale * -0.50000000 * np.einsum('ij,juab->iuab', F[c,c], T2[hc,ha,pv,pv], optimize='optimal')
C2[c,a,v,v] += scale * -0.50000000 * np.einsum('ui,jiab->juab', F[a,c], T2[hc,hc,pv,pv], optimize='optimal')
C2[c,a,v,v] += scale * +0.50000000 * np.einsum('iu,vwab,uw->ivab', F[c,a], T2[ha,ha,pv,pv], eta1, optimize='optimal')
C2[c,a,v,v] += scale * +0.50000000 * np.einsum('iu,vwab,uw->ivab', F[c,a], T2[ha,ha,pv,pv], gamma1, optimize='optimal')
C2[c,a,v,v] += scale * -0.50000000 * np.einsum('uv,iwab,vw->iuab', F[a,a], T2[hc,ha,pv,pv], eta1, optimize='optimal')
C2[c,a,v,v] += scale * -0.50000000 * np.einsum('uv,iwab,vw->iuab', F[a,a], T2[hc,ha,pv,pv], gamma1, optimize='optimal')
C2[c,a,v,v] += scale * +1.00000000 * np.einsum('ua,ivwb,wu->ivab', F[a,v], T2[hc,ha,pa,pv], eta1, optimize='optimal')
C2[c,a,v,v] += scale * +1.00000000 * np.einsum('ua,ivwb,wu->ivab', F[a,v], T2[hc,ha,pa,pv], gamma1, optimize='optimal')
C2[c,a,v,v] += scale * -1.00000000 * np.einsum('ab,iuca->iubc', F[v,v], T2[hc,ha,pv,pv], optimize='optimal')
C2[c,c,a,a] += scale * +0.50000000 * np.einsum('ij,kjuv->ikuv', F[c,c], T2[hc,hc,pa,pa], optimize='optimal')
C2[c,c,a,a] += scale * -0.50000000 * np.einsum('uv,ijwx,xu->ijvw', F[a,a], T2[hc,hc,pa,pa], eta1, optimize='optimal')
C2[c,c,a,a] += scale * -0.50000000 * np.einsum('uv,ijwx,xu->ijvw', F[a,a], T2[hc,hc,pa,pa], gamma1, optimize='optimal')
C2[c,c,a,a] += scale * -0.50000000 * np.einsum('au,ijva->ijuv', F[v,a], T2[hc,hc,pa,pv], optimize='optimal')
C2[c,c,a,a] += scale * +0.50000000 * np.einsum('iu,jvwx,uv->ijwx', F[c,a], T2[hc,ha,pa,pa], eta1, optimize='optimal')
C2[c,c,a,a] += scale * +0.50000000 * np.einsum('iu,jvwx,uv->ijwx', F[c,a], T2[hc,ha,pa,pa], gamma1, optimize='optimal')
C2[c,c,c,a] += scale * -0.50000000 * np.einsum('ui,jkvw,wu->jkiv', F[a,c], T2[hc,hc,pa,pa], eta1, optimize='optimal')
C2[c,c,c,a] += scale * -0.50000000 * np.einsum('ui,jkvw,wu->jkiv', F[a,c], T2[hc,hc,pa,pa], gamma1, optimize='optimal')
C2[c,c,c,a] += scale * -0.50000000 * np.einsum('ai,jkua->jkiu', F[v,c], T2[hc,hc,pa,pv], optimize='optimal')
C2[c,c,a,v] += scale * +1.00000000 * np.einsum('ij,kjua->ikua', F[c,c], T2[hc,hc,pa,pv], optimize='optimal')
C2[c,c,a,v] += scale * +0.50000000 * np.einsum('uv,ijwa,wu->ijva', F[a,a], T2[hc,hc,pa,pv], eta1, optimize='optimal')
C2[c,c,a,v] += scale * +0.50000000 * np.einsum('uv,ijwa,wu->ijva', F[a,a], T2[hc,hc,pa,pv], gamma1, optimize='optimal')
C2[c,c,a,v] += scale * -0.50000000 * np.einsum('au,ijba->ijub', F[v,a], T2[hc,hc,pv,pv], optimize='optimal')
C2[c,c,a,v] += scale * +1.00000000 * np.einsum('iu,jvwa,uv->ijwa', F[c,a], T2[hc,ha,pa,pv], eta1, optimize='optimal')
C2[c,c,a,v] += scale * +1.00000000 * np.einsum('iu,jvwa,uv->ijwa', F[c,a], T2[hc,ha,pa,pv], gamma1, optimize='optimal')
C2[c,c,a,v] += scale * +0.50000000 * np.einsum('ua,ijvw,wu->ijva', F[a,v], T2[hc,hc,pa,pa], eta1, optimize='optimal')
C2[c,c,a,v] += scale * +0.50000000 * np.einsum('ua,ijvw,wu->ijva', F[a,v], T2[hc,hc,pa,pa], gamma1, optimize='optimal')
C2[c,c,a,v] += scale * +0.50000000 * np.einsum('ab,ijua->ijub', F[v,v], T2[hc,hc,pa,pv], optimize='optimal')
C2[c,c,c,v] += scale * +0.50000000 * np.einsum('ui,jkva,vu->jkia', F[a,c], T2[hc,hc,pa,pv], eta1, optimize='optimal')
C2[c,c,c,v] += scale * +0.50000000 * np.einsum('ui,jkva,vu->jkia', F[a,c], T2[hc,hc,pa,pv], gamma1, optimize='optimal')
C2[c,c,c,v] += scale * -0.50000000 * np.einsum('ai,jkba->jkib', F[v,c], T2[hc,hc,pv,pv], optimize='optimal')
C2[c,c,v,v] += scale * +0.50000000 * np.einsum('ij,kjab->ikab', F[c,c], T2[hc,hc,pv,pv], optimize='optimal')
C2[c,c,v,v] += scale * +0.50000000 * np.einsum('iu,jvab,uv->ijab', F[c,a], T2[hc,ha,pv,pv], eta1, optimize='optimal')
C2[c,c,v,v] += scale * +0.50000000 * np.einsum('iu,jvab,uv->ijab', F[c,a], T2[hc,ha,pv,pv], gamma1, optimize='optimal')
C2[c,c,v,v] += scale * +0.50000000 * np.einsum('ua,ijvb,vu->ijab', F[a,v], T2[hc,hc,pa,pv], eta1, optimize='optimal')
C2[c,c,v,v] += scale * +0.50000000 * np.einsum('ua,ijvb,vu->ijab', F[a,v], T2[hc,hc,pa,pv], gamma1, optimize='optimal')
C2[c,c,v,v] += scale * -0.50000000 * np.einsum('ab,ijca->ijbc', F[v,v], T2[hc,hc,pv,pv], optimize='optimal')
C2[c,v,a,a] += scale * -0.50000000 * np.einsum('ai,jiuv->jauv', F[v,c], T2[hc,hc,pa,pa], optimize='optimal')
C2[c,v,a,a] += scale * -0.50000000 * np.einsum('au,ivwx,uv->iawx', F[v,a], T2[hc,ha,pa,pa], eta1, optimize='optimal')
C2[c,v,a,a] += scale * -0.50000000 * np.einsum('au,ivwx,uv->iawx', F[v,a], T2[hc,ha,pa,pa], gamma1, optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('ai,jiub->jaub', F[v,c], T2[hc,hc,pa,pv], optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('au,ivwb,uv->iawb', F[v,a], T2[hc,ha,pa,pv], eta1, optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('au,ivwb,uv->iawb', F[v,a], T2[hc,ha,pa,pv], gamma1, optimize='optimal')
C2[c,v,v,v] += scale * -0.50000000 * np.einsum('ai,jibc->jabc', F[v,c], T2[hc,hc,pv,pv], optimize='optimal')
C2[c,v,v,v] += scale * -0.50000000 * np.einsum('au,ivbc,uv->iabc', F[v,a], T2[hc,ha,pv,pv], eta1, optimize='optimal')
C2[c,v,v,v] += scale * -0.50000000 * np.einsum('au,ivbc,uv->iabc', F[v,a], T2[hc,ha,pv,pv], gamma1, optimize='optimal')
t1 = time.time()
if verbose: print("H1_T2_C2 took {:.4f} seconds to run.".format(t1-t0))
def H2_T1_C2(C1, C2, F, V, T1, T2, gamma1, eta1, lambda2, lambda3, mf, verbose=False, scale=1.0):
# 144 lines
t0 = time.time()
hc = mf.hc
ha = mf.ha
pa = mf.pa
pv = mf.pv
c = mf.core
a = mf.active
v = mf.virt
C2[a,a,a,a] += scale * -0.50000000 * np.einsum('iu,vwix->vwux', T1[hc,pa], V[a,a,c,a], optimize='optimal')
C2[a,a,a,a] += scale * -0.50000000 * np.einsum('ua,vawx->uvwx', T1[ha,pv], V[a,v,a,a], optimize='optimal')
C2[a,a,c,a] += scale * -0.50000000 * np.einsum('iu,vwji->vwju', T1[hc,pa], V[a,a,c,c], optimize='optimal')
C2[a,a,c,a] += scale * -1.00000000 * np.einsum('ua,vaiw->uviw', T1[ha,pv], V[a,v,c,a], optimize='optimal')
C2[a,a,c,c] += scale * -0.50000000 * np.einsum('ua,vaij->uvij', T1[ha,pv], V[a,v,c,c], optimize='optimal')
C2[a,a,a,v] += scale * -0.50000000 * np.einsum('iu,vwia->vwua', T1[hc,pa], V[a,a,c,v], optimize='optimal')
C2[a,a,a,v] += scale * +0.50000000 * np.einsum('ia,uviw->uvwa', T1[hc,pv], V[a,a,c,a], optimize='optimal')
C2[a,a,a,v] += scale * -0.50000000 * np.einsum('ua,vwxy,yu->vwxa', T1[ha,pv], V[a,a,a,a], eta1, optimize='optimal')
C2[a,a,a,v] += scale * -0.50000000 * np.einsum('ua,vwxy,yu->vwxa', T1[ha,pv], V[a,a,a,a], gamma1, optimize='optimal')
C2[a,a,a,v] += scale * -1.00000000 * np.einsum('ua,vawb->uvwb', T1[ha,pv], V[a,v,a,v], optimize='optimal')
C2[a,a,c,v] += scale * -0.50000000 * np.einsum('ia,uvji->uvja', T1[hc,pv], V[a,a,c,c], optimize='optimal')
C2[a,a,c,v] += scale * -0.50000000 * np.einsum('ua,vwix,xu->vwia', T1[ha,pv], V[a,a,c,a], eta1, optimize='optimal')
C2[a,a,c,v] += scale * -0.50000000 * np.einsum('ua,vwix,xu->vwia', T1[ha,pv], V[a,a,c,a], gamma1, optimize='optimal')
C2[a,a,c,v] += scale * -1.00000000 * np.einsum('ua,vaib->uvib', T1[ha,pv], V[a,v,c,v], optimize='optimal')
C2[a,a,v,v] += scale * -0.50000000 * np.einsum('ia,uvib->uvab', T1[hc,pv], V[a,a,c,v], optimize='optimal')
C2[a,a,v,v] += scale * -0.50000000 * np.einsum('ua,vwxb,xu->vwab', T1[ha,pv], V[a,a,a,v], eta1, optimize='optimal')
C2[a,a,v,v] += scale * -0.50000000 * np.einsum('ua,vwxb,xu->vwab', T1[ha,pv], V[a,a,a,v], gamma1, optimize='optimal')
C2[a,a,v,v] += scale * -0.50000000 * np.einsum('ua,vabc->uvbc', T1[ha,pv], V[a,v,v,v], optimize='optimal')
C2[a,v,a,a] += scale * -1.00000000 * np.einsum('iu,vaiw->vauw', T1[hc,pa], V[a,v,c,a], optimize='optimal')
C2[a,v,a,a] += scale * -0.50000000 * np.einsum('ua,bavw->ubvw', T1[ha,pv], V[v,v,a,a], optimize='optimal')
C2[a,v,c,a] += scale * -1.00000000 * np.einsum('iu,vaji->vaju', T1[hc,pa], V[a,v,c,c], optimize='optimal')
C2[a,v,c,a] += scale * -1.00000000 * np.einsum('ua,baiv->ubiv', T1[ha,pv], V[v,v,c,a], optimize='optimal')
C2[a,v,c,c] += scale * -0.50000000 * np.einsum('ua,baij->ubij', T1[ha,pv], V[v,v,c,c], optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('iu,vaib->vaub', T1[hc,pa], V[a,v,c,v], optimize='optimal')
C2[a,v,a,v] += scale * +1.00000000 * np.einsum('ia,ubiv->ubva', T1[hc,pv], V[a,v,c,a], optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('ua,vbwx,xu->vbwa', T1[ha,pv], V[a,v,a,a], eta1, optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('ua,vbwx,xu->vbwa', T1[ha,pv], V[a,v,a,a], gamma1, optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('ua,bavc->ubvc', T1[ha,pv], V[v,v,a,v], optimize='optimal')
C2[a,v,c,v] += scale * -1.00000000 * np.einsum('ia,ubji->ubja', T1[hc,pv], V[a,v,c,c], optimize='optimal')
C2[a,v,c,v] += scale * -1.00000000 * np.einsum('ua,vbiw,wu->vbia', T1[ha,pv], V[a,v,c,a], eta1, optimize='optimal')
C2[a,v,c,v] += scale * -1.00000000 * np.einsum('ua,vbiw,wu->vbia', T1[ha,pv], V[a,v,c,a], gamma1, optimize='optimal')
C2[a,v,c,v] += scale * -1.00000000 * np.einsum('ua,baic->ubic', T1[ha,pv], V[v,v,c,v], optimize='optimal')
C2[a,v,v,v] += scale * -1.00000000 * np.einsum('ia,ubic->ubac', T1[hc,pv], V[a,v,c,v], optimize='optimal')
C2[a,v,v,v] += scale * -1.00000000 * np.einsum('ua,vbwc,wu->vbac', T1[ha,pv], V[a,v,a,v], eta1, optimize='optimal')
C2[a,v,v,v] += scale * -1.00000000 * np.einsum('ua,vbwc,wu->vbac', T1[ha,pv], V[a,v,a,v], gamma1, optimize='optimal')
C2[a,v,v,v] += scale * -0.50000000 * np.einsum('ua,bacd->ubcd', T1[ha,pv], V[v,v,v,v], optimize='optimal')
C2[c,a,a,a] += scale * -1.00000000 * np.einsum('iu,jviw->jvuw', T1[hc,pa], V[c,a,c,a], optimize='optimal')
C2[c,a,a,a] += scale * -0.50000000 * np.einsum('iu,vwxy,uw->ivxy', T1[hc,pa], V[a,a,a,a], eta1, optimize='optimal')
C2[c,a,a,a] += scale * -0.50000000 * np.einsum('iu,vwxy,uw->ivxy', T1[hc,pa], V[a,a,a,a], gamma1, optimize='optimal')
C2[c,a,a,a] += scale * -0.50000000 * np.einsum('ia,uavw->iuvw', T1[hc,pv], V[a,v,a,a], optimize='optimal')
C2[c,a,a,a] += scale * +0.50000000 * np.einsum('ua,iavw->iuvw', T1[ha,pv], V[c,v,a,a], optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('iu,jvki->jvku', T1[hc,pa], V[c,a,c,c], optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('iu,vwjx,uw->ivjx', T1[hc,pa], V[a,a,c,a], eta1, optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('iu,vwjx,uw->ivjx', T1[hc,pa], V[a,a,c,a], gamma1, optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('ia,uajv->iujv', T1[hc,pv], V[a,v,c,a], optimize='optimal')
C2[c,a,c,a] += scale * +1.00000000 * np.einsum('ua,iajv->iujv', T1[ha,pv], V[c,v,c,a], optimize='optimal')
C2[c,a,c,c] += scale * -0.50000000 * np.einsum('iu,vwjk,uw->ivjk', T1[hc,pa], V[a,a,c,c], eta1, optimize='optimal')
C2[c,a,c,c] += scale * -0.50000000 * np.einsum('iu,vwjk,uw->ivjk', T1[hc,pa], V[a,a,c,c], gamma1, optimize='optimal')
C2[c,a,c,c] += scale * -0.50000000 * np.einsum('ia,uajk->iujk', T1[hc,pv], V[a,v,c,c], optimize='optimal')
C2[c,a,c,c] += scale * +0.50000000 * np.einsum('ua,iajk->iujk', T1[ha,pv], V[c,v,c,c], optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('iu,jvia->jvua', T1[hc,pa], V[c,a,c,v], optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('iu,vwxa,uw->ivxa', T1[hc,pa], V[a,a,a,v], eta1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('iu,vwxa,uw->ivxa', T1[hc,pa], V[a,a,a,v], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('ia,juiv->juva', T1[hc,pv], V[c,a,c,a], optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('ua,ivwx,xu->ivwa', T1[ha,pv], V[c,a,a,a], eta1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('ua,ivwx,xu->ivwa', T1[ha,pv], V[c,a,a,a], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('ia,uavb->iuvb', T1[hc,pv], V[a,v,a,v], optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('ua,iavb->iuvb', T1[ha,pv], V[c,v,a,v], optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('iu,vwja,uw->ivja', T1[hc,pa], V[a,a,c,v], eta1, optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('iu,vwja,uw->ivja', T1[hc,pa], V[a,a,c,v], gamma1, optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('ia,juki->juka', T1[hc,pv], V[c,a,c,c], optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('ua,ivjw,wu->ivja', T1[ha,pv], V[c,a,c,a], eta1, optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('ua,ivjw,wu->ivja', T1[ha,pv], V[c,a,c,a], gamma1, optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('ia,uajb->iujb', T1[hc,pv], V[a,v,c,v], optimize='optimal')
C2[c,a,c,v] += scale * +1.00000000 * np.einsum('ua,iajb->iujb', T1[ha,pv], V[c,v,c,v], optimize='optimal')
C2[c,a,v,v] += scale * -0.50000000 * np.einsum('iu,vwab,uw->ivab', T1[hc,pa], V[a,a,v,v], eta1, optimize='optimal')
C2[c,a,v,v] += scale * -0.50000000 * np.einsum('iu,vwab,uw->ivab', T1[hc,pa], V[a,a,v,v], gamma1, optimize='optimal')
C2[c,a,v,v] += scale * -1.00000000 * np.einsum('ia,juib->juab', T1[hc,pv], V[c,a,c,v], optimize='optimal')
C2[c,a,v,v] += scale * -1.00000000 * np.einsum('ua,ivwb,wu->ivab', T1[ha,pv], V[c,a,a,v], eta1, optimize='optimal')
C2[c,a,v,v] += scale * -1.00000000 * np.einsum('ua,ivwb,wu->ivab', T1[ha,pv], V[c,a,a,v], gamma1, optimize='optimal')
C2[c,a,v,v] += scale * -0.50000000 * np.einsum('ia,uabc->iubc', T1[hc,pv], V[a,v,v,v], optimize='optimal')
C2[c,a,v,v] += scale * +0.50000000 * np.einsum('ua,iabc->iubc', T1[ha,pv], V[c,v,v,v], optimize='optimal')
C2[c,c,a,a] += scale * -0.50000000 * np.einsum('iu,jkiv->jkuv', T1[hc,pa], V[c,c,c,a], optimize='optimal')
C2[c,c,a,a] += scale * -0.50000000 * np.einsum('iu,jvwx,uv->ijwx', T1[hc,pa], V[c,a,a,a], eta1, optimize='optimal')
C2[c,c,a,a] += scale * -0.50000000 * np.einsum('iu,jvwx,uv->ijwx', T1[hc,pa], V[c,a,a,a], gamma1, optimize='optimal')
C2[c,c,a,a] += scale * -0.50000000 * np.einsum('ia,jauv->ijuv', T1[hc,pv], V[c,v,a,a], optimize='optimal')
C2[c,c,c,a] += scale * -0.50000000 * np.einsum('iu,jkli->jklu', T1[hc,pa], V[c,c,c,c], optimize='optimal')
C2[c,c,c,a] += scale * -1.00000000 * np.einsum('iu,jvkw,uv->ijkw', T1[hc,pa], V[c,a,c,a], eta1, optimize='optimal')
C2[c,c,c,a] += scale * -1.00000000 * np.einsum('iu,jvkw,uv->ijkw', T1[hc,pa], V[c,a,c,a], gamma1, optimize='optimal')
C2[c,c,c,a] += scale * -1.00000000 * np.einsum('ia,jaku->ijku', T1[hc,pv], V[c,v,c,a], optimize='optimal')
C2[c,c,c,c] += scale * -0.50000000 * np.einsum('iu,jvkl,uv->ijkl', T1[hc,pa], V[c,a,c,c], eta1, optimize='optimal')
C2[c,c,c,c] += scale * -0.50000000 * np.einsum('iu,jvkl,uv->ijkl', T1[hc,pa], V[c,a,c,c], gamma1, optimize='optimal')
C2[c,c,c,c] += scale * -0.50000000 * np.einsum('ia,jakl->ijkl', T1[hc,pv], V[c,v,c,c], optimize='optimal')
C2[c,c,a,v] += scale * -0.50000000 * np.einsum('iu,jkia->jkua', T1[hc,pa], V[c,c,c,v], optimize='optimal')
C2[c,c,a,v] += scale * -1.00000000 * np.einsum('iu,jvwa,uv->ijwa', T1[hc,pa], V[c,a,a,v], eta1, optimize='optimal')
C2[c,c,a,v] += scale * -1.00000000 * np.einsum('iu,jvwa,uv->ijwa', T1[hc,pa], V[c,a,a,v], gamma1, optimize='optimal')
C2[c,c,a,v] += scale * +0.50000000 * np.einsum('ia,jkiu->jkua', T1[hc,pv], V[c,c,c,a], optimize='optimal')
C2[c,c,a,v] += scale * -0.50000000 * np.einsum('ua,ijvw,wu->ijva', T1[ha,pv], V[c,c,a,a], eta1, optimize='optimal')
C2[c,c,a,v] += scale * -0.50000000 * np.einsum('ua,ijvw,wu->ijva', T1[ha,pv], V[c,c,a,a], gamma1, optimize='optimal')
C2[c,c,a,v] += scale * -1.00000000 * np.einsum('ia,jaub->ijub', T1[hc,pv], V[c,v,a,v], optimize='optimal')
C2[c,c,c,v] += scale * -1.00000000 * np.einsum('iu,jvka,uv->ijka', T1[hc,pa], V[c,a,c,v], eta1, optimize='optimal')
C2[c,c,c,v] += scale * -1.00000000 * np.einsum('iu,jvka,uv->ijka', T1[hc,pa], V[c,a,c,v], gamma1, optimize='optimal')
C2[c,c,c,v] += scale * -0.50000000 * np.einsum('ia,jkli->jkla', T1[hc,pv], V[c,c,c,c], optimize='optimal')
C2[c,c,c,v] += scale * -0.50000000 * np.einsum('ua,ijkv,vu->ijka', T1[ha,pv], V[c,c,c,a], eta1, optimize='optimal')
C2[c,c,c,v] += scale * -0.50000000 * np.einsum('ua,ijkv,vu->ijka', T1[ha,pv], V[c,c,c,a], gamma1, optimize='optimal')
C2[c,c,c,v] += scale * -1.00000000 * np.einsum('ia,jakb->ijkb', T1[hc,pv], V[c,v,c,v], optimize='optimal')
C2[c,c,v,v] += scale * -0.50000000 * np.einsum('iu,jvab,uv->ijab', T1[hc,pa], V[c,a,v,v], eta1, optimize='optimal')
C2[c,c,v,v] += scale * -0.50000000 * np.einsum('iu,jvab,uv->ijab', T1[hc,pa], V[c,a,v,v], gamma1, optimize='optimal')
C2[c,c,v,v] += scale * -0.50000000 * np.einsum('ia,jkib->jkab', T1[hc,pv], V[c,c,c,v], optimize='optimal')
C2[c,c,v,v] += scale * -0.50000000 * np.einsum('ua,ijvb,vu->ijab', T1[ha,pv], V[c,c,a,v], eta1, optimize='optimal')
C2[c,c,v,v] += scale * -0.50000000 * np.einsum('ua,ijvb,vu->ijab', T1[ha,pv], V[c,c,a,v], gamma1, optimize='optimal')
C2[c,c,v,v] += scale * -0.50000000 * np.einsum('ia,jabc->ijbc', T1[hc,pv], V[c,v,v,v], optimize='optimal')
C2[c,v,a,a] += scale * -1.00000000 * np.einsum('iu,jaiv->jauv', T1[hc,pa], V[c,v,c,a], optimize='optimal')
C2[c,v,a,a] += scale * +0.50000000 * np.einsum('iu,vawx,uv->iawx', T1[hc,pa], V[a,v,a,a], eta1, optimize='optimal')
C2[c,v,a,a] += scale * +0.50000000 * np.einsum('iu,vawx,uv->iawx', T1[hc,pa], V[a,v,a,a], gamma1, optimize='optimal')
C2[c,v,a,a] += scale * -0.50000000 * np.einsum('ia,bauv->ibuv', T1[hc,pv], V[v,v,a,a], optimize='optimal')
C2[c,v,c,a] += scale * -1.00000000 * np.einsum('iu,jaki->jaku', T1[hc,pa], V[c,v,c,c], optimize='optimal')
C2[c,v,c,a] += scale * +1.00000000 * np.einsum('iu,vajw,uv->iajw', T1[hc,pa], V[a,v,c,a], eta1, optimize='optimal')
C2[c,v,c,a] += scale * +1.00000000 * np.einsum('iu,vajw,uv->iajw', T1[hc,pa], V[a,v,c,a], gamma1, optimize='optimal')
C2[c,v,c,a] += scale * -1.00000000 * np.einsum('ia,baju->ibju', T1[hc,pv], V[v,v,c,a], optimize='optimal')
C2[c,v,c,c] += scale * +0.50000000 * np.einsum('iu,vajk,uv->iajk', T1[hc,pa], V[a,v,c,c], eta1, optimize='optimal')
C2[c,v,c,c] += scale * +0.50000000 * np.einsum('iu,vajk,uv->iajk', T1[hc,pa], V[a,v,c,c], gamma1, optimize='optimal')
C2[c,v,c,c] += scale * -0.50000000 * np.einsum('ia,bajk->ibjk', T1[hc,pv], V[v,v,c,c], optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('iu,jaib->jaub', T1[hc,pa], V[c,v,c,v], optimize='optimal')
C2[c,v,a,v] += scale * +1.00000000 * np.einsum('iu,vawb,uv->iawb', T1[hc,pa], V[a,v,a,v], eta1, optimize='optimal')
C2[c,v,a,v] += scale * +1.00000000 * np.einsum('iu,vawb,uv->iawb', T1[hc,pa], V[a,v,a,v], gamma1, optimize='optimal')
C2[c,v,a,v] += scale * +1.00000000 * np.einsum('ia,jbiu->jbua', T1[hc,pv], V[c,v,c,a], optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('ua,ibvw,wu->ibva', T1[ha,pv], V[c,v,a,a], eta1, optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('ua,ibvw,wu->ibva', T1[ha,pv], V[c,v,a,a], gamma1, optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('ia,bauc->ibuc', T1[hc,pv], V[v,v,a,v], optimize='optimal')
C2[c,v,c,v] += scale * +1.00000000 * np.einsum('iu,vajb,uv->iajb', T1[hc,pa], V[a,v,c,v], eta1, optimize='optimal')
C2[c,v,c,v] += scale * +1.00000000 * np.einsum('iu,vajb,uv->iajb', T1[hc,pa], V[a,v,c,v], gamma1, optimize='optimal')
C2[c,v,c,v] += scale * -1.00000000 * np.einsum('ia,jbki->jbka', T1[hc,pv], V[c,v,c,c], optimize='optimal')
C2[c,v,c,v] += scale * -1.00000000 * np.einsum('ua,ibjv,vu->ibja', T1[ha,pv], V[c,v,c,a], eta1, optimize='optimal')
C2[c,v,c,v] += scale * -1.00000000 * np.einsum('ua,ibjv,vu->ibja', T1[ha,pv], V[c,v,c,a], gamma1, optimize='optimal')
C2[c,v,c,v] += scale * -1.00000000 * np.einsum('ia,bajc->ibjc', T1[hc,pv], V[v,v,c,v], optimize='optimal')
C2[c,v,v,v] += scale * +0.50000000 * np.einsum('iu,vabc,uv->iabc', T1[hc,pa], V[a,v,v,v], eta1, optimize='optimal')
C2[c,v,v,v] += scale * +0.50000000 * np.einsum('iu,vabc,uv->iabc', T1[hc,pa], V[a,v,v,v], gamma1, optimize='optimal')
C2[c,v,v,v] += scale * -1.00000000 * np.einsum('ia,jbic->jbac', T1[hc,pv], V[c,v,c,v], optimize='optimal')
C2[c,v,v,v] += scale * -1.00000000 * np.einsum('ua,ibvc,vu->ibac', T1[ha,pv], V[c,v,a,v], eta1, optimize='optimal')
C2[c,v,v,v] += scale * -1.00000000 * np.einsum('ua,ibvc,vu->ibac', T1[ha,pv], V[c,v,a,v], gamma1, optimize='optimal')
C2[c,v,v,v] += scale * -0.50000000 * np.einsum('ia,bacd->ibcd', T1[hc,pv], V[v,v,v,v], optimize='optimal')
C2[v,v,a,a] += scale * -0.50000000 * np.einsum('iu,abiv->abuv', T1[hc,pa], V[v,v,c,a], optimize='optimal')
C2[v,v,c,a] += scale * -0.50000000 * np.einsum('iu,abji->abju', T1[hc,pa], V[v,v,c,c], optimize='optimal')
C2[v,v,a,v] += scale * -0.50000000 * np.einsum('iu,abic->abuc', T1[hc,pa], V[v,v,c,v], optimize='optimal')
C2[v,v,a,v] += scale * +0.50000000 * np.einsum('ia,bciu->bcua', T1[hc,pv], V[v,v,c,a], optimize='optimal')
C2[v,v,a,v] += scale * -0.50000000 * np.einsum('ua,bcvw,wu->bcva', T1[ha,pv], V[v,v,a,a], eta1, optimize='optimal')
C2[v,v,a,v] += scale * -0.50000000 * np.einsum('ua,bcvw,wu->bcva', T1[ha,pv], V[v,v,a,a], gamma1, optimize='optimal')
C2[v,v,c,v] += scale * -0.50000000 * np.einsum('ia,bcji->bcja', T1[hc,pv], V[v,v,c,c], optimize='optimal')
C2[v,v,c,v] += scale * -0.50000000 * np.einsum('ua,bciv,vu->bcia', T1[ha,pv], V[v,v,c,a], eta1, optimize='optimal')
C2[v,v,c,v] += scale * -0.50000000 * np.einsum('ua,bciv,vu->bcia', T1[ha,pv], V[v,v,c,a], gamma1, optimize='optimal')
C2[v,v,v,v] += scale * -0.50000000 * np.einsum('ia,bcid->bcad', T1[hc,pv], V[v,v,c,v], optimize='optimal')
C2[v,v,v,v] += scale * -0.50000000 * np.einsum('ua,bcvd,vu->bcad', T1[ha,pv], V[v,v,a,v], eta1, optimize='optimal')
C2[v,v,v,v] += scale * -0.50000000 * np.einsum('ua,bcvd,vu->bcad', T1[ha,pv], V[v,v,a,v], gamma1, optimize='optimal')
t1 = time.time()
if verbose: print("H2_T1_C2 took {:.4f} seconds to run.".format(t1-t0))
def H2_T2_C2(C1, C2, F, V, T1, T2, gamma1, eta1, lambda2, lambda3, mf, verbose=False, scale=1.0):
# 282 lines
t0 = time.time()
hc = mf.hc
ha = mf.ha
pa = mf.pa
pv = mf.pv
c = mf.core
a = mf.active
v = mf.virt
C2[a,a,a,a] += scale * +0.12500000 * np.einsum('ijuv,wxij->wxuv', T2[hc,hc,pa,pa], V[a,a,c,c], optimize='optimal')
C2[a,a,a,a] += scale * +0.25000000 * np.einsum('iuvw,xyiz,zu->xyvw', T2[hc,ha,pa,pa], V[a,a,c,a], gamma1, optimize='optimal')
C2[a,a,a,a] += scale * +1.00000000 * np.einsum('iuvw,xyiz,wy->uxvz', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, optimize='optimal')
C2[a,a,a,a] += scale * +1.00000000 * np.einsum('iuva,waix->uwvx', T2[hc,ha,pa,pv], V[a,v,c,a], optimize='optimal')
C2[a,a,a,a] += scale * +1.00000000 * np.einsum('uvwa,xayz,zv->uxwy', T2[ha,ha,pa,pv], V[a,v,a,a], gamma1, optimize='optimal')
C2[a,a,a,a] += scale * +0.25000000 * np.einsum('uvwa,xayz,wx->uvyz', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, optimize='optimal')
C2[a,a,a,a] += scale * +0.12500000 * np.einsum('uvab,abwx->uvwx', T2[ha,ha,pv,pv], V[v,v,a,a], optimize='optimal')
C2[a,a,c,a] += scale * +1.00000000 * np.einsum('iuvw,xyji,wy->uxjv', T2[hc,ha,pa,pa], V[a,a,c,c], eta1, optimize='optimal')
C2[a,a,c,a] += scale * +1.00000000 * np.einsum('iuva,waji->uwjv', T2[hc,ha,pa,pv], V[a,v,c,c], optimize='optimal')
C2[a,a,c,a] += scale * -1.00000000 * np.einsum('uvwa,xaiy,yv->uxiw', T2[ha,ha,pa,pv], V[a,v,c,a], gamma1, optimize='optimal')
C2[a,a,c,a] += scale * +0.50000000 * np.einsum('uvwa,xaiy,wx->uviy', T2[ha,ha,pa,pv], V[a,v,c,a], eta1, optimize='optimal')
C2[a,a,c,a] += scale * +0.25000000 * np.einsum('uvab,abiw->uviw', T2[ha,ha,pv,pv], V[v,v,c,a], optimize='optimal')
C2[a,a,c,c] += scale * +0.25000000 * np.einsum('uvwa,xaij,wx->uvij', T2[ha,ha,pa,pv], V[a,v,c,c], eta1, optimize='optimal')
C2[a,a,c,c] += scale * +0.12500000 * np.einsum('uvab,abij->uvij', T2[ha,ha,pv,pv], V[v,v,c,c], optimize='optimal')
C2[a,a,a,v] += scale * +1.00000000 * np.einsum('iuvw,xyia,wy->uxva', T2[hc,ha,pa,pa], V[a,a,c,v], eta1, optimize='optimal')
C2[a,a,a,v] += scale * +0.25000000 * np.einsum('ijua,vwij->vwua', T2[hc,hc,pa,pv], V[a,a,c,c], optimize='optimal')
C2[a,a,a,v] += scale * +0.50000000 * np.einsum('iuva,wxiy,yu->wxva', T2[hc,ha,pa,pv], V[a,a,c,a], gamma1, optimize='optimal')
C2[a,a,a,v] += scale * -0.25000000 * np.einsum('uvwa,xyzr,rv,zu->xywa', T2[ha,ha,pa,pv], V[a,a,a,a], eta1, eta1, optimize='optimal')
C2[a,a,a,v] += scale * +0.25000000 * np.einsum('uvwa,xyzr,rv,zu->xywa', T2[ha,ha,pa,pv], V[a,a,a,a], gamma1, gamma1, optimize='optimal')
C2[a,a,a,v] += scale * +1.00000000 * np.einsum('iuva,waib->uwvb', T2[hc,ha,pa,pv], V[a,v,c,v], optimize='optimal')
C2[a,a,a,v] += scale * -1.00000000 * np.einsum('uvwa,xayb,yv->uxwb', T2[ha,ha,pa,pv], V[a,v,a,v], gamma1, optimize='optimal')
C2[a,a,a,v] += scale * +1.00000000 * np.einsum('iuva,wxiy,vx->uwya', T2[hc,ha,pa,pv], V[a,a,c,a], eta1, optimize='optimal')
C2[a,a,a,v] += scale * -1.00000000 * np.einsum('uvwa,xyzr,rv,wy->uxza', T2[ha,ha,pa,pv], V[a,a,a,a], eta1, gamma1, optimize='optimal')
C2[a,a,a,v] += scale * +1.00000000 * np.einsum('uvwa,xyzr,wy,rv->uxza', T2[ha,ha,pa,pv], V[a,a,a,a], eta1, gamma1, optimize='optimal')
C2[a,a,a,v] += scale * +0.50000000 * np.einsum('uvwa,xayb,wx->uvyb', T2[ha,ha,pa,pv], V[a,v,a,v], eta1, optimize='optimal')
C2[a,a,a,v] += scale * -1.00000000 * np.einsum('iuab,vbiw->uvwa', T2[hc,ha,pv,pv], V[a,v,c,a], optimize='optimal')
C2[a,a,a,v] += scale * -1.00000000 * np.einsum('uvab,wbxy,yv->uwxa', T2[ha,ha,pv,pv], V[a,v,a,a], gamma1, optimize='optimal')
C2[a,a,a,v] += scale * +0.25000000 * np.einsum('uvab,abwc->uvwc', T2[ha,ha,pv,pv], V[v,v,a,v], optimize='optimal')
C2[a,a,c,v] += scale * -1.00000000 * np.einsum('iuva,wxji,vx->uwja', T2[hc,ha,pa,pv], V[a,a,c,c], eta1, optimize='optimal')
C2[a,a,c,v] += scale * -1.00000000 * np.einsum('uvwa,xyiz,zv,wy->uxia', T2[ha,ha,pa,pv], V[a,a,c,a], eta1, gamma1, optimize='optimal')
C2[a,a,c,v] += scale * +1.00000000 * np.einsum('uvwa,xyiz,wy,zv->uxia', T2[ha,ha,pa,pv], V[a,a,c,a], eta1, gamma1, optimize='optimal')
C2[a,a,c,v] += scale * +0.50000000 * np.einsum('uvwa,xaib,wx->uvib', T2[ha,ha,pa,pv], V[a,v,c,v], eta1, optimize='optimal')
C2[a,a,c,v] += scale * +1.00000000 * np.einsum('iuab,vbji->uvja', T2[hc,ha,pv,pv], V[a,v,c,c], optimize='optimal')
C2[a,a,c,v] += scale * -1.00000000 * np.einsum('uvab,wbix,xv->uwia', T2[ha,ha,pv,pv], V[a,v,c,a], gamma1, optimize='optimal')
C2[a,a,c,v] += scale * +0.25000000 * np.einsum('uvab,abic->uvic', T2[ha,ha,pv,pv], V[v,v,c,v], optimize='optimal')
C2[a,a,v,v] += scale * -1.00000000 * np.einsum('iuva,wxib,vx->uwab', T2[hc,ha,pa,pv], V[a,a,c,v], eta1, optimize='optimal')
C2[a,a,v,v] += scale * -1.00000000 * np.einsum('uvwa,xyzb,zv,wy->uxab', T2[ha,ha,pa,pv], V[a,a,a,v], eta1, gamma1, optimize='optimal')
C2[a,a,v,v] += scale * +1.00000000 * np.einsum('uvwa,xyzb,wy,zv->uxab', T2[ha,ha,pa,pv], V[a,a,a,v], eta1, gamma1, optimize='optimal')
C2[a,a,v,v] += scale * +0.25000000 * np.einsum('uvwa,xabc,wx->uvbc', T2[ha,ha,pa,pv], V[a,v,v,v], eta1, optimize='optimal')
C2[a,a,v,v] += scale * +0.12500000 * np.einsum('ijab,uvij->uvab', T2[hc,hc,pv,pv], V[a,a,c,c], optimize='optimal')
C2[a,a,v,v] += scale * +0.25000000 * np.einsum('iuab,vwix,xu->vwab', T2[hc,ha,pv,pv], V[a,a,c,a], gamma1, optimize='optimal')
C2[a,a,v,v] += scale * -0.12500000 * np.einsum('uvab,wxyz,zv,yu->wxab', T2[ha,ha,pv,pv], V[a,a,a,a], eta1, eta1, optimize='optimal')
C2[a,a,v,v] += scale * +0.12500000 * np.einsum('uvab,wxyz,zv,yu->wxab', T2[ha,ha,pv,pv], V[a,a,a,a], gamma1, gamma1, optimize='optimal')
C2[a,a,v,v] += scale * +1.00000000 * np.einsum('iuab,vbic->uvac', T2[hc,ha,pv,pv], V[a,v,c,v], optimize='optimal')
C2[a,a,v,v] += scale * -1.00000000 * np.einsum('uvab,wbxc,xv->uwac', T2[ha,ha,pv,pv], V[a,v,a,v], gamma1, optimize='optimal')
C2[a,a,v,v] += scale * +0.12500000 * np.einsum('uvab,abcd->uvcd', T2[ha,ha,pv,pv], V[v,v,v,v], optimize='optimal')
C2[a,v,a,a] += scale * +0.25000000 * np.einsum('ijuv,waij->wauv', T2[hc,hc,pa,pa], V[a,v,c,c], optimize='optimal')
C2[a,v,a,a] += scale * +0.50000000 * np.einsum('iuvw,xaiy,yu->xavw', T2[hc,ha,pa,pa], V[a,v,c,a], gamma1, optimize='optimal')
C2[a,v,a,a] += scale * -1.00000000 * np.einsum('iuvw,xaiy,wx->uavy', T2[hc,ha,pa,pa], V[a,v,c,a], eta1, optimize='optimal')
C2[a,v,a,a] += scale * +1.00000000 * np.einsum('iuva,baiw->ubvw', T2[hc,ha,pa,pv], V[v,v,c,a], optimize='optimal')
C2[a,v,a,a] += scale * +1.00000000 * np.einsum('uvwa,baxy,yv->ubwx', T2[ha,ha,pa,pv], V[v,v,a,a], gamma1, optimize='optimal')
C2[a,v,c,a] += scale * -1.00000000 * np.einsum('iuvw,xaji,wx->uajv', T2[hc,ha,pa,pa], V[a,v,c,c], eta1, optimize='optimal')
C2[a,v,c,a] += scale * +1.00000000 * np.einsum('iuva,baji->ubjv', T2[hc,ha,pa,pv], V[v,v,c,c], optimize='optimal')
C2[a,v,c,a] += scale * -1.00000000 * np.einsum('uvwa,baix,xv->ubiw', T2[ha,ha,pa,pv], V[v,v,c,a], gamma1, optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('iuvw,xaib,wx->uavb', T2[hc,ha,pa,pa], V[a,v,c,v], eta1, optimize='optimal')
C2[a,v,a,v] += scale * +0.50000000 * np.einsum('ijua,vbij->vbua', T2[hc,hc,pa,pv], V[a,v,c,c], optimize='optimal')
C2[a,v,a,v] += scale * +1.00000000 * np.einsum('iuva,wbix,xu->wbva', T2[hc,ha,pa,pv], V[a,v,c,a], gamma1, optimize='optimal')
C2[a,v,a,v] += scale * -0.50000000 * np.einsum('uvwa,xbyz,zv,yu->xbwa', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, eta1, optimize='optimal')
C2[a,v,a,v] += scale * +0.50000000 * np.einsum('uvwa,xbyz,zv,yu->xbwa', T2[ha,ha,pa,pv], V[a,v,a,a], gamma1, gamma1, optimize='optimal')
C2[a,v,a,v] += scale * +1.00000000 * np.einsum('iuva,baic->ubvc', T2[hc,ha,pa,pv], V[v,v,c,v], optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('uvwa,baxc,xv->ubwc', T2[ha,ha,pa,pv], V[v,v,a,v], gamma1, optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('iuva,wbix,vw->ubxa', T2[hc,ha,pa,pv], V[a,v,c,a], eta1, optimize='optimal')
C2[a,v,a,v] += scale * +1.00000000 * np.einsum('uvwa,xbyz,zv,wx->ubya', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, gamma1, optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('uvwa,xbyz,wx,zv->ubya', T2[ha,ha,pa,pv], V[a,v,a,a], eta1, gamma1, optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('iuab,cbiv->ucva', T2[hc,ha,pv,pv], V[v,v,c,a], optimize='optimal')
C2[a,v,a,v] += scale * -1.00000000 * np.einsum('uvab,cbwx,xv->ucwa', T2[ha,ha,pv,pv], V[v,v,a,a], gamma1, optimize='optimal')
C2[a,v,c,v] += scale * +1.00000000 * np.einsum('iuva,wbji,vw->ubja', T2[hc,ha,pa,pv], V[a,v,c,c], eta1, optimize='optimal')
C2[a,v,c,v] += scale * +1.00000000 * np.einsum('uvwa,xbiy,yv,wx->ubia', T2[ha,ha,pa,pv], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C2[a,v,c,v] += scale * -1.00000000 * np.einsum('uvwa,xbiy,wx,yv->ubia', T2[ha,ha,pa,pv], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C2[a,v,c,v] += scale * +1.00000000 * np.einsum('iuab,cbji->ucja', T2[hc,ha,pv,pv], V[v,v,c,c], optimize='optimal')
C2[a,v,c,v] += scale * -1.00000000 * np.einsum('uvab,cbiw,wv->ucia', T2[ha,ha,pv,pv], V[v,v,c,a], gamma1, optimize='optimal')
C2[a,v,v,v] += scale * +1.00000000 * np.einsum('iuva,wbic,vw->ubac', T2[hc,ha,pa,pv], V[a,v,c,v], eta1, optimize='optimal')
C2[a,v,v,v] += scale * +1.00000000 * np.einsum('uvwa,xbyc,yv,wx->ubac', T2[ha,ha,pa,pv], V[a,v,a,v], eta1, gamma1, optimize='optimal')
C2[a,v,v,v] += scale * -1.00000000 * np.einsum('uvwa,xbyc,wx,yv->ubac', T2[ha,ha,pa,pv], V[a,v,a,v], eta1, gamma1, optimize='optimal')
C2[a,v,v,v] += scale * +0.25000000 * np.einsum('ijab,ucij->ucab', T2[hc,hc,pv,pv], V[a,v,c,c], optimize='optimal')
C2[a,v,v,v] += scale * +0.50000000 * np.einsum('iuab,vciw,wu->vcab', T2[hc,ha,pv,pv], V[a,v,c,a], gamma1, optimize='optimal')
C2[a,v,v,v] += scale * -0.25000000 * np.einsum('uvab,wcxy,yv,xu->wcab', T2[ha,ha,pv,pv], V[a,v,a,a], eta1, eta1, optimize='optimal')
C2[a,v,v,v] += scale * +0.25000000 * np.einsum('uvab,wcxy,yv,xu->wcab', T2[ha,ha,pv,pv], V[a,v,a,a], gamma1, gamma1, optimize='optimal')
C2[a,v,v,v] += scale * +1.00000000 * np.einsum('iuab,cbid->ucad', T2[hc,ha,pv,pv], V[v,v,c,v], optimize='optimal')
C2[a,v,v,v] += scale * -1.00000000 * np.einsum('uvab,cbwd,wv->ucad', T2[ha,ha,pv,pv], V[v,v,a,v], gamma1, optimize='optimal')
C2[c,a,a,a] += scale * +0.25000000 * np.einsum('ijuv,kwij->kwuv', T2[hc,hc,pa,pa], V[c,a,c,c], optimize='optimal')
C2[c,a,a,a] += scale * +0.50000000 * np.einsum('iuvw,jxiy,yu->jxvw', T2[hc,ha,pa,pa], V[c,a,c,a], gamma1, optimize='optimal')
C2[c,a,a,a] += scale * -1.00000000 * np.einsum('ijuv,wxjy,vx->iwuy', T2[hc,hc,pa,pa], V[a,a,c,a], eta1, optimize='optimal')
C2[c,a,a,a] += scale * -1.00000000 * np.einsum('iuvw,xyzr,ru,wy->ixvz', T2[hc,ha,pa,pa], V[a,a,a,a], eta1, gamma1, optimize='optimal')
C2[c,a,a,a] += scale * +1.00000000 * np.einsum('iuvw,xyzr,wy,ru->ixvz', T2[hc,ha,pa,pa], V[a,a,a,a], eta1, gamma1, optimize='optimal')
C2[c,a,a,a] += scale * -1.00000000 * np.einsum('iuvw,jxiy,wx->juvy', T2[hc,ha,pa,pa], V[c,a,c,a], eta1, optimize='optimal')
C2[c,a,a,a] += scale * -1.00000000 * np.einsum('ijua,vajw->ivuw', T2[hc,hc,pa,pv], V[a,v,c,a], optimize='optimal')
C2[c,a,a,a] += scale * +1.00000000 * np.einsum('iuva,waxy,yu->iwvx', T2[hc,ha,pa,pv], V[a,v,a,a], gamma1, optimize='optimal')
C2[c,a,a,a] += scale * -1.00000000 * np.einsum('iuva,jaiw->juvw', T2[hc,ha,pa,pv], V[c,v,c,a], optimize='optimal')
C2[c,a,a,a] += scale * -1.00000000 * np.einsum('uvwa,iaxy,yv->iuwx', T2[ha,ha,pa,pv], V[c,v,a,a], gamma1, optimize='optimal')
C2[c,a,a,a] += scale * +0.25000000 * np.einsum('iuvw,xyzr,wy,vx->iuzr', T2[hc,ha,pa,pa], V[a,a,a,a], eta1, eta1, optimize='optimal')
C2[c,a,a,a] += scale * -0.25000000 * np.einsum('iuvw,xyzr,wy,vx->iuzr', T2[hc,ha,pa,pa], V[a,a,a,a], gamma1, gamma1, optimize='optimal')
C2[c,a,a,a] += scale * +0.50000000 * np.einsum('iuva,waxy,vw->iuxy', T2[hc,ha,pa,pv], V[a,v,a,a], eta1, optimize='optimal')
C2[c,a,a,a] += scale * +0.25000000 * np.einsum('iuab,abvw->iuvw', T2[hc,ha,pv,pv], V[v,v,a,a], optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('ijuv,wxkj,vx->iwku', T2[hc,hc,pa,pa], V[a,a,c,c], eta1, optimize='optimal')
C2[c,a,c,a] += scale * +1.00000000 * np.einsum('iuvw,xyjz,zu,wy->ixjv', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, gamma1, optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('iuvw,xyjz,wy,zu->ixjv', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, gamma1, optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('iuvw,jxki,wx->jukv', T2[hc,ha,pa,pa], V[c,a,c,c], eta1, optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('ijua,vakj->ivku', T2[hc,hc,pa,pv], V[a,v,c,c], optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('iuva,wajx,xu->iwjv', T2[hc,ha,pa,pv], V[a,v,c,a], gamma1, optimize='optimal')
C2[c,a,c,a] += scale * -1.00000000 * np.einsum('iuva,jaki->jukv', T2[hc,ha,pa,pv], V[c,v,c,c], optimize='optimal')
C2[c,a,c,a] += scale * +1.00000000 * np.einsum('uvwa,iajx,xv->iujw', T2[ha,ha,pa,pv], V[c,v,c,a], gamma1, optimize='optimal')
C2[c,a,c,a] += scale * +0.50000000 * np.einsum('iuvw,xyjz,wy,vx->iujz', T2[hc,ha,pa,pa], V[a,a,c,a], eta1, eta1, optimize='optimal')
C2[c,a,c,a] += scale * -0.50000000 * np.einsum('iuvw,xyjz,wy,vx->iujz', T2[hc,ha,pa,pa], V[a,a,c,a], gamma1, gamma1, optimize='optimal')
C2[c,a,c,a] += scale * +1.00000000 * np.einsum('iuva,wajx,vw->iujx', T2[hc,ha,pa,pv], V[a,v,c,a], eta1, optimize='optimal')
C2[c,a,c,a] += scale * +0.50000000 * np.einsum('iuab,abjv->iujv', T2[hc,ha,pv,pv], V[v,v,c,a], optimize='optimal')
C2[c,a,c,c] += scale * +0.25000000 * np.einsum('iuvw,xyjk,wy,vx->iujk', T2[hc,ha,pa,pa], V[a,a,c,c], eta1, eta1, optimize='optimal')
C2[c,a,c,c] += scale * -0.25000000 * np.einsum('iuvw,xyjk,wy,vx->iujk', T2[hc,ha,pa,pa], V[a,a,c,c], gamma1, gamma1, optimize='optimal')
C2[c,a,c,c] += scale * +0.50000000 * np.einsum('iuva,wajk,vw->iujk', T2[hc,ha,pa,pv], V[a,v,c,c], eta1, optimize='optimal')
C2[c,a,c,c] += scale * +0.25000000 * np.einsum('iuab,abjk->iujk', T2[hc,ha,pv,pv], V[v,v,c,c], optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('ijuv,wxja,vx->iwua', T2[hc,hc,pa,pa], V[a,a,c,v], eta1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('iuvw,xyza,zu,wy->ixva', T2[hc,ha,pa,pa], V[a,a,a,v], eta1, gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('iuvw,xyza,wy,zu->ixva', T2[hc,ha,pa,pa], V[a,a,a,v], eta1, gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('iuvw,jxia,wx->juva', T2[hc,ha,pa,pa], V[c,a,c,v], eta1, optimize='optimal')
C2[c,a,a,v] += scale * +0.50000000 * np.einsum('ijua,kvij->kvua', T2[hc,hc,pa,pv], V[c,a,c,c], optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('iuva,jwix,xu->jwva', T2[hc,ha,pa,pv], V[c,a,c,a], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -0.50000000 * np.einsum('uvwa,ixyz,zv,yu->ixwa', T2[ha,ha,pa,pv], V[c,a,a,a], eta1, eta1, optimize='optimal')
C2[c,a,a,v] += scale * +0.50000000 * np.einsum('uvwa,ixyz,zv,yu->ixwa', T2[ha,ha,pa,pv], V[c,a,a,a], gamma1, gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('ijua,vajb->ivub', T2[hc,hc,pa,pv], V[a,v,c,v], optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('iuva,waxb,xu->iwvb', T2[hc,ha,pa,pv], V[a,v,a,v], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('iuva,jaib->juvb', T2[hc,ha,pa,pv], V[c,v,c,v], optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('uvwa,iaxb,xv->iuwb', T2[ha,ha,pa,pv], V[c,v,a,v], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * +0.50000000 * np.einsum('iuvw,xyza,wy,vx->iuza', T2[hc,ha,pa,pa], V[a,a,a,v], eta1, eta1, optimize='optimal')
C2[c,a,a,v] += scale * -0.50000000 * np.einsum('iuvw,xyza,wy,vx->iuza', T2[hc,ha,pa,pa], V[a,a,a,v], gamma1, gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('ijua,vwjx,uw->ivxa', T2[hc,hc,pa,pv], V[a,a,c,a], eta1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('iuva,wxyz,zu,vx->iwya', T2[hc,ha,pa,pv], V[a,a,a,a], eta1, gamma1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('iuva,wxyz,vx,zu->iwya', T2[hc,ha,pa,pv], V[a,a,a,a], eta1, gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('iuva,jwix,vw->juxa', T2[hc,ha,pa,pv], V[c,a,c,a], eta1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('uvwa,ixyz,zv,wx->iuya', T2[ha,ha,pa,pv], V[c,a,a,a], eta1, gamma1, optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('uvwa,ixyz,wx,zv->iuya', T2[ha,ha,pa,pv], V[c,a,a,a], eta1, gamma1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('iuva,waxb,vw->iuxb', T2[hc,ha,pa,pv], V[a,v,a,v], eta1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('ijab,ubjv->iuva', T2[hc,hc,pv,pv], V[a,v,c,a], optimize='optimal')
C2[c,a,a,v] += scale * -1.00000000 * np.einsum('iuab,vbwx,xu->ivwa', T2[hc,ha,pv,pv], V[a,v,a,a], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('iuab,jbiv->juva', T2[hc,ha,pv,pv], V[c,v,c,a], optimize='optimal')
C2[c,a,a,v] += scale * +1.00000000 * np.einsum('uvab,ibwx,xv->iuwa', T2[ha,ha,pv,pv], V[c,v,a,a], gamma1, optimize='optimal')
C2[c,a,a,v] += scale * +0.50000000 * np.einsum('iuab,abvc->iuvc', T2[hc,ha,pv,pv], V[v,v,a,v], optimize='optimal')
C2[c,a,c,v] += scale * +0.50000000 * np.einsum('iuvw,xyja,wy,vx->iuja', T2[hc,ha,pa,pa], V[a,a,c,v], eta1, eta1, optimize='optimal')
C2[c,a,c,v] += scale * -0.50000000 * np.einsum('iuvw,xyja,wy,vx->iuja', T2[hc,ha,pa,pa], V[a,a,c,v], gamma1, gamma1, optimize='optimal')
C2[c,a,c,v] += scale * +1.00000000 * np.einsum('ijua,vwkj,uw->ivka', T2[hc,hc,pa,pv], V[a,a,c,c], eta1, optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('iuva,wxjy,yu,vx->iwja', T2[hc,ha,pa,pv], V[a,a,c,a], eta1, gamma1, optimize='optimal')
C2[c,a,c,v] += scale * +1.00000000 * np.einsum('iuva,wxjy,vx,yu->iwja', T2[hc,ha,pa,pv], V[a,a,c,a], eta1, gamma1, optimize='optimal')
C2[c,a,c,v] += scale * +1.00000000 * np.einsum('iuva,jwki,vw->juka', T2[hc,ha,pa,pv], V[c,a,c,c], eta1, optimize='optimal')
C2[c,a,c,v] += scale * +1.00000000 * np.einsum('uvwa,ixjy,yv,wx->iuja', T2[ha,ha,pa,pv], V[c,a,c,a], eta1, gamma1, optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('uvwa,ixjy,wx,yv->iuja', T2[ha,ha,pa,pv], V[c,a,c,a], eta1, gamma1, optimize='optimal')
C2[c,a,c,v] += scale * +1.00000000 * np.einsum('iuva,wajb,vw->iujb', T2[hc,ha,pa,pv], V[a,v,c,v], eta1, optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('ijab,ubkj->iuka', T2[hc,hc,pv,pv], V[a,v,c,c], optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('iuab,vbjw,wu->ivja', T2[hc,ha,pv,pv], V[a,v,c,a], gamma1, optimize='optimal')
C2[c,a,c,v] += scale * -1.00000000 * np.einsum('iuab,jbki->juka', T2[hc,ha,pv,pv], V[c,v,c,c], optimize='optimal')
C2[c,a,c,v] += scale * +1.00000000 * np.einsum('uvab,ibjw,wv->iuja', T2[ha,ha,pv,pv], V[c,v,c,a], gamma1, optimize='optimal')
C2[c,a,c,v] += scale * +0.50000000 * np.einsum('iuab,abjc->iujc', T2[hc,ha,pv,pv], V[v,v,c,v], optimize='optimal')
C2[c,a,v,v] += scale * +0.25000000 * np.einsum('iuvw,xyab,wy,vx->iuab', T2[hc,ha,pa,pa], V[a,a,v,v], eta1, eta1, optimize='optimal')
C2[c,a,v,v] += scale * -0.25000000 * np.einsum('iuvw,xyab,wy,vx->iuab', T2[hc,ha,pa,pa], V[a,a,v,v], gamma1, gamma1, optimize='optimal')
C2[c,a,v,v] += scale * +1.00000000 * np.einsum('ijua,vwjb,uw->ivab', T2[hc,hc,pa,pv], V[a,a,c,v], eta1, optimize='optimal')
C2[c,a,v,v] += scale * -1.00000000 * np.einsum('iuva,wxyb,yu,vx->iwab', T2[hc,ha,pa,pv], V[a,a,a,v], eta1, gamma1, optimize='optimal')
C2[c,a,v,v] += scale * +1.00000000 * np.einsum('iuva,wxyb,vx,yu->iwab', T2[hc,ha,pa,pv], V[a,a,a,v], eta1, gamma1, optimize='optimal')
C2[c,a,v,v] += scale * +1.00000000 * np.einsum('iuva,jwib,vw->juab', T2[hc,ha,pa,pv], V[c,a,c,v], eta1, optimize='optimal')
C2[c,a,v,v] += scale * +1.00000000 * np.einsum('uvwa,ixyb,yv,wx->iuab', T2[ha,ha,pa,pv], V[c,a,a,v], eta1, gamma1, optimize='optimal')
C2[c,a,v,v] += scale * -1.00000000 * np.einsum('uvwa,ixyb,wx,yv->iuab', T2[ha,ha,pa,pv], V[c,a,a,v], eta1, gamma1, optimize='optimal')
C2[c,a,v,v] += scale * +0.50000000 * np.einsum('iuva,wabc,vw->iubc', T2[hc,ha,pa,pv], V[a,v,v,v], eta1, optimize='optimal')
C2[c,a,v,v] += scale * +0.25000000 * np.einsum('ijab,kuij->kuab', T2[hc,hc,pv,pv], V[c,a,c,c], optimize='optimal')
C2[c,a,v,v] += scale * +0.50000000 * np.einsum('iuab,jviw,wu->jvab', T2[hc,ha,pv,pv], V[c,a,c,a], gamma1, optimize='optimal')
C2[c,a,v,v] += scale * -0.25000000 * np.einsum('uvab,iwxy,yv,xu->iwab', T2[ha,ha,pv,pv], V[c,a,a,a], eta1, eta1, optimize='optimal')
C2[c,a,v,v] += scale * +0.25000000 * np.einsum('uvab,iwxy,yv,xu->iwab', T2[ha,ha,pv,pv], V[c,a,a,a], gamma1, gamma1, optimize='optimal')
C2[c,a,v,v] += scale * -1.00000000 * np.einsum('ijab,ubjc->iuac', T2[hc,hc,pv,pv], V[a,v,c,v], optimize='optimal')
C2[c,a,v,v] += scale * -1.00000000 * np.einsum('iuab,vbwc,wu->ivac', T2[hc,ha,pv,pv], V[a,v,a,v], gamma1, optimize='optimal')
C2[c,a,v,v] += scale * -1.00000000 * np.einsum('iuab,jbic->juac', T2[hc,ha,pv,pv], V[c,v,c,v], optimize='optimal')
C2[c,a,v,v] += scale * +1.00000000 * np.einsum('uvab,ibwc,wv->iuac', T2[ha,ha,pv,pv], V[c,v,a,v], gamma1, optimize='optimal')
C2[c,a,v,v] += scale * +0.25000000 * np.einsum('iuab,abcd->iucd', T2[hc,ha,pv,pv], V[v,v,v,v], optimize='optimal')
C2[c,c,a,a] += scale * +0.12500000 * np.einsum('ijuv,klij->kluv', T2[hc,hc,pa,pa], V[c,c,c,c], optimize='optimal')
C2[c,c,a,a] += scale * +0.25000000 * np.einsum('iuvw,jkix,xu->jkvw', T2[hc,ha,pa,pa], V[c,c,c,a], gamma1, optimize='optimal')
C2[c,c,a,a] += scale * -1.00000000 * np.einsum('ijuv,kwjx,vw->ikux', T2[hc,hc,pa,pa], V[c,a,c,a], eta1, optimize='optimal')
C2[c,c,a,a] += scale * -1.00000000 * np.einsum('iuvw,jxyz,zu,wx->ijvy', T2[hc,ha,pa,pa], V[c,a,a,a], eta1, gamma1, optimize='optimal')
C2[c,c,a,a] += scale * +1.00000000 * np.einsum('iuvw,jxyz,wx,zu->ijvy', T2[hc,ha,pa,pa], V[c,a,a,a], eta1, gamma1, optimize='optimal')
C2[c,c,a,a] += scale * -1.00000000 * np.einsum('ijua,kajv->ikuv', T2[hc,hc,pa,pv], V[c,v,c,a], optimize='optimal')
C2[c,c,a,a] += scale * +1.00000000 * np.einsum('iuva,jawx,xu->ijvw', T2[hc,ha,pa,pv], V[c,v,a,a], gamma1, optimize='optimal')
C2[c,c,a,a] += scale * +0.12500000 * np.einsum('ijuv,wxyz,vx,uw->ijyz', T2[hc,hc,pa,pa], V[a,a,a,a], eta1, eta1, optimize='optimal')
C2[c,c,a,a] += scale * -0.12500000 * np.einsum('ijuv,wxyz,vx,uw->ijyz', T2[hc,hc,pa,pa], V[a,a,a,a], gamma1, gamma1, optimize='optimal')
C2[c,c,a,a] += scale * +0.25000000 * np.einsum('ijua,vawx,uv->ijwx', T2[hc,hc,pa,pv], V[a,v,a,a], eta1, optimize='optimal')
C2[c,c,a,a] += scale * +0.12500000 * np.einsum('ijab,abuv->ijuv', T2[hc,hc,pv,pv], V[v,v,a,a], optimize='optimal')
C2[c,c,c,a] += scale * -1.00000000 * np.einsum('ijuv,kwlj,vw->iklu', T2[hc,hc,pa,pa], V[c,a,c,c], eta1, optimize='optimal')
C2[c,c,c,a] += scale * +1.00000000 * np.einsum('iuvw,jxky,yu,wx->ijkv', T2[hc,ha,pa,pa], V[c,a,c,a], eta1, gamma1, optimize='optimal')
C2[c,c,c,a] += scale * -1.00000000 * np.einsum('iuvw,jxky,wx,yu->ijkv', T2[hc,ha,pa,pa], V[c,a,c,a], eta1, gamma1, optimize='optimal')
C2[c,c,c,a] += scale * -1.00000000 * np.einsum('ijua,kalj->iklu', T2[hc,hc,pa,pv], V[c,v,c,c], optimize='optimal')
C2[c,c,c,a] += scale * -1.00000000 * np.einsum('iuva,jakw,wu->ijkv', T2[hc,ha,pa,pv], V[c,v,c,a], gamma1, optimize='optimal')
C2[c,c,c,a] += scale * +0.25000000 * np.einsum('ijuv,wxky,vx,uw->ijky', T2[hc,hc,pa,pa], V[a,a,c,a], eta1, eta1, optimize='optimal')
C2[c,c,c,a] += scale * -0.25000000 * np.einsum('ijuv,wxky,vx,uw->ijky', T2[hc,hc,pa,pa], V[a,a,c,a], gamma1, gamma1, optimize='optimal')
C2[c,c,c,a] += scale * +0.50000000 * np.einsum('ijua,vakw,uv->ijkw', T2[hc,hc,pa,pv], V[a,v,c,a], eta1, optimize='optimal')
C2[c,c,c,a] += scale * +0.25000000 * np.einsum('ijab,abku->ijku', T2[hc,hc,pv,pv], V[v,v,c,a], optimize='optimal')
C2[c,c,c,c] += scale * +0.12500000 * np.einsum('ijuv,wxkl,vx,uw->ijkl', T2[hc,hc,pa,pa], V[a,a,c,c], eta1, eta1, optimize='optimal')
C2[c,c,c,c] += scale * -0.12500000 * np.einsum('ijuv,wxkl,vx,uw->ijkl', T2[hc,hc,pa,pa], V[a,a,c,c], gamma1, gamma1, optimize='optimal')
C2[c,c,c,c] += scale * +0.25000000 * np.einsum('ijua,vakl,uv->ijkl', T2[hc,hc,pa,pv], V[a,v,c,c], eta1, optimize='optimal')
C2[c,c,c,c] += scale * +0.12500000 * np.einsum('ijab,abkl->ijkl', T2[hc,hc,pv,pv], V[v,v,c,c], optimize='optimal')
C2[c,c,a,v] += scale * -1.00000000 * np.einsum('ijuv,kwja,vw->ikua', T2[hc,hc,pa,pa], V[c,a,c,v], eta1, optimize='optimal')
C2[c,c,a,v] += scale * +1.00000000 * np.einsum('iuvw,jxya,yu,wx->ijva', T2[hc,ha,pa,pa], V[c,a,a,v], eta1, gamma1, optimize='optimal')
C2[c,c,a,v] += scale * -1.00000000 * np.einsum('iuvw,jxya,wx,yu->ijva', T2[hc,ha,pa,pa], V[c,a,a,v], eta1, gamma1, optimize='optimal')
C2[c,c,a,v] += scale * +0.25000000 * np.einsum('ijua,klij->klua', T2[hc,hc,pa,pv], V[c,c,c,c], optimize='optimal')
C2[c,c,a,v] += scale * +0.50000000 * np.einsum('iuva,jkiw,wu->jkva', T2[hc,ha,pa,pv], V[c,c,c,a], gamma1, optimize='optimal')
C2[c,c,a,v] += scale * -0.25000000 * np.einsum('uvwa,ijxy,yv,xu->ijwa', T2[ha,ha,pa,pv], V[c,c,a,a], eta1, eta1, optimize='optimal')
C2[c,c,a,v] += scale * +0.25000000 * np.einsum('uvwa,ijxy,yv,xu->ijwa', T2[ha,ha,pa,pv], V[c,c,a,a], gamma1, gamma1, optimize='optimal')
C2[c,c,a,v] += scale * -1.00000000 * np.einsum('ijua,kajb->ikub', T2[hc,hc,pa,pv], V[c,v,c,v], optimize='optimal')
C2[c,c,a,v] += scale * -1.00000000 * np.einsum('iuva,jawb,wu->ijvb', T2[hc,ha,pa,pv], V[c,v,a,v], gamma1, optimize='optimal')
C2[c,c,a,v] += scale * +0.25000000 * np.einsum('ijuv,wxya,vx,uw->ijya', T2[hc,hc,pa,pa], V[a,a,a,v], eta1, eta1, optimize='optimal')
C2[c,c,a,v] += scale * -0.25000000 * np.einsum('ijuv,wxya,vx,uw->ijya', T2[hc,hc,pa,pa], V[a,a,a,v], gamma1, gamma1, optimize='optimal')
C2[c,c,a,v] += scale * -1.00000000 * np.einsum('ijua,kvjw,uv->ikwa', T2[hc,hc,pa,pv], V[c,a,c,a], eta1, optimize='optimal')
C2[c,c,a,v] += scale * -1.00000000 * np.einsum('iuva,jwxy,yu,vw->ijxa', T2[hc,ha,pa,pv], V[c,a,a,a], eta1, gamma1, optimize='optimal')
C2[c,c,a,v] += scale * +1.00000000 * np.einsum('iuva,jwxy,vw,yu->ijxa', T2[hc,ha,pa,pv], V[c,a,a,a], eta1, gamma1, optimize='optimal')
C2[c,c,a,v] += scale * +0.50000000 * np.einsum('ijua,vawb,uv->ijwb', T2[hc,hc,pa,pv], V[a,v,a,v], eta1, optimize='optimal')
C2[c,c,a,v] += scale * +1.00000000 * np.einsum('ijab,kbju->ikua', T2[hc,hc,pv,pv], V[c,v,c,a], optimize='optimal')
C2[c,c,a,v] += scale * -1.00000000 * np.einsum('iuab,jbvw,wu->ijva', T2[hc,ha,pv,pv], V[c,v,a,a], gamma1, optimize='optimal')
C2[c,c,a,v] += scale * +0.25000000 * np.einsum('ijab,abuc->ijuc', T2[hc,hc,pv,pv], V[v,v,a,v], optimize='optimal')
C2[c,c,c,v] += scale * +0.25000000 * np.einsum('ijuv,wxka,vx,uw->ijka', T2[hc,hc,pa,pa], V[a,a,c,v], eta1, eta1, optimize='optimal')
C2[c,c,c,v] += scale * -0.25000000 * np.einsum('ijuv,wxka,vx,uw->ijka', T2[hc,hc,pa,pa], V[a,a,c,v], gamma1, gamma1, optimize='optimal')
C2[c,c,c,v] += scale * +1.00000000 * np.einsum('ijua,kvlj,uv->ikla', T2[hc,hc,pa,pv], V[c,a,c,c], eta1, optimize='optimal')
C2[c,c,c,v] += scale * -1.00000000 * np.einsum('iuva,jwkx,xu,vw->ijka', T2[hc,ha,pa,pv], V[c,a,c,a], eta1, gamma1, optimize='optimal')
C2[c,c,c,v] += scale * +1.00000000 * np.einsum('iuva,jwkx,vw,xu->ijka', T2[hc,ha,pa,pv], V[c,a,c,a], eta1, gamma1, optimize='optimal')
C2[c,c,c,v] += scale * +0.50000000 * np.einsum('ijua,vakb,uv->ijkb', T2[hc,hc,pa,pv], V[a,v,c,v], eta1, optimize='optimal')
C2[c,c,c,v] += scale * -1.00000000 * np.einsum('ijab,kblj->ikla', T2[hc,hc,pv,pv], V[c,v,c,c], optimize='optimal')
C2[c,c,c,v] += scale * -1.00000000 * np.einsum('iuab,jbkv,vu->ijka', T2[hc,ha,pv,pv], V[c,v,c,a], gamma1, optimize='optimal')
C2[c,c,c,v] += scale * +0.25000000 * np.einsum('ijab,abkc->ijkc', T2[hc,hc,pv,pv], V[v,v,c,v], optimize='optimal')
C2[c,c,v,v] += scale * +0.12500000 * np.einsum('ijuv,wxab,vx,uw->ijab', T2[hc,hc,pa,pa], V[a,a,v,v], eta1, eta1, optimize='optimal')
C2[c,c,v,v] += scale * -0.12500000 * np.einsum('ijuv,wxab,vx,uw->ijab', T2[hc,hc,pa,pa], V[a,a,v,v], gamma1, gamma1, optimize='optimal')
C2[c,c,v,v] += scale * +1.00000000 * np.einsum('ijua,kvjb,uv->ikab', T2[hc,hc,pa,pv], V[c,a,c,v], eta1, optimize='optimal')
C2[c,c,v,v] += scale * -1.00000000 * np.einsum('iuva,jwxb,xu,vw->ijab', T2[hc,ha,pa,pv], V[c,a,a,v], eta1, gamma1, optimize='optimal')
C2[c,c,v,v] += scale * +1.00000000 * np.einsum('iuva,jwxb,vw,xu->ijab', T2[hc,ha,pa,pv], V[c,a,a,v], eta1, gamma1, optimize='optimal')
C2[c,c,v,v] += scale * +0.25000000 * np.einsum('ijua,vabc,uv->ijbc', T2[hc,hc,pa,pv], V[a,v,v,v], eta1, optimize='optimal')
C2[c,c,v,v] += scale * +0.12500000 * np.einsum('ijab,klij->klab', T2[hc,hc,pv,pv], V[c,c,c,c], optimize='optimal')
C2[c,c,v,v] += scale * +0.25000000 * np.einsum('iuab,jkiv,vu->jkab', T2[hc,ha,pv,pv], V[c,c,c,a], gamma1, optimize='optimal')
C2[c,c,v,v] += scale * -0.12500000 * np.einsum('uvab,ijwx,xv,wu->ijab', T2[ha,ha,pv,pv], V[c,c,a,a], eta1, eta1, optimize='optimal')
C2[c,c,v,v] += scale * +0.12500000 * np.einsum('uvab,ijwx,xv,wu->ijab', T2[ha,ha,pv,pv], V[c,c,a,a], gamma1, gamma1, optimize='optimal')
C2[c,c,v,v] += scale * -1.00000000 * np.einsum('ijab,kbjc->ikac', T2[hc,hc,pv,pv], V[c,v,c,v], optimize='optimal')
C2[c,c,v,v] += scale * -1.00000000 * np.einsum('iuab,jbvc,vu->ijac', T2[hc,ha,pv,pv], V[c,v,a,v], gamma1, optimize='optimal')
C2[c,c,v,v] += scale * +0.12500000 * np.einsum('ijab,abcd->ijcd', T2[hc,hc,pv,pv], V[v,v,v,v], optimize='optimal')
C2[c,v,a,a] += scale * +0.25000000 * np.einsum('ijuv,kaij->kauv', T2[hc,hc,pa,pa], V[c,v,c,c], optimize='optimal')
C2[c,v,a,a] += scale * +0.50000000 * np.einsum('iuvw,jaix,xu->javw', T2[hc,ha,pa,pa], V[c,v,c,a], gamma1, optimize='optimal')
C2[c,v,a,a] += scale * +1.00000000 * np.einsum('ijuv,wajx,vw->iaux', T2[hc,hc,pa,pa], V[a,v,c,a], eta1, optimize='optimal')
C2[c,v,a,a] += scale * +1.00000000 * np.einsum('iuvw,xayz,zu,wx->iavy', T2[hc,ha,pa,pa], V[a,v,a,a], eta1, gamma1, optimize='optimal')
C2[c,v,a,a] += scale * -1.00000000 * np.einsum('iuvw,xayz,wx,zu->iavy', T2[hc,ha,pa,pa], V[a,v,a,a], eta1, gamma1, optimize='optimal')
C2[c,v,a,a] += scale * -1.00000000 * np.einsum('ijua,bajv->ibuv', T2[hc,hc,pa,pv], V[v,v,c,a], optimize='optimal')
C2[c,v,a,a] += scale * +1.00000000 * np.einsum('iuva,bawx,xu->ibvw', T2[hc,ha,pa,pv], V[v,v,a,a], gamma1, optimize='optimal')
C2[c,v,c,a] += scale * +1.00000000 * np.einsum('ijuv,wakj,vw->iaku', T2[hc,hc,pa,pa], V[a,v,c,c], eta1, optimize='optimal')
C2[c,v,c,a] += scale * -1.00000000 * np.einsum('iuvw,xajy,yu,wx->iajv', T2[hc,ha,pa,pa], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C2[c,v,c,a] += scale * +1.00000000 * np.einsum('iuvw,xajy,wx,yu->iajv', T2[hc,ha,pa,pa], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C2[c,v,c,a] += scale * -1.00000000 * np.einsum('ijua,bakj->ibku', T2[hc,hc,pa,pv], V[v,v,c,c], optimize='optimal')
C2[c,v,c,a] += scale * -1.00000000 * np.einsum('iuva,bajw,wu->ibjv', T2[hc,ha,pa,pv], V[v,v,c,a], gamma1, optimize='optimal')
C2[c,v,a,v] += scale * +1.00000000 * np.einsum('ijuv,wajb,vw->iaub', T2[hc,hc,pa,pa], V[a,v,c,v], eta1, optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('iuvw,xayb,yu,wx->iavb', T2[hc,ha,pa,pa], V[a,v,a,v], eta1, gamma1, optimize='optimal')
C2[c,v,a,v] += scale * +1.00000000 * np.einsum('iuvw,xayb,wx,yu->iavb', T2[hc,ha,pa,pa], V[a,v,a,v], eta1, gamma1, optimize='optimal')
C2[c,v,a,v] += scale * +0.50000000 * np.einsum('ijua,kbij->kbua', T2[hc,hc,pa,pv], V[c,v,c,c], optimize='optimal')
C2[c,v,a,v] += scale * +1.00000000 * np.einsum('iuva,jbiw,wu->jbva', T2[hc,ha,pa,pv], V[c,v,c,a], gamma1, optimize='optimal')
C2[c,v,a,v] += scale * -0.50000000 * np.einsum('uvwa,ibxy,yv,xu->ibwa', T2[ha,ha,pa,pv], V[c,v,a,a], eta1, eta1, optimize='optimal')
C2[c,v,a,v] += scale * +0.50000000 * np.einsum('uvwa,ibxy,yv,xu->ibwa', T2[ha,ha,pa,pv], V[c,v,a,a], gamma1, gamma1, optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('ijua,bajc->ibuc', T2[hc,hc,pa,pv], V[v,v,c,v], optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('iuva,bawc,wu->ibvc', T2[hc,ha,pa,pv], V[v,v,a,v], gamma1, optimize='optimal')
C2[c,v,a,v] += scale * +1.00000000 * np.einsum('ijua,vbjw,uv->ibwa', T2[hc,hc,pa,pv], V[a,v,c,a], eta1, optimize='optimal')
C2[c,v,a,v] += scale * +1.00000000 * np.einsum('iuva,wbxy,yu,vw->ibxa', T2[hc,ha,pa,pv], V[a,v,a,a], eta1, gamma1, optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('iuva,wbxy,vw,yu->ibxa', T2[hc,ha,pa,pv], V[a,v,a,a], eta1, gamma1, optimize='optimal')
C2[c,v,a,v] += scale * +1.00000000 * np.einsum('ijab,cbju->icua', T2[hc,hc,pv,pv], V[v,v,c,a], optimize='optimal')
C2[c,v,a,v] += scale * -1.00000000 * np.einsum('iuab,cbvw,wu->icva', T2[hc,ha,pv,pv], V[v,v,a,a], gamma1, optimize='optimal')
C2[c,v,c,v] += scale * -1.00000000 * np.einsum('ijua,vbkj,uv->ibka', T2[hc,hc,pa,pv], V[a,v,c,c], eta1, optimize='optimal')
C2[c,v,c,v] += scale * +1.00000000 * np.einsum('iuva,wbjx,xu,vw->ibja', T2[hc,ha,pa,pv], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C2[c,v,c,v] += scale * -1.00000000 * np.einsum('iuva,wbjx,vw,xu->ibja', T2[hc,ha,pa,pv], V[a,v,c,a], eta1, gamma1, optimize='optimal')
C2[c,v,c,v] += scale * -1.00000000 * np.einsum('ijab,cbkj->icka', T2[hc,hc,pv,pv], V[v,v,c,c], optimize='optimal')
C2[c,v,c,v] += scale * -1.00000000 * np.einsum('iuab,cbjv,vu->icja', T2[hc,ha,pv,pv], V[v,v,c,a], gamma1, optimize='optimal')
C2[c,v,v,v] += scale * -1.00000000 * np.einsum('ijua,vbjc,uv->ibac', T2[hc,hc,pa,pv], V[a,v,c,v], eta1, optimize='optimal')
C2[c,v,v,v] += scale * +1.00000000 * np.einsum('iuva,wbxc,xu,vw->ibac', T2[hc,ha,pa,pv], V[a,v,a,v], eta1, gamma1, optimize='optimal')
C2[c,v,v,v] += scale * -1.00000000 * np.einsum('iuva,wbxc,vw,xu->ibac', T2[hc,ha,pa,pv], V[a,v,a,v], eta1, gamma1, optimize='optimal')
C2[c,v,v,v] += scale * +0.25000000 * np.einsum('ijab,kcij->kcab', T2[hc,hc,pv,pv], V[c,v,c,c], optimize='optimal')
C2[c,v,v,v] += scale * +0.50000000 * np.einsum('iuab,jciv,vu->jcab', T2[hc,ha,pv,pv], V[c,v,c,a], gamma1, optimize='optimal')
C2[c,v,v,v] += scale * -0.25000000 * np.einsum('uvab,icwx,xv,wu->icab', T2[ha,ha,pv,pv], V[c,v,a,a], eta1, eta1, optimize='optimal')
C2[c,v,v,v] += scale * +0.25000000 * np.einsum('uvab,icwx,xv,wu->icab', T2[ha,ha,pv,pv], V[c,v,a,a], gamma1, gamma1, optimize='optimal')
C2[c,v,v,v] += scale * -1.00000000 * np.einsum('ijab,cbjd->icad', T2[hc,hc,pv,pv], V[v,v,c,v], optimize='optimal')
C2[c,v,v,v] += scale * -1.00000000 * np.einsum('iuab,cbvd,vu->icad', T2[hc,ha,pv,pv], V[v,v,a,v], gamma1, optimize='optimal')
C2[v,v,a,a] += scale * +0.12500000 * np.einsum('ijuv,abij->abuv', T2[hc,hc,pa,pa], V[v,v,c,c], optimize='optimal')
C2[v,v,a,a] += scale * +0.25000000 * np.einsum('iuvw,abix,xu->abvw', T2[hc,ha,pa,pa], V[v,v,c,a], gamma1, optimize='optimal')
C2[v,v,a,v] += scale * +0.25000000 * np.einsum('ijua,bcij->bcua', T2[hc,hc,pa,pv], V[v,v,c,c], optimize='optimal')
C2[v,v,a,v] += scale * +0.50000000 * np.einsum('iuva,bciw,wu->bcva', T2[hc,ha,pa,pv], V[v,v,c,a], gamma1, optimize='optimal')
C2[v,v,a,v] += scale * -0.25000000 * np.einsum('uvwa,bcxy,yv,xu->bcwa', T2[ha,ha,pa,pv], V[v,v,a,a], eta1, eta1, optimize='optimal')
C2[v,v,a,v] += scale * +0.25000000 * np.einsum('uvwa,bcxy,yv,xu->bcwa', T2[ha,ha,pa,pv], V[v,v,a,a], gamma1, gamma1, optimize='optimal')
C2[v,v,v,v] += scale * +0.12500000 * np.einsum('ijab,cdij->cdab', T2[hc,hc,pv,pv], V[v,v,c,c], optimize='optimal')
C2[v,v,v,v] += scale * +0.25000000 * np.einsum('iuab,cdiv,vu->cdab', T2[hc,ha,pv,pv], V[v,v,c,a], gamma1, optimize='optimal')
C2[v,v,v,v] += scale * -0.12500000 * np.einsum('uvab,cdwx,xv,wu->cdab', T2[ha,ha,pv,pv], V[v,v,a,a], eta1, eta1, optimize='optimal')
C2[v,v,v,v] += scale * +0.12500000 * np.einsum('uvab,cdwx,xv,wu->cdab', T2[ha,ha,pv,pv], V[v,v,a,a], gamma1, gamma1, optimize='optimal')
t1 = time.time()
if verbose: print("H2_T2_C2 took {:.4f} seconds to run.".format(t1-t0))