Skip to content

Commit

Permalink
Debugging extract_from_list
Browse files Browse the repository at this point in the history
  • Loading branch information
choglass committed Apr 23, 2024
1 parent b79234f commit 452318e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cell2mol/cell_reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ def combine(tobemerged: list, references: list, cellvec: list, threshold_tmat: f
reordered_newmolec.cell_indices = reordered_cell_indices
reordered_newmolec.set_fractional_coord(reordered_frac_cood)
reordered_newmolec.set_atoms(create_adjacencies=True, debug=2)

if reordered_newmolec.iscomplex:
reordered_newmolec.split_complex()
reordered_newmolec.get_hapticity(debug=debug)
Expand All @@ -515,6 +516,7 @@ def combine(tobemerged: list, references: list, cellvec: list, threshold_tmat: f
met.get_coordination_geometry(debug=debug)
if debug >= 1: print(f"COMBINE: {reordered_newmolec.fomula=}")
if debug >= 1: print(f"COMBINE: {reordered_newmolec=}")

issame = compare_species(reordered_newmolec, ref, debug=debug)
if issame: ## Then is a molecule that appears in the reference list
found = True
Expand Down
2 changes: 2 additions & 0 deletions cell2mol/charge_assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,8 @@ def prepare_unresolved(unique_indices: list, unique_species: list, distributions
list_indices.append(spec.get_parent_index("molecule"))
list_options.append(options)

# TODO: we use metal OS predicted by ML to select the best charge distribution

return list_molecules, list_indices, list_options

#######################################################
Expand Down
3 changes: 3 additions & 0 deletions cell2mol/other.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ def extract_from_list(entrylist: list, old_array: list, dimension: int=2, debug:
new_array[idx, jdx] = old_array[row][col]
elif dimension == 1:
new_array = np.empty((length), dtype=object)
print("EXTRACT_FROM_LIST. received:", entrylist, old_array)
for idx, val in enumerate(entrylist):
print("EXTRACT_FROM_LIST. received:", idx, val, old_array[val])
new_array[idx] = old_array[val]
print(f"EXTRACT_FROM_LIST. {new_array=}")
return list(new_array)
#return list([np.stack(list(new_array), axis=0)])

Expand Down

0 comments on commit 452318e

Please sign in to comment.