Used to compute a global similarity of structures based on the average similarity of local atomic environments in the structure. More precisely, returns the similarity kernel K as: .. math:: K(A, B) = \\frac{1}{N M}\sum_{ij} C_{ij}(A, B) where :math:`N` is the number of ato
| 19 | |
| 20 | |
| 21 | class AverageKernel(LocalSimilarityKernel): |
| 22 | """Used to compute a global similarity of structures based on the average |
| 23 | similarity of local atomic environments in the structure. More precisely, |
| 24 | returns the similarity kernel K as: |
| 25 | |
| 26 | .. math:: |
| 27 | K(A, B) = \\frac{1}{N M}\sum_{ij} C_{ij}(A, B) |
| 28 | |
| 29 | where :math:`N` is the number of atoms in structure :math:`A`, :math:`M` is |
| 30 | the number of atoms in structure :math:`B` and the similarity between local |
| 31 | atomic environments :math:`C_{ij}` has been calculated with the pairwise |
| 32 | metric (e.g. linear, gaussian) defined by the parameters given in the |
| 33 | constructor. |
| 34 | """ |
| 35 | |
| 36 | def get_global_similarity(self, localkernel): |
| 37 | """ |
| 38 | Computes the average global similarity between two structures A and B. |
| 39 | |
| 40 | Args: |
| 41 | localkernel(np.ndarray): NxM matrix of local similarities between |
| 42 | structures A and B, with N and M atoms respectively. |
| 43 | Returns: |
| 44 | float: Average similarity between the structures A and B. |
| 45 | """ |
| 46 | K_ij = np.mean(localkernel) |
| 47 | |
| 48 | return K_ij |
no outgoing calls