Skip to content

Commit

Permalink
fix error when atom types neighbors are unique
Browse files Browse the repository at this point in the history
  • Loading branch information
killiansheriff committed Aug 15, 2023
1 parent 2e59002 commit 17e0de3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/WarrenCowleyParameters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ def get_wc_from_neigh_in_shell_types(
for i in range(ntypes):
neight_type_aroud_itype = neigh_in_shell_types[central_atom_type_mask[i]]
neight_type_aroud_itype_flat = neight_type_aroud_itype.flatten()
counts = np.bincount(neight_type_aroud_itype_flat)
pij = counts[unique_types] / (neight_type_aroud_itype.shape[0] * neight_in_shell)

counts = np.bincount(neight_type_aroud_itype_flat, minlength=ntypes + 1)

pij = counts[unique_types] / (neight_type_aroud_itype.shape[0] * neight_in_shell)

wc[i, :] = 1 - pij / c

return wc
Expand Down Expand Up @@ -110,6 +112,6 @@ def modify(self, data: DataCollection, frame: int, **kwargs):
neigh_in_shell_types, central_atom_type_mask, c, unique_types
)
wc_for_shells[m] = wc

data.attributes["Warren-Cowley parameters"] = wc_for_shells
self.create_visualization_tables(unique_types, nshells, wc_for_shells, data)
self.create_visualization_tables(unique_types, nshells, wc_for_shells, data)

0 comments on commit 17e0de3

Please sign in to comment.