This issue comes from a Codex global repository scan.
Problem
feature_to_block() indexes ase.data.chemical_symbols with the ndarray returned by idp.untransform(...):
|
symbol = ase.data.chemical_symbols[idp.untransform(data[_keys.ATOM_TYPE_KEY][atom].reshape(-1))] |
The same pattern appears for edge atoms:
|
symbol_i = ase.data.chemical_symbols[idp.untransform(data[_keys.ATOM_TYPE_KEY][atom_i].reshape(-1))] |
|
symbol_j = ase.data.chemical_symbols[idp.untransform(data[_keys.ATOM_TYPE_KEY][atom_j].reshape(-1))] |
When atom types are shaped like (N, 1), idp.untransform(data[_keys.ATOM_TYPE_KEY][atom].reshape(-1)) returns an array such as array([14]), and list indexing with that ndarray raises TypeError.
Suggested fix
Convert the untransformed result to a scalar before indexing:
atomic_number = int(np.asarray(idp.untransform(...)).reshape(-1)[0])
symbol = ase.data.chemical_symbols[atomic_number]
This issue comes from a Codex global repository scan.
Problem
feature_to_block()indexesase.data.chemical_symbolswith the ndarray returned byidp.untransform(...):dftio/dftio/data/interfaces/ham_to_feature.py
Line 199 in c9d128f
The same pattern appears for edge atoms:
dftio/dftio/data/interfaces/ham_to_feature.py
Lines 226 to 227 in c9d128f
When atom types are shaped like
(N, 1),idp.untransform(data[_keys.ATOM_TYPE_KEY][atom].reshape(-1))returns an array such asarray([14]), and list indexing with that ndarray raisesTypeError.Suggested fix
Convert the untransformed result to a scalar before indexing: