diff --git a/mddatasetbuilder/datasetbuilder.py b/mddatasetbuilder/datasetbuilder.py index 529caea..fe26b8b 100644 --- a/mddatasetbuilder/datasetbuilder.py +++ b/mddatasetbuilder/datasetbuilder.py @@ -344,7 +344,7 @@ def _calcoulumbmatrix(self, atoms): with np.errstate(divide="ignore", invalid="ignore"): np.divide(top, r, top) np.fill_diagonal(top, diag) - top[top == np.Infinity] = 0 + top[top == np.inf] = 0 top[np.isnan(top)] = 0 return np.linalg.eigh(top)[0] @@ -375,10 +375,11 @@ def _clusterdatas(cls, X, n_clusters, n_each=1): ) labels = clus.fit_predict(X) choosedidx = [] + rng = np.random.default_rng() for i in range(n_clusters): idx = np.where(labels == i)[0] if idx.size: - choosedidx.append(np.random.choice(idx, n_each)) + choosedidx.append(rng.choice(idx, n_each)) index = np.concatenate(choosedidx) return index diff --git a/pyproject.toml b/pyproject.toml index ee7539f..d47f8fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,6 +98,7 @@ select = [ "I", # isort "UP", # pyupgrade "C4", # flake8-comprehensions + "NPY", # numpy ] ignore = [ "E501", # line too long