@@ -59,12 +59,10 @@ def get_global_kernel(
59
59
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
60
60
N2 = np .array ([len (Q ) for Q in Q2 ], dtype = np .int32 )
61
61
62
- assert (
63
- N1 .shape [0 ] == X1 .shape [0 ]
64
- ), "Error: List of charges does not match shape of representations"
65
- assert (
66
- N2 .shape [0 ] == X2 .shape [0 ]
67
- ), "Error: List of charges does not match shape of representations"
62
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
63
+ raise ValueError ("List of charges does not match shape of representations" )
64
+ if not (N2 .shape [0 ] == X2 .shape [0 ]):
65
+ raise ValueError ("Error: List of charges does not match shape of representations" )
68
66
69
67
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
70
68
Q2_input = np .zeros ((max (N2 ), X2 .shape [0 ]), dtype = np .int32 )
@@ -114,12 +112,10 @@ def get_local_kernels(
114
112
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
115
113
N2 = np .array ([len (Q ) for Q in Q2 ], dtype = np .int32 )
116
114
117
- assert (
118
- N1 .shape [0 ] == X1 .shape [0 ]
119
- ), "Error: List of charges does not match shape of representations"
120
- assert (
121
- N2 .shape [0 ] == X2 .shape [0 ]
122
- ), "Error: List of charges does not match shape of representations"
115
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
116
+ raise ValueError ("Error: List of charges does not match shape of representations" )
117
+ if not (N2 .shape [0 ] == X2 .shape [0 ]):
118
+ raise ValueError ("Error: List of charges does not match shape of representations" )
123
119
124
120
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
125
121
Q2_input = np .zeros ((max (N2 ), X2 .shape [0 ]), dtype = np .int32 )
@@ -176,12 +172,10 @@ def get_local_kernel(
176
172
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
177
173
N2 = np .array ([len (Q ) for Q in Q2 ], dtype = np .int32 )
178
174
179
- assert (
180
- N1 .shape [0 ] == X1 .shape [0 ]
181
- ), "Error: List of charges does not match shape of representations"
182
- assert (
183
- N2 .shape [0 ] == X2 .shape [0 ]
184
- ), "Error: List of charges does not match shape of representations"
175
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
176
+ raise ValueError ("List of charges does not match shape of representations" )
177
+ if not (N2 .shape [0 ] == X2 .shape [0 ]):
178
+ raise ValueError ("List of charges does not match shape of representations" )
185
179
186
180
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
187
181
Q2_input = np .zeros ((max (N2 ), X2 .shape [0 ]), dtype = np .int32 )
@@ -228,9 +222,8 @@ def get_local_symmetric_kernels(X1: ndarray, Q1: List[List[int]], SIGMAS: List[f
228
222
229
223
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
230
224
231
- assert (
232
- N1 .shape [0 ] == X1 .shape [0 ]
233
- ), "Error: List of charges does not match shape of representations"
225
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
226
+ raise ValueError ("Error: List of charges does not match shape of representations" )
234
227
235
228
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
236
229
for i , q in enumerate (Q1 ):
@@ -275,9 +268,8 @@ def get_local_symmetric_kernel(
275
268
276
269
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
277
270
278
- assert (
279
- N1 .shape [0 ] == X1 .shape [0 ]
280
- ), "Error: List of charges does not match shape of representations"
271
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
272
+ raise ValueError ("Error: List of charges does not match shape of representations" )
281
273
282
274
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
283
275
for i , q in enumerate (Q1 ):
@@ -329,12 +321,10 @@ def get_atomic_local_kernel(
329
321
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
330
322
N2 = np .array ([len (Q ) for Q in Q2 ], dtype = np .int32 )
331
323
332
- assert (
333
- N1 .shape [0 ] == X1 .shape [0 ]
334
- ), "Error: List of charges does not match shape of representations"
335
- assert (
336
- N2 .shape [0 ] == X2 .shape [0 ]
337
- ), "Error: List of charges does not match shape of representations"
324
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
325
+ raise ValueError ("List of charges does not match shape of representations" )
326
+ if not (N2 .shape [0 ] == X2 .shape [0 ]):
327
+ raise ValueError ("List of charges does not match shape of representations" )
338
328
339
329
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
340
330
Q2_input = np .zeros ((max (N2 ), X2 .shape [0 ]), dtype = np .int32 )
@@ -394,12 +384,10 @@ def get_atomic_local_gradient_kernel(
394
384
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
395
385
N2 = np .array ([len (Q ) for Q in Q2 ], dtype = np .int32 )
396
386
397
- assert (
398
- N1 .shape [0 ] == X1 .shape [0 ]
399
- ), "Error: List of charges does not match shape of representations"
400
- assert (
401
- N2 .shape [0 ] == X2 .shape [0 ]
402
- ), "Error: List of charges does not match shape of representations"
387
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
388
+ raise ValueError ("List of charges does not match shape of representations" )
389
+ if not (N2 .shape [0 ] == X2 .shape [0 ]):
390
+ raise ValueError ("List of charges does not match shape of representations" )
403
391
404
392
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
405
393
Q2_input = np .zeros ((max (N2 ), X2 .shape [0 ]), dtype = np .int32 )
@@ -475,12 +463,10 @@ def get_local_gradient_kernel(
475
463
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
476
464
N2 = np .array ([len (Q ) for Q in Q2 ], dtype = np .int32 )
477
465
478
- assert (
479
- N1 .shape [0 ] == X1 .shape [0 ]
480
- ), "Error: List of charges does not match shape of representations"
481
- assert (
482
- N2 .shape [0 ] == X2 .shape [0 ]
483
- ), "Error: List of charges does not match shape of representations"
466
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
467
+ raise ValueError ("List of charges does not match shape of representations" )
468
+ if not (N2 .shape [0 ] == X2 .shape [0 ]):
469
+ raise ValueError ("List of charges does not match shape of representations" )
484
470
485
471
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
486
472
Q2_input = np .zeros ((max (N2 ), X2 .shape [0 ]), dtype = np .int32 )
@@ -552,12 +538,10 @@ def get_gdml_kernel(
552
538
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
553
539
N2 = np .array ([len (Q ) for Q in Q2 ], dtype = np .int32 )
554
540
555
- assert (
556
- N1 .shape [0 ] == X1 .shape [0 ]
557
- ), "Error: List of charges does not match shape of representations"
558
- assert (
559
- N2 .shape [0 ] == X2 .shape [0 ]
560
- ), "Error: List of charges does not match shape of representations"
541
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
542
+ raise ValueError ("List of charges does not match shape of representations" )
543
+ if not (N2 .shape [0 ] == X2 .shape [0 ]):
544
+ raise ValueError ("List of charges does not match shape of representations" )
561
545
562
546
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
563
547
Q2_input = np .zeros ((max (N2 ), X2 .shape [0 ]), dtype = np .int32 )
@@ -627,9 +611,8 @@ def get_symmetric_gdml_kernel(
627
611
628
612
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
629
613
630
- assert (
631
- N1 .shape [0 ] == X1 .shape [0 ]
632
- ), "Error: List of charges does not match shape of representations"
614
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
615
+ raise ValueError ("List of charges does not match shape of representations" )
633
616
634
617
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
635
618
@@ -692,12 +675,10 @@ def get_gp_kernel(
692
675
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
693
676
N2 = np .array ([len (Q ) for Q in Q2 ], dtype = np .int32 )
694
677
695
- assert (
696
- N1 .shape [0 ] == X1 .shape [0 ]
697
- ), "Error: List of charges does not match shape of representations"
698
- assert (
699
- N2 .shape [0 ] == X2 .shape [0 ]
700
- ), "Error: List of charges does not match shape of representations"
678
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
679
+ raise ValueError ("List of charges does not match shape of representations" )
680
+ if not (N2 .shape [0 ] == X2 .shape [0 ]):
681
+ raise ValueError ("List of charges does not match shape of representations" )
701
682
702
683
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
703
684
Q2_input = np .zeros ((max (N2 ), X2 .shape [0 ]), dtype = np .int32 )
@@ -765,9 +746,8 @@ def get_symmetric_gp_kernel(
765
746
766
747
N1 = np .array ([len (Q ) for Q in Q1 ], dtype = np .int32 )
767
748
768
- assert (
769
- N1 .shape [0 ] == X1 .shape [0 ]
770
- ), "Error: List of charges does not match shape of representations"
749
+ if not (N1 .shape [0 ] == X1 .shape [0 ]):
750
+ raise ValueError ("List of charges does not match shape of representations" )
771
751
772
752
Q1_input = np .zeros ((max (N1 ), X1 .shape [0 ]), dtype = np .int32 )
773
753
0 commit comments