@@ -435,6 +435,13 @@ def cg_couple(
435
435
for o3_lambda in o3_lambdas
436
436
]
437
437
elif cg_backend == "python-dense" :
438
+
439
+ n_samples = array .shape [0 ]
440
+ n_properties = array .shape [3 ]
441
+
442
+ array = array .swapaxes (1 , 3 )
443
+ array = array .reshape (n_samples * n_properties , 2 * l2 + 1 , 2 * l1 + 1 )
444
+
438
445
return [
439
446
_cg_couple_dense (array , o3_lambda , cg_coefficients )
440
447
for o3_lambda in o3_lambdas
@@ -505,18 +512,14 @@ def _cg_couple_dense(
505
512
:param cg_coefficients: CG coefficients as returned by
506
513
:py:func:`calculate_cg_coefficients` with ``cg_backed="python-dense"``
507
514
"""
508
- # TODO: fix this!
509
- # assert len(array.shape) == 3
515
+ assert len (array .shape ) == 3
510
516
511
- l1 = (array .shape [1 ] - 1 ) // 2
512
- l2 = (array .shape [2 ] - 1 ) // 2
517
+ l1 = (array .shape [2 ] - 1 ) // 2
518
+ l2 = (array .shape [1 ] - 1 ) // 2
513
519
514
520
cg_l1l2lam = cg_coefficients .block ({"l1" : l1 , "l2" : l2 , "lambda" : o3_lambda }).values
515
521
516
- return _dispatch .permute (
517
- _dispatch .tensordot (array , cg_l1l2lam [0 , ..., 0 ], axes = ([1 , 2 ], [0 , 1 ])),
518
- [0 , 2 , 1 ]
519
- )
522
+ return _dispatch .tensordot (array , cg_l1l2lam [0 , ..., 0 ], axes = ([2 , 1 ], [0 , 1 ]))
520
523
521
524
522
525
# ======================================================================= #
0 commit comments