2828_molid_name = 'mol_id'
2929
3030
31-
3231def _get_llist (mol ):
3332 """Get list of angular momentum quantum numbers for basis functions of each element of a molecule.
3433
@@ -50,7 +49,7 @@ def _get_tsize(tensor):
5049 Returns:
5150 int: Total size of the tensor (total number of elements).
5251 """
53- return sum ([ np .prod (tensor .block (key ).values .shape ) for key in tensor .keys ] )
52+ return sum (np .prod (tensor .block (key ).values .shape ) for key in tensor .keys )
5453
5554
5655def _labels_to_array (labels ):
@@ -120,19 +119,19 @@ def vector_to_tensormap(mol, c):
120119 if llists [q ]== sorted (llists [q ]):
121120 for l in set (llists [q ]):
122121 msize = 2 * l + 1
123- nsize = blocks [( l ,q ) ].shape [- 1 ]
122+ nsize = blocks [l ,q ].shape [- 1 ]
124123 cslice = c [i (nsize * msize )].reshape (nsize ,msize ).T
125124 if l == 1 : # for l=1, the pyscf order is x,y,z (1,-1,0)
126125 cslice = cslice [pyscf2gpr_l1_order ]
127- blocks [( l ,q ) ][iq [q ],:,:] = cslice
126+ blocks [l ,q ][iq [q ],:,:] = cslice
128127 else :
129128 il = dict .fromkeys (range (max (llists [q ]) + 1 ), 0 )
130129 for l in llists [q ]:
131130 msize = 2 * l + 1
132131 cslice = c [i (msize )]
133132 if l == 1 : # for l=1, the pyscf order is x,y,z (1,-1,0)
134133 cslice = cslice [pyscf2gpr_l1_order ]
135- blocks [( l ,q ) ][iq [q ],:,il [l ]] = cslice
134+ blocks [l ,q ][iq [q ],:,il [l ]] = cslice
136135 il [l ] += 1
137136 iq [q ] += 1
138137
@@ -256,7 +255,7 @@ def matrix_to_tensormap(mol, dm):
256255 dmslice = np .transpose (dmslice , axes = [1 ,3 ,0 ,2 ]).reshape (msize1 ,msize2 ,- 1 )
257256 block = tensor_blocks [tm_label_vals .index ((l1 ,l2 ,q1 ,q2 ))]
258257 at_p = block .samples .position ((iat1 ,iat2 ))
259- blocks [( l1 ,l2 ,q1 ,q2 ) ][at_p ,:,:,:] = dmslice
258+ blocks [l1 ,l2 ,q1 ,q2 ][at_p ,:,:,:] = dmslice
260259 iq2 [q2 ] += 1
261260 iq1 [q1 ] += 1
262261 else :
@@ -275,7 +274,7 @@ def matrix_to_tensormap(mol, dm):
275274 block = tensor_blocks [tm_label_vals .index ((l1 , l2 , q1 , q2 ))]
276275 at_p = block .samples .position ((iat1 , iat2 ))
277276 n_p = block .properties .position ((il1 [l1 ], il2 [l2 ]))
278- blocks [( l1 ,l2 ,q1 ,q2 ) ][at_p ,:,:,n_p ] = dmslice
277+ blocks [l1 ,l2 ,q1 ,q2 ][at_p ,:,:,n_p ] = dmslice
279278 il2 [l2 ] += 1
280279 iq2 [q2 ] += 1
281280 il1 [l1 ] += 1
@@ -486,7 +485,7 @@ def split(tensor):
486485 continue
487486 sampleidx = [t [0 ] for t in samples ]
488487 samplelbl = [t [1 ] for t in samples ]
489- #sampleidx = [block.samples.position(lbl) for lbl in samplelbl]
488+ # sampleidx = [block.samples.position(lbl) for lbl in samplelbl]
490489
491490 blocks [key ] = block .values [sampleidx ]
492491 block_samp_labels [key ] = metatensor .Labels (tensor .sample_names [1 :], np .array (samplelbl )[:,1 :])
0 commit comments