示例#1
0
    def __init__(self, distance_matrix, labels):
        """Initialize a similarity descriptor

           Arguments:
             distance_matrix  --  a matrix with interatomic distances, this can
                                  also be distances in a graph
             labels  --  a list with integer labels used to identify atoms of
                         the same type
        """
        self.table_distances = similarity_table_distances(distance_matrix)
        self.table_labels = similarity_table_labels(labels.astype(numpy.int32))
        order = numpy.lexsort([self.table_labels[:, 1], self.table_labels[:, 0]])
        self.table_labels = self.table_labels[order]
        self.table_distances = self.table_distances[order]
示例#2
0
 def __init__(self, mol_or_graph, labels=None):
     if labels is None:
         self.labels = mol_or_graph.numbers.astype(numpy.int32)
     else:
         self.labels = labels.astype(numpy.int32)
     self.table_labels = similarity_table_labels(self.labels)
     if isinstance(mol_or_graph, Molecule):
         self.table_distances = similarity_table_distances(mol_or_graph.distance_matrix)
     elif isinstance(mol_or_graph, MolecularGraph):
         self.table_distances = similarity_table_distances(mol_or_graph.distances)
     #order = self.table_labels.argsort(axis=0,kind='heapsort')
     order = numpy.lexsort([self.table_labels[:,1], self.table_labels[:,0]])
     self.table_labels = self.table_labels[order]
     self.table_distances = self.table_distances[order]
示例#3
0
    def __init__(self, distance_matrix, labels):
        """Initialize a similarity descriptor

           Arguments:
             distance_matrix  --  a matrix with interatomic distances, this can
                                  also be distances in a graph
             labels  --  a list with integer labels used to identify atoms of
                         the same type
        """
        self.table_distances = similarity_table_distances(distance_matrix)
        self.table_labels = similarity_table_labels(labels.astype(numpy.int32))
        order = numpy.lexsort(
            [self.table_labels[:, 1], self.table_labels[:, 0]])
        self.table_labels = self.table_labels[order]
        self.table_distances = self.table_distances[order]
示例#4
0
 def __init__(self, mol_or_graph, labels=None):
     if labels is None:
         self.labels = mol_or_graph.numbers.astype(numpy.int32)
     else:
         self.labels = labels.astype(numpy.int32)
     self.table_labels = similarity_table_labels(self.labels)
     if isinstance(mol_or_graph, Molecule):
         self.table_distances = similarity_table_distances(
             mol_or_graph.distance_matrix)
     elif isinstance(mol_or_graph, MolecularGraph):
         self.table_distances = similarity_table_distances(
             mol_or_graph.distances)
     #order = self.table_labels.argsort(axis=0,kind='heapsort')
     order = numpy.lexsort(
         [self.table_labels[:, 1], self.table_labels[:, 0]])
     self.table_labels = self.table_labels[order]
     self.table_distances = self.table_distances[order]