Commits (4)
......@@ -47,6 +47,9 @@ class DOSFingerprint():
def get_similarities(self, list_of_fingerprints):
return np.array([self.similarity_function(self, fp) for fp in list_of_fingerprints])
def __eq__(self, other):
return self.bins == other.bins and self.indices == other.indices and self.stepsize == other.stepsize and self.grid_id == other.grid_id and self.filling_factor == other.filling_factor
def _integrate_to_bins(self, xs, ys):
"""
Performs stepwise numerical integration of ``ys`` over the range of ``xs``. The stepsize of the generated histogram is controlled by DOSFingerprint().stepsize.
......@@ -85,7 +88,10 @@ class DOSFingerprint():
"""
grid_array = grid.grid()
# cut the energy and dos to grid size
energy, dos = np.transpose([(e,d) for e,d in zip(energy, dos) if (e >= grid_array[0][0] and e <= grid_array[-1][0])])
energy_dos = np.transpose([(e,d) for e,d in zip(energy, dos) if (e >= grid_array[0][0] and e <= grid_array[-1][0])])
if len(energy_dos) != 2:
return [0, 0], ''
energy, dos = energy_dos
# calculate fingerprint
bin_fp = ''
grid_index = 0
......
......@@ -27,6 +27,8 @@ class Grid():
return {'grid_type' : grid_type, 'num_bins' : int(num_bins), 'mu' : float(mu), 'sigma' : float(sigma), 'cutoff' : tuple([float(x) for x in cutoff[1:-1].split(',')])}
def grid(self):
if self.grid_type != 'dg_cut':
raise NotImplementedError('Currently, only the grid dg_cut is implemented.')
asc = 0
desc = 0
x_grid = [0]
......