30
30
from .frepresentations import fgenerate_local_coulomb_matrix
31
31
from .frepresentations import fgenerate_atomic_coulomb_matrix
32
32
from .frepresentations import fgenerate_eigenvalue_coulomb_matrix
33
+ from .frepresentations import fgenerate_bob
33
34
34
35
from .data import NUCLEAR_CHARGE
35
36
@@ -294,37 +295,6 @@ def generate_bob(nuclear_charges, coordinates, atomtypes, size=23, asize = {"O":
294
295
:return: 1D representation
295
296
:rtype: numpy array
296
297
"""
297
- natoms = len (nuclear_charges )
298
-
299
- coulomb_matrix = fgenerate_unsorted_coulomb_matrix (nuclear_charges , coordinates , size )
300
-
301
- coulomb_matrix = vector_to_matrix (coulomb_matrix )
302
- descriptor = []
303
- atomtypes = np .asarray (atomtypes )
304
- for atom1 , size1 in sorted (asize .items ()):
305
- pos1 = np .where (atomtypes == atom1 )[0 ]
306
- feature_vector = np .zeros (size1 )
307
- feature_vector [:pos1 .size ] = np .diag (coulomb_matrix )[pos1 ]
308
- feature_vector .sort ()
309
- descriptor .append (feature_vector [:])
310
- for atom2 , size2 in sorted (asize .items ()):
311
- if atom1 > atom2 :
312
- continue
313
- if atom1 == atom2 :
314
- size = size1 * (size1 - 1 )// 2
315
- feature_vector = np .zeros (size )
316
- sub_matrix = coulomb_matrix [np .ix_ (pos1 ,pos1 )]
317
- feature_vector [:pos1 .size * (pos1 .size - 1 )// 2 ] = sub_matrix [np .triu_indices (pos1 .size , 1 )]
318
- feature_vector .sort ()
319
- descriptor .append (feature_vector [:])
320
- else :
321
- pos2 = np .where (atomtypes == atom2 )[0 ]
322
- feature_vector = np .zeros (size1 * size2 )
323
- feature_vector [:pos1 .size * pos2 .size ] = coulomb_matrix [np .ix_ (pos1 ,pos2 )].ravel ()
324
- feature_vector .sort ()
325
- descriptor .append (feature_vector [:])
326
-
327
- return np .concatenate (descriptor )
328
298
329
299
n = 0
330
300
atoms = sorted (asize , key = asize .get )
@@ -340,7 +310,6 @@ def generate_bob(nuclear_charges, coordinates, atomtypes, size=23, asize = {"O":
340
310
341
311
return fgenerate_bob (nuclear_charges , coordinates , nuclear_charges , ids , nmax , n )
342
312
343
-
344
313
def get_slatm_mbtypes (nuclear_charges , pbc = '000' ):
345
314
"""
346
315
Get the list of minimal types of many-body terms in a dataset. This resulting list
0 commit comments