Skip to content

Commit

Permalink
fixing the get_kinds, missing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikibonacci committed Jul 23, 2024
1 parent a7ae92d commit 6ea5f1b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/aiida_atomistic/data/structure/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def _from_pymatgen_molecule(cls, mol: PYMATGEN_MOLECULE, margin=5):
- min(x.coords.tolist()[2] for x in mol.properties.sites)
+ 2 * margin,
]
structure = cls.from_pymatgen_structure(mol.get_boxed_structure(*box))
structure = cls._from_pymatgen_structure(mol.get_boxed_structure(*box))
structure.properties.pbc = [False, False, False]

return structure
Expand Down Expand Up @@ -1205,7 +1205,9 @@ def _to_kinds(self, property_name, symbols, thr: float = 0):
# list for the value of the property for each generated kind.

if isinstance(prop_array[0], np.ndarray):
indexes = np.array([np.linalg.norm(row-prop_array[0])/ thr for row in prop_array], dtype=int)
# here, to deal with set of 3D indexes and avoid to deal with directions of the vectors,
# I transform the set of indexes into string, so I can compared them in the np.where
indexes = np.array([np.array2string(np.array((row-prop_array[0])/ thr, dtype=int)) for row in prop_array])
else:
indexes = np.array((prop_array - np.min(prop_array)) / thr, dtype=int)

Expand Down

0 comments on commit 6ea5f1b

Please sign in to comment.